app.js 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. /* harmony default export */ __webpack_exports__["default"] = ({
  1622. props: ['asset', 'pcextraStart'],
  1623. data: function data() {
  1624. return {
  1625. data: JSON.parse(this.asset),
  1626. pcextra: JSON.parse(this.pcextraStart)
  1627. };
  1628. },
  1629. mounted: function mounted() {
  1630. var _this = this;
  1631. console.log(this.pcextra);
  1632. Echo.channel('assets').listen('AssetUpdated', function (e) {
  1633. _this.data = JSON.parse(e.data);
  1634. });
  1635. }
  1636. });
  1637. /***/ }),
  1638. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  1639. /*!*********************************************************************************************************************************************************************!*\
  1640. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  1641. \*********************************************************************************************************************************************************************/
  1642. /*! exports provided: default */
  1643. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1644. "use strict";
  1645. __webpack_require__.r(__webpack_exports__);
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. //
  1668. //
  1669. //
  1670. //
  1671. //
  1672. //
  1673. //
  1674. //
  1675. //
  1676. /* harmony default export */ __webpack_exports__["default"] = ({
  1677. props: ['credential'],
  1678. data: function data() {
  1679. return {
  1680. data: JSON.parse(this.credential)
  1681. };
  1682. },
  1683. mounted: function mounted() {
  1684. var _this = this;
  1685. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1686. _this.data = JSON.parse(e.data);
  1687. });
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  1692. /*!****************************************************************************************************************************************************************!*\
  1693. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  1694. \****************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. /* harmony default export */ __webpack_exports__["default"] = ({
  1725. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1726. props: ['initialnotes', 'authusername'],
  1727. data: function data() {
  1728. return {
  1729. notes: this.initialnotes
  1730. };
  1731. }
  1732. });
  1733. /***/ }),
  1734. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1735. /*!*****************************************************************************************************************************************************************!*\
  1736. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  1737. \*****************************************************************************************************************************************************************/
  1738. /*! exports provided: default */
  1739. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1740. "use strict";
  1741. __webpack_require__.r(__webpack_exports__);
  1742. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1743. //
  1744. //
  1745. //
  1746. //
  1747. //
  1748. //
  1749. //
  1750. //
  1751. //
  1752. //
  1753. //
  1754. //
  1755. //
  1756. //
  1757. //
  1758. //
  1759. //
  1760. //
  1761. //
  1762. //
  1763. //
  1764. //
  1765. //
  1766. //
  1767. //
  1768. //
  1769. //
  1770. //
  1771. //
  1772. //
  1773. //
  1774. //
  1775. //
  1776. //
  1777. //
  1778. //
  1779. //
  1780. //
  1781. //
  1782. /* harmony default export */ __webpack_exports__["default"] = ({
  1783. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1784. props: ['workOrder'],
  1785. data: function data() {
  1786. return {
  1787. data: JSON.parse(this.workOrder),
  1788. showModal: false
  1789. };
  1790. },
  1791. mounted: function mounted() {
  1792. var _this = this;
  1793. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  1794. _this.data = JSON.parse(e.data);
  1795. });
  1796. },
  1797. methods: {
  1798. updateWorkOrder: function updateWorkOrder() {
  1799. axios.put('/api/workorder/' + this.data.woid, this.data).then(function (response) {})["catch"](function (error) {});
  1800. $('#workordereditModal').modal('hide');
  1801. }
  1802. }
  1803. });
  1804. /***/ }),
  1805. /***/ "./node_modules/base64-js/index.js":
  1806. /*!*****************************************!*\
  1807. !*** ./node_modules/base64-js/index.js ***!
  1808. \*****************************************/
  1809. /*! no static exports found */
  1810. /***/ (function(module, exports, __webpack_require__) {
  1811. "use strict";
  1812. exports.byteLength = byteLength
  1813. exports.toByteArray = toByteArray
  1814. exports.fromByteArray = fromByteArray
  1815. var lookup = []
  1816. var revLookup = []
  1817. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  1818. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  1819. for (var i = 0, len = code.length; i < len; ++i) {
  1820. lookup[i] = code[i]
  1821. revLookup[code.charCodeAt(i)] = i
  1822. }
  1823. // Support decoding URL-safe base64 strings, as Node.js does.
  1824. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  1825. revLookup['-'.charCodeAt(0)] = 62
  1826. revLookup['_'.charCodeAt(0)] = 63
  1827. function getLens (b64) {
  1828. var len = b64.length
  1829. if (len % 4 > 0) {
  1830. throw new Error('Invalid string. Length must be a multiple of 4')
  1831. }
  1832. // Trim off extra bytes after placeholder bytes are found
  1833. // See: https://github.com/beatgammit/base64-js/issues/42
  1834. var validLen = b64.indexOf('=')
  1835. if (validLen === -1) validLen = len
  1836. var placeHoldersLen = validLen === len
  1837. ? 0
  1838. : 4 - (validLen % 4)
  1839. return [validLen, placeHoldersLen]
  1840. }
  1841. // base64 is 4/3 + up to two characters of the original data
  1842. function byteLength (b64) {
  1843. var lens = getLens(b64)
  1844. var validLen = lens[0]
  1845. var placeHoldersLen = lens[1]
  1846. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1847. }
  1848. function _byteLength (b64, validLen, placeHoldersLen) {
  1849. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1850. }
  1851. function toByteArray (b64) {
  1852. var tmp
  1853. var lens = getLens(b64)
  1854. var validLen = lens[0]
  1855. var placeHoldersLen = lens[1]
  1856. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  1857. var curByte = 0
  1858. // if there are placeholders, only get up to the last complete 4 chars
  1859. var len = placeHoldersLen > 0
  1860. ? validLen - 4
  1861. : validLen
  1862. var i
  1863. for (i = 0; i < len; i += 4) {
  1864. tmp =
  1865. (revLookup[b64.charCodeAt(i)] << 18) |
  1866. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  1867. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  1868. revLookup[b64.charCodeAt(i + 3)]
  1869. arr[curByte++] = (tmp >> 16) & 0xFF
  1870. arr[curByte++] = (tmp >> 8) & 0xFF
  1871. arr[curByte++] = tmp & 0xFF
  1872. }
  1873. if (placeHoldersLen === 2) {
  1874. tmp =
  1875. (revLookup[b64.charCodeAt(i)] << 2) |
  1876. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  1877. arr[curByte++] = tmp & 0xFF
  1878. }
  1879. if (placeHoldersLen === 1) {
  1880. tmp =
  1881. (revLookup[b64.charCodeAt(i)] << 10) |
  1882. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  1883. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  1884. arr[curByte++] = (tmp >> 8) & 0xFF
  1885. arr[curByte++] = tmp & 0xFF
  1886. }
  1887. return arr
  1888. }
  1889. function tripletToBase64 (num) {
  1890. return lookup[num >> 18 & 0x3F] +
  1891. lookup[num >> 12 & 0x3F] +
  1892. lookup[num >> 6 & 0x3F] +
  1893. lookup[num & 0x3F]
  1894. }
  1895. function encodeChunk (uint8, start, end) {
  1896. var tmp
  1897. var output = []
  1898. for (var i = start; i < end; i += 3) {
  1899. tmp =
  1900. ((uint8[i] << 16) & 0xFF0000) +
  1901. ((uint8[i + 1] << 8) & 0xFF00) +
  1902. (uint8[i + 2] & 0xFF)
  1903. output.push(tripletToBase64(tmp))
  1904. }
  1905. return output.join('')
  1906. }
  1907. function fromByteArray (uint8) {
  1908. var tmp
  1909. var len = uint8.length
  1910. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  1911. var parts = []
  1912. var maxChunkLength = 16383 // must be multiple of 3
  1913. // go through the array every three bytes, we'll deal with trailing stuff later
  1914. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  1915. parts.push(encodeChunk(
  1916. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  1917. ))
  1918. }
  1919. // pad the end with zeros, but make sure to not forget the extra bytes
  1920. if (extraBytes === 1) {
  1921. tmp = uint8[len - 1]
  1922. parts.push(
  1923. lookup[tmp >> 2] +
  1924. lookup[(tmp << 4) & 0x3F] +
  1925. '=='
  1926. )
  1927. } else if (extraBytes === 2) {
  1928. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  1929. parts.push(
  1930. lookup[tmp >> 10] +
  1931. lookup[(tmp >> 4) & 0x3F] +
  1932. lookup[(tmp << 2) & 0x3F] +
  1933. '='
  1934. )
  1935. }
  1936. return parts.join('')
  1937. }
  1938. /***/ }),
  1939. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1940. /*!*****************************************************!*\
  1941. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1942. \*****************************************************/
  1943. /*! no static exports found */
  1944. /***/ (function(module, exports, __webpack_require__) {
  1945. /*!
  1946. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  1947. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1948. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1949. */
  1950. (function (global, factory) {
  1951. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  1952. undefined;
  1953. }(this, (function (exports, $, Popper) { 'use strict';
  1954. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  1955. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  1956. function _defineProperties(target, props) {
  1957. for (var i = 0; i < props.length; i++) {
  1958. var descriptor = props[i];
  1959. descriptor.enumerable = descriptor.enumerable || false;
  1960. descriptor.configurable = true;
  1961. if ("value" in descriptor) descriptor.writable = true;
  1962. Object.defineProperty(target, descriptor.key, descriptor);
  1963. }
  1964. }
  1965. function _createClass(Constructor, protoProps, staticProps) {
  1966. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1967. if (staticProps) _defineProperties(Constructor, staticProps);
  1968. return Constructor;
  1969. }
  1970. function _defineProperty(obj, key, value) {
  1971. if (key in obj) {
  1972. Object.defineProperty(obj, key, {
  1973. value: value,
  1974. enumerable: true,
  1975. configurable: true,
  1976. writable: true
  1977. });
  1978. } else {
  1979. obj[key] = value;
  1980. }
  1981. return obj;
  1982. }
  1983. function ownKeys(object, enumerableOnly) {
  1984. var keys = Object.keys(object);
  1985. if (Object.getOwnPropertySymbols) {
  1986. var symbols = Object.getOwnPropertySymbols(object);
  1987. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  1988. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  1989. });
  1990. keys.push.apply(keys, symbols);
  1991. }
  1992. return keys;
  1993. }
  1994. function _objectSpread2(target) {
  1995. for (var i = 1; i < arguments.length; i++) {
  1996. var source = arguments[i] != null ? arguments[i] : {};
  1997. if (i % 2) {
  1998. ownKeys(Object(source), true).forEach(function (key) {
  1999. _defineProperty(target, key, source[key]);
  2000. });
  2001. } else if (Object.getOwnPropertyDescriptors) {
  2002. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2003. } else {
  2004. ownKeys(Object(source)).forEach(function (key) {
  2005. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2006. });
  2007. }
  2008. }
  2009. return target;
  2010. }
  2011. function _inheritsLoose(subClass, superClass) {
  2012. subClass.prototype = Object.create(superClass.prototype);
  2013. subClass.prototype.constructor = subClass;
  2014. subClass.__proto__ = superClass;
  2015. }
  2016. /**
  2017. * --------------------------------------------------------------------------
  2018. * Bootstrap (v4.4.1): util.js
  2019. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2020. * --------------------------------------------------------------------------
  2021. */
  2022. /**
  2023. * ------------------------------------------------------------------------
  2024. * Private TransitionEnd Helpers
  2025. * ------------------------------------------------------------------------
  2026. */
  2027. var TRANSITION_END = 'transitionend';
  2028. var MAX_UID = 1000000;
  2029. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2030. function toType(obj) {
  2031. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2032. }
  2033. function getSpecialTransitionEndEvent() {
  2034. return {
  2035. bindType: TRANSITION_END,
  2036. delegateType: TRANSITION_END,
  2037. handle: function handle(event) {
  2038. if ($(event.target).is(this)) {
  2039. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2040. }
  2041. return undefined; // eslint-disable-line no-undefined
  2042. }
  2043. };
  2044. }
  2045. function transitionEndEmulator(duration) {
  2046. var _this = this;
  2047. var called = false;
  2048. $(this).one(Util.TRANSITION_END, function () {
  2049. called = true;
  2050. });
  2051. setTimeout(function () {
  2052. if (!called) {
  2053. Util.triggerTransitionEnd(_this);
  2054. }
  2055. }, duration);
  2056. return this;
  2057. }
  2058. function setTransitionEndSupport() {
  2059. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2060. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2061. }
  2062. /**
  2063. * --------------------------------------------------------------------------
  2064. * Public Util Api
  2065. * --------------------------------------------------------------------------
  2066. */
  2067. var Util = {
  2068. TRANSITION_END: 'bsTransitionEnd',
  2069. getUID: function getUID(prefix) {
  2070. do {
  2071. // eslint-disable-next-line no-bitwise
  2072. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2073. } while (document.getElementById(prefix));
  2074. return prefix;
  2075. },
  2076. getSelectorFromElement: function getSelectorFromElement(element) {
  2077. var selector = element.getAttribute('data-target');
  2078. if (!selector || selector === '#') {
  2079. var hrefAttr = element.getAttribute('href');
  2080. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2081. }
  2082. try {
  2083. return document.querySelector(selector) ? selector : null;
  2084. } catch (err) {
  2085. return null;
  2086. }
  2087. },
  2088. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2089. if (!element) {
  2090. return 0;
  2091. } // Get transition-duration of the element
  2092. var transitionDuration = $(element).css('transition-duration');
  2093. var transitionDelay = $(element).css('transition-delay');
  2094. var floatTransitionDuration = parseFloat(transitionDuration);
  2095. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2096. if (!floatTransitionDuration && !floatTransitionDelay) {
  2097. return 0;
  2098. } // If multiple durations are defined, take the first
  2099. transitionDuration = transitionDuration.split(',')[0];
  2100. transitionDelay = transitionDelay.split(',')[0];
  2101. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2102. },
  2103. reflow: function reflow(element) {
  2104. return element.offsetHeight;
  2105. },
  2106. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2107. $(element).trigger(TRANSITION_END);
  2108. },
  2109. // TODO: Remove in v5
  2110. supportsTransitionEnd: function supportsTransitionEnd() {
  2111. return Boolean(TRANSITION_END);
  2112. },
  2113. isElement: function isElement(obj) {
  2114. return (obj[0] || obj).nodeType;
  2115. },
  2116. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2117. for (var property in configTypes) {
  2118. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2119. var expectedTypes = configTypes[property];
  2120. var value = config[property];
  2121. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2122. if (!new RegExp(expectedTypes).test(valueType)) {
  2123. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2124. }
  2125. }
  2126. }
  2127. },
  2128. findShadowRoot: function findShadowRoot(element) {
  2129. if (!document.documentElement.attachShadow) {
  2130. return null;
  2131. } // Can find the shadow root otherwise it'll return the document
  2132. if (typeof element.getRootNode === 'function') {
  2133. var root = element.getRootNode();
  2134. return root instanceof ShadowRoot ? root : null;
  2135. }
  2136. if (element instanceof ShadowRoot) {
  2137. return element;
  2138. } // when we don't find a shadow root
  2139. if (!element.parentNode) {
  2140. return null;
  2141. }
  2142. return Util.findShadowRoot(element.parentNode);
  2143. },
  2144. jQueryDetection: function jQueryDetection() {
  2145. if (typeof $ === 'undefined') {
  2146. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2147. }
  2148. var version = $.fn.jquery.split(' ')[0].split('.');
  2149. var minMajor = 1;
  2150. var ltMajor = 2;
  2151. var minMinor = 9;
  2152. var minPatch = 1;
  2153. var maxMajor = 4;
  2154. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2155. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2156. }
  2157. }
  2158. };
  2159. Util.jQueryDetection();
  2160. setTransitionEndSupport();
  2161. /**
  2162. * ------------------------------------------------------------------------
  2163. * Constants
  2164. * ------------------------------------------------------------------------
  2165. */
  2166. var NAME = 'alert';
  2167. var VERSION = '4.4.1';
  2168. var DATA_KEY = 'bs.alert';
  2169. var EVENT_KEY = "." + DATA_KEY;
  2170. var DATA_API_KEY = '.data-api';
  2171. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2172. var Selector = {
  2173. DISMISS: '[data-dismiss="alert"]'
  2174. };
  2175. var Event = {
  2176. CLOSE: "close" + EVENT_KEY,
  2177. CLOSED: "closed" + EVENT_KEY,
  2178. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2179. };
  2180. var ClassName = {
  2181. ALERT: 'alert',
  2182. FADE: 'fade',
  2183. SHOW: 'show'
  2184. };
  2185. /**
  2186. * ------------------------------------------------------------------------
  2187. * Class Definition
  2188. * ------------------------------------------------------------------------
  2189. */
  2190. var Alert =
  2191. /*#__PURE__*/
  2192. function () {
  2193. function Alert(element) {
  2194. this._element = element;
  2195. } // Getters
  2196. var _proto = Alert.prototype;
  2197. // Public
  2198. _proto.close = function close(element) {
  2199. var rootElement = this._element;
  2200. if (element) {
  2201. rootElement = this._getRootElement(element);
  2202. }
  2203. var customEvent = this._triggerCloseEvent(rootElement);
  2204. if (customEvent.isDefaultPrevented()) {
  2205. return;
  2206. }
  2207. this._removeElement(rootElement);
  2208. };
  2209. _proto.dispose = function dispose() {
  2210. $.removeData(this._element, DATA_KEY);
  2211. this._element = null;
  2212. } // Private
  2213. ;
  2214. _proto._getRootElement = function _getRootElement(element) {
  2215. var selector = Util.getSelectorFromElement(element);
  2216. var parent = false;
  2217. if (selector) {
  2218. parent = document.querySelector(selector);
  2219. }
  2220. if (!parent) {
  2221. parent = $(element).closest("." + ClassName.ALERT)[0];
  2222. }
  2223. return parent;
  2224. };
  2225. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2226. var closeEvent = $.Event(Event.CLOSE);
  2227. $(element).trigger(closeEvent);
  2228. return closeEvent;
  2229. };
  2230. _proto._removeElement = function _removeElement(element) {
  2231. var _this = this;
  2232. $(element).removeClass(ClassName.SHOW);
  2233. if (!$(element).hasClass(ClassName.FADE)) {
  2234. this._destroyElement(element);
  2235. return;
  2236. }
  2237. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2238. $(element).one(Util.TRANSITION_END, function (event) {
  2239. return _this._destroyElement(element, event);
  2240. }).emulateTransitionEnd(transitionDuration);
  2241. };
  2242. _proto._destroyElement = function _destroyElement(element) {
  2243. $(element).detach().trigger(Event.CLOSED).remove();
  2244. } // Static
  2245. ;
  2246. Alert._jQueryInterface = function _jQueryInterface(config) {
  2247. return this.each(function () {
  2248. var $element = $(this);
  2249. var data = $element.data(DATA_KEY);
  2250. if (!data) {
  2251. data = new Alert(this);
  2252. $element.data(DATA_KEY, data);
  2253. }
  2254. if (config === 'close') {
  2255. data[config](this);
  2256. }
  2257. });
  2258. };
  2259. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2260. return function (event) {
  2261. if (event) {
  2262. event.preventDefault();
  2263. }
  2264. alertInstance.close(this);
  2265. };
  2266. };
  2267. _createClass(Alert, null, [{
  2268. key: "VERSION",
  2269. get: function get() {
  2270. return VERSION;
  2271. }
  2272. }]);
  2273. return Alert;
  2274. }();
  2275. /**
  2276. * ------------------------------------------------------------------------
  2277. * Data Api implementation
  2278. * ------------------------------------------------------------------------
  2279. */
  2280. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2281. /**
  2282. * ------------------------------------------------------------------------
  2283. * jQuery
  2284. * ------------------------------------------------------------------------
  2285. */
  2286. $.fn[NAME] = Alert._jQueryInterface;
  2287. $.fn[NAME].Constructor = Alert;
  2288. $.fn[NAME].noConflict = function () {
  2289. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2290. return Alert._jQueryInterface;
  2291. };
  2292. /**
  2293. * ------------------------------------------------------------------------
  2294. * Constants
  2295. * ------------------------------------------------------------------------
  2296. */
  2297. var NAME$1 = 'button';
  2298. var VERSION$1 = '4.4.1';
  2299. var DATA_KEY$1 = 'bs.button';
  2300. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2301. var DATA_API_KEY$1 = '.data-api';
  2302. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2303. var ClassName$1 = {
  2304. ACTIVE: 'active',
  2305. BUTTON: 'btn',
  2306. FOCUS: 'focus'
  2307. };
  2308. var Selector$1 = {
  2309. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2310. DATA_TOGGLES: '[data-toggle="buttons"]',
  2311. DATA_TOGGLE: '[data-toggle="button"]',
  2312. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2313. INPUT: 'input:not([type="hidden"])',
  2314. ACTIVE: '.active',
  2315. BUTTON: '.btn'
  2316. };
  2317. var Event$1 = {
  2318. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2319. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2320. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2321. };
  2322. /**
  2323. * ------------------------------------------------------------------------
  2324. * Class Definition
  2325. * ------------------------------------------------------------------------
  2326. */
  2327. var Button =
  2328. /*#__PURE__*/
  2329. function () {
  2330. function Button(element) {
  2331. this._element = element;
  2332. } // Getters
  2333. var _proto = Button.prototype;
  2334. // Public
  2335. _proto.toggle = function toggle() {
  2336. var triggerChangeEvent = true;
  2337. var addAriaPressed = true;
  2338. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2339. if (rootElement) {
  2340. var input = this._element.querySelector(Selector$1.INPUT);
  2341. if (input) {
  2342. if (input.type === 'radio') {
  2343. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2344. triggerChangeEvent = false;
  2345. } else {
  2346. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2347. if (activeElement) {
  2348. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2349. }
  2350. }
  2351. } else if (input.type === 'checkbox') {
  2352. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2353. triggerChangeEvent = false;
  2354. }
  2355. } else {
  2356. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2357. triggerChangeEvent = false;
  2358. }
  2359. if (triggerChangeEvent) {
  2360. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2361. $(input).trigger('change');
  2362. }
  2363. input.focus();
  2364. addAriaPressed = false;
  2365. }
  2366. }
  2367. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2368. if (addAriaPressed) {
  2369. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2370. }
  2371. if (triggerChangeEvent) {
  2372. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2373. }
  2374. }
  2375. };
  2376. _proto.dispose = function dispose() {
  2377. $.removeData(this._element, DATA_KEY$1);
  2378. this._element = null;
  2379. } // Static
  2380. ;
  2381. Button._jQueryInterface = function _jQueryInterface(config) {
  2382. return this.each(function () {
  2383. var data = $(this).data(DATA_KEY$1);
  2384. if (!data) {
  2385. data = new Button(this);
  2386. $(this).data(DATA_KEY$1, data);
  2387. }
  2388. if (config === 'toggle') {
  2389. data[config]();
  2390. }
  2391. });
  2392. };
  2393. _createClass(Button, null, [{
  2394. key: "VERSION",
  2395. get: function get() {
  2396. return VERSION$1;
  2397. }
  2398. }]);
  2399. return Button;
  2400. }();
  2401. /**
  2402. * ------------------------------------------------------------------------
  2403. * Data Api implementation
  2404. * ------------------------------------------------------------------------
  2405. */
  2406. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2407. var button = event.target;
  2408. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2409. button = $(button).closest(Selector$1.BUTTON)[0];
  2410. }
  2411. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2412. event.preventDefault(); // work around Firefox bug #1540995
  2413. } else {
  2414. var inputBtn = button.querySelector(Selector$1.INPUT);
  2415. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2416. event.preventDefault(); // work around Firefox bug #1540995
  2417. return;
  2418. }
  2419. Button._jQueryInterface.call($(button), 'toggle');
  2420. }
  2421. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2422. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2423. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2424. });
  2425. $(window).on(Event$1.LOAD_DATA_API, function () {
  2426. // ensure correct active class is set to match the controls' actual values/states
  2427. // find all checkboxes/readio buttons inside data-toggle groups
  2428. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2429. for (var i = 0, len = buttons.length; i < len; i++) {
  2430. var button = buttons[i];
  2431. var input = button.querySelector(Selector$1.INPUT);
  2432. if (input.checked || input.hasAttribute('checked')) {
  2433. button.classList.add(ClassName$1.ACTIVE);
  2434. } else {
  2435. button.classList.remove(ClassName$1.ACTIVE);
  2436. }
  2437. } // find all button toggles
  2438. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2439. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2440. var _button = buttons[_i];
  2441. if (_button.getAttribute('aria-pressed') === 'true') {
  2442. _button.classList.add(ClassName$1.ACTIVE);
  2443. } else {
  2444. _button.classList.remove(ClassName$1.ACTIVE);
  2445. }
  2446. }
  2447. });
  2448. /**
  2449. * ------------------------------------------------------------------------
  2450. * jQuery
  2451. * ------------------------------------------------------------------------
  2452. */
  2453. $.fn[NAME$1] = Button._jQueryInterface;
  2454. $.fn[NAME$1].Constructor = Button;
  2455. $.fn[NAME$1].noConflict = function () {
  2456. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2457. return Button._jQueryInterface;
  2458. };
  2459. /**
  2460. * ------------------------------------------------------------------------
  2461. * Constants
  2462. * ------------------------------------------------------------------------
  2463. */
  2464. var NAME$2 = 'carousel';
  2465. var VERSION$2 = '4.4.1';
  2466. var DATA_KEY$2 = 'bs.carousel';
  2467. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2468. var DATA_API_KEY$2 = '.data-api';
  2469. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2470. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2471. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2472. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2473. var SWIPE_THRESHOLD = 40;
  2474. var Default = {
  2475. interval: 5000,
  2476. keyboard: true,
  2477. slide: false,
  2478. pause: 'hover',
  2479. wrap: true,
  2480. touch: true
  2481. };
  2482. var DefaultType = {
  2483. interval: '(number|boolean)',
  2484. keyboard: 'boolean',
  2485. slide: '(boolean|string)',
  2486. pause: '(string|boolean)',
  2487. wrap: 'boolean',
  2488. touch: 'boolean'
  2489. };
  2490. var Direction = {
  2491. NEXT: 'next',
  2492. PREV: 'prev',
  2493. LEFT: 'left',
  2494. RIGHT: 'right'
  2495. };
  2496. var Event$2 = {
  2497. SLIDE: "slide" + EVENT_KEY$2,
  2498. SLID: "slid" + EVENT_KEY$2,
  2499. KEYDOWN: "keydown" + EVENT_KEY$2,
  2500. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2501. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2502. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2503. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2504. TOUCHEND: "touchend" + EVENT_KEY$2,
  2505. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2506. POINTERUP: "pointerup" + EVENT_KEY$2,
  2507. DRAG_START: "dragstart" + EVENT_KEY$2,
  2508. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2509. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2510. };
  2511. var ClassName$2 = {
  2512. CAROUSEL: 'carousel',
  2513. ACTIVE: 'active',
  2514. SLIDE: 'slide',
  2515. RIGHT: 'carousel-item-right',
  2516. LEFT: 'carousel-item-left',
  2517. NEXT: 'carousel-item-next',
  2518. PREV: 'carousel-item-prev',
  2519. ITEM: 'carousel-item',
  2520. POINTER_EVENT: 'pointer-event'
  2521. };
  2522. var Selector$2 = {
  2523. ACTIVE: '.active',
  2524. ACTIVE_ITEM: '.active.carousel-item',
  2525. ITEM: '.carousel-item',
  2526. ITEM_IMG: '.carousel-item img',
  2527. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2528. INDICATORS: '.carousel-indicators',
  2529. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2530. DATA_RIDE: '[data-ride="carousel"]'
  2531. };
  2532. var PointerType = {
  2533. TOUCH: 'touch',
  2534. PEN: 'pen'
  2535. };
  2536. /**
  2537. * ------------------------------------------------------------------------
  2538. * Class Definition
  2539. * ------------------------------------------------------------------------
  2540. */
  2541. var Carousel =
  2542. /*#__PURE__*/
  2543. function () {
  2544. function Carousel(element, config) {
  2545. this._items = null;
  2546. this._interval = null;
  2547. this._activeElement = null;
  2548. this._isPaused = false;
  2549. this._isSliding = false;
  2550. this.touchTimeout = null;
  2551. this.touchStartX = 0;
  2552. this.touchDeltaX = 0;
  2553. this._config = this._getConfig(config);
  2554. this._element = element;
  2555. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2556. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2557. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2558. this._addEventListeners();
  2559. } // Getters
  2560. var _proto = Carousel.prototype;
  2561. // Public
  2562. _proto.next = function next() {
  2563. if (!this._isSliding) {
  2564. this._slide(Direction.NEXT);
  2565. }
  2566. };
  2567. _proto.nextWhenVisible = function nextWhenVisible() {
  2568. // Don't call next when the page isn't visible
  2569. // or the carousel or its parent isn't visible
  2570. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2571. this.next();
  2572. }
  2573. };
  2574. _proto.prev = function prev() {
  2575. if (!this._isSliding) {
  2576. this._slide(Direction.PREV);
  2577. }
  2578. };
  2579. _proto.pause = function pause(event) {
  2580. if (!event) {
  2581. this._isPaused = true;
  2582. }
  2583. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2584. Util.triggerTransitionEnd(this._element);
  2585. this.cycle(true);
  2586. }
  2587. clearInterval(this._interval);
  2588. this._interval = null;
  2589. };
  2590. _proto.cycle = function cycle(event) {
  2591. if (!event) {
  2592. this._isPaused = false;
  2593. }
  2594. if (this._interval) {
  2595. clearInterval(this._interval);
  2596. this._interval = null;
  2597. }
  2598. if (this._config.interval && !this._isPaused) {
  2599. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2600. }
  2601. };
  2602. _proto.to = function to(index) {
  2603. var _this = this;
  2604. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2605. var activeIndex = this._getItemIndex(this._activeElement);
  2606. if (index > this._items.length - 1 || index < 0) {
  2607. return;
  2608. }
  2609. if (this._isSliding) {
  2610. $(this._element).one(Event$2.SLID, function () {
  2611. return _this.to(index);
  2612. });
  2613. return;
  2614. }
  2615. if (activeIndex === index) {
  2616. this.pause();
  2617. this.cycle();
  2618. return;
  2619. }
  2620. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2621. this._slide(direction, this._items[index]);
  2622. };
  2623. _proto.dispose = function dispose() {
  2624. $(this._element).off(EVENT_KEY$2);
  2625. $.removeData(this._element, DATA_KEY$2);
  2626. this._items = null;
  2627. this._config = null;
  2628. this._element = null;
  2629. this._interval = null;
  2630. this._isPaused = null;
  2631. this._isSliding = null;
  2632. this._activeElement = null;
  2633. this._indicatorsElement = null;
  2634. } // Private
  2635. ;
  2636. _proto._getConfig = function _getConfig(config) {
  2637. config = _objectSpread2({}, Default, {}, config);
  2638. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2639. return config;
  2640. };
  2641. _proto._handleSwipe = function _handleSwipe() {
  2642. var absDeltax = Math.abs(this.touchDeltaX);
  2643. if (absDeltax <= SWIPE_THRESHOLD) {
  2644. return;
  2645. }
  2646. var direction = absDeltax / this.touchDeltaX;
  2647. this.touchDeltaX = 0; // swipe left
  2648. if (direction > 0) {
  2649. this.prev();
  2650. } // swipe right
  2651. if (direction < 0) {
  2652. this.next();
  2653. }
  2654. };
  2655. _proto._addEventListeners = function _addEventListeners() {
  2656. var _this2 = this;
  2657. if (this._config.keyboard) {
  2658. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2659. return _this2._keydown(event);
  2660. });
  2661. }
  2662. if (this._config.pause === 'hover') {
  2663. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2664. return _this2.pause(event);
  2665. }).on(Event$2.MOUSELEAVE, function (event) {
  2666. return _this2.cycle(event);
  2667. });
  2668. }
  2669. if (this._config.touch) {
  2670. this._addTouchEventListeners();
  2671. }
  2672. };
  2673. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2674. var _this3 = this;
  2675. if (!this._touchSupported) {
  2676. return;
  2677. }
  2678. var start = function start(event) {
  2679. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2680. _this3.touchStartX = event.originalEvent.clientX;
  2681. } else if (!_this3._pointerEvent) {
  2682. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2683. }
  2684. };
  2685. var move = function move(event) {
  2686. // ensure swiping with one touch and not pinching
  2687. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2688. _this3.touchDeltaX = 0;
  2689. } else {
  2690. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2691. }
  2692. };
  2693. var end = function end(event) {
  2694. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2695. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2696. }
  2697. _this3._handleSwipe();
  2698. if (_this3._config.pause === 'hover') {
  2699. // If it's a touch-enabled device, mouseenter/leave are fired as
  2700. // part of the mouse compatibility events on first tap - the carousel
  2701. // would stop cycling until user tapped out of it;
  2702. // here, we listen for touchend, explicitly pause the carousel
  2703. // (as if it's the second time we tap on it, mouseenter compat event
  2704. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2705. // events to fire) we explicitly restart cycling
  2706. _this3.pause();
  2707. if (_this3.touchTimeout) {
  2708. clearTimeout(_this3.touchTimeout);
  2709. }
  2710. _this3.touchTimeout = setTimeout(function (event) {
  2711. return _this3.cycle(event);
  2712. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2713. }
  2714. };
  2715. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2716. return e.preventDefault();
  2717. });
  2718. if (this._pointerEvent) {
  2719. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2720. return start(event);
  2721. });
  2722. $(this._element).on(Event$2.POINTERUP, function (event) {
  2723. return end(event);
  2724. });
  2725. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2726. } else {
  2727. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2728. return start(event);
  2729. });
  2730. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2731. return move(event);
  2732. });
  2733. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2734. return end(event);
  2735. });
  2736. }
  2737. };
  2738. _proto._keydown = function _keydown(event) {
  2739. if (/input|textarea/i.test(event.target.tagName)) {
  2740. return;
  2741. }
  2742. switch (event.which) {
  2743. case ARROW_LEFT_KEYCODE:
  2744. event.preventDefault();
  2745. this.prev();
  2746. break;
  2747. case ARROW_RIGHT_KEYCODE:
  2748. event.preventDefault();
  2749. this.next();
  2750. break;
  2751. }
  2752. };
  2753. _proto._getItemIndex = function _getItemIndex(element) {
  2754. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2755. return this._items.indexOf(element);
  2756. };
  2757. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2758. var isNextDirection = direction === Direction.NEXT;
  2759. var isPrevDirection = direction === Direction.PREV;
  2760. var activeIndex = this._getItemIndex(activeElement);
  2761. var lastItemIndex = this._items.length - 1;
  2762. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2763. if (isGoingToWrap && !this._config.wrap) {
  2764. return activeElement;
  2765. }
  2766. var delta = direction === Direction.PREV ? -1 : 1;
  2767. var itemIndex = (activeIndex + delta) % this._items.length;
  2768. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2769. };
  2770. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2771. var targetIndex = this._getItemIndex(relatedTarget);
  2772. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2773. var slideEvent = $.Event(Event$2.SLIDE, {
  2774. relatedTarget: relatedTarget,
  2775. direction: eventDirectionName,
  2776. from: fromIndex,
  2777. to: targetIndex
  2778. });
  2779. $(this._element).trigger(slideEvent);
  2780. return slideEvent;
  2781. };
  2782. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2783. if (this._indicatorsElement) {
  2784. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2785. $(indicators).removeClass(ClassName$2.ACTIVE);
  2786. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2787. if (nextIndicator) {
  2788. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2789. }
  2790. }
  2791. };
  2792. _proto._slide = function _slide(direction, element) {
  2793. var _this4 = this;
  2794. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2795. var activeElementIndex = this._getItemIndex(activeElement);
  2796. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2797. var nextElementIndex = this._getItemIndex(nextElement);
  2798. var isCycling = Boolean(this._interval);
  2799. var directionalClassName;
  2800. var orderClassName;
  2801. var eventDirectionName;
  2802. if (direction === Direction.NEXT) {
  2803. directionalClassName = ClassName$2.LEFT;
  2804. orderClassName = ClassName$2.NEXT;
  2805. eventDirectionName = Direction.LEFT;
  2806. } else {
  2807. directionalClassName = ClassName$2.RIGHT;
  2808. orderClassName = ClassName$2.PREV;
  2809. eventDirectionName = Direction.RIGHT;
  2810. }
  2811. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2812. this._isSliding = false;
  2813. return;
  2814. }
  2815. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2816. if (slideEvent.isDefaultPrevented()) {
  2817. return;
  2818. }
  2819. if (!activeElement || !nextElement) {
  2820. // Some weirdness is happening, so we bail
  2821. return;
  2822. }
  2823. this._isSliding = true;
  2824. if (isCycling) {
  2825. this.pause();
  2826. }
  2827. this._setActiveIndicatorElement(nextElement);
  2828. var slidEvent = $.Event(Event$2.SLID, {
  2829. relatedTarget: nextElement,
  2830. direction: eventDirectionName,
  2831. from: activeElementIndex,
  2832. to: nextElementIndex
  2833. });
  2834. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2835. $(nextElement).addClass(orderClassName);
  2836. Util.reflow(nextElement);
  2837. $(activeElement).addClass(directionalClassName);
  2838. $(nextElement).addClass(directionalClassName);
  2839. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2840. if (nextElementInterval) {
  2841. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2842. this._config.interval = nextElementInterval;
  2843. } else {
  2844. this._config.interval = this._config.defaultInterval || this._config.interval;
  2845. }
  2846. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2847. $(activeElement).one(Util.TRANSITION_END, function () {
  2848. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2849. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2850. _this4._isSliding = false;
  2851. setTimeout(function () {
  2852. return $(_this4._element).trigger(slidEvent);
  2853. }, 0);
  2854. }).emulateTransitionEnd(transitionDuration);
  2855. } else {
  2856. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2857. $(nextElement).addClass(ClassName$2.ACTIVE);
  2858. this._isSliding = false;
  2859. $(this._element).trigger(slidEvent);
  2860. }
  2861. if (isCycling) {
  2862. this.cycle();
  2863. }
  2864. } // Static
  2865. ;
  2866. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2867. return this.each(function () {
  2868. var data = $(this).data(DATA_KEY$2);
  2869. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2870. if (typeof config === 'object') {
  2871. _config = _objectSpread2({}, _config, {}, config);
  2872. }
  2873. var action = typeof config === 'string' ? config : _config.slide;
  2874. if (!data) {
  2875. data = new Carousel(this, _config);
  2876. $(this).data(DATA_KEY$2, data);
  2877. }
  2878. if (typeof config === 'number') {
  2879. data.to(config);
  2880. } else if (typeof action === 'string') {
  2881. if (typeof data[action] === 'undefined') {
  2882. throw new TypeError("No method named \"" + action + "\"");
  2883. }
  2884. data[action]();
  2885. } else if (_config.interval && _config.ride) {
  2886. data.pause();
  2887. data.cycle();
  2888. }
  2889. });
  2890. };
  2891. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2892. var selector = Util.getSelectorFromElement(this);
  2893. if (!selector) {
  2894. return;
  2895. }
  2896. var target = $(selector)[0];
  2897. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  2898. return;
  2899. }
  2900. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  2901. var slideIndex = this.getAttribute('data-slide-to');
  2902. if (slideIndex) {
  2903. config.interval = false;
  2904. }
  2905. Carousel._jQueryInterface.call($(target), config);
  2906. if (slideIndex) {
  2907. $(target).data(DATA_KEY$2).to(slideIndex);
  2908. }
  2909. event.preventDefault();
  2910. };
  2911. _createClass(Carousel, null, [{
  2912. key: "VERSION",
  2913. get: function get() {
  2914. return VERSION$2;
  2915. }
  2916. }, {
  2917. key: "Default",
  2918. get: function get() {
  2919. return Default;
  2920. }
  2921. }]);
  2922. return Carousel;
  2923. }();
  2924. /**
  2925. * ------------------------------------------------------------------------
  2926. * Data Api implementation
  2927. * ------------------------------------------------------------------------
  2928. */
  2929. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  2930. $(window).on(Event$2.LOAD_DATA_API, function () {
  2931. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  2932. for (var i = 0, len = carousels.length; i < len; i++) {
  2933. var $carousel = $(carousels[i]);
  2934. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2935. }
  2936. });
  2937. /**
  2938. * ------------------------------------------------------------------------
  2939. * jQuery
  2940. * ------------------------------------------------------------------------
  2941. */
  2942. $.fn[NAME$2] = Carousel._jQueryInterface;
  2943. $.fn[NAME$2].Constructor = Carousel;
  2944. $.fn[NAME$2].noConflict = function () {
  2945. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2946. return Carousel._jQueryInterface;
  2947. };
  2948. /**
  2949. * ------------------------------------------------------------------------
  2950. * Constants
  2951. * ------------------------------------------------------------------------
  2952. */
  2953. var NAME$3 = 'collapse';
  2954. var VERSION$3 = '4.4.1';
  2955. var DATA_KEY$3 = 'bs.collapse';
  2956. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2957. var DATA_API_KEY$3 = '.data-api';
  2958. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  2959. var Default$1 = {
  2960. toggle: true,
  2961. parent: ''
  2962. };
  2963. var DefaultType$1 = {
  2964. toggle: 'boolean',
  2965. parent: '(string|element)'
  2966. };
  2967. var Event$3 = {
  2968. SHOW: "show" + EVENT_KEY$3,
  2969. SHOWN: "shown" + EVENT_KEY$3,
  2970. HIDE: "hide" + EVENT_KEY$3,
  2971. HIDDEN: "hidden" + EVENT_KEY$3,
  2972. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  2973. };
  2974. var ClassName$3 = {
  2975. SHOW: 'show',
  2976. COLLAPSE: 'collapse',
  2977. COLLAPSING: 'collapsing',
  2978. COLLAPSED: 'collapsed'
  2979. };
  2980. var Dimension = {
  2981. WIDTH: 'width',
  2982. HEIGHT: 'height'
  2983. };
  2984. var Selector$3 = {
  2985. ACTIVES: '.show, .collapsing',
  2986. DATA_TOGGLE: '[data-toggle="collapse"]'
  2987. };
  2988. /**
  2989. * ------------------------------------------------------------------------
  2990. * Class Definition
  2991. * ------------------------------------------------------------------------
  2992. */
  2993. var Collapse =
  2994. /*#__PURE__*/
  2995. function () {
  2996. function Collapse(element, config) {
  2997. this._isTransitioning = false;
  2998. this._element = element;
  2999. this._config = this._getConfig(config);
  3000. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3001. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3002. for (var i = 0, len = toggleList.length; i < len; i++) {
  3003. var elem = toggleList[i];
  3004. var selector = Util.getSelectorFromElement(elem);
  3005. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3006. return foundElem === element;
  3007. });
  3008. if (selector !== null && filterElement.length > 0) {
  3009. this._selector = selector;
  3010. this._triggerArray.push(elem);
  3011. }
  3012. }
  3013. this._parent = this._config.parent ? this._getParent() : null;
  3014. if (!this._config.parent) {
  3015. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3016. }
  3017. if (this._config.toggle) {
  3018. this.toggle();
  3019. }
  3020. } // Getters
  3021. var _proto = Collapse.prototype;
  3022. // Public
  3023. _proto.toggle = function toggle() {
  3024. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3025. this.hide();
  3026. } else {
  3027. this.show();
  3028. }
  3029. };
  3030. _proto.show = function show() {
  3031. var _this = this;
  3032. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3033. return;
  3034. }
  3035. var actives;
  3036. var activesData;
  3037. if (this._parent) {
  3038. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3039. if (typeof _this._config.parent === 'string') {
  3040. return elem.getAttribute('data-parent') === _this._config.parent;
  3041. }
  3042. return elem.classList.contains(ClassName$3.COLLAPSE);
  3043. });
  3044. if (actives.length === 0) {
  3045. actives = null;
  3046. }
  3047. }
  3048. if (actives) {
  3049. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3050. if (activesData && activesData._isTransitioning) {
  3051. return;
  3052. }
  3053. }
  3054. var startEvent = $.Event(Event$3.SHOW);
  3055. $(this._element).trigger(startEvent);
  3056. if (startEvent.isDefaultPrevented()) {
  3057. return;
  3058. }
  3059. if (actives) {
  3060. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3061. if (!activesData) {
  3062. $(actives).data(DATA_KEY$3, null);
  3063. }
  3064. }
  3065. var dimension = this._getDimension();
  3066. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3067. this._element.style[dimension] = 0;
  3068. if (this._triggerArray.length) {
  3069. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3070. }
  3071. this.setTransitioning(true);
  3072. var complete = function complete() {
  3073. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3074. _this._element.style[dimension] = '';
  3075. _this.setTransitioning(false);
  3076. $(_this._element).trigger(Event$3.SHOWN);
  3077. };
  3078. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3079. var scrollSize = "scroll" + capitalizedDimension;
  3080. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3081. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3082. this._element.style[dimension] = this._element[scrollSize] + "px";
  3083. };
  3084. _proto.hide = function hide() {
  3085. var _this2 = this;
  3086. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3087. return;
  3088. }
  3089. var startEvent = $.Event(Event$3.HIDE);
  3090. $(this._element).trigger(startEvent);
  3091. if (startEvent.isDefaultPrevented()) {
  3092. return;
  3093. }
  3094. var dimension = this._getDimension();
  3095. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3096. Util.reflow(this._element);
  3097. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3098. var triggerArrayLength = this._triggerArray.length;
  3099. if (triggerArrayLength > 0) {
  3100. for (var i = 0; i < triggerArrayLength; i++) {
  3101. var trigger = this._triggerArray[i];
  3102. var selector = Util.getSelectorFromElement(trigger);
  3103. if (selector !== null) {
  3104. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3105. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3106. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3107. }
  3108. }
  3109. }
  3110. }
  3111. this.setTransitioning(true);
  3112. var complete = function complete() {
  3113. _this2.setTransitioning(false);
  3114. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3115. };
  3116. this._element.style[dimension] = '';
  3117. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3118. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3119. };
  3120. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3121. this._isTransitioning = isTransitioning;
  3122. };
  3123. _proto.dispose = function dispose() {
  3124. $.removeData(this._element, DATA_KEY$3);
  3125. this._config = null;
  3126. this._parent = null;
  3127. this._element = null;
  3128. this._triggerArray = null;
  3129. this._isTransitioning = null;
  3130. } // Private
  3131. ;
  3132. _proto._getConfig = function _getConfig(config) {
  3133. config = _objectSpread2({}, Default$1, {}, config);
  3134. config.toggle = Boolean(config.toggle); // Coerce string values
  3135. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3136. return config;
  3137. };
  3138. _proto._getDimension = function _getDimension() {
  3139. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3140. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3141. };
  3142. _proto._getParent = function _getParent() {
  3143. var _this3 = this;
  3144. var parent;
  3145. if (Util.isElement(this._config.parent)) {
  3146. parent = this._config.parent; // It's a jQuery object
  3147. if (typeof this._config.parent.jquery !== 'undefined') {
  3148. parent = this._config.parent[0];
  3149. }
  3150. } else {
  3151. parent = document.querySelector(this._config.parent);
  3152. }
  3153. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3154. var children = [].slice.call(parent.querySelectorAll(selector));
  3155. $(children).each(function (i, element) {
  3156. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3157. });
  3158. return parent;
  3159. };
  3160. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3161. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3162. if (triggerArray.length) {
  3163. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3164. }
  3165. } // Static
  3166. ;
  3167. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3168. var selector = Util.getSelectorFromElement(element);
  3169. return selector ? document.querySelector(selector) : null;
  3170. };
  3171. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3172. return this.each(function () {
  3173. var $this = $(this);
  3174. var data = $this.data(DATA_KEY$3);
  3175. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3176. if (!data && _config.toggle && /show|hide/.test(config)) {
  3177. _config.toggle = false;
  3178. }
  3179. if (!data) {
  3180. data = new Collapse(this, _config);
  3181. $this.data(DATA_KEY$3, data);
  3182. }
  3183. if (typeof config === 'string') {
  3184. if (typeof data[config] === 'undefined') {
  3185. throw new TypeError("No method named \"" + config + "\"");
  3186. }
  3187. data[config]();
  3188. }
  3189. });
  3190. };
  3191. _createClass(Collapse, null, [{
  3192. key: "VERSION",
  3193. get: function get() {
  3194. return VERSION$3;
  3195. }
  3196. }, {
  3197. key: "Default",
  3198. get: function get() {
  3199. return Default$1;
  3200. }
  3201. }]);
  3202. return Collapse;
  3203. }();
  3204. /**
  3205. * ------------------------------------------------------------------------
  3206. * Data Api implementation
  3207. * ------------------------------------------------------------------------
  3208. */
  3209. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3210. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3211. if (event.currentTarget.tagName === 'A') {
  3212. event.preventDefault();
  3213. }
  3214. var $trigger = $(this);
  3215. var selector = Util.getSelectorFromElement(this);
  3216. var selectors = [].slice.call(document.querySelectorAll(selector));
  3217. $(selectors).each(function () {
  3218. var $target = $(this);
  3219. var data = $target.data(DATA_KEY$3);
  3220. var config = data ? 'toggle' : $trigger.data();
  3221. Collapse._jQueryInterface.call($target, config);
  3222. });
  3223. });
  3224. /**
  3225. * ------------------------------------------------------------------------
  3226. * jQuery
  3227. * ------------------------------------------------------------------------
  3228. */
  3229. $.fn[NAME$3] = Collapse._jQueryInterface;
  3230. $.fn[NAME$3].Constructor = Collapse;
  3231. $.fn[NAME$3].noConflict = function () {
  3232. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3233. return Collapse._jQueryInterface;
  3234. };
  3235. /**
  3236. * ------------------------------------------------------------------------
  3237. * Constants
  3238. * ------------------------------------------------------------------------
  3239. */
  3240. var NAME$4 = 'dropdown';
  3241. var VERSION$4 = '4.4.1';
  3242. var DATA_KEY$4 = 'bs.dropdown';
  3243. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3244. var DATA_API_KEY$4 = '.data-api';
  3245. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3246. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3247. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3248. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3249. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3250. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3251. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3252. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3253. var Event$4 = {
  3254. HIDE: "hide" + EVENT_KEY$4,
  3255. HIDDEN: "hidden" + EVENT_KEY$4,
  3256. SHOW: "show" + EVENT_KEY$4,
  3257. SHOWN: "shown" + EVENT_KEY$4,
  3258. CLICK: "click" + EVENT_KEY$4,
  3259. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3260. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3261. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3262. };
  3263. var ClassName$4 = {
  3264. DISABLED: 'disabled',
  3265. SHOW: 'show',
  3266. DROPUP: 'dropup',
  3267. DROPRIGHT: 'dropright',
  3268. DROPLEFT: 'dropleft',
  3269. MENURIGHT: 'dropdown-menu-right',
  3270. MENULEFT: 'dropdown-menu-left',
  3271. POSITION_STATIC: 'position-static'
  3272. };
  3273. var Selector$4 = {
  3274. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3275. FORM_CHILD: '.dropdown form',
  3276. MENU: '.dropdown-menu',
  3277. NAVBAR_NAV: '.navbar-nav',
  3278. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3279. };
  3280. var AttachmentMap = {
  3281. TOP: 'top-start',
  3282. TOPEND: 'top-end',
  3283. BOTTOM: 'bottom-start',
  3284. BOTTOMEND: 'bottom-end',
  3285. RIGHT: 'right-start',
  3286. RIGHTEND: 'right-end',
  3287. LEFT: 'left-start',
  3288. LEFTEND: 'left-end'
  3289. };
  3290. var Default$2 = {
  3291. offset: 0,
  3292. flip: true,
  3293. boundary: 'scrollParent',
  3294. reference: 'toggle',
  3295. display: 'dynamic',
  3296. popperConfig: null
  3297. };
  3298. var DefaultType$2 = {
  3299. offset: '(number|string|function)',
  3300. flip: 'boolean',
  3301. boundary: '(string|element)',
  3302. reference: '(string|element)',
  3303. display: 'string',
  3304. popperConfig: '(null|object)'
  3305. };
  3306. /**
  3307. * ------------------------------------------------------------------------
  3308. * Class Definition
  3309. * ------------------------------------------------------------------------
  3310. */
  3311. var Dropdown =
  3312. /*#__PURE__*/
  3313. function () {
  3314. function Dropdown(element, config) {
  3315. this._element = element;
  3316. this._popper = null;
  3317. this._config = this._getConfig(config);
  3318. this._menu = this._getMenuElement();
  3319. this._inNavbar = this._detectNavbar();
  3320. this._addEventListeners();
  3321. } // Getters
  3322. var _proto = Dropdown.prototype;
  3323. // Public
  3324. _proto.toggle = function toggle() {
  3325. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3326. return;
  3327. }
  3328. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3329. Dropdown._clearMenus();
  3330. if (isActive) {
  3331. return;
  3332. }
  3333. this.show(true);
  3334. };
  3335. _proto.show = function show(usePopper) {
  3336. if (usePopper === void 0) {
  3337. usePopper = false;
  3338. }
  3339. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3340. return;
  3341. }
  3342. var relatedTarget = {
  3343. relatedTarget: this._element
  3344. };
  3345. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3346. var parent = Dropdown._getParentFromElement(this._element);
  3347. $(parent).trigger(showEvent);
  3348. if (showEvent.isDefaultPrevented()) {
  3349. return;
  3350. } // Disable totally Popper.js for Dropdown in Navbar
  3351. if (!this._inNavbar && usePopper) {
  3352. /**
  3353. * Check for Popper dependency
  3354. * Popper - https://popper.js.org
  3355. */
  3356. if (typeof Popper === 'undefined') {
  3357. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3358. }
  3359. var referenceElement = this._element;
  3360. if (this._config.reference === 'parent') {
  3361. referenceElement = parent;
  3362. } else if (Util.isElement(this._config.reference)) {
  3363. referenceElement = this._config.reference; // Check if it's jQuery element
  3364. if (typeof this._config.reference.jquery !== 'undefined') {
  3365. referenceElement = this._config.reference[0];
  3366. }
  3367. } // If boundary is not `scrollParent`, then set position to `static`
  3368. // to allow the menu to "escape" the scroll parent's boundaries
  3369. // https://github.com/twbs/bootstrap/issues/24251
  3370. if (this._config.boundary !== 'scrollParent') {
  3371. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3372. }
  3373. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3374. } // If this is a touch-enabled device we add extra
  3375. // empty mouseover listeners to the body's immediate children;
  3376. // only needed because of broken event delegation on iOS
  3377. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3378. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3379. $(document.body).children().on('mouseover', null, $.noop);
  3380. }
  3381. this._element.focus();
  3382. this._element.setAttribute('aria-expanded', true);
  3383. $(this._menu).toggleClass(ClassName$4.SHOW);
  3384. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3385. };
  3386. _proto.hide = function hide() {
  3387. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3388. return;
  3389. }
  3390. var relatedTarget = {
  3391. relatedTarget: this._element
  3392. };
  3393. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3394. var parent = Dropdown._getParentFromElement(this._element);
  3395. $(parent).trigger(hideEvent);
  3396. if (hideEvent.isDefaultPrevented()) {
  3397. return;
  3398. }
  3399. if (this._popper) {
  3400. this._popper.destroy();
  3401. }
  3402. $(this._menu).toggleClass(ClassName$4.SHOW);
  3403. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3404. };
  3405. _proto.dispose = function dispose() {
  3406. $.removeData(this._element, DATA_KEY$4);
  3407. $(this._element).off(EVENT_KEY$4);
  3408. this._element = null;
  3409. this._menu = null;
  3410. if (this._popper !== null) {
  3411. this._popper.destroy();
  3412. this._popper = null;
  3413. }
  3414. };
  3415. _proto.update = function update() {
  3416. this._inNavbar = this._detectNavbar();
  3417. if (this._popper !== null) {
  3418. this._popper.scheduleUpdate();
  3419. }
  3420. } // Private
  3421. ;
  3422. _proto._addEventListeners = function _addEventListeners() {
  3423. var _this = this;
  3424. $(this._element).on(Event$4.CLICK, function (event) {
  3425. event.preventDefault();
  3426. event.stopPropagation();
  3427. _this.toggle();
  3428. });
  3429. };
  3430. _proto._getConfig = function _getConfig(config) {
  3431. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3432. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3433. return config;
  3434. };
  3435. _proto._getMenuElement = function _getMenuElement() {
  3436. if (!this._menu) {
  3437. var parent = Dropdown._getParentFromElement(this._element);
  3438. if (parent) {
  3439. this._menu = parent.querySelector(Selector$4.MENU);
  3440. }
  3441. }
  3442. return this._menu;
  3443. };
  3444. _proto._getPlacement = function _getPlacement() {
  3445. var $parentDropdown = $(this._element.parentNode);
  3446. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3447. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3448. placement = AttachmentMap.TOP;
  3449. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3450. placement = AttachmentMap.TOPEND;
  3451. }
  3452. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3453. placement = AttachmentMap.RIGHT;
  3454. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3455. placement = AttachmentMap.LEFT;
  3456. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3457. placement = AttachmentMap.BOTTOMEND;
  3458. }
  3459. return placement;
  3460. };
  3461. _proto._detectNavbar = function _detectNavbar() {
  3462. return $(this._element).closest('.navbar').length > 0;
  3463. };
  3464. _proto._getOffset = function _getOffset() {
  3465. var _this2 = this;
  3466. var offset = {};
  3467. if (typeof this._config.offset === 'function') {
  3468. offset.fn = function (data) {
  3469. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3470. return data;
  3471. };
  3472. } else {
  3473. offset.offset = this._config.offset;
  3474. }
  3475. return offset;
  3476. };
  3477. _proto._getPopperConfig = function _getPopperConfig() {
  3478. var popperConfig = {
  3479. placement: this._getPlacement(),
  3480. modifiers: {
  3481. offset: this._getOffset(),
  3482. flip: {
  3483. enabled: this._config.flip
  3484. },
  3485. preventOverflow: {
  3486. boundariesElement: this._config.boundary
  3487. }
  3488. }
  3489. }; // Disable Popper.js if we have a static display
  3490. if (this._config.display === 'static') {
  3491. popperConfig.modifiers.applyStyle = {
  3492. enabled: false
  3493. };
  3494. }
  3495. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3496. } // Static
  3497. ;
  3498. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3499. return this.each(function () {
  3500. var data = $(this).data(DATA_KEY$4);
  3501. var _config = typeof config === 'object' ? config : null;
  3502. if (!data) {
  3503. data = new Dropdown(this, _config);
  3504. $(this).data(DATA_KEY$4, data);
  3505. }
  3506. if (typeof config === 'string') {
  3507. if (typeof data[config] === 'undefined') {
  3508. throw new TypeError("No method named \"" + config + "\"");
  3509. }
  3510. data[config]();
  3511. }
  3512. });
  3513. };
  3514. Dropdown._clearMenus = function _clearMenus(event) {
  3515. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3516. return;
  3517. }
  3518. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3519. for (var i = 0, len = toggles.length; i < len; i++) {
  3520. var parent = Dropdown._getParentFromElement(toggles[i]);
  3521. var context = $(toggles[i]).data(DATA_KEY$4);
  3522. var relatedTarget = {
  3523. relatedTarget: toggles[i]
  3524. };
  3525. if (event && event.type === 'click') {
  3526. relatedTarget.clickEvent = event;
  3527. }
  3528. if (!context) {
  3529. continue;
  3530. }
  3531. var dropdownMenu = context._menu;
  3532. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3533. continue;
  3534. }
  3535. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3536. continue;
  3537. }
  3538. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3539. $(parent).trigger(hideEvent);
  3540. if (hideEvent.isDefaultPrevented()) {
  3541. continue;
  3542. } // If this is a touch-enabled device we remove the extra
  3543. // empty mouseover listeners we added for iOS support
  3544. if ('ontouchstart' in document.documentElement) {
  3545. $(document.body).children().off('mouseover', null, $.noop);
  3546. }
  3547. toggles[i].setAttribute('aria-expanded', 'false');
  3548. if (context._popper) {
  3549. context._popper.destroy();
  3550. }
  3551. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3552. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3553. }
  3554. };
  3555. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3556. var parent;
  3557. var selector = Util.getSelectorFromElement(element);
  3558. if (selector) {
  3559. parent = document.querySelector(selector);
  3560. }
  3561. return parent || element.parentNode;
  3562. } // eslint-disable-next-line complexity
  3563. ;
  3564. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3565. // If not input/textarea:
  3566. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3567. // If input/textarea:
  3568. // - If space key => not a dropdown command
  3569. // - If key is other than escape
  3570. // - If key is not up or down => not a dropdown command
  3571. // - If trigger inside the menu => not a dropdown command
  3572. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3573. return;
  3574. }
  3575. event.preventDefault();
  3576. event.stopPropagation();
  3577. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3578. return;
  3579. }
  3580. var parent = Dropdown._getParentFromElement(this);
  3581. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3582. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3583. return;
  3584. }
  3585. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3586. if (event.which === ESCAPE_KEYCODE) {
  3587. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3588. $(toggle).trigger('focus');
  3589. }
  3590. $(this).trigger('click');
  3591. return;
  3592. }
  3593. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3594. return $(item).is(':visible');
  3595. });
  3596. if (items.length === 0) {
  3597. return;
  3598. }
  3599. var index = items.indexOf(event.target);
  3600. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3601. // Up
  3602. index--;
  3603. }
  3604. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3605. // Down
  3606. index++;
  3607. }
  3608. if (index < 0) {
  3609. index = 0;
  3610. }
  3611. items[index].focus();
  3612. };
  3613. _createClass(Dropdown, null, [{
  3614. key: "VERSION",
  3615. get: function get() {
  3616. return VERSION$4;
  3617. }
  3618. }, {
  3619. key: "Default",
  3620. get: function get() {
  3621. return Default$2;
  3622. }
  3623. }, {
  3624. key: "DefaultType",
  3625. get: function get() {
  3626. return DefaultType$2;
  3627. }
  3628. }]);
  3629. return Dropdown;
  3630. }();
  3631. /**
  3632. * ------------------------------------------------------------------------
  3633. * Data Api implementation
  3634. * ------------------------------------------------------------------------
  3635. */
  3636. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  3637. event.preventDefault();
  3638. event.stopPropagation();
  3639. Dropdown._jQueryInterface.call($(this), 'toggle');
  3640. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3641. e.stopPropagation();
  3642. });
  3643. /**
  3644. * ------------------------------------------------------------------------
  3645. * jQuery
  3646. * ------------------------------------------------------------------------
  3647. */
  3648. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3649. $.fn[NAME$4].Constructor = Dropdown;
  3650. $.fn[NAME$4].noConflict = function () {
  3651. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3652. return Dropdown._jQueryInterface;
  3653. };
  3654. /**
  3655. * ------------------------------------------------------------------------
  3656. * Constants
  3657. * ------------------------------------------------------------------------
  3658. */
  3659. var NAME$5 = 'modal';
  3660. var VERSION$5 = '4.4.1';
  3661. var DATA_KEY$5 = 'bs.modal';
  3662. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3663. var DATA_API_KEY$5 = '.data-api';
  3664. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3665. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3666. var Default$3 = {
  3667. backdrop: true,
  3668. keyboard: true,
  3669. focus: true,
  3670. show: true
  3671. };
  3672. var DefaultType$3 = {
  3673. backdrop: '(boolean|string)',
  3674. keyboard: 'boolean',
  3675. focus: 'boolean',
  3676. show: 'boolean'
  3677. };
  3678. var Event$5 = {
  3679. HIDE: "hide" + EVENT_KEY$5,
  3680. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3681. HIDDEN: "hidden" + EVENT_KEY$5,
  3682. SHOW: "show" + EVENT_KEY$5,
  3683. SHOWN: "shown" + EVENT_KEY$5,
  3684. FOCUSIN: "focusin" + EVENT_KEY$5,
  3685. RESIZE: "resize" + EVENT_KEY$5,
  3686. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3687. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3688. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3689. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3690. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3691. };
  3692. var ClassName$5 = {
  3693. SCROLLABLE: 'modal-dialog-scrollable',
  3694. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3695. BACKDROP: 'modal-backdrop',
  3696. OPEN: 'modal-open',
  3697. FADE: 'fade',
  3698. SHOW: 'show',
  3699. STATIC: 'modal-static'
  3700. };
  3701. var Selector$5 = {
  3702. DIALOG: '.modal-dialog',
  3703. MODAL_BODY: '.modal-body',
  3704. DATA_TOGGLE: '[data-toggle="modal"]',
  3705. DATA_DISMISS: '[data-dismiss="modal"]',
  3706. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3707. STICKY_CONTENT: '.sticky-top'
  3708. };
  3709. /**
  3710. * ------------------------------------------------------------------------
  3711. * Class Definition
  3712. * ------------------------------------------------------------------------
  3713. */
  3714. var Modal =
  3715. /*#__PURE__*/
  3716. function () {
  3717. function Modal(element, config) {
  3718. this._config = this._getConfig(config);
  3719. this._element = element;
  3720. this._dialog = element.querySelector(Selector$5.DIALOG);
  3721. this._backdrop = null;
  3722. this._isShown = false;
  3723. this._isBodyOverflowing = false;
  3724. this._ignoreBackdropClick = false;
  3725. this._isTransitioning = false;
  3726. this._scrollbarWidth = 0;
  3727. } // Getters
  3728. var _proto = Modal.prototype;
  3729. // Public
  3730. _proto.toggle = function toggle(relatedTarget) {
  3731. return this._isShown ? this.hide() : this.show(relatedTarget);
  3732. };
  3733. _proto.show = function show(relatedTarget) {
  3734. var _this = this;
  3735. if (this._isShown || this._isTransitioning) {
  3736. return;
  3737. }
  3738. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3739. this._isTransitioning = true;
  3740. }
  3741. var showEvent = $.Event(Event$5.SHOW, {
  3742. relatedTarget: relatedTarget
  3743. });
  3744. $(this._element).trigger(showEvent);
  3745. if (this._isShown || showEvent.isDefaultPrevented()) {
  3746. return;
  3747. }
  3748. this._isShown = true;
  3749. this._checkScrollbar();
  3750. this._setScrollbar();
  3751. this._adjustDialog();
  3752. this._setEscapeEvent();
  3753. this._setResizeEvent();
  3754. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3755. return _this.hide(event);
  3756. });
  3757. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3758. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3759. if ($(event.target).is(_this._element)) {
  3760. _this._ignoreBackdropClick = true;
  3761. }
  3762. });
  3763. });
  3764. this._showBackdrop(function () {
  3765. return _this._showElement(relatedTarget);
  3766. });
  3767. };
  3768. _proto.hide = function hide(event) {
  3769. var _this2 = this;
  3770. if (event) {
  3771. event.preventDefault();
  3772. }
  3773. if (!this._isShown || this._isTransitioning) {
  3774. return;
  3775. }
  3776. var hideEvent = $.Event(Event$5.HIDE);
  3777. $(this._element).trigger(hideEvent);
  3778. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3779. return;
  3780. }
  3781. this._isShown = false;
  3782. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3783. if (transition) {
  3784. this._isTransitioning = true;
  3785. }
  3786. this._setEscapeEvent();
  3787. this._setResizeEvent();
  3788. $(document).off(Event$5.FOCUSIN);
  3789. $(this._element).removeClass(ClassName$5.SHOW);
  3790. $(this._element).off(Event$5.CLICK_DISMISS);
  3791. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3792. if (transition) {
  3793. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3794. $(this._element).one(Util.TRANSITION_END, function (event) {
  3795. return _this2._hideModal(event);
  3796. }).emulateTransitionEnd(transitionDuration);
  3797. } else {
  3798. this._hideModal();
  3799. }
  3800. };
  3801. _proto.dispose = function dispose() {
  3802. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3803. return $(htmlElement).off(EVENT_KEY$5);
  3804. });
  3805. /**
  3806. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3807. * Do not move `document` in `htmlElements` array
  3808. * It will remove `Event.CLICK_DATA_API` event that should remain
  3809. */
  3810. $(document).off(Event$5.FOCUSIN);
  3811. $.removeData(this._element, DATA_KEY$5);
  3812. this._config = null;
  3813. this._element = null;
  3814. this._dialog = null;
  3815. this._backdrop = null;
  3816. this._isShown = null;
  3817. this._isBodyOverflowing = null;
  3818. this._ignoreBackdropClick = null;
  3819. this._isTransitioning = null;
  3820. this._scrollbarWidth = null;
  3821. };
  3822. _proto.handleUpdate = function handleUpdate() {
  3823. this._adjustDialog();
  3824. } // Private
  3825. ;
  3826. _proto._getConfig = function _getConfig(config) {
  3827. config = _objectSpread2({}, Default$3, {}, config);
  3828. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3829. return config;
  3830. };
  3831. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3832. var _this3 = this;
  3833. if (this._config.backdrop === 'static') {
  3834. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3835. $(this._element).trigger(hideEventPrevented);
  3836. if (hideEventPrevented.defaultPrevented) {
  3837. return;
  3838. }
  3839. this._element.classList.add(ClassName$5.STATIC);
  3840. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3841. $(this._element).one(Util.TRANSITION_END, function () {
  3842. _this3._element.classList.remove(ClassName$5.STATIC);
  3843. }).emulateTransitionEnd(modalTransitionDuration);
  3844. this._element.focus();
  3845. } else {
  3846. this.hide();
  3847. }
  3848. };
  3849. _proto._showElement = function _showElement(relatedTarget) {
  3850. var _this4 = this;
  3851. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3852. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3853. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3854. // Don't move modal's DOM position
  3855. document.body.appendChild(this._element);
  3856. }
  3857. this._element.style.display = 'block';
  3858. this._element.removeAttribute('aria-hidden');
  3859. this._element.setAttribute('aria-modal', true);
  3860. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3861. modalBody.scrollTop = 0;
  3862. } else {
  3863. this._element.scrollTop = 0;
  3864. }
  3865. if (transition) {
  3866. Util.reflow(this._element);
  3867. }
  3868. $(this._element).addClass(ClassName$5.SHOW);
  3869. if (this._config.focus) {
  3870. this._enforceFocus();
  3871. }
  3872. var shownEvent = $.Event(Event$5.SHOWN, {
  3873. relatedTarget: relatedTarget
  3874. });
  3875. var transitionComplete = function transitionComplete() {
  3876. if (_this4._config.focus) {
  3877. _this4._element.focus();
  3878. }
  3879. _this4._isTransitioning = false;
  3880. $(_this4._element).trigger(shownEvent);
  3881. };
  3882. if (transition) {
  3883. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3884. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3885. } else {
  3886. transitionComplete();
  3887. }
  3888. };
  3889. _proto._enforceFocus = function _enforceFocus() {
  3890. var _this5 = this;
  3891. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3892. .on(Event$5.FOCUSIN, function (event) {
  3893. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3894. _this5._element.focus();
  3895. }
  3896. });
  3897. };
  3898. _proto._setEscapeEvent = function _setEscapeEvent() {
  3899. var _this6 = this;
  3900. if (this._isShown && this._config.keyboard) {
  3901. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  3902. if (event.which === ESCAPE_KEYCODE$1) {
  3903. _this6._triggerBackdropTransition();
  3904. }
  3905. });
  3906. } else if (!this._isShown) {
  3907. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  3908. }
  3909. };
  3910. _proto._setResizeEvent = function _setResizeEvent() {
  3911. var _this7 = this;
  3912. if (this._isShown) {
  3913. $(window).on(Event$5.RESIZE, function (event) {
  3914. return _this7.handleUpdate(event);
  3915. });
  3916. } else {
  3917. $(window).off(Event$5.RESIZE);
  3918. }
  3919. };
  3920. _proto._hideModal = function _hideModal() {
  3921. var _this8 = this;
  3922. this._element.style.display = 'none';
  3923. this._element.setAttribute('aria-hidden', true);
  3924. this._element.removeAttribute('aria-modal');
  3925. this._isTransitioning = false;
  3926. this._showBackdrop(function () {
  3927. $(document.body).removeClass(ClassName$5.OPEN);
  3928. _this8._resetAdjustments();
  3929. _this8._resetScrollbar();
  3930. $(_this8._element).trigger(Event$5.HIDDEN);
  3931. });
  3932. };
  3933. _proto._removeBackdrop = function _removeBackdrop() {
  3934. if (this._backdrop) {
  3935. $(this._backdrop).remove();
  3936. this._backdrop = null;
  3937. }
  3938. };
  3939. _proto._showBackdrop = function _showBackdrop(callback) {
  3940. var _this9 = this;
  3941. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  3942. if (this._isShown && this._config.backdrop) {
  3943. this._backdrop = document.createElement('div');
  3944. this._backdrop.className = ClassName$5.BACKDROP;
  3945. if (animate) {
  3946. this._backdrop.classList.add(animate);
  3947. }
  3948. $(this._backdrop).appendTo(document.body);
  3949. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  3950. if (_this9._ignoreBackdropClick) {
  3951. _this9._ignoreBackdropClick = false;
  3952. return;
  3953. }
  3954. if (event.target !== event.currentTarget) {
  3955. return;
  3956. }
  3957. _this9._triggerBackdropTransition();
  3958. });
  3959. if (animate) {
  3960. Util.reflow(this._backdrop);
  3961. }
  3962. $(this._backdrop).addClass(ClassName$5.SHOW);
  3963. if (!callback) {
  3964. return;
  3965. }
  3966. if (!animate) {
  3967. callback();
  3968. return;
  3969. }
  3970. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3971. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3972. } else if (!this._isShown && this._backdrop) {
  3973. $(this._backdrop).removeClass(ClassName$5.SHOW);
  3974. var callbackRemove = function callbackRemove() {
  3975. _this9._removeBackdrop();
  3976. if (callback) {
  3977. callback();
  3978. }
  3979. };
  3980. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3981. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3982. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3983. } else {
  3984. callbackRemove();
  3985. }
  3986. } else if (callback) {
  3987. callback();
  3988. }
  3989. } // ----------------------------------------------------------------------
  3990. // the following methods are used to handle overflowing modals
  3991. // todo (fat): these should probably be refactored out of modal.js
  3992. // ----------------------------------------------------------------------
  3993. ;
  3994. _proto._adjustDialog = function _adjustDialog() {
  3995. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3996. if (!this._isBodyOverflowing && isModalOverflowing) {
  3997. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3998. }
  3999. if (this._isBodyOverflowing && !isModalOverflowing) {
  4000. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4001. }
  4002. };
  4003. _proto._resetAdjustments = function _resetAdjustments() {
  4004. this._element.style.paddingLeft = '';
  4005. this._element.style.paddingRight = '';
  4006. };
  4007. _proto._checkScrollbar = function _checkScrollbar() {
  4008. var rect = document.body.getBoundingClientRect();
  4009. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4010. this._scrollbarWidth = this._getScrollbarWidth();
  4011. };
  4012. _proto._setScrollbar = function _setScrollbar() {
  4013. var _this10 = this;
  4014. if (this._isBodyOverflowing) {
  4015. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4016. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4017. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4018. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4019. $(fixedContent).each(function (index, element) {
  4020. var actualPadding = element.style.paddingRight;
  4021. var calculatedPadding = $(element).css('padding-right');
  4022. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4023. }); // Adjust sticky content margin
  4024. $(stickyContent).each(function (index, element) {
  4025. var actualMargin = element.style.marginRight;
  4026. var calculatedMargin = $(element).css('margin-right');
  4027. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4028. }); // Adjust body padding
  4029. var actualPadding = document.body.style.paddingRight;
  4030. var calculatedPadding = $(document.body).css('padding-right');
  4031. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4032. }
  4033. $(document.body).addClass(ClassName$5.OPEN);
  4034. };
  4035. _proto._resetScrollbar = function _resetScrollbar() {
  4036. // Restore fixed content padding
  4037. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4038. $(fixedContent).each(function (index, element) {
  4039. var padding = $(element).data('padding-right');
  4040. $(element).removeData('padding-right');
  4041. element.style.paddingRight = padding ? padding : '';
  4042. }); // Restore sticky content
  4043. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4044. $(elements).each(function (index, element) {
  4045. var margin = $(element).data('margin-right');
  4046. if (typeof margin !== 'undefined') {
  4047. $(element).css('margin-right', margin).removeData('margin-right');
  4048. }
  4049. }); // Restore body padding
  4050. var padding = $(document.body).data('padding-right');
  4051. $(document.body).removeData('padding-right');
  4052. document.body.style.paddingRight = padding ? padding : '';
  4053. };
  4054. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4055. // thx d.walsh
  4056. var scrollDiv = document.createElement('div');
  4057. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4058. document.body.appendChild(scrollDiv);
  4059. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4060. document.body.removeChild(scrollDiv);
  4061. return scrollbarWidth;
  4062. } // Static
  4063. ;
  4064. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4065. return this.each(function () {
  4066. var data = $(this).data(DATA_KEY$5);
  4067. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4068. if (!data) {
  4069. data = new Modal(this, _config);
  4070. $(this).data(DATA_KEY$5, data);
  4071. }
  4072. if (typeof config === 'string') {
  4073. if (typeof data[config] === 'undefined') {
  4074. throw new TypeError("No method named \"" + config + "\"");
  4075. }
  4076. data[config](relatedTarget);
  4077. } else if (_config.show) {
  4078. data.show(relatedTarget);
  4079. }
  4080. });
  4081. };
  4082. _createClass(Modal, null, [{
  4083. key: "VERSION",
  4084. get: function get() {
  4085. return VERSION$5;
  4086. }
  4087. }, {
  4088. key: "Default",
  4089. get: function get() {
  4090. return Default$3;
  4091. }
  4092. }]);
  4093. return Modal;
  4094. }();
  4095. /**
  4096. * ------------------------------------------------------------------------
  4097. * Data Api implementation
  4098. * ------------------------------------------------------------------------
  4099. */
  4100. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4101. var _this11 = this;
  4102. var target;
  4103. var selector = Util.getSelectorFromElement(this);
  4104. if (selector) {
  4105. target = document.querySelector(selector);
  4106. }
  4107. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4108. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4109. event.preventDefault();
  4110. }
  4111. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4112. if (showEvent.isDefaultPrevented()) {
  4113. // Only register focus restorer if modal will actually get shown
  4114. return;
  4115. }
  4116. $target.one(Event$5.HIDDEN, function () {
  4117. if ($(_this11).is(':visible')) {
  4118. _this11.focus();
  4119. }
  4120. });
  4121. });
  4122. Modal._jQueryInterface.call($(target), config, this);
  4123. });
  4124. /**
  4125. * ------------------------------------------------------------------------
  4126. * jQuery
  4127. * ------------------------------------------------------------------------
  4128. */
  4129. $.fn[NAME$5] = Modal._jQueryInterface;
  4130. $.fn[NAME$5].Constructor = Modal;
  4131. $.fn[NAME$5].noConflict = function () {
  4132. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4133. return Modal._jQueryInterface;
  4134. };
  4135. /**
  4136. * --------------------------------------------------------------------------
  4137. * Bootstrap (v4.4.1): tools/sanitizer.js
  4138. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4139. * --------------------------------------------------------------------------
  4140. */
  4141. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4142. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4143. var DefaultWhitelist = {
  4144. // Global attributes allowed on any supplied element below.
  4145. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4146. a: ['target', 'href', 'title', 'rel'],
  4147. area: [],
  4148. b: [],
  4149. br: [],
  4150. col: [],
  4151. code: [],
  4152. div: [],
  4153. em: [],
  4154. hr: [],
  4155. h1: [],
  4156. h2: [],
  4157. h3: [],
  4158. h4: [],
  4159. h5: [],
  4160. h6: [],
  4161. i: [],
  4162. img: ['src', 'alt', 'title', 'width', 'height'],
  4163. li: [],
  4164. ol: [],
  4165. p: [],
  4166. pre: [],
  4167. s: [],
  4168. small: [],
  4169. span: [],
  4170. sub: [],
  4171. sup: [],
  4172. strong: [],
  4173. u: [],
  4174. ul: []
  4175. };
  4176. /**
  4177. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4178. *
  4179. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4180. */
  4181. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4182. /**
  4183. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4184. *
  4185. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4186. */
  4187. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
  4188. function allowedAttribute(attr, allowedAttributeList) {
  4189. var attrName = attr.nodeName.toLowerCase();
  4190. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4191. if (uriAttrs.indexOf(attrName) !== -1) {
  4192. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4193. }
  4194. return true;
  4195. }
  4196. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4197. return attrRegex instanceof RegExp;
  4198. }); // Check if a regular expression validates the attribute.
  4199. for (var i = 0, l = regExp.length; i < l; i++) {
  4200. if (attrName.match(regExp[i])) {
  4201. return true;
  4202. }
  4203. }
  4204. return false;
  4205. }
  4206. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4207. if (unsafeHtml.length === 0) {
  4208. return unsafeHtml;
  4209. }
  4210. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4211. return sanitizeFn(unsafeHtml);
  4212. }
  4213. var domParser = new window.DOMParser();
  4214. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4215. var whitelistKeys = Object.keys(whiteList);
  4216. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4217. var _loop = function _loop(i, len) {
  4218. var el = elements[i];
  4219. var elName = el.nodeName.toLowerCase();
  4220. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4221. el.parentNode.removeChild(el);
  4222. return "continue";
  4223. }
  4224. var attributeList = [].slice.call(el.attributes);
  4225. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4226. attributeList.forEach(function (attr) {
  4227. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4228. el.removeAttribute(attr.nodeName);
  4229. }
  4230. });
  4231. };
  4232. for (var i = 0, len = elements.length; i < len; i++) {
  4233. var _ret = _loop(i);
  4234. if (_ret === "continue") continue;
  4235. }
  4236. return createdDocument.body.innerHTML;
  4237. }
  4238. /**
  4239. * ------------------------------------------------------------------------
  4240. * Constants
  4241. * ------------------------------------------------------------------------
  4242. */
  4243. var NAME$6 = 'tooltip';
  4244. var VERSION$6 = '4.4.1';
  4245. var DATA_KEY$6 = 'bs.tooltip';
  4246. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4247. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4248. var CLASS_PREFIX = 'bs-tooltip';
  4249. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4250. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4251. var DefaultType$4 = {
  4252. animation: 'boolean',
  4253. template: 'string',
  4254. title: '(string|element|function)',
  4255. trigger: 'string',
  4256. delay: '(number|object)',
  4257. html: 'boolean',
  4258. selector: '(string|boolean)',
  4259. placement: '(string|function)',
  4260. offset: '(number|string|function)',
  4261. container: '(string|element|boolean)',
  4262. fallbackPlacement: '(string|array)',
  4263. boundary: '(string|element)',
  4264. sanitize: 'boolean',
  4265. sanitizeFn: '(null|function)',
  4266. whiteList: 'object',
  4267. popperConfig: '(null|object)'
  4268. };
  4269. var AttachmentMap$1 = {
  4270. AUTO: 'auto',
  4271. TOP: 'top',
  4272. RIGHT: 'right',
  4273. BOTTOM: 'bottom',
  4274. LEFT: 'left'
  4275. };
  4276. var Default$4 = {
  4277. animation: true,
  4278. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4279. trigger: 'hover focus',
  4280. title: '',
  4281. delay: 0,
  4282. html: false,
  4283. selector: false,
  4284. placement: 'top',
  4285. offset: 0,
  4286. container: false,
  4287. fallbackPlacement: 'flip',
  4288. boundary: 'scrollParent',
  4289. sanitize: true,
  4290. sanitizeFn: null,
  4291. whiteList: DefaultWhitelist,
  4292. popperConfig: null
  4293. };
  4294. var HoverState = {
  4295. SHOW: 'show',
  4296. OUT: 'out'
  4297. };
  4298. var Event$6 = {
  4299. HIDE: "hide" + EVENT_KEY$6,
  4300. HIDDEN: "hidden" + EVENT_KEY$6,
  4301. SHOW: "show" + EVENT_KEY$6,
  4302. SHOWN: "shown" + EVENT_KEY$6,
  4303. INSERTED: "inserted" + EVENT_KEY$6,
  4304. CLICK: "click" + EVENT_KEY$6,
  4305. FOCUSIN: "focusin" + EVENT_KEY$6,
  4306. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4307. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4308. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4309. };
  4310. var ClassName$6 = {
  4311. FADE: 'fade',
  4312. SHOW: 'show'
  4313. };
  4314. var Selector$6 = {
  4315. TOOLTIP: '.tooltip',
  4316. TOOLTIP_INNER: '.tooltip-inner',
  4317. ARROW: '.arrow'
  4318. };
  4319. var Trigger = {
  4320. HOVER: 'hover',
  4321. FOCUS: 'focus',
  4322. CLICK: 'click',
  4323. MANUAL: 'manual'
  4324. };
  4325. /**
  4326. * ------------------------------------------------------------------------
  4327. * Class Definition
  4328. * ------------------------------------------------------------------------
  4329. */
  4330. var Tooltip =
  4331. /*#__PURE__*/
  4332. function () {
  4333. function Tooltip(element, config) {
  4334. if (typeof Popper === 'undefined') {
  4335. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4336. } // private
  4337. this._isEnabled = true;
  4338. this._timeout = 0;
  4339. this._hoverState = '';
  4340. this._activeTrigger = {};
  4341. this._popper = null; // Protected
  4342. this.element = element;
  4343. this.config = this._getConfig(config);
  4344. this.tip = null;
  4345. this._setListeners();
  4346. } // Getters
  4347. var _proto = Tooltip.prototype;
  4348. // Public
  4349. _proto.enable = function enable() {
  4350. this._isEnabled = true;
  4351. };
  4352. _proto.disable = function disable() {
  4353. this._isEnabled = false;
  4354. };
  4355. _proto.toggleEnabled = function toggleEnabled() {
  4356. this._isEnabled = !this._isEnabled;
  4357. };
  4358. _proto.toggle = function toggle(event) {
  4359. if (!this._isEnabled) {
  4360. return;
  4361. }
  4362. if (event) {
  4363. var dataKey = this.constructor.DATA_KEY;
  4364. var context = $(event.currentTarget).data(dataKey);
  4365. if (!context) {
  4366. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4367. $(event.currentTarget).data(dataKey, context);
  4368. }
  4369. context._activeTrigger.click = !context._activeTrigger.click;
  4370. if (context._isWithActiveTrigger()) {
  4371. context._enter(null, context);
  4372. } else {
  4373. context._leave(null, context);
  4374. }
  4375. } else {
  4376. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4377. this._leave(null, this);
  4378. return;
  4379. }
  4380. this._enter(null, this);
  4381. }
  4382. };
  4383. _proto.dispose = function dispose() {
  4384. clearTimeout(this._timeout);
  4385. $.removeData(this.element, this.constructor.DATA_KEY);
  4386. $(this.element).off(this.constructor.EVENT_KEY);
  4387. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4388. if (this.tip) {
  4389. $(this.tip).remove();
  4390. }
  4391. this._isEnabled = null;
  4392. this._timeout = null;
  4393. this._hoverState = null;
  4394. this._activeTrigger = null;
  4395. if (this._popper) {
  4396. this._popper.destroy();
  4397. }
  4398. this._popper = null;
  4399. this.element = null;
  4400. this.config = null;
  4401. this.tip = null;
  4402. };
  4403. _proto.show = function show() {
  4404. var _this = this;
  4405. if ($(this.element).css('display') === 'none') {
  4406. throw new Error('Please use show on visible elements');
  4407. }
  4408. var showEvent = $.Event(this.constructor.Event.SHOW);
  4409. if (this.isWithContent() && this._isEnabled) {
  4410. $(this.element).trigger(showEvent);
  4411. var shadowRoot = Util.findShadowRoot(this.element);
  4412. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4413. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4414. return;
  4415. }
  4416. var tip = this.getTipElement();
  4417. var tipId = Util.getUID(this.constructor.NAME);
  4418. tip.setAttribute('id', tipId);
  4419. this.element.setAttribute('aria-describedby', tipId);
  4420. this.setContent();
  4421. if (this.config.animation) {
  4422. $(tip).addClass(ClassName$6.FADE);
  4423. }
  4424. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4425. var attachment = this._getAttachment(placement);
  4426. this.addAttachmentClass(attachment);
  4427. var container = this._getContainer();
  4428. $(tip).data(this.constructor.DATA_KEY, this);
  4429. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4430. $(tip).appendTo(container);
  4431. }
  4432. $(this.element).trigger(this.constructor.Event.INSERTED);
  4433. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4434. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4435. // empty mouseover listeners to the body's immediate children;
  4436. // only needed because of broken event delegation on iOS
  4437. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4438. if ('ontouchstart' in document.documentElement) {
  4439. $(document.body).children().on('mouseover', null, $.noop);
  4440. }
  4441. var complete = function complete() {
  4442. if (_this.config.animation) {
  4443. _this._fixTransition();
  4444. }
  4445. var prevHoverState = _this._hoverState;
  4446. _this._hoverState = null;
  4447. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4448. if (prevHoverState === HoverState.OUT) {
  4449. _this._leave(null, _this);
  4450. }
  4451. };
  4452. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4453. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4454. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4455. } else {
  4456. complete();
  4457. }
  4458. }
  4459. };
  4460. _proto.hide = function hide(callback) {
  4461. var _this2 = this;
  4462. var tip = this.getTipElement();
  4463. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4464. var complete = function complete() {
  4465. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4466. tip.parentNode.removeChild(tip);
  4467. }
  4468. _this2._cleanTipClass();
  4469. _this2.element.removeAttribute('aria-describedby');
  4470. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4471. if (_this2._popper !== null) {
  4472. _this2._popper.destroy();
  4473. }
  4474. if (callback) {
  4475. callback();
  4476. }
  4477. };
  4478. $(this.element).trigger(hideEvent);
  4479. if (hideEvent.isDefaultPrevented()) {
  4480. return;
  4481. }
  4482. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4483. // empty mouseover listeners we added for iOS support
  4484. if ('ontouchstart' in document.documentElement) {
  4485. $(document.body).children().off('mouseover', null, $.noop);
  4486. }
  4487. this._activeTrigger[Trigger.CLICK] = false;
  4488. this._activeTrigger[Trigger.FOCUS] = false;
  4489. this._activeTrigger[Trigger.HOVER] = false;
  4490. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4491. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4492. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4493. } else {
  4494. complete();
  4495. }
  4496. this._hoverState = '';
  4497. };
  4498. _proto.update = function update() {
  4499. if (this._popper !== null) {
  4500. this._popper.scheduleUpdate();
  4501. }
  4502. } // Protected
  4503. ;
  4504. _proto.isWithContent = function isWithContent() {
  4505. return Boolean(this.getTitle());
  4506. };
  4507. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4508. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4509. };
  4510. _proto.getTipElement = function getTipElement() {
  4511. this.tip = this.tip || $(this.config.template)[0];
  4512. return this.tip;
  4513. };
  4514. _proto.setContent = function setContent() {
  4515. var tip = this.getTipElement();
  4516. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4517. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4518. };
  4519. _proto.setElementContent = function setElementContent($element, content) {
  4520. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4521. // Content is a DOM node or a jQuery
  4522. if (this.config.html) {
  4523. if (!$(content).parent().is($element)) {
  4524. $element.empty().append(content);
  4525. }
  4526. } else {
  4527. $element.text($(content).text());
  4528. }
  4529. return;
  4530. }
  4531. if (this.config.html) {
  4532. if (this.config.sanitize) {
  4533. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4534. }
  4535. $element.html(content);
  4536. } else {
  4537. $element.text(content);
  4538. }
  4539. };
  4540. _proto.getTitle = function getTitle() {
  4541. var title = this.element.getAttribute('data-original-title');
  4542. if (!title) {
  4543. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4544. }
  4545. return title;
  4546. } // Private
  4547. ;
  4548. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4549. var _this3 = this;
  4550. var defaultBsConfig = {
  4551. placement: attachment,
  4552. modifiers: {
  4553. offset: this._getOffset(),
  4554. flip: {
  4555. behavior: this.config.fallbackPlacement
  4556. },
  4557. arrow: {
  4558. element: Selector$6.ARROW
  4559. },
  4560. preventOverflow: {
  4561. boundariesElement: this.config.boundary
  4562. }
  4563. },
  4564. onCreate: function onCreate(data) {
  4565. if (data.originalPlacement !== data.placement) {
  4566. _this3._handlePopperPlacementChange(data);
  4567. }
  4568. },
  4569. onUpdate: function onUpdate(data) {
  4570. return _this3._handlePopperPlacementChange(data);
  4571. }
  4572. };
  4573. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4574. };
  4575. _proto._getOffset = function _getOffset() {
  4576. var _this4 = this;
  4577. var offset = {};
  4578. if (typeof this.config.offset === 'function') {
  4579. offset.fn = function (data) {
  4580. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4581. return data;
  4582. };
  4583. } else {
  4584. offset.offset = this.config.offset;
  4585. }
  4586. return offset;
  4587. };
  4588. _proto._getContainer = function _getContainer() {
  4589. if (this.config.container === false) {
  4590. return document.body;
  4591. }
  4592. if (Util.isElement(this.config.container)) {
  4593. return $(this.config.container);
  4594. }
  4595. return $(document).find(this.config.container);
  4596. };
  4597. _proto._getAttachment = function _getAttachment(placement) {
  4598. return AttachmentMap$1[placement.toUpperCase()];
  4599. };
  4600. _proto._setListeners = function _setListeners() {
  4601. var _this5 = this;
  4602. var triggers = this.config.trigger.split(' ');
  4603. triggers.forEach(function (trigger) {
  4604. if (trigger === 'click') {
  4605. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4606. return _this5.toggle(event);
  4607. });
  4608. } else if (trigger !== Trigger.MANUAL) {
  4609. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4610. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4611. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4612. return _this5._enter(event);
  4613. }).on(eventOut, _this5.config.selector, function (event) {
  4614. return _this5._leave(event);
  4615. });
  4616. }
  4617. });
  4618. this._hideModalHandler = function () {
  4619. if (_this5.element) {
  4620. _this5.hide();
  4621. }
  4622. };
  4623. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4624. if (this.config.selector) {
  4625. this.config = _objectSpread2({}, this.config, {
  4626. trigger: 'manual',
  4627. selector: ''
  4628. });
  4629. } else {
  4630. this._fixTitle();
  4631. }
  4632. };
  4633. _proto._fixTitle = function _fixTitle() {
  4634. var titleType = typeof this.element.getAttribute('data-original-title');
  4635. if (this.element.getAttribute('title') || titleType !== 'string') {
  4636. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4637. this.element.setAttribute('title', '');
  4638. }
  4639. };
  4640. _proto._enter = function _enter(event, context) {
  4641. var dataKey = this.constructor.DATA_KEY;
  4642. context = context || $(event.currentTarget).data(dataKey);
  4643. if (!context) {
  4644. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4645. $(event.currentTarget).data(dataKey, context);
  4646. }
  4647. if (event) {
  4648. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4649. }
  4650. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4651. context._hoverState = HoverState.SHOW;
  4652. return;
  4653. }
  4654. clearTimeout(context._timeout);
  4655. context._hoverState = HoverState.SHOW;
  4656. if (!context.config.delay || !context.config.delay.show) {
  4657. context.show();
  4658. return;
  4659. }
  4660. context._timeout = setTimeout(function () {
  4661. if (context._hoverState === HoverState.SHOW) {
  4662. context.show();
  4663. }
  4664. }, context.config.delay.show);
  4665. };
  4666. _proto._leave = function _leave(event, context) {
  4667. var dataKey = this.constructor.DATA_KEY;
  4668. context = context || $(event.currentTarget).data(dataKey);
  4669. if (!context) {
  4670. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4671. $(event.currentTarget).data(dataKey, context);
  4672. }
  4673. if (event) {
  4674. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4675. }
  4676. if (context._isWithActiveTrigger()) {
  4677. return;
  4678. }
  4679. clearTimeout(context._timeout);
  4680. context._hoverState = HoverState.OUT;
  4681. if (!context.config.delay || !context.config.delay.hide) {
  4682. context.hide();
  4683. return;
  4684. }
  4685. context._timeout = setTimeout(function () {
  4686. if (context._hoverState === HoverState.OUT) {
  4687. context.hide();
  4688. }
  4689. }, context.config.delay.hide);
  4690. };
  4691. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4692. for (var trigger in this._activeTrigger) {
  4693. if (this._activeTrigger[trigger]) {
  4694. return true;
  4695. }
  4696. }
  4697. return false;
  4698. };
  4699. _proto._getConfig = function _getConfig(config) {
  4700. var dataAttributes = $(this.element).data();
  4701. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4702. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4703. delete dataAttributes[dataAttr];
  4704. }
  4705. });
  4706. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4707. if (typeof config.delay === 'number') {
  4708. config.delay = {
  4709. show: config.delay,
  4710. hide: config.delay
  4711. };
  4712. }
  4713. if (typeof config.title === 'number') {
  4714. config.title = config.title.toString();
  4715. }
  4716. if (typeof config.content === 'number') {
  4717. config.content = config.content.toString();
  4718. }
  4719. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4720. if (config.sanitize) {
  4721. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4722. }
  4723. return config;
  4724. };
  4725. _proto._getDelegateConfig = function _getDelegateConfig() {
  4726. var config = {};
  4727. if (this.config) {
  4728. for (var key in this.config) {
  4729. if (this.constructor.Default[key] !== this.config[key]) {
  4730. config[key] = this.config[key];
  4731. }
  4732. }
  4733. }
  4734. return config;
  4735. };
  4736. _proto._cleanTipClass = function _cleanTipClass() {
  4737. var $tip = $(this.getTipElement());
  4738. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4739. if (tabClass !== null && tabClass.length) {
  4740. $tip.removeClass(tabClass.join(''));
  4741. }
  4742. };
  4743. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4744. var popperInstance = popperData.instance;
  4745. this.tip = popperInstance.popper;
  4746. this._cleanTipClass();
  4747. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4748. };
  4749. _proto._fixTransition = function _fixTransition() {
  4750. var tip = this.getTipElement();
  4751. var initConfigAnimation = this.config.animation;
  4752. if (tip.getAttribute('x-placement') !== null) {
  4753. return;
  4754. }
  4755. $(tip).removeClass(ClassName$6.FADE);
  4756. this.config.animation = false;
  4757. this.hide();
  4758. this.show();
  4759. this.config.animation = initConfigAnimation;
  4760. } // Static
  4761. ;
  4762. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4763. return this.each(function () {
  4764. var data = $(this).data(DATA_KEY$6);
  4765. var _config = typeof config === 'object' && config;
  4766. if (!data && /dispose|hide/.test(config)) {
  4767. return;
  4768. }
  4769. if (!data) {
  4770. data = new Tooltip(this, _config);
  4771. $(this).data(DATA_KEY$6, data);
  4772. }
  4773. if (typeof config === 'string') {
  4774. if (typeof data[config] === 'undefined') {
  4775. throw new TypeError("No method named \"" + config + "\"");
  4776. }
  4777. data[config]();
  4778. }
  4779. });
  4780. };
  4781. _createClass(Tooltip, null, [{
  4782. key: "VERSION",
  4783. get: function get() {
  4784. return VERSION$6;
  4785. }
  4786. }, {
  4787. key: "Default",
  4788. get: function get() {
  4789. return Default$4;
  4790. }
  4791. }, {
  4792. key: "NAME",
  4793. get: function get() {
  4794. return NAME$6;
  4795. }
  4796. }, {
  4797. key: "DATA_KEY",
  4798. get: function get() {
  4799. return DATA_KEY$6;
  4800. }
  4801. }, {
  4802. key: "Event",
  4803. get: function get() {
  4804. return Event$6;
  4805. }
  4806. }, {
  4807. key: "EVENT_KEY",
  4808. get: function get() {
  4809. return EVENT_KEY$6;
  4810. }
  4811. }, {
  4812. key: "DefaultType",
  4813. get: function get() {
  4814. return DefaultType$4;
  4815. }
  4816. }]);
  4817. return Tooltip;
  4818. }();
  4819. /**
  4820. * ------------------------------------------------------------------------
  4821. * jQuery
  4822. * ------------------------------------------------------------------------
  4823. */
  4824. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4825. $.fn[NAME$6].Constructor = Tooltip;
  4826. $.fn[NAME$6].noConflict = function () {
  4827. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4828. return Tooltip._jQueryInterface;
  4829. };
  4830. /**
  4831. * ------------------------------------------------------------------------
  4832. * Constants
  4833. * ------------------------------------------------------------------------
  4834. */
  4835. var NAME$7 = 'popover';
  4836. var VERSION$7 = '4.4.1';
  4837. var DATA_KEY$7 = 'bs.popover';
  4838. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4839. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4840. var CLASS_PREFIX$1 = 'bs-popover';
  4841. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4842. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4843. placement: 'right',
  4844. trigger: 'click',
  4845. content: '',
  4846. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4847. });
  4848. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4849. content: '(string|element|function)'
  4850. });
  4851. var ClassName$7 = {
  4852. FADE: 'fade',
  4853. SHOW: 'show'
  4854. };
  4855. var Selector$7 = {
  4856. TITLE: '.popover-header',
  4857. CONTENT: '.popover-body'
  4858. };
  4859. var Event$7 = {
  4860. HIDE: "hide" + EVENT_KEY$7,
  4861. HIDDEN: "hidden" + EVENT_KEY$7,
  4862. SHOW: "show" + EVENT_KEY$7,
  4863. SHOWN: "shown" + EVENT_KEY$7,
  4864. INSERTED: "inserted" + EVENT_KEY$7,
  4865. CLICK: "click" + EVENT_KEY$7,
  4866. FOCUSIN: "focusin" + EVENT_KEY$7,
  4867. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4868. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4869. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4870. };
  4871. /**
  4872. * ------------------------------------------------------------------------
  4873. * Class Definition
  4874. * ------------------------------------------------------------------------
  4875. */
  4876. var Popover =
  4877. /*#__PURE__*/
  4878. function (_Tooltip) {
  4879. _inheritsLoose(Popover, _Tooltip);
  4880. function Popover() {
  4881. return _Tooltip.apply(this, arguments) || this;
  4882. }
  4883. var _proto = Popover.prototype;
  4884. // Overrides
  4885. _proto.isWithContent = function isWithContent() {
  4886. return this.getTitle() || this._getContent();
  4887. };
  4888. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4889. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4890. };
  4891. _proto.getTipElement = function getTipElement() {
  4892. this.tip = this.tip || $(this.config.template)[0];
  4893. return this.tip;
  4894. };
  4895. _proto.setContent = function setContent() {
  4896. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4897. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4898. var content = this._getContent();
  4899. if (typeof content === 'function') {
  4900. content = content.call(this.element);
  4901. }
  4902. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4903. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4904. } // Private
  4905. ;
  4906. _proto._getContent = function _getContent() {
  4907. return this.element.getAttribute('data-content') || this.config.content;
  4908. };
  4909. _proto._cleanTipClass = function _cleanTipClass() {
  4910. var $tip = $(this.getTipElement());
  4911. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4912. if (tabClass !== null && tabClass.length > 0) {
  4913. $tip.removeClass(tabClass.join(''));
  4914. }
  4915. } // Static
  4916. ;
  4917. Popover._jQueryInterface = function _jQueryInterface(config) {
  4918. return this.each(function () {
  4919. var data = $(this).data(DATA_KEY$7);
  4920. var _config = typeof config === 'object' ? config : null;
  4921. if (!data && /dispose|hide/.test(config)) {
  4922. return;
  4923. }
  4924. if (!data) {
  4925. data = new Popover(this, _config);
  4926. $(this).data(DATA_KEY$7, data);
  4927. }
  4928. if (typeof config === 'string') {
  4929. if (typeof data[config] === 'undefined') {
  4930. throw new TypeError("No method named \"" + config + "\"");
  4931. }
  4932. data[config]();
  4933. }
  4934. });
  4935. };
  4936. _createClass(Popover, null, [{
  4937. key: "VERSION",
  4938. // Getters
  4939. get: function get() {
  4940. return VERSION$7;
  4941. }
  4942. }, {
  4943. key: "Default",
  4944. get: function get() {
  4945. return Default$5;
  4946. }
  4947. }, {
  4948. key: "NAME",
  4949. get: function get() {
  4950. return NAME$7;
  4951. }
  4952. }, {
  4953. key: "DATA_KEY",
  4954. get: function get() {
  4955. return DATA_KEY$7;
  4956. }
  4957. }, {
  4958. key: "Event",
  4959. get: function get() {
  4960. return Event$7;
  4961. }
  4962. }, {
  4963. key: "EVENT_KEY",
  4964. get: function get() {
  4965. return EVENT_KEY$7;
  4966. }
  4967. }, {
  4968. key: "DefaultType",
  4969. get: function get() {
  4970. return DefaultType$5;
  4971. }
  4972. }]);
  4973. return Popover;
  4974. }(Tooltip);
  4975. /**
  4976. * ------------------------------------------------------------------------
  4977. * jQuery
  4978. * ------------------------------------------------------------------------
  4979. */
  4980. $.fn[NAME$7] = Popover._jQueryInterface;
  4981. $.fn[NAME$7].Constructor = Popover;
  4982. $.fn[NAME$7].noConflict = function () {
  4983. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4984. return Popover._jQueryInterface;
  4985. };
  4986. /**
  4987. * ------------------------------------------------------------------------
  4988. * Constants
  4989. * ------------------------------------------------------------------------
  4990. */
  4991. var NAME$8 = 'scrollspy';
  4992. var VERSION$8 = '4.4.1';
  4993. var DATA_KEY$8 = 'bs.scrollspy';
  4994. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4995. var DATA_API_KEY$6 = '.data-api';
  4996. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  4997. var Default$6 = {
  4998. offset: 10,
  4999. method: 'auto',
  5000. target: ''
  5001. };
  5002. var DefaultType$6 = {
  5003. offset: 'number',
  5004. method: 'string',
  5005. target: '(string|element)'
  5006. };
  5007. var Event$8 = {
  5008. ACTIVATE: "activate" + EVENT_KEY$8,
  5009. SCROLL: "scroll" + EVENT_KEY$8,
  5010. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5011. };
  5012. var ClassName$8 = {
  5013. DROPDOWN_ITEM: 'dropdown-item',
  5014. DROPDOWN_MENU: 'dropdown-menu',
  5015. ACTIVE: 'active'
  5016. };
  5017. var Selector$8 = {
  5018. DATA_SPY: '[data-spy="scroll"]',
  5019. ACTIVE: '.active',
  5020. NAV_LIST_GROUP: '.nav, .list-group',
  5021. NAV_LINKS: '.nav-link',
  5022. NAV_ITEMS: '.nav-item',
  5023. LIST_ITEMS: '.list-group-item',
  5024. DROPDOWN: '.dropdown',
  5025. DROPDOWN_ITEMS: '.dropdown-item',
  5026. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5027. };
  5028. var OffsetMethod = {
  5029. OFFSET: 'offset',
  5030. POSITION: 'position'
  5031. };
  5032. /**
  5033. * ------------------------------------------------------------------------
  5034. * Class Definition
  5035. * ------------------------------------------------------------------------
  5036. */
  5037. var ScrollSpy =
  5038. /*#__PURE__*/
  5039. function () {
  5040. function ScrollSpy(element, config) {
  5041. var _this = this;
  5042. this._element = element;
  5043. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5044. this._config = this._getConfig(config);
  5045. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5046. this._offsets = [];
  5047. this._targets = [];
  5048. this._activeTarget = null;
  5049. this._scrollHeight = 0;
  5050. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5051. return _this._process(event);
  5052. });
  5053. this.refresh();
  5054. this._process();
  5055. } // Getters
  5056. var _proto = ScrollSpy.prototype;
  5057. // Public
  5058. _proto.refresh = function refresh() {
  5059. var _this2 = this;
  5060. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5061. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5062. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5063. this._offsets = [];
  5064. this._targets = [];
  5065. this._scrollHeight = this._getScrollHeight();
  5066. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5067. targets.map(function (element) {
  5068. var target;
  5069. var targetSelector = Util.getSelectorFromElement(element);
  5070. if (targetSelector) {
  5071. target = document.querySelector(targetSelector);
  5072. }
  5073. if (target) {
  5074. var targetBCR = target.getBoundingClientRect();
  5075. if (targetBCR.width || targetBCR.height) {
  5076. // TODO (fat): remove sketch reliance on jQuery position/offset
  5077. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5078. }
  5079. }
  5080. return null;
  5081. }).filter(function (item) {
  5082. return item;
  5083. }).sort(function (a, b) {
  5084. return a[0] - b[0];
  5085. }).forEach(function (item) {
  5086. _this2._offsets.push(item[0]);
  5087. _this2._targets.push(item[1]);
  5088. });
  5089. };
  5090. _proto.dispose = function dispose() {
  5091. $.removeData(this._element, DATA_KEY$8);
  5092. $(this._scrollElement).off(EVENT_KEY$8);
  5093. this._element = null;
  5094. this._scrollElement = null;
  5095. this._config = null;
  5096. this._selector = null;
  5097. this._offsets = null;
  5098. this._targets = null;
  5099. this._activeTarget = null;
  5100. this._scrollHeight = null;
  5101. } // Private
  5102. ;
  5103. _proto._getConfig = function _getConfig(config) {
  5104. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5105. if (typeof config.target !== 'string') {
  5106. var id = $(config.target).attr('id');
  5107. if (!id) {
  5108. id = Util.getUID(NAME$8);
  5109. $(config.target).attr('id', id);
  5110. }
  5111. config.target = "#" + id;
  5112. }
  5113. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5114. return config;
  5115. };
  5116. _proto._getScrollTop = function _getScrollTop() {
  5117. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5118. };
  5119. _proto._getScrollHeight = function _getScrollHeight() {
  5120. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5121. };
  5122. _proto._getOffsetHeight = function _getOffsetHeight() {
  5123. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5124. };
  5125. _proto._process = function _process() {
  5126. var scrollTop = this._getScrollTop() + this._config.offset;
  5127. var scrollHeight = this._getScrollHeight();
  5128. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5129. if (this._scrollHeight !== scrollHeight) {
  5130. this.refresh();
  5131. }
  5132. if (scrollTop >= maxScroll) {
  5133. var target = this._targets[this._targets.length - 1];
  5134. if (this._activeTarget !== target) {
  5135. this._activate(target);
  5136. }
  5137. return;
  5138. }
  5139. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5140. this._activeTarget = null;
  5141. this._clear();
  5142. return;
  5143. }
  5144. var offsetLength = this._offsets.length;
  5145. for (var i = offsetLength; i--;) {
  5146. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5147. if (isActiveTarget) {
  5148. this._activate(this._targets[i]);
  5149. }
  5150. }
  5151. };
  5152. _proto._activate = function _activate(target) {
  5153. this._activeTarget = target;
  5154. this._clear();
  5155. var queries = this._selector.split(',').map(function (selector) {
  5156. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5157. });
  5158. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5159. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5160. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5161. $link.addClass(ClassName$8.ACTIVE);
  5162. } else {
  5163. // Set triggered link as active
  5164. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5165. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5166. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  5167. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5168. }
  5169. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5170. relatedTarget: target
  5171. });
  5172. };
  5173. _proto._clear = function _clear() {
  5174. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5175. return node.classList.contains(ClassName$8.ACTIVE);
  5176. }).forEach(function (node) {
  5177. return node.classList.remove(ClassName$8.ACTIVE);
  5178. });
  5179. } // Static
  5180. ;
  5181. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5182. return this.each(function () {
  5183. var data = $(this).data(DATA_KEY$8);
  5184. var _config = typeof config === 'object' && config;
  5185. if (!data) {
  5186. data = new ScrollSpy(this, _config);
  5187. $(this).data(DATA_KEY$8, data);
  5188. }
  5189. if (typeof config === 'string') {
  5190. if (typeof data[config] === 'undefined') {
  5191. throw new TypeError("No method named \"" + config + "\"");
  5192. }
  5193. data[config]();
  5194. }
  5195. });
  5196. };
  5197. _createClass(ScrollSpy, null, [{
  5198. key: "VERSION",
  5199. get: function get() {
  5200. return VERSION$8;
  5201. }
  5202. }, {
  5203. key: "Default",
  5204. get: function get() {
  5205. return Default$6;
  5206. }
  5207. }]);
  5208. return ScrollSpy;
  5209. }();
  5210. /**
  5211. * ------------------------------------------------------------------------
  5212. * Data Api implementation
  5213. * ------------------------------------------------------------------------
  5214. */
  5215. $(window).on(Event$8.LOAD_DATA_API, function () {
  5216. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5217. var scrollSpysLength = scrollSpys.length;
  5218. for (var i = scrollSpysLength; i--;) {
  5219. var $spy = $(scrollSpys[i]);
  5220. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5221. }
  5222. });
  5223. /**
  5224. * ------------------------------------------------------------------------
  5225. * jQuery
  5226. * ------------------------------------------------------------------------
  5227. */
  5228. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5229. $.fn[NAME$8].Constructor = ScrollSpy;
  5230. $.fn[NAME$8].noConflict = function () {
  5231. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5232. return ScrollSpy._jQueryInterface;
  5233. };
  5234. /**
  5235. * ------------------------------------------------------------------------
  5236. * Constants
  5237. * ------------------------------------------------------------------------
  5238. */
  5239. var NAME$9 = 'tab';
  5240. var VERSION$9 = '4.4.1';
  5241. var DATA_KEY$9 = 'bs.tab';
  5242. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5243. var DATA_API_KEY$7 = '.data-api';
  5244. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5245. var Event$9 = {
  5246. HIDE: "hide" + EVENT_KEY$9,
  5247. HIDDEN: "hidden" + EVENT_KEY$9,
  5248. SHOW: "show" + EVENT_KEY$9,
  5249. SHOWN: "shown" + EVENT_KEY$9,
  5250. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5251. };
  5252. var ClassName$9 = {
  5253. DROPDOWN_MENU: 'dropdown-menu',
  5254. ACTIVE: 'active',
  5255. DISABLED: 'disabled',
  5256. FADE: 'fade',
  5257. SHOW: 'show'
  5258. };
  5259. var Selector$9 = {
  5260. DROPDOWN: '.dropdown',
  5261. NAV_LIST_GROUP: '.nav, .list-group',
  5262. ACTIVE: '.active',
  5263. ACTIVE_UL: '> li > .active',
  5264. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5265. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5266. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5267. };
  5268. /**
  5269. * ------------------------------------------------------------------------
  5270. * Class Definition
  5271. * ------------------------------------------------------------------------
  5272. */
  5273. var Tab =
  5274. /*#__PURE__*/
  5275. function () {
  5276. function Tab(element) {
  5277. this._element = element;
  5278. } // Getters
  5279. var _proto = Tab.prototype;
  5280. // Public
  5281. _proto.show = function show() {
  5282. var _this = this;
  5283. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5284. return;
  5285. }
  5286. var target;
  5287. var previous;
  5288. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5289. var selector = Util.getSelectorFromElement(this._element);
  5290. if (listElement) {
  5291. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5292. previous = $.makeArray($(listElement).find(itemSelector));
  5293. previous = previous[previous.length - 1];
  5294. }
  5295. var hideEvent = $.Event(Event$9.HIDE, {
  5296. relatedTarget: this._element
  5297. });
  5298. var showEvent = $.Event(Event$9.SHOW, {
  5299. relatedTarget: previous
  5300. });
  5301. if (previous) {
  5302. $(previous).trigger(hideEvent);
  5303. }
  5304. $(this._element).trigger(showEvent);
  5305. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5306. return;
  5307. }
  5308. if (selector) {
  5309. target = document.querySelector(selector);
  5310. }
  5311. this._activate(this._element, listElement);
  5312. var complete = function complete() {
  5313. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5314. relatedTarget: _this._element
  5315. });
  5316. var shownEvent = $.Event(Event$9.SHOWN, {
  5317. relatedTarget: previous
  5318. });
  5319. $(previous).trigger(hiddenEvent);
  5320. $(_this._element).trigger(shownEvent);
  5321. };
  5322. if (target) {
  5323. this._activate(target, target.parentNode, complete);
  5324. } else {
  5325. complete();
  5326. }
  5327. };
  5328. _proto.dispose = function dispose() {
  5329. $.removeData(this._element, DATA_KEY$9);
  5330. this._element = null;
  5331. } // Private
  5332. ;
  5333. _proto._activate = function _activate(element, container, callback) {
  5334. var _this2 = this;
  5335. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5336. var active = activeElements[0];
  5337. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5338. var complete = function complete() {
  5339. return _this2._transitionComplete(element, active, callback);
  5340. };
  5341. if (active && isTransitioning) {
  5342. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5343. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5344. } else {
  5345. complete();
  5346. }
  5347. };
  5348. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5349. if (active) {
  5350. $(active).removeClass(ClassName$9.ACTIVE);
  5351. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5352. if (dropdownChild) {
  5353. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5354. }
  5355. if (active.getAttribute('role') === 'tab') {
  5356. active.setAttribute('aria-selected', false);
  5357. }
  5358. }
  5359. $(element).addClass(ClassName$9.ACTIVE);
  5360. if (element.getAttribute('role') === 'tab') {
  5361. element.setAttribute('aria-selected', true);
  5362. }
  5363. Util.reflow(element);
  5364. if (element.classList.contains(ClassName$9.FADE)) {
  5365. element.classList.add(ClassName$9.SHOW);
  5366. }
  5367. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5368. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5369. if (dropdownElement) {
  5370. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5371. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5372. }
  5373. element.setAttribute('aria-expanded', true);
  5374. }
  5375. if (callback) {
  5376. callback();
  5377. }
  5378. } // Static
  5379. ;
  5380. Tab._jQueryInterface = function _jQueryInterface(config) {
  5381. return this.each(function () {
  5382. var $this = $(this);
  5383. var data = $this.data(DATA_KEY$9);
  5384. if (!data) {
  5385. data = new Tab(this);
  5386. $this.data(DATA_KEY$9, data);
  5387. }
  5388. if (typeof config === 'string') {
  5389. if (typeof data[config] === 'undefined') {
  5390. throw new TypeError("No method named \"" + config + "\"");
  5391. }
  5392. data[config]();
  5393. }
  5394. });
  5395. };
  5396. _createClass(Tab, null, [{
  5397. key: "VERSION",
  5398. get: function get() {
  5399. return VERSION$9;
  5400. }
  5401. }]);
  5402. return Tab;
  5403. }();
  5404. /**
  5405. * ------------------------------------------------------------------------
  5406. * Data Api implementation
  5407. * ------------------------------------------------------------------------
  5408. */
  5409. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5410. event.preventDefault();
  5411. Tab._jQueryInterface.call($(this), 'show');
  5412. });
  5413. /**
  5414. * ------------------------------------------------------------------------
  5415. * jQuery
  5416. * ------------------------------------------------------------------------
  5417. */
  5418. $.fn[NAME$9] = Tab._jQueryInterface;
  5419. $.fn[NAME$9].Constructor = Tab;
  5420. $.fn[NAME$9].noConflict = function () {
  5421. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5422. return Tab._jQueryInterface;
  5423. };
  5424. /**
  5425. * ------------------------------------------------------------------------
  5426. * Constants
  5427. * ------------------------------------------------------------------------
  5428. */
  5429. var NAME$a = 'toast';
  5430. var VERSION$a = '4.4.1';
  5431. var DATA_KEY$a = 'bs.toast';
  5432. var EVENT_KEY$a = "." + DATA_KEY$a;
  5433. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5434. var Event$a = {
  5435. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5436. HIDE: "hide" + EVENT_KEY$a,
  5437. HIDDEN: "hidden" + EVENT_KEY$a,
  5438. SHOW: "show" + EVENT_KEY$a,
  5439. SHOWN: "shown" + EVENT_KEY$a
  5440. };
  5441. var ClassName$a = {
  5442. FADE: 'fade',
  5443. HIDE: 'hide',
  5444. SHOW: 'show',
  5445. SHOWING: 'showing'
  5446. };
  5447. var DefaultType$7 = {
  5448. animation: 'boolean',
  5449. autohide: 'boolean',
  5450. delay: 'number'
  5451. };
  5452. var Default$7 = {
  5453. animation: true,
  5454. autohide: true,
  5455. delay: 500
  5456. };
  5457. var Selector$a = {
  5458. DATA_DISMISS: '[data-dismiss="toast"]'
  5459. };
  5460. /**
  5461. * ------------------------------------------------------------------------
  5462. * Class Definition
  5463. * ------------------------------------------------------------------------
  5464. */
  5465. var Toast =
  5466. /*#__PURE__*/
  5467. function () {
  5468. function Toast(element, config) {
  5469. this._element = element;
  5470. this._config = this._getConfig(config);
  5471. this._timeout = null;
  5472. this._setListeners();
  5473. } // Getters
  5474. var _proto = Toast.prototype;
  5475. // Public
  5476. _proto.show = function show() {
  5477. var _this = this;
  5478. var showEvent = $.Event(Event$a.SHOW);
  5479. $(this._element).trigger(showEvent);
  5480. if (showEvent.isDefaultPrevented()) {
  5481. return;
  5482. }
  5483. if (this._config.animation) {
  5484. this._element.classList.add(ClassName$a.FADE);
  5485. }
  5486. var complete = function complete() {
  5487. _this._element.classList.remove(ClassName$a.SHOWING);
  5488. _this._element.classList.add(ClassName$a.SHOW);
  5489. $(_this._element).trigger(Event$a.SHOWN);
  5490. if (_this._config.autohide) {
  5491. _this._timeout = setTimeout(function () {
  5492. _this.hide();
  5493. }, _this._config.delay);
  5494. }
  5495. };
  5496. this._element.classList.remove(ClassName$a.HIDE);
  5497. Util.reflow(this._element);
  5498. this._element.classList.add(ClassName$a.SHOWING);
  5499. if (this._config.animation) {
  5500. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5501. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5502. } else {
  5503. complete();
  5504. }
  5505. };
  5506. _proto.hide = function hide() {
  5507. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5508. return;
  5509. }
  5510. var hideEvent = $.Event(Event$a.HIDE);
  5511. $(this._element).trigger(hideEvent);
  5512. if (hideEvent.isDefaultPrevented()) {
  5513. return;
  5514. }
  5515. this._close();
  5516. };
  5517. _proto.dispose = function dispose() {
  5518. clearTimeout(this._timeout);
  5519. this._timeout = null;
  5520. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5521. this._element.classList.remove(ClassName$a.SHOW);
  5522. }
  5523. $(this._element).off(Event$a.CLICK_DISMISS);
  5524. $.removeData(this._element, DATA_KEY$a);
  5525. this._element = null;
  5526. this._config = null;
  5527. } // Private
  5528. ;
  5529. _proto._getConfig = function _getConfig(config) {
  5530. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5531. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5532. return config;
  5533. };
  5534. _proto._setListeners = function _setListeners() {
  5535. var _this2 = this;
  5536. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5537. return _this2.hide();
  5538. });
  5539. };
  5540. _proto._close = function _close() {
  5541. var _this3 = this;
  5542. var complete = function complete() {
  5543. _this3._element.classList.add(ClassName$a.HIDE);
  5544. $(_this3._element).trigger(Event$a.HIDDEN);
  5545. };
  5546. this._element.classList.remove(ClassName$a.SHOW);
  5547. if (this._config.animation) {
  5548. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5549. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5550. } else {
  5551. complete();
  5552. }
  5553. } // Static
  5554. ;
  5555. Toast._jQueryInterface = function _jQueryInterface(config) {
  5556. return this.each(function () {
  5557. var $element = $(this);
  5558. var data = $element.data(DATA_KEY$a);
  5559. var _config = typeof config === 'object' && config;
  5560. if (!data) {
  5561. data = new Toast(this, _config);
  5562. $element.data(DATA_KEY$a, data);
  5563. }
  5564. if (typeof config === 'string') {
  5565. if (typeof data[config] === 'undefined') {
  5566. throw new TypeError("No method named \"" + config + "\"");
  5567. }
  5568. data[config](this);
  5569. }
  5570. });
  5571. };
  5572. _createClass(Toast, null, [{
  5573. key: "VERSION",
  5574. get: function get() {
  5575. return VERSION$a;
  5576. }
  5577. }, {
  5578. key: "DefaultType",
  5579. get: function get() {
  5580. return DefaultType$7;
  5581. }
  5582. }, {
  5583. key: "Default",
  5584. get: function get() {
  5585. return Default$7;
  5586. }
  5587. }]);
  5588. return Toast;
  5589. }();
  5590. /**
  5591. * ------------------------------------------------------------------------
  5592. * jQuery
  5593. * ------------------------------------------------------------------------
  5594. */
  5595. $.fn[NAME$a] = Toast._jQueryInterface;
  5596. $.fn[NAME$a].Constructor = Toast;
  5597. $.fn[NAME$a].noConflict = function () {
  5598. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5599. return Toast._jQueryInterface;
  5600. };
  5601. exports.Alert = Alert;
  5602. exports.Button = Button;
  5603. exports.Carousel = Carousel;
  5604. exports.Collapse = Collapse;
  5605. exports.Dropdown = Dropdown;
  5606. exports.Modal = Modal;
  5607. exports.Popover = Popover;
  5608. exports.Scrollspy = ScrollSpy;
  5609. exports.Tab = Tab;
  5610. exports.Toast = Toast;
  5611. exports.Tooltip = Tooltip;
  5612. exports.Util = Util;
  5613. Object.defineProperty(exports, '__esModule', { value: true });
  5614. })));
  5615. //# sourceMappingURL=bootstrap.js.map
  5616. /***/ }),
  5617. /***/ "./node_modules/buffer/index.js":
  5618. /*!**************************************!*\
  5619. !*** ./node_modules/buffer/index.js ***!
  5620. \**************************************/
  5621. /*! no static exports found */
  5622. /***/ (function(module, exports, __webpack_require__) {
  5623. "use strict";
  5624. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5625. * The buffer module from node.js, for the browser.
  5626. *
  5627. * @author Feross Aboukhadijeh <http://feross.org>
  5628. * @license MIT
  5629. */
  5630. /* eslint-disable no-proto */
  5631. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5632. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5633. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5634. exports.Buffer = Buffer
  5635. exports.SlowBuffer = SlowBuffer
  5636. exports.INSPECT_MAX_BYTES = 50
  5637. /**
  5638. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5639. * === true Use Uint8Array implementation (fastest)
  5640. * === false Use Object implementation (most compatible, even IE6)
  5641. *
  5642. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5643. * Opera 11.6+, iOS 4.2+.
  5644. *
  5645. * Due to various browser bugs, sometimes the Object implementation will be used even
  5646. * when the browser supports typed arrays.
  5647. *
  5648. * Note:
  5649. *
  5650. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5651. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5652. *
  5653. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5654. *
  5655. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5656. * incorrect length in some situations.
  5657. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5658. * get the Object implementation, which is slower but behaves correctly.
  5659. */
  5660. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5661. ? global.TYPED_ARRAY_SUPPORT
  5662. : typedArraySupport()
  5663. /*
  5664. * Export kMaxLength after typed array support is determined.
  5665. */
  5666. exports.kMaxLength = kMaxLength()
  5667. function typedArraySupport () {
  5668. try {
  5669. var arr = new Uint8Array(1)
  5670. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5671. return arr.foo() === 42 && // typed array instances can be augmented
  5672. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5673. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5674. } catch (e) {
  5675. return false
  5676. }
  5677. }
  5678. function kMaxLength () {
  5679. return Buffer.TYPED_ARRAY_SUPPORT
  5680. ? 0x7fffffff
  5681. : 0x3fffffff
  5682. }
  5683. function createBuffer (that, length) {
  5684. if (kMaxLength() < length) {
  5685. throw new RangeError('Invalid typed array length')
  5686. }
  5687. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5688. // Return an augmented `Uint8Array` instance, for best performance
  5689. that = new Uint8Array(length)
  5690. that.__proto__ = Buffer.prototype
  5691. } else {
  5692. // Fallback: Return an object instance of the Buffer class
  5693. if (that === null) {
  5694. that = new Buffer(length)
  5695. }
  5696. that.length = length
  5697. }
  5698. return that
  5699. }
  5700. /**
  5701. * The Buffer constructor returns instances of `Uint8Array` that have their
  5702. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5703. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5704. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5705. * returns a single octet.
  5706. *
  5707. * The `Uint8Array` prototype remains unmodified.
  5708. */
  5709. function Buffer (arg, encodingOrOffset, length) {
  5710. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5711. return new Buffer(arg, encodingOrOffset, length)
  5712. }
  5713. // Common case.
  5714. if (typeof arg === 'number') {
  5715. if (typeof encodingOrOffset === 'string') {
  5716. throw new Error(
  5717. 'If encoding is specified then the first argument must be a string'
  5718. )
  5719. }
  5720. return allocUnsafe(this, arg)
  5721. }
  5722. return from(this, arg, encodingOrOffset, length)
  5723. }
  5724. Buffer.poolSize = 8192 // not used by this implementation
  5725. // TODO: Legacy, not needed anymore. Remove in next major version.
  5726. Buffer._augment = function (arr) {
  5727. arr.__proto__ = Buffer.prototype
  5728. return arr
  5729. }
  5730. function from (that, value, encodingOrOffset, length) {
  5731. if (typeof value === 'number') {
  5732. throw new TypeError('"value" argument must not be a number')
  5733. }
  5734. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5735. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5736. }
  5737. if (typeof value === 'string') {
  5738. return fromString(that, value, encodingOrOffset)
  5739. }
  5740. return fromObject(that, value)
  5741. }
  5742. /**
  5743. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5744. * if value is a number.
  5745. * Buffer.from(str[, encoding])
  5746. * Buffer.from(array)
  5747. * Buffer.from(buffer)
  5748. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5749. **/
  5750. Buffer.from = function (value, encodingOrOffset, length) {
  5751. return from(null, value, encodingOrOffset, length)
  5752. }
  5753. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5754. Buffer.prototype.__proto__ = Uint8Array.prototype
  5755. Buffer.__proto__ = Uint8Array
  5756. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5757. Buffer[Symbol.species] === Buffer) {
  5758. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5759. Object.defineProperty(Buffer, Symbol.species, {
  5760. value: null,
  5761. configurable: true
  5762. })
  5763. }
  5764. }
  5765. function assertSize (size) {
  5766. if (typeof size !== 'number') {
  5767. throw new TypeError('"size" argument must be a number')
  5768. } else if (size < 0) {
  5769. throw new RangeError('"size" argument must not be negative')
  5770. }
  5771. }
  5772. function alloc (that, size, fill, encoding) {
  5773. assertSize(size)
  5774. if (size <= 0) {
  5775. return createBuffer(that, size)
  5776. }
  5777. if (fill !== undefined) {
  5778. // Only pay attention to encoding if it's a string. This
  5779. // prevents accidentally sending in a number that would
  5780. // be interpretted as a start offset.
  5781. return typeof encoding === 'string'
  5782. ? createBuffer(that, size).fill(fill, encoding)
  5783. : createBuffer(that, size).fill(fill)
  5784. }
  5785. return createBuffer(that, size)
  5786. }
  5787. /**
  5788. * Creates a new filled Buffer instance.
  5789. * alloc(size[, fill[, encoding]])
  5790. **/
  5791. Buffer.alloc = function (size, fill, encoding) {
  5792. return alloc(null, size, fill, encoding)
  5793. }
  5794. function allocUnsafe (that, size) {
  5795. assertSize(size)
  5796. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5797. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5798. for (var i = 0; i < size; ++i) {
  5799. that[i] = 0
  5800. }
  5801. }
  5802. return that
  5803. }
  5804. /**
  5805. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  5806. * */
  5807. Buffer.allocUnsafe = function (size) {
  5808. return allocUnsafe(null, size)
  5809. }
  5810. /**
  5811. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  5812. */
  5813. Buffer.allocUnsafeSlow = function (size) {
  5814. return allocUnsafe(null, size)
  5815. }
  5816. function fromString (that, string, encoding) {
  5817. if (typeof encoding !== 'string' || encoding === '') {
  5818. encoding = 'utf8'
  5819. }
  5820. if (!Buffer.isEncoding(encoding)) {
  5821. throw new TypeError('"encoding" must be a valid string encoding')
  5822. }
  5823. var length = byteLength(string, encoding) | 0
  5824. that = createBuffer(that, length)
  5825. var actual = that.write(string, encoding)
  5826. if (actual !== length) {
  5827. // Writing a hex string, for example, that contains invalid characters will
  5828. // cause everything after the first invalid character to be ignored. (e.g.
  5829. // 'abxxcd' will be treated as 'ab')
  5830. that = that.slice(0, actual)
  5831. }
  5832. return that
  5833. }
  5834. function fromArrayLike (that, array) {
  5835. var length = array.length < 0 ? 0 : checked(array.length) | 0
  5836. that = createBuffer(that, length)
  5837. for (var i = 0; i < length; i += 1) {
  5838. that[i] = array[i] & 255
  5839. }
  5840. return that
  5841. }
  5842. function fromArrayBuffer (that, array, byteOffset, length) {
  5843. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  5844. if (byteOffset < 0 || array.byteLength < byteOffset) {
  5845. throw new RangeError('\'offset\' is out of bounds')
  5846. }
  5847. if (array.byteLength < byteOffset + (length || 0)) {
  5848. throw new RangeError('\'length\' is out of bounds')
  5849. }
  5850. if (byteOffset === undefined && length === undefined) {
  5851. array = new Uint8Array(array)
  5852. } else if (length === undefined) {
  5853. array = new Uint8Array(array, byteOffset)
  5854. } else {
  5855. array = new Uint8Array(array, byteOffset, length)
  5856. }
  5857. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5858. // Return an augmented `Uint8Array` instance, for best performance
  5859. that = array
  5860. that.__proto__ = Buffer.prototype
  5861. } else {
  5862. // Fallback: Return an object instance of the Buffer class
  5863. that = fromArrayLike(that, array)
  5864. }
  5865. return that
  5866. }
  5867. function fromObject (that, obj) {
  5868. if (Buffer.isBuffer(obj)) {
  5869. var len = checked(obj.length) | 0
  5870. that = createBuffer(that, len)
  5871. if (that.length === 0) {
  5872. return that
  5873. }
  5874. obj.copy(that, 0, 0, len)
  5875. return that
  5876. }
  5877. if (obj) {
  5878. if ((typeof ArrayBuffer !== 'undefined' &&
  5879. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  5880. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  5881. return createBuffer(that, 0)
  5882. }
  5883. return fromArrayLike(that, obj)
  5884. }
  5885. if (obj.type === 'Buffer' && isArray(obj.data)) {
  5886. return fromArrayLike(that, obj.data)
  5887. }
  5888. }
  5889. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  5890. }
  5891. function checked (length) {
  5892. // Note: cannot use `length < kMaxLength()` here because that fails when
  5893. // length is NaN (which is otherwise coerced to zero.)
  5894. if (length >= kMaxLength()) {
  5895. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  5896. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  5897. }
  5898. return length | 0
  5899. }
  5900. function SlowBuffer (length) {
  5901. if (+length != length) { // eslint-disable-line eqeqeq
  5902. length = 0
  5903. }
  5904. return Buffer.alloc(+length)
  5905. }
  5906. Buffer.isBuffer = function isBuffer (b) {
  5907. return !!(b != null && b._isBuffer)
  5908. }
  5909. Buffer.compare = function compare (a, b) {
  5910. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  5911. throw new TypeError('Arguments must be Buffers')
  5912. }
  5913. if (a === b) return 0
  5914. var x = a.length
  5915. var y = b.length
  5916. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  5917. if (a[i] !== b[i]) {
  5918. x = a[i]
  5919. y = b[i]
  5920. break
  5921. }
  5922. }
  5923. if (x < y) return -1
  5924. if (y < x) return 1
  5925. return 0
  5926. }
  5927. Buffer.isEncoding = function isEncoding (encoding) {
  5928. switch (String(encoding).toLowerCase()) {
  5929. case 'hex':
  5930. case 'utf8':
  5931. case 'utf-8':
  5932. case 'ascii':
  5933. case 'latin1':
  5934. case 'binary':
  5935. case 'base64':
  5936. case 'ucs2':
  5937. case 'ucs-2':
  5938. case 'utf16le':
  5939. case 'utf-16le':
  5940. return true
  5941. default:
  5942. return false
  5943. }
  5944. }
  5945. Buffer.concat = function concat (list, length) {
  5946. if (!isArray(list)) {
  5947. throw new TypeError('"list" argument must be an Array of Buffers')
  5948. }
  5949. if (list.length === 0) {
  5950. return Buffer.alloc(0)
  5951. }
  5952. var i
  5953. if (length === undefined) {
  5954. length = 0
  5955. for (i = 0; i < list.length; ++i) {
  5956. length += list[i].length
  5957. }
  5958. }
  5959. var buffer = Buffer.allocUnsafe(length)
  5960. var pos = 0
  5961. for (i = 0; i < list.length; ++i) {
  5962. var buf = list[i]
  5963. if (!Buffer.isBuffer(buf)) {
  5964. throw new TypeError('"list" argument must be an Array of Buffers')
  5965. }
  5966. buf.copy(buffer, pos)
  5967. pos += buf.length
  5968. }
  5969. return buffer
  5970. }
  5971. function byteLength (string, encoding) {
  5972. if (Buffer.isBuffer(string)) {
  5973. return string.length
  5974. }
  5975. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  5976. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  5977. return string.byteLength
  5978. }
  5979. if (typeof string !== 'string') {
  5980. string = '' + string
  5981. }
  5982. var len = string.length
  5983. if (len === 0) return 0
  5984. // Use a for loop to avoid recursion
  5985. var loweredCase = false
  5986. for (;;) {
  5987. switch (encoding) {
  5988. case 'ascii':
  5989. case 'latin1':
  5990. case 'binary':
  5991. return len
  5992. case 'utf8':
  5993. case 'utf-8':
  5994. case undefined:
  5995. return utf8ToBytes(string).length
  5996. case 'ucs2':
  5997. case 'ucs-2':
  5998. case 'utf16le':
  5999. case 'utf-16le':
  6000. return len * 2
  6001. case 'hex':
  6002. return len >>> 1
  6003. case 'base64':
  6004. return base64ToBytes(string).length
  6005. default:
  6006. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6007. encoding = ('' + encoding).toLowerCase()
  6008. loweredCase = true
  6009. }
  6010. }
  6011. }
  6012. Buffer.byteLength = byteLength
  6013. function slowToString (encoding, start, end) {
  6014. var loweredCase = false
  6015. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6016. // property of a typed array.
  6017. // This behaves neither like String nor Uint8Array in that we set start/end
  6018. // to their upper/lower bounds if the value passed is out of range.
  6019. // undefined is handled specially as per ECMA-262 6th Edition,
  6020. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6021. if (start === undefined || start < 0) {
  6022. start = 0
  6023. }
  6024. // Return early if start > this.length. Done here to prevent potential uint32
  6025. // coercion fail below.
  6026. if (start > this.length) {
  6027. return ''
  6028. }
  6029. if (end === undefined || end > this.length) {
  6030. end = this.length
  6031. }
  6032. if (end <= 0) {
  6033. return ''
  6034. }
  6035. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6036. end >>>= 0
  6037. start >>>= 0
  6038. if (end <= start) {
  6039. return ''
  6040. }
  6041. if (!encoding) encoding = 'utf8'
  6042. while (true) {
  6043. switch (encoding) {
  6044. case 'hex':
  6045. return hexSlice(this, start, end)
  6046. case 'utf8':
  6047. case 'utf-8':
  6048. return utf8Slice(this, start, end)
  6049. case 'ascii':
  6050. return asciiSlice(this, start, end)
  6051. case 'latin1':
  6052. case 'binary':
  6053. return latin1Slice(this, start, end)
  6054. case 'base64':
  6055. return base64Slice(this, start, end)
  6056. case 'ucs2':
  6057. case 'ucs-2':
  6058. case 'utf16le':
  6059. case 'utf-16le':
  6060. return utf16leSlice(this, start, end)
  6061. default:
  6062. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6063. encoding = (encoding + '').toLowerCase()
  6064. loweredCase = true
  6065. }
  6066. }
  6067. }
  6068. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6069. // Buffer instances.
  6070. Buffer.prototype._isBuffer = true
  6071. function swap (b, n, m) {
  6072. var i = b[n]
  6073. b[n] = b[m]
  6074. b[m] = i
  6075. }
  6076. Buffer.prototype.swap16 = function swap16 () {
  6077. var len = this.length
  6078. if (len % 2 !== 0) {
  6079. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6080. }
  6081. for (var i = 0; i < len; i += 2) {
  6082. swap(this, i, i + 1)
  6083. }
  6084. return this
  6085. }
  6086. Buffer.prototype.swap32 = function swap32 () {
  6087. var len = this.length
  6088. if (len % 4 !== 0) {
  6089. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6090. }
  6091. for (var i = 0; i < len; i += 4) {
  6092. swap(this, i, i + 3)
  6093. swap(this, i + 1, i + 2)
  6094. }
  6095. return this
  6096. }
  6097. Buffer.prototype.swap64 = function swap64 () {
  6098. var len = this.length
  6099. if (len % 8 !== 0) {
  6100. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6101. }
  6102. for (var i = 0; i < len; i += 8) {
  6103. swap(this, i, i + 7)
  6104. swap(this, i + 1, i + 6)
  6105. swap(this, i + 2, i + 5)
  6106. swap(this, i + 3, i + 4)
  6107. }
  6108. return this
  6109. }
  6110. Buffer.prototype.toString = function toString () {
  6111. var length = this.length | 0
  6112. if (length === 0) return ''
  6113. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6114. return slowToString.apply(this, arguments)
  6115. }
  6116. Buffer.prototype.equals = function equals (b) {
  6117. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6118. if (this === b) return true
  6119. return Buffer.compare(this, b) === 0
  6120. }
  6121. Buffer.prototype.inspect = function inspect () {
  6122. var str = ''
  6123. var max = exports.INSPECT_MAX_BYTES
  6124. if (this.length > 0) {
  6125. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6126. if (this.length > max) str += ' ... '
  6127. }
  6128. return '<Buffer ' + str + '>'
  6129. }
  6130. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6131. if (!Buffer.isBuffer(target)) {
  6132. throw new TypeError('Argument must be a Buffer')
  6133. }
  6134. if (start === undefined) {
  6135. start = 0
  6136. }
  6137. if (end === undefined) {
  6138. end = target ? target.length : 0
  6139. }
  6140. if (thisStart === undefined) {
  6141. thisStart = 0
  6142. }
  6143. if (thisEnd === undefined) {
  6144. thisEnd = this.length
  6145. }
  6146. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6147. throw new RangeError('out of range index')
  6148. }
  6149. if (thisStart >= thisEnd && start >= end) {
  6150. return 0
  6151. }
  6152. if (thisStart >= thisEnd) {
  6153. return -1
  6154. }
  6155. if (start >= end) {
  6156. return 1
  6157. }
  6158. start >>>= 0
  6159. end >>>= 0
  6160. thisStart >>>= 0
  6161. thisEnd >>>= 0
  6162. if (this === target) return 0
  6163. var x = thisEnd - thisStart
  6164. var y = end - start
  6165. var len = Math.min(x, y)
  6166. var thisCopy = this.slice(thisStart, thisEnd)
  6167. var targetCopy = target.slice(start, end)
  6168. for (var i = 0; i < len; ++i) {
  6169. if (thisCopy[i] !== targetCopy[i]) {
  6170. x = thisCopy[i]
  6171. y = targetCopy[i]
  6172. break
  6173. }
  6174. }
  6175. if (x < y) return -1
  6176. if (y < x) return 1
  6177. return 0
  6178. }
  6179. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6180. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6181. //
  6182. // Arguments:
  6183. // - buffer - a Buffer to search
  6184. // - val - a string, Buffer, or number
  6185. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6186. // - encoding - an optional encoding, relevant is val is a string
  6187. // - dir - true for indexOf, false for lastIndexOf
  6188. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6189. // Empty buffer means no match
  6190. if (buffer.length === 0) return -1
  6191. // Normalize byteOffset
  6192. if (typeof byteOffset === 'string') {
  6193. encoding = byteOffset
  6194. byteOffset = 0
  6195. } else if (byteOffset > 0x7fffffff) {
  6196. byteOffset = 0x7fffffff
  6197. } else if (byteOffset < -0x80000000) {
  6198. byteOffset = -0x80000000
  6199. }
  6200. byteOffset = +byteOffset // Coerce to Number.
  6201. if (isNaN(byteOffset)) {
  6202. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6203. byteOffset = dir ? 0 : (buffer.length - 1)
  6204. }
  6205. // Normalize byteOffset: negative offsets start from the end of the buffer
  6206. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6207. if (byteOffset >= buffer.length) {
  6208. if (dir) return -1
  6209. else byteOffset = buffer.length - 1
  6210. } else if (byteOffset < 0) {
  6211. if (dir) byteOffset = 0
  6212. else return -1
  6213. }
  6214. // Normalize val
  6215. if (typeof val === 'string') {
  6216. val = Buffer.from(val, encoding)
  6217. }
  6218. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6219. if (Buffer.isBuffer(val)) {
  6220. // Special case: looking for empty string/buffer always fails
  6221. if (val.length === 0) {
  6222. return -1
  6223. }
  6224. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6225. } else if (typeof val === 'number') {
  6226. val = val & 0xFF // Search for a byte value [0-255]
  6227. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6228. typeof Uint8Array.prototype.indexOf === 'function') {
  6229. if (dir) {
  6230. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6231. } else {
  6232. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6233. }
  6234. }
  6235. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6236. }
  6237. throw new TypeError('val must be string, number or Buffer')
  6238. }
  6239. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6240. var indexSize = 1
  6241. var arrLength = arr.length
  6242. var valLength = val.length
  6243. if (encoding !== undefined) {
  6244. encoding = String(encoding).toLowerCase()
  6245. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6246. encoding === 'utf16le' || encoding === 'utf-16le') {
  6247. if (arr.length < 2 || val.length < 2) {
  6248. return -1
  6249. }
  6250. indexSize = 2
  6251. arrLength /= 2
  6252. valLength /= 2
  6253. byteOffset /= 2
  6254. }
  6255. }
  6256. function read (buf, i) {
  6257. if (indexSize === 1) {
  6258. return buf[i]
  6259. } else {
  6260. return buf.readUInt16BE(i * indexSize)
  6261. }
  6262. }
  6263. var i
  6264. if (dir) {
  6265. var foundIndex = -1
  6266. for (i = byteOffset; i < arrLength; i++) {
  6267. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6268. if (foundIndex === -1) foundIndex = i
  6269. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6270. } else {
  6271. if (foundIndex !== -1) i -= i - foundIndex
  6272. foundIndex = -1
  6273. }
  6274. }
  6275. } else {
  6276. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6277. for (i = byteOffset; i >= 0; i--) {
  6278. var found = true
  6279. for (var j = 0; j < valLength; j++) {
  6280. if (read(arr, i + j) !== read(val, j)) {
  6281. found = false
  6282. break
  6283. }
  6284. }
  6285. if (found) return i
  6286. }
  6287. }
  6288. return -1
  6289. }
  6290. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6291. return this.indexOf(val, byteOffset, encoding) !== -1
  6292. }
  6293. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6294. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6295. }
  6296. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6297. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6298. }
  6299. function hexWrite (buf, string, offset, length) {
  6300. offset = Number(offset) || 0
  6301. var remaining = buf.length - offset
  6302. if (!length) {
  6303. length = remaining
  6304. } else {
  6305. length = Number(length)
  6306. if (length > remaining) {
  6307. length = remaining
  6308. }
  6309. }
  6310. // must be an even number of digits
  6311. var strLen = string.length
  6312. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6313. if (length > strLen / 2) {
  6314. length = strLen / 2
  6315. }
  6316. for (var i = 0; i < length; ++i) {
  6317. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6318. if (isNaN(parsed)) return i
  6319. buf[offset + i] = parsed
  6320. }
  6321. return i
  6322. }
  6323. function utf8Write (buf, string, offset, length) {
  6324. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6325. }
  6326. function asciiWrite (buf, string, offset, length) {
  6327. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6328. }
  6329. function latin1Write (buf, string, offset, length) {
  6330. return asciiWrite(buf, string, offset, length)
  6331. }
  6332. function base64Write (buf, string, offset, length) {
  6333. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6334. }
  6335. function ucs2Write (buf, string, offset, length) {
  6336. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6337. }
  6338. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6339. // Buffer#write(string)
  6340. if (offset === undefined) {
  6341. encoding = 'utf8'
  6342. length = this.length
  6343. offset = 0
  6344. // Buffer#write(string, encoding)
  6345. } else if (length === undefined && typeof offset === 'string') {
  6346. encoding = offset
  6347. length = this.length
  6348. offset = 0
  6349. // Buffer#write(string, offset[, length][, encoding])
  6350. } else if (isFinite(offset)) {
  6351. offset = offset | 0
  6352. if (isFinite(length)) {
  6353. length = length | 0
  6354. if (encoding === undefined) encoding = 'utf8'
  6355. } else {
  6356. encoding = length
  6357. length = undefined
  6358. }
  6359. // legacy write(string, encoding, offset, length) - remove in v0.13
  6360. } else {
  6361. throw new Error(
  6362. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6363. )
  6364. }
  6365. var remaining = this.length - offset
  6366. if (length === undefined || length > remaining) length = remaining
  6367. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6368. throw new RangeError('Attempt to write outside buffer bounds')
  6369. }
  6370. if (!encoding) encoding = 'utf8'
  6371. var loweredCase = false
  6372. for (;;) {
  6373. switch (encoding) {
  6374. case 'hex':
  6375. return hexWrite(this, string, offset, length)
  6376. case 'utf8':
  6377. case 'utf-8':
  6378. return utf8Write(this, string, offset, length)
  6379. case 'ascii':
  6380. return asciiWrite(this, string, offset, length)
  6381. case 'latin1':
  6382. case 'binary':
  6383. return latin1Write(this, string, offset, length)
  6384. case 'base64':
  6385. // Warning: maxLength not taken into account in base64Write
  6386. return base64Write(this, string, offset, length)
  6387. case 'ucs2':
  6388. case 'ucs-2':
  6389. case 'utf16le':
  6390. case 'utf-16le':
  6391. return ucs2Write(this, string, offset, length)
  6392. default:
  6393. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6394. encoding = ('' + encoding).toLowerCase()
  6395. loweredCase = true
  6396. }
  6397. }
  6398. }
  6399. Buffer.prototype.toJSON = function toJSON () {
  6400. return {
  6401. type: 'Buffer',
  6402. data: Array.prototype.slice.call(this._arr || this, 0)
  6403. }
  6404. }
  6405. function base64Slice (buf, start, end) {
  6406. if (start === 0 && end === buf.length) {
  6407. return base64.fromByteArray(buf)
  6408. } else {
  6409. return base64.fromByteArray(buf.slice(start, end))
  6410. }
  6411. }
  6412. function utf8Slice (buf, start, end) {
  6413. end = Math.min(buf.length, end)
  6414. var res = []
  6415. var i = start
  6416. while (i < end) {
  6417. var firstByte = buf[i]
  6418. var codePoint = null
  6419. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6420. : (firstByte > 0xDF) ? 3
  6421. : (firstByte > 0xBF) ? 2
  6422. : 1
  6423. if (i + bytesPerSequence <= end) {
  6424. var secondByte, thirdByte, fourthByte, tempCodePoint
  6425. switch (bytesPerSequence) {
  6426. case 1:
  6427. if (firstByte < 0x80) {
  6428. codePoint = firstByte
  6429. }
  6430. break
  6431. case 2:
  6432. secondByte = buf[i + 1]
  6433. if ((secondByte & 0xC0) === 0x80) {
  6434. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6435. if (tempCodePoint > 0x7F) {
  6436. codePoint = tempCodePoint
  6437. }
  6438. }
  6439. break
  6440. case 3:
  6441. secondByte = buf[i + 1]
  6442. thirdByte = buf[i + 2]
  6443. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6444. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6445. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6446. codePoint = tempCodePoint
  6447. }
  6448. }
  6449. break
  6450. case 4:
  6451. secondByte = buf[i + 1]
  6452. thirdByte = buf[i + 2]
  6453. fourthByte = buf[i + 3]
  6454. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6455. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6456. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6457. codePoint = tempCodePoint
  6458. }
  6459. }
  6460. }
  6461. }
  6462. if (codePoint === null) {
  6463. // we did not generate a valid codePoint so insert a
  6464. // replacement char (U+FFFD) and advance only 1 byte
  6465. codePoint = 0xFFFD
  6466. bytesPerSequence = 1
  6467. } else if (codePoint > 0xFFFF) {
  6468. // encode to utf16 (surrogate pair dance)
  6469. codePoint -= 0x10000
  6470. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6471. codePoint = 0xDC00 | codePoint & 0x3FF
  6472. }
  6473. res.push(codePoint)
  6474. i += bytesPerSequence
  6475. }
  6476. return decodeCodePointsArray(res)
  6477. }
  6478. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6479. // the lowest limit is Chrome, with 0x10000 args.
  6480. // We go 1 magnitude less, for safety
  6481. var MAX_ARGUMENTS_LENGTH = 0x1000
  6482. function decodeCodePointsArray (codePoints) {
  6483. var len = codePoints.length
  6484. if (len <= MAX_ARGUMENTS_LENGTH) {
  6485. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6486. }
  6487. // Decode in chunks to avoid "call stack size exceeded".
  6488. var res = ''
  6489. var i = 0
  6490. while (i < len) {
  6491. res += String.fromCharCode.apply(
  6492. String,
  6493. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6494. )
  6495. }
  6496. return res
  6497. }
  6498. function asciiSlice (buf, start, end) {
  6499. var ret = ''
  6500. end = Math.min(buf.length, end)
  6501. for (var i = start; i < end; ++i) {
  6502. ret += String.fromCharCode(buf[i] & 0x7F)
  6503. }
  6504. return ret
  6505. }
  6506. function latin1Slice (buf, start, end) {
  6507. var ret = ''
  6508. end = Math.min(buf.length, end)
  6509. for (var i = start; i < end; ++i) {
  6510. ret += String.fromCharCode(buf[i])
  6511. }
  6512. return ret
  6513. }
  6514. function hexSlice (buf, start, end) {
  6515. var len = buf.length
  6516. if (!start || start < 0) start = 0
  6517. if (!end || end < 0 || end > len) end = len
  6518. var out = ''
  6519. for (var i = start; i < end; ++i) {
  6520. out += toHex(buf[i])
  6521. }
  6522. return out
  6523. }
  6524. function utf16leSlice (buf, start, end) {
  6525. var bytes = buf.slice(start, end)
  6526. var res = ''
  6527. for (var i = 0; i < bytes.length; i += 2) {
  6528. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6529. }
  6530. return res
  6531. }
  6532. Buffer.prototype.slice = function slice (start, end) {
  6533. var len = this.length
  6534. start = ~~start
  6535. end = end === undefined ? len : ~~end
  6536. if (start < 0) {
  6537. start += len
  6538. if (start < 0) start = 0
  6539. } else if (start > len) {
  6540. start = len
  6541. }
  6542. if (end < 0) {
  6543. end += len
  6544. if (end < 0) end = 0
  6545. } else if (end > len) {
  6546. end = len
  6547. }
  6548. if (end < start) end = start
  6549. var newBuf
  6550. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6551. newBuf = this.subarray(start, end)
  6552. newBuf.__proto__ = Buffer.prototype
  6553. } else {
  6554. var sliceLen = end - start
  6555. newBuf = new Buffer(sliceLen, undefined)
  6556. for (var i = 0; i < sliceLen; ++i) {
  6557. newBuf[i] = this[i + start]
  6558. }
  6559. }
  6560. return newBuf
  6561. }
  6562. /*
  6563. * Need to make sure that buffer isn't trying to write out of bounds.
  6564. */
  6565. function checkOffset (offset, ext, length) {
  6566. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6567. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6568. }
  6569. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6570. offset = offset | 0
  6571. byteLength = byteLength | 0
  6572. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6573. var val = this[offset]
  6574. var mul = 1
  6575. var i = 0
  6576. while (++i < byteLength && (mul *= 0x100)) {
  6577. val += this[offset + i] * mul
  6578. }
  6579. return val
  6580. }
  6581. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6582. offset = offset | 0
  6583. byteLength = byteLength | 0
  6584. if (!noAssert) {
  6585. checkOffset(offset, byteLength, this.length)
  6586. }
  6587. var val = this[offset + --byteLength]
  6588. var mul = 1
  6589. while (byteLength > 0 && (mul *= 0x100)) {
  6590. val += this[offset + --byteLength] * mul
  6591. }
  6592. return val
  6593. }
  6594. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6595. if (!noAssert) checkOffset(offset, 1, this.length)
  6596. return this[offset]
  6597. }
  6598. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6599. if (!noAssert) checkOffset(offset, 2, this.length)
  6600. return this[offset] | (this[offset + 1] << 8)
  6601. }
  6602. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6603. if (!noAssert) checkOffset(offset, 2, this.length)
  6604. return (this[offset] << 8) | this[offset + 1]
  6605. }
  6606. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6607. if (!noAssert) checkOffset(offset, 4, this.length)
  6608. return ((this[offset]) |
  6609. (this[offset + 1] << 8) |
  6610. (this[offset + 2] << 16)) +
  6611. (this[offset + 3] * 0x1000000)
  6612. }
  6613. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6614. if (!noAssert) checkOffset(offset, 4, this.length)
  6615. return (this[offset] * 0x1000000) +
  6616. ((this[offset + 1] << 16) |
  6617. (this[offset + 2] << 8) |
  6618. this[offset + 3])
  6619. }
  6620. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6621. offset = offset | 0
  6622. byteLength = byteLength | 0
  6623. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6624. var val = this[offset]
  6625. var mul = 1
  6626. var i = 0
  6627. while (++i < byteLength && (mul *= 0x100)) {
  6628. val += this[offset + i] * mul
  6629. }
  6630. mul *= 0x80
  6631. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6632. return val
  6633. }
  6634. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6635. offset = offset | 0
  6636. byteLength = byteLength | 0
  6637. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6638. var i = byteLength
  6639. var mul = 1
  6640. var val = this[offset + --i]
  6641. while (i > 0 && (mul *= 0x100)) {
  6642. val += this[offset + --i] * mul
  6643. }
  6644. mul *= 0x80
  6645. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6646. return val
  6647. }
  6648. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6649. if (!noAssert) checkOffset(offset, 1, this.length)
  6650. if (!(this[offset] & 0x80)) return (this[offset])
  6651. return ((0xff - this[offset] + 1) * -1)
  6652. }
  6653. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6654. if (!noAssert) checkOffset(offset, 2, this.length)
  6655. var val = this[offset] | (this[offset + 1] << 8)
  6656. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6657. }
  6658. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6659. if (!noAssert) checkOffset(offset, 2, this.length)
  6660. var val = this[offset + 1] | (this[offset] << 8)
  6661. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6662. }
  6663. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6664. if (!noAssert) checkOffset(offset, 4, this.length)
  6665. return (this[offset]) |
  6666. (this[offset + 1] << 8) |
  6667. (this[offset + 2] << 16) |
  6668. (this[offset + 3] << 24)
  6669. }
  6670. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6671. if (!noAssert) checkOffset(offset, 4, this.length)
  6672. return (this[offset] << 24) |
  6673. (this[offset + 1] << 16) |
  6674. (this[offset + 2] << 8) |
  6675. (this[offset + 3])
  6676. }
  6677. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6678. if (!noAssert) checkOffset(offset, 4, this.length)
  6679. return ieee754.read(this, offset, true, 23, 4)
  6680. }
  6681. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6682. if (!noAssert) checkOffset(offset, 4, this.length)
  6683. return ieee754.read(this, offset, false, 23, 4)
  6684. }
  6685. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6686. if (!noAssert) checkOffset(offset, 8, this.length)
  6687. return ieee754.read(this, offset, true, 52, 8)
  6688. }
  6689. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6690. if (!noAssert) checkOffset(offset, 8, this.length)
  6691. return ieee754.read(this, offset, false, 52, 8)
  6692. }
  6693. function checkInt (buf, value, offset, ext, max, min) {
  6694. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6695. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6696. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6697. }
  6698. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6699. value = +value
  6700. offset = offset | 0
  6701. byteLength = byteLength | 0
  6702. if (!noAssert) {
  6703. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6704. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6705. }
  6706. var mul = 1
  6707. var i = 0
  6708. this[offset] = value & 0xFF
  6709. while (++i < byteLength && (mul *= 0x100)) {
  6710. this[offset + i] = (value / mul) & 0xFF
  6711. }
  6712. return offset + byteLength
  6713. }
  6714. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6715. value = +value
  6716. offset = offset | 0
  6717. byteLength = byteLength | 0
  6718. if (!noAssert) {
  6719. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6720. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6721. }
  6722. var i = byteLength - 1
  6723. var mul = 1
  6724. this[offset + i] = value & 0xFF
  6725. while (--i >= 0 && (mul *= 0x100)) {
  6726. this[offset + i] = (value / mul) & 0xFF
  6727. }
  6728. return offset + byteLength
  6729. }
  6730. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6731. value = +value
  6732. offset = offset | 0
  6733. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6734. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6735. this[offset] = (value & 0xff)
  6736. return offset + 1
  6737. }
  6738. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6739. if (value < 0) value = 0xffff + value + 1
  6740. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6741. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6742. (littleEndian ? i : 1 - i) * 8
  6743. }
  6744. }
  6745. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6746. value = +value
  6747. offset = offset | 0
  6748. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6749. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6750. this[offset] = (value & 0xff)
  6751. this[offset + 1] = (value >>> 8)
  6752. } else {
  6753. objectWriteUInt16(this, value, offset, true)
  6754. }
  6755. return offset + 2
  6756. }
  6757. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6758. value = +value
  6759. offset = offset | 0
  6760. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6761. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6762. this[offset] = (value >>> 8)
  6763. this[offset + 1] = (value & 0xff)
  6764. } else {
  6765. objectWriteUInt16(this, value, offset, false)
  6766. }
  6767. return offset + 2
  6768. }
  6769. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6770. if (value < 0) value = 0xffffffff + value + 1
  6771. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6772. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6773. }
  6774. }
  6775. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6776. value = +value
  6777. offset = offset | 0
  6778. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6779. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6780. this[offset + 3] = (value >>> 24)
  6781. this[offset + 2] = (value >>> 16)
  6782. this[offset + 1] = (value >>> 8)
  6783. this[offset] = (value & 0xff)
  6784. } else {
  6785. objectWriteUInt32(this, value, offset, true)
  6786. }
  6787. return offset + 4
  6788. }
  6789. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6790. value = +value
  6791. offset = offset | 0
  6792. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6793. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6794. this[offset] = (value >>> 24)
  6795. this[offset + 1] = (value >>> 16)
  6796. this[offset + 2] = (value >>> 8)
  6797. this[offset + 3] = (value & 0xff)
  6798. } else {
  6799. objectWriteUInt32(this, value, offset, false)
  6800. }
  6801. return offset + 4
  6802. }
  6803. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  6804. value = +value
  6805. offset = offset | 0
  6806. if (!noAssert) {
  6807. var limit = Math.pow(2, 8 * byteLength - 1)
  6808. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6809. }
  6810. var i = 0
  6811. var mul = 1
  6812. var sub = 0
  6813. this[offset] = value & 0xFF
  6814. while (++i < byteLength && (mul *= 0x100)) {
  6815. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  6816. sub = 1
  6817. }
  6818. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6819. }
  6820. return offset + byteLength
  6821. }
  6822. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  6823. value = +value
  6824. offset = offset | 0
  6825. if (!noAssert) {
  6826. var limit = Math.pow(2, 8 * byteLength - 1)
  6827. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6828. }
  6829. var i = byteLength - 1
  6830. var mul = 1
  6831. var sub = 0
  6832. this[offset + i] = value & 0xFF
  6833. while (--i >= 0 && (mul *= 0x100)) {
  6834. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  6835. sub = 1
  6836. }
  6837. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6838. }
  6839. return offset + byteLength
  6840. }
  6841. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  6842. value = +value
  6843. offset = offset | 0
  6844. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  6845. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6846. if (value < 0) value = 0xff + value + 1
  6847. this[offset] = (value & 0xff)
  6848. return offset + 1
  6849. }
  6850. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  6851. value = +value
  6852. offset = offset | 0
  6853. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6854. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6855. this[offset] = (value & 0xff)
  6856. this[offset + 1] = (value >>> 8)
  6857. } else {
  6858. objectWriteUInt16(this, value, offset, true)
  6859. }
  6860. return offset + 2
  6861. }
  6862. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  6863. value = +value
  6864. offset = offset | 0
  6865. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6866. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6867. this[offset] = (value >>> 8)
  6868. this[offset + 1] = (value & 0xff)
  6869. } else {
  6870. objectWriteUInt16(this, value, offset, false)
  6871. }
  6872. return offset + 2
  6873. }
  6874. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  6875. value = +value
  6876. offset = offset | 0
  6877. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6878. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6879. this[offset] = (value & 0xff)
  6880. this[offset + 1] = (value >>> 8)
  6881. this[offset + 2] = (value >>> 16)
  6882. this[offset + 3] = (value >>> 24)
  6883. } else {
  6884. objectWriteUInt32(this, value, offset, true)
  6885. }
  6886. return offset + 4
  6887. }
  6888. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  6889. value = +value
  6890. offset = offset | 0
  6891. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6892. if (value < 0) value = 0xffffffff + value + 1
  6893. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6894. this[offset] = (value >>> 24)
  6895. this[offset + 1] = (value >>> 16)
  6896. this[offset + 2] = (value >>> 8)
  6897. this[offset + 3] = (value & 0xff)
  6898. } else {
  6899. objectWriteUInt32(this, value, offset, false)
  6900. }
  6901. return offset + 4
  6902. }
  6903. function checkIEEE754 (buf, value, offset, ext, max, min) {
  6904. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6905. if (offset < 0) throw new RangeError('Index out of range')
  6906. }
  6907. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  6908. if (!noAssert) {
  6909. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  6910. }
  6911. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  6912. return offset + 4
  6913. }
  6914. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  6915. return writeFloat(this, value, offset, true, noAssert)
  6916. }
  6917. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  6918. return writeFloat(this, value, offset, false, noAssert)
  6919. }
  6920. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  6921. if (!noAssert) {
  6922. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  6923. }
  6924. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  6925. return offset + 8
  6926. }
  6927. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  6928. return writeDouble(this, value, offset, true, noAssert)
  6929. }
  6930. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  6931. return writeDouble(this, value, offset, false, noAssert)
  6932. }
  6933. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  6934. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  6935. if (!start) start = 0
  6936. if (!end && end !== 0) end = this.length
  6937. if (targetStart >= target.length) targetStart = target.length
  6938. if (!targetStart) targetStart = 0
  6939. if (end > 0 && end < start) end = start
  6940. // Copy 0 bytes; we're done
  6941. if (end === start) return 0
  6942. if (target.length === 0 || this.length === 0) return 0
  6943. // Fatal error conditions
  6944. if (targetStart < 0) {
  6945. throw new RangeError('targetStart out of bounds')
  6946. }
  6947. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  6948. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  6949. // Are we oob?
  6950. if (end > this.length) end = this.length
  6951. if (target.length - targetStart < end - start) {
  6952. end = target.length - targetStart + start
  6953. }
  6954. var len = end - start
  6955. var i
  6956. if (this === target && start < targetStart && targetStart < end) {
  6957. // descending copy from end
  6958. for (i = len - 1; i >= 0; --i) {
  6959. target[i + targetStart] = this[i + start]
  6960. }
  6961. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  6962. // ascending copy from start
  6963. for (i = 0; i < len; ++i) {
  6964. target[i + targetStart] = this[i + start]
  6965. }
  6966. } else {
  6967. Uint8Array.prototype.set.call(
  6968. target,
  6969. this.subarray(start, start + len),
  6970. targetStart
  6971. )
  6972. }
  6973. return len
  6974. }
  6975. // Usage:
  6976. // buffer.fill(number[, offset[, end]])
  6977. // buffer.fill(buffer[, offset[, end]])
  6978. // buffer.fill(string[, offset[, end]][, encoding])
  6979. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  6980. // Handle string cases:
  6981. if (typeof val === 'string') {
  6982. if (typeof start === 'string') {
  6983. encoding = start
  6984. start = 0
  6985. end = this.length
  6986. } else if (typeof end === 'string') {
  6987. encoding = end
  6988. end = this.length
  6989. }
  6990. if (val.length === 1) {
  6991. var code = val.charCodeAt(0)
  6992. if (code < 256) {
  6993. val = code
  6994. }
  6995. }
  6996. if (encoding !== undefined && typeof encoding !== 'string') {
  6997. throw new TypeError('encoding must be a string')
  6998. }
  6999. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7000. throw new TypeError('Unknown encoding: ' + encoding)
  7001. }
  7002. } else if (typeof val === 'number') {
  7003. val = val & 255
  7004. }
  7005. // Invalid ranges are not set to a default, so can range check early.
  7006. if (start < 0 || this.length < start || this.length < end) {
  7007. throw new RangeError('Out of range index')
  7008. }
  7009. if (end <= start) {
  7010. return this
  7011. }
  7012. start = start >>> 0
  7013. end = end === undefined ? this.length : end >>> 0
  7014. if (!val) val = 0
  7015. var i
  7016. if (typeof val === 'number') {
  7017. for (i = start; i < end; ++i) {
  7018. this[i] = val
  7019. }
  7020. } else {
  7021. var bytes = Buffer.isBuffer(val)
  7022. ? val
  7023. : utf8ToBytes(new Buffer(val, encoding).toString())
  7024. var len = bytes.length
  7025. for (i = 0; i < end - start; ++i) {
  7026. this[i + start] = bytes[i % len]
  7027. }
  7028. }
  7029. return this
  7030. }
  7031. // HELPER FUNCTIONS
  7032. // ================
  7033. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7034. function base64clean (str) {
  7035. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7036. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7037. // Node converts strings with length < 2 to ''
  7038. if (str.length < 2) return ''
  7039. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7040. while (str.length % 4 !== 0) {
  7041. str = str + '='
  7042. }
  7043. return str
  7044. }
  7045. function stringtrim (str) {
  7046. if (str.trim) return str.trim()
  7047. return str.replace(/^\s+|\s+$/g, '')
  7048. }
  7049. function toHex (n) {
  7050. if (n < 16) return '0' + n.toString(16)
  7051. return n.toString(16)
  7052. }
  7053. function utf8ToBytes (string, units) {
  7054. units = units || Infinity
  7055. var codePoint
  7056. var length = string.length
  7057. var leadSurrogate = null
  7058. var bytes = []
  7059. for (var i = 0; i < length; ++i) {
  7060. codePoint = string.charCodeAt(i)
  7061. // is surrogate component
  7062. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7063. // last char was a lead
  7064. if (!leadSurrogate) {
  7065. // no lead yet
  7066. if (codePoint > 0xDBFF) {
  7067. // unexpected trail
  7068. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7069. continue
  7070. } else if (i + 1 === length) {
  7071. // unpaired lead
  7072. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7073. continue
  7074. }
  7075. // valid lead
  7076. leadSurrogate = codePoint
  7077. continue
  7078. }
  7079. // 2 leads in a row
  7080. if (codePoint < 0xDC00) {
  7081. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7082. leadSurrogate = codePoint
  7083. continue
  7084. }
  7085. // valid surrogate pair
  7086. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7087. } else if (leadSurrogate) {
  7088. // valid bmp char, but last char was a lead
  7089. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7090. }
  7091. leadSurrogate = null
  7092. // encode utf8
  7093. if (codePoint < 0x80) {
  7094. if ((units -= 1) < 0) break
  7095. bytes.push(codePoint)
  7096. } else if (codePoint < 0x800) {
  7097. if ((units -= 2) < 0) break
  7098. bytes.push(
  7099. codePoint >> 0x6 | 0xC0,
  7100. codePoint & 0x3F | 0x80
  7101. )
  7102. } else if (codePoint < 0x10000) {
  7103. if ((units -= 3) < 0) break
  7104. bytes.push(
  7105. codePoint >> 0xC | 0xE0,
  7106. codePoint >> 0x6 & 0x3F | 0x80,
  7107. codePoint & 0x3F | 0x80
  7108. )
  7109. } else if (codePoint < 0x110000) {
  7110. if ((units -= 4) < 0) break
  7111. bytes.push(
  7112. codePoint >> 0x12 | 0xF0,
  7113. codePoint >> 0xC & 0x3F | 0x80,
  7114. codePoint >> 0x6 & 0x3F | 0x80,
  7115. codePoint & 0x3F | 0x80
  7116. )
  7117. } else {
  7118. throw new Error('Invalid code point')
  7119. }
  7120. }
  7121. return bytes
  7122. }
  7123. function asciiToBytes (str) {
  7124. var byteArray = []
  7125. for (var i = 0; i < str.length; ++i) {
  7126. // Node's code seems to be doing this and not & 0x7F..
  7127. byteArray.push(str.charCodeAt(i) & 0xFF)
  7128. }
  7129. return byteArray
  7130. }
  7131. function utf16leToBytes (str, units) {
  7132. var c, hi, lo
  7133. var byteArray = []
  7134. for (var i = 0; i < str.length; ++i) {
  7135. if ((units -= 2) < 0) break
  7136. c = str.charCodeAt(i)
  7137. hi = c >> 8
  7138. lo = c % 256
  7139. byteArray.push(lo)
  7140. byteArray.push(hi)
  7141. }
  7142. return byteArray
  7143. }
  7144. function base64ToBytes (str) {
  7145. return base64.toByteArray(base64clean(str))
  7146. }
  7147. function blitBuffer (src, dst, offset, length) {
  7148. for (var i = 0; i < length; ++i) {
  7149. if ((i + offset >= dst.length) || (i >= src.length)) break
  7150. dst[i + offset] = src[i]
  7151. }
  7152. return i
  7153. }
  7154. function isnan (val) {
  7155. return val !== val // eslint-disable-line no-self-compare
  7156. }
  7157. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7158. /***/ }),
  7159. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7160. /*!**************************************************!*\
  7161. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7162. \**************************************************/
  7163. /*! no static exports found */
  7164. /***/ (function(module, exports, __webpack_require__) {
  7165. /*!
  7166. * clipboard.js v2.0.4
  7167. * https://zenorocha.github.io/clipboard.js
  7168. *
  7169. * Licensed MIT © Zeno Rocha
  7170. */
  7171. (function webpackUniversalModuleDefinition(root, factory) {
  7172. if(true)
  7173. module.exports = factory();
  7174. else {}
  7175. })(this, function() {
  7176. return /******/ (function(modules) { // webpackBootstrap
  7177. /******/ // The module cache
  7178. /******/ var installedModules = {};
  7179. /******/
  7180. /******/ // The require function
  7181. /******/ function __webpack_require__(moduleId) {
  7182. /******/
  7183. /******/ // Check if module is in cache
  7184. /******/ if(installedModules[moduleId]) {
  7185. /******/ return installedModules[moduleId].exports;
  7186. /******/ }
  7187. /******/ // Create a new module (and put it into the cache)
  7188. /******/ var module = installedModules[moduleId] = {
  7189. /******/ i: moduleId,
  7190. /******/ l: false,
  7191. /******/ exports: {}
  7192. /******/ };
  7193. /******/
  7194. /******/ // Execute the module function
  7195. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7196. /******/
  7197. /******/ // Flag the module as loaded
  7198. /******/ module.l = true;
  7199. /******/
  7200. /******/ // Return the exports of the module
  7201. /******/ return module.exports;
  7202. /******/ }
  7203. /******/
  7204. /******/
  7205. /******/ // expose the modules object (__webpack_modules__)
  7206. /******/ __webpack_require__.m = modules;
  7207. /******/
  7208. /******/ // expose the module cache
  7209. /******/ __webpack_require__.c = installedModules;
  7210. /******/
  7211. /******/ // define getter function for harmony exports
  7212. /******/ __webpack_require__.d = function(exports, name, getter) {
  7213. /******/ if(!__webpack_require__.o(exports, name)) {
  7214. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7215. /******/ }
  7216. /******/ };
  7217. /******/
  7218. /******/ // define __esModule on exports
  7219. /******/ __webpack_require__.r = function(exports) {
  7220. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7221. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7222. /******/ }
  7223. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7224. /******/ };
  7225. /******/
  7226. /******/ // create a fake namespace object
  7227. /******/ // mode & 1: value is a module id, require it
  7228. /******/ // mode & 2: merge all properties of value into the ns
  7229. /******/ // mode & 4: return value when already ns object
  7230. /******/ // mode & 8|1: behave like require
  7231. /******/ __webpack_require__.t = function(value, mode) {
  7232. /******/ if(mode & 1) value = __webpack_require__(value);
  7233. /******/ if(mode & 8) return value;
  7234. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7235. /******/ var ns = Object.create(null);
  7236. /******/ __webpack_require__.r(ns);
  7237. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7238. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7239. /******/ return ns;
  7240. /******/ };
  7241. /******/
  7242. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7243. /******/ __webpack_require__.n = function(module) {
  7244. /******/ var getter = module && module.__esModule ?
  7245. /******/ function getDefault() { return module['default']; } :
  7246. /******/ function getModuleExports() { return module; };
  7247. /******/ __webpack_require__.d(getter, 'a', getter);
  7248. /******/ return getter;
  7249. /******/ };
  7250. /******/
  7251. /******/ // Object.prototype.hasOwnProperty.call
  7252. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7253. /******/
  7254. /******/ // __webpack_public_path__
  7255. /******/ __webpack_require__.p = "";
  7256. /******/
  7257. /******/
  7258. /******/ // Load entry module and return exports
  7259. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7260. /******/ })
  7261. /************************************************************************/
  7262. /******/ ([
  7263. /* 0 */
  7264. /***/ (function(module, exports, __webpack_require__) {
  7265. "use strict";
  7266. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7267. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7268. var _clipboardAction = __webpack_require__(1);
  7269. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7270. var _tinyEmitter = __webpack_require__(3);
  7271. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7272. var _goodListener = __webpack_require__(4);
  7273. var _goodListener2 = _interopRequireDefault(_goodListener);
  7274. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7275. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7276. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7277. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7278. /**
  7279. * Base class which takes one or more elements, adds event listeners to them,
  7280. * and instantiates a new `ClipboardAction` on each click.
  7281. */
  7282. var Clipboard = function (_Emitter) {
  7283. _inherits(Clipboard, _Emitter);
  7284. /**
  7285. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7286. * @param {Object} options
  7287. */
  7288. function Clipboard(trigger, options) {
  7289. _classCallCheck(this, Clipboard);
  7290. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7291. _this.resolveOptions(options);
  7292. _this.listenClick(trigger);
  7293. return _this;
  7294. }
  7295. /**
  7296. * Defines if attributes would be resolved using internal setter functions
  7297. * or custom functions that were passed in the constructor.
  7298. * @param {Object} options
  7299. */
  7300. _createClass(Clipboard, [{
  7301. key: 'resolveOptions',
  7302. value: function resolveOptions() {
  7303. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7304. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7305. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7306. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7307. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7308. }
  7309. /**
  7310. * Adds a click event listener to the passed trigger.
  7311. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7312. */
  7313. }, {
  7314. key: 'listenClick',
  7315. value: function listenClick(trigger) {
  7316. var _this2 = this;
  7317. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7318. return _this2.onClick(e);
  7319. });
  7320. }
  7321. /**
  7322. * Defines a new `ClipboardAction` on each click event.
  7323. * @param {Event} e
  7324. */
  7325. }, {
  7326. key: 'onClick',
  7327. value: function onClick(e) {
  7328. var trigger = e.delegateTarget || e.currentTarget;
  7329. if (this.clipboardAction) {
  7330. this.clipboardAction = null;
  7331. }
  7332. this.clipboardAction = new _clipboardAction2.default({
  7333. action: this.action(trigger),
  7334. target: this.target(trigger),
  7335. text: this.text(trigger),
  7336. container: this.container,
  7337. trigger: trigger,
  7338. emitter: this
  7339. });
  7340. }
  7341. /**
  7342. * Default `action` lookup function.
  7343. * @param {Element} trigger
  7344. */
  7345. }, {
  7346. key: 'defaultAction',
  7347. value: function defaultAction(trigger) {
  7348. return getAttributeValue('action', trigger);
  7349. }
  7350. /**
  7351. * Default `target` lookup function.
  7352. * @param {Element} trigger
  7353. */
  7354. }, {
  7355. key: 'defaultTarget',
  7356. value: function defaultTarget(trigger) {
  7357. var selector = getAttributeValue('target', trigger);
  7358. if (selector) {
  7359. return document.querySelector(selector);
  7360. }
  7361. }
  7362. /**
  7363. * Returns the support of the given action, or all actions if no action is
  7364. * given.
  7365. * @param {String} [action]
  7366. */
  7367. }, {
  7368. key: 'defaultText',
  7369. /**
  7370. * Default `text` lookup function.
  7371. * @param {Element} trigger
  7372. */
  7373. value: function defaultText(trigger) {
  7374. return getAttributeValue('text', trigger);
  7375. }
  7376. /**
  7377. * Destroy lifecycle.
  7378. */
  7379. }, {
  7380. key: 'destroy',
  7381. value: function destroy() {
  7382. this.listener.destroy();
  7383. if (this.clipboardAction) {
  7384. this.clipboardAction.destroy();
  7385. this.clipboardAction = null;
  7386. }
  7387. }
  7388. }], [{
  7389. key: 'isSupported',
  7390. value: function isSupported() {
  7391. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7392. var actions = typeof action === 'string' ? [action] : action;
  7393. var support = !!document.queryCommandSupported;
  7394. actions.forEach(function (action) {
  7395. support = support && !!document.queryCommandSupported(action);
  7396. });
  7397. return support;
  7398. }
  7399. }]);
  7400. return Clipboard;
  7401. }(_tinyEmitter2.default);
  7402. /**
  7403. * Helper function to retrieve attribute value.
  7404. * @param {String} suffix
  7405. * @param {Element} element
  7406. */
  7407. function getAttributeValue(suffix, element) {
  7408. var attribute = 'data-clipboard-' + suffix;
  7409. if (!element.hasAttribute(attribute)) {
  7410. return;
  7411. }
  7412. return element.getAttribute(attribute);
  7413. }
  7414. module.exports = Clipboard;
  7415. /***/ }),
  7416. /* 1 */
  7417. /***/ (function(module, exports, __webpack_require__) {
  7418. "use strict";
  7419. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7420. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7421. var _select = __webpack_require__(2);
  7422. var _select2 = _interopRequireDefault(_select);
  7423. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7424. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7425. /**
  7426. * Inner class which performs selection from either `text` or `target`
  7427. * properties and then executes copy or cut operations.
  7428. */
  7429. var ClipboardAction = function () {
  7430. /**
  7431. * @param {Object} options
  7432. */
  7433. function ClipboardAction(options) {
  7434. _classCallCheck(this, ClipboardAction);
  7435. this.resolveOptions(options);
  7436. this.initSelection();
  7437. }
  7438. /**
  7439. * Defines base properties passed from constructor.
  7440. * @param {Object} options
  7441. */
  7442. _createClass(ClipboardAction, [{
  7443. key: 'resolveOptions',
  7444. value: function resolveOptions() {
  7445. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7446. this.action = options.action;
  7447. this.container = options.container;
  7448. this.emitter = options.emitter;
  7449. this.target = options.target;
  7450. this.text = options.text;
  7451. this.trigger = options.trigger;
  7452. this.selectedText = '';
  7453. }
  7454. /**
  7455. * Decides which selection strategy is going to be applied based
  7456. * on the existence of `text` and `target` properties.
  7457. */
  7458. }, {
  7459. key: 'initSelection',
  7460. value: function initSelection() {
  7461. if (this.text) {
  7462. this.selectFake();
  7463. } else if (this.target) {
  7464. this.selectTarget();
  7465. }
  7466. }
  7467. /**
  7468. * Creates a fake textarea element, sets its value from `text` property,
  7469. * and makes a selection on it.
  7470. */
  7471. }, {
  7472. key: 'selectFake',
  7473. value: function selectFake() {
  7474. var _this = this;
  7475. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7476. this.removeFake();
  7477. this.fakeHandlerCallback = function () {
  7478. return _this.removeFake();
  7479. };
  7480. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7481. this.fakeElem = document.createElement('textarea');
  7482. // Prevent zooming on iOS
  7483. this.fakeElem.style.fontSize = '12pt';
  7484. // Reset box model
  7485. this.fakeElem.style.border = '0';
  7486. this.fakeElem.style.padding = '0';
  7487. this.fakeElem.style.margin = '0';
  7488. // Move element out of screen horizontally
  7489. this.fakeElem.style.position = 'absolute';
  7490. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7491. // Move element to the same position vertically
  7492. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7493. this.fakeElem.style.top = yPosition + 'px';
  7494. this.fakeElem.setAttribute('readonly', '');
  7495. this.fakeElem.value = this.text;
  7496. this.container.appendChild(this.fakeElem);
  7497. this.selectedText = (0, _select2.default)(this.fakeElem);
  7498. this.copyText();
  7499. }
  7500. /**
  7501. * Only removes the fake element after another click event, that way
  7502. * a user can hit `Ctrl+C` to copy because selection still exists.
  7503. */
  7504. }, {
  7505. key: 'removeFake',
  7506. value: function removeFake() {
  7507. if (this.fakeHandler) {
  7508. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7509. this.fakeHandler = null;
  7510. this.fakeHandlerCallback = null;
  7511. }
  7512. if (this.fakeElem) {
  7513. this.container.removeChild(this.fakeElem);
  7514. this.fakeElem = null;
  7515. }
  7516. }
  7517. /**
  7518. * Selects the content from element passed on `target` property.
  7519. */
  7520. }, {
  7521. key: 'selectTarget',
  7522. value: function selectTarget() {
  7523. this.selectedText = (0, _select2.default)(this.target);
  7524. this.copyText();
  7525. }
  7526. /**
  7527. * Executes the copy operation based on the current selection.
  7528. */
  7529. }, {
  7530. key: 'copyText',
  7531. value: function copyText() {
  7532. var succeeded = void 0;
  7533. try {
  7534. succeeded = document.execCommand(this.action);
  7535. } catch (err) {
  7536. succeeded = false;
  7537. }
  7538. this.handleResult(succeeded);
  7539. }
  7540. /**
  7541. * Fires an event based on the copy operation result.
  7542. * @param {Boolean} succeeded
  7543. */
  7544. }, {
  7545. key: 'handleResult',
  7546. value: function handleResult(succeeded) {
  7547. this.emitter.emit(succeeded ? 'success' : 'error', {
  7548. action: this.action,
  7549. text: this.selectedText,
  7550. trigger: this.trigger,
  7551. clearSelection: this.clearSelection.bind(this)
  7552. });
  7553. }
  7554. /**
  7555. * Moves focus away from `target` and back to the trigger, removes current selection.
  7556. */
  7557. }, {
  7558. key: 'clearSelection',
  7559. value: function clearSelection() {
  7560. if (this.trigger) {
  7561. this.trigger.focus();
  7562. }
  7563. window.getSelection().removeAllRanges();
  7564. }
  7565. /**
  7566. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7567. * @param {String} action
  7568. */
  7569. }, {
  7570. key: 'destroy',
  7571. /**
  7572. * Destroy lifecycle.
  7573. */
  7574. value: function destroy() {
  7575. this.removeFake();
  7576. }
  7577. }, {
  7578. key: 'action',
  7579. set: function set() {
  7580. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7581. this._action = action;
  7582. if (this._action !== 'copy' && this._action !== 'cut') {
  7583. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7584. }
  7585. }
  7586. /**
  7587. * Gets the `action` property.
  7588. * @return {String}
  7589. */
  7590. ,
  7591. get: function get() {
  7592. return this._action;
  7593. }
  7594. /**
  7595. * Sets the `target` property using an element
  7596. * that will be have its content copied.
  7597. * @param {Element} target
  7598. */
  7599. }, {
  7600. key: 'target',
  7601. set: function set(target) {
  7602. if (target !== undefined) {
  7603. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7604. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7605. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7606. }
  7607. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7608. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7609. }
  7610. this._target = target;
  7611. } else {
  7612. throw new Error('Invalid "target" value, use a valid Element');
  7613. }
  7614. }
  7615. }
  7616. /**
  7617. * Gets the `target` property.
  7618. * @return {String|HTMLElement}
  7619. */
  7620. ,
  7621. get: function get() {
  7622. return this._target;
  7623. }
  7624. }]);
  7625. return ClipboardAction;
  7626. }();
  7627. module.exports = ClipboardAction;
  7628. /***/ }),
  7629. /* 2 */
  7630. /***/ (function(module, exports) {
  7631. function select(element) {
  7632. var selectedText;
  7633. if (element.nodeName === 'SELECT') {
  7634. element.focus();
  7635. selectedText = element.value;
  7636. }
  7637. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7638. var isReadOnly = element.hasAttribute('readonly');
  7639. if (!isReadOnly) {
  7640. element.setAttribute('readonly', '');
  7641. }
  7642. element.select();
  7643. element.setSelectionRange(0, element.value.length);
  7644. if (!isReadOnly) {
  7645. element.removeAttribute('readonly');
  7646. }
  7647. selectedText = element.value;
  7648. }
  7649. else {
  7650. if (element.hasAttribute('contenteditable')) {
  7651. element.focus();
  7652. }
  7653. var selection = window.getSelection();
  7654. var range = document.createRange();
  7655. range.selectNodeContents(element);
  7656. selection.removeAllRanges();
  7657. selection.addRange(range);
  7658. selectedText = selection.toString();
  7659. }
  7660. return selectedText;
  7661. }
  7662. module.exports = select;
  7663. /***/ }),
  7664. /* 3 */
  7665. /***/ (function(module, exports) {
  7666. function E () {
  7667. // Keep this empty so it's easier to inherit from
  7668. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7669. }
  7670. E.prototype = {
  7671. on: function (name, callback, ctx) {
  7672. var e = this.e || (this.e = {});
  7673. (e[name] || (e[name] = [])).push({
  7674. fn: callback,
  7675. ctx: ctx
  7676. });
  7677. return this;
  7678. },
  7679. once: function (name, callback, ctx) {
  7680. var self = this;
  7681. function listener () {
  7682. self.off(name, listener);
  7683. callback.apply(ctx, arguments);
  7684. };
  7685. listener._ = callback
  7686. return this.on(name, listener, ctx);
  7687. },
  7688. emit: function (name) {
  7689. var data = [].slice.call(arguments, 1);
  7690. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7691. var i = 0;
  7692. var len = evtArr.length;
  7693. for (i; i < len; i++) {
  7694. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7695. }
  7696. return this;
  7697. },
  7698. off: function (name, callback) {
  7699. var e = this.e || (this.e = {});
  7700. var evts = e[name];
  7701. var liveEvents = [];
  7702. if (evts && callback) {
  7703. for (var i = 0, len = evts.length; i < len; i++) {
  7704. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7705. liveEvents.push(evts[i]);
  7706. }
  7707. }
  7708. // Remove event from queue to prevent memory leak
  7709. // Suggested by https://github.com/lazd
  7710. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7711. (liveEvents.length)
  7712. ? e[name] = liveEvents
  7713. : delete e[name];
  7714. return this;
  7715. }
  7716. };
  7717. module.exports = E;
  7718. /***/ }),
  7719. /* 4 */
  7720. /***/ (function(module, exports, __webpack_require__) {
  7721. var is = __webpack_require__(5);
  7722. var delegate = __webpack_require__(6);
  7723. /**
  7724. * Validates all params and calls the right
  7725. * listener function based on its target type.
  7726. *
  7727. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7728. * @param {String} type
  7729. * @param {Function} callback
  7730. * @return {Object}
  7731. */
  7732. function listen(target, type, callback) {
  7733. if (!target && !type && !callback) {
  7734. throw new Error('Missing required arguments');
  7735. }
  7736. if (!is.string(type)) {
  7737. throw new TypeError('Second argument must be a String');
  7738. }
  7739. if (!is.fn(callback)) {
  7740. throw new TypeError('Third argument must be a Function');
  7741. }
  7742. if (is.node(target)) {
  7743. return listenNode(target, type, callback);
  7744. }
  7745. else if (is.nodeList(target)) {
  7746. return listenNodeList(target, type, callback);
  7747. }
  7748. else if (is.string(target)) {
  7749. return listenSelector(target, type, callback);
  7750. }
  7751. else {
  7752. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7753. }
  7754. }
  7755. /**
  7756. * Adds an event listener to a HTML element
  7757. * and returns a remove listener function.
  7758. *
  7759. * @param {HTMLElement} node
  7760. * @param {String} type
  7761. * @param {Function} callback
  7762. * @return {Object}
  7763. */
  7764. function listenNode(node, type, callback) {
  7765. node.addEventListener(type, callback);
  7766. return {
  7767. destroy: function() {
  7768. node.removeEventListener(type, callback);
  7769. }
  7770. }
  7771. }
  7772. /**
  7773. * Add an event listener to a list of HTML elements
  7774. * and returns a remove listener function.
  7775. *
  7776. * @param {NodeList|HTMLCollection} nodeList
  7777. * @param {String} type
  7778. * @param {Function} callback
  7779. * @return {Object}
  7780. */
  7781. function listenNodeList(nodeList, type, callback) {
  7782. Array.prototype.forEach.call(nodeList, function(node) {
  7783. node.addEventListener(type, callback);
  7784. });
  7785. return {
  7786. destroy: function() {
  7787. Array.prototype.forEach.call(nodeList, function(node) {
  7788. node.removeEventListener(type, callback);
  7789. });
  7790. }
  7791. }
  7792. }
  7793. /**
  7794. * Add an event listener to a selector
  7795. * and returns a remove listener function.
  7796. *
  7797. * @param {String} selector
  7798. * @param {String} type
  7799. * @param {Function} callback
  7800. * @return {Object}
  7801. */
  7802. function listenSelector(selector, type, callback) {
  7803. return delegate(document.body, selector, type, callback);
  7804. }
  7805. module.exports = listen;
  7806. /***/ }),
  7807. /* 5 */
  7808. /***/ (function(module, exports) {
  7809. /**
  7810. * Check if argument is a HTML element.
  7811. *
  7812. * @param {Object} value
  7813. * @return {Boolean}
  7814. */
  7815. exports.node = function(value) {
  7816. return value !== undefined
  7817. && value instanceof HTMLElement
  7818. && value.nodeType === 1;
  7819. };
  7820. /**
  7821. * Check if argument is a list of HTML elements.
  7822. *
  7823. * @param {Object} value
  7824. * @return {Boolean}
  7825. */
  7826. exports.nodeList = function(value) {
  7827. var type = Object.prototype.toString.call(value);
  7828. return value !== undefined
  7829. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  7830. && ('length' in value)
  7831. && (value.length === 0 || exports.node(value[0]));
  7832. };
  7833. /**
  7834. * Check if argument is a string.
  7835. *
  7836. * @param {Object} value
  7837. * @return {Boolean}
  7838. */
  7839. exports.string = function(value) {
  7840. return typeof value === 'string'
  7841. || value instanceof String;
  7842. };
  7843. /**
  7844. * Check if argument is a function.
  7845. *
  7846. * @param {Object} value
  7847. * @return {Boolean}
  7848. */
  7849. exports.fn = function(value) {
  7850. var type = Object.prototype.toString.call(value);
  7851. return type === '[object Function]';
  7852. };
  7853. /***/ }),
  7854. /* 6 */
  7855. /***/ (function(module, exports, __webpack_require__) {
  7856. var closest = __webpack_require__(7);
  7857. /**
  7858. * Delegates event to a selector.
  7859. *
  7860. * @param {Element} element
  7861. * @param {String} selector
  7862. * @param {String} type
  7863. * @param {Function} callback
  7864. * @param {Boolean} useCapture
  7865. * @return {Object}
  7866. */
  7867. function _delegate(element, selector, type, callback, useCapture) {
  7868. var listenerFn = listener.apply(this, arguments);
  7869. element.addEventListener(type, listenerFn, useCapture);
  7870. return {
  7871. destroy: function() {
  7872. element.removeEventListener(type, listenerFn, useCapture);
  7873. }
  7874. }
  7875. }
  7876. /**
  7877. * Delegates event to a selector.
  7878. *
  7879. * @param {Element|String|Array} [elements]
  7880. * @param {String} selector
  7881. * @param {String} type
  7882. * @param {Function} callback
  7883. * @param {Boolean} useCapture
  7884. * @return {Object}
  7885. */
  7886. function delegate(elements, selector, type, callback, useCapture) {
  7887. // Handle the regular Element usage
  7888. if (typeof elements.addEventListener === 'function') {
  7889. return _delegate.apply(null, arguments);
  7890. }
  7891. // Handle Element-less usage, it defaults to global delegation
  7892. if (typeof type === 'function') {
  7893. // Use `document` as the first parameter, then apply arguments
  7894. // This is a short way to .unshift `arguments` without running into deoptimizations
  7895. return _delegate.bind(null, document).apply(null, arguments);
  7896. }
  7897. // Handle Selector-based usage
  7898. if (typeof elements === 'string') {
  7899. elements = document.querySelectorAll(elements);
  7900. }
  7901. // Handle Array-like based usage
  7902. return Array.prototype.map.call(elements, function (element) {
  7903. return _delegate(element, selector, type, callback, useCapture);
  7904. });
  7905. }
  7906. /**
  7907. * Finds closest match and invokes callback.
  7908. *
  7909. * @param {Element} element
  7910. * @param {String} selector
  7911. * @param {String} type
  7912. * @param {Function} callback
  7913. * @return {Function}
  7914. */
  7915. function listener(element, selector, type, callback) {
  7916. return function(e) {
  7917. e.delegateTarget = closest(e.target, selector);
  7918. if (e.delegateTarget) {
  7919. callback.call(element, e);
  7920. }
  7921. }
  7922. }
  7923. module.exports = delegate;
  7924. /***/ }),
  7925. /* 7 */
  7926. /***/ (function(module, exports) {
  7927. var DOCUMENT_NODE_TYPE = 9;
  7928. /**
  7929. * A polyfill for Element.matches()
  7930. */
  7931. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  7932. var proto = Element.prototype;
  7933. proto.matches = proto.matchesSelector ||
  7934. proto.mozMatchesSelector ||
  7935. proto.msMatchesSelector ||
  7936. proto.oMatchesSelector ||
  7937. proto.webkitMatchesSelector;
  7938. }
  7939. /**
  7940. * Finds the closest parent that matches a selector.
  7941. *
  7942. * @param {Element} element
  7943. * @param {String} selector
  7944. * @return {Function}
  7945. */
  7946. function closest (element, selector) {
  7947. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  7948. if (typeof element.matches === 'function' &&
  7949. element.matches(selector)) {
  7950. return element;
  7951. }
  7952. element = element.parentNode;
  7953. }
  7954. }
  7955. module.exports = closest;
  7956. /***/ })
  7957. /******/ ]);
  7958. });
  7959. /***/ }),
  7960. /***/ "./node_modules/ieee754/index.js":
  7961. /*!***************************************!*\
  7962. !*** ./node_modules/ieee754/index.js ***!
  7963. \***************************************/
  7964. /*! no static exports found */
  7965. /***/ (function(module, exports) {
  7966. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  7967. var e, m
  7968. var eLen = (nBytes * 8) - mLen - 1
  7969. var eMax = (1 << eLen) - 1
  7970. var eBias = eMax >> 1
  7971. var nBits = -7
  7972. var i = isLE ? (nBytes - 1) : 0
  7973. var d = isLE ? -1 : 1
  7974. var s = buffer[offset + i]
  7975. i += d
  7976. e = s & ((1 << (-nBits)) - 1)
  7977. s >>= (-nBits)
  7978. nBits += eLen
  7979. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  7980. m = e & ((1 << (-nBits)) - 1)
  7981. e >>= (-nBits)
  7982. nBits += mLen
  7983. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  7984. if (e === 0) {
  7985. e = 1 - eBias
  7986. } else if (e === eMax) {
  7987. return m ? NaN : ((s ? -1 : 1) * Infinity)
  7988. } else {
  7989. m = m + Math.pow(2, mLen)
  7990. e = e - eBias
  7991. }
  7992. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  7993. }
  7994. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  7995. var e, m, c
  7996. var eLen = (nBytes * 8) - mLen - 1
  7997. var eMax = (1 << eLen) - 1
  7998. var eBias = eMax >> 1
  7999. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8000. var i = isLE ? 0 : (nBytes - 1)
  8001. var d = isLE ? 1 : -1
  8002. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8003. value = Math.abs(value)
  8004. if (isNaN(value) || value === Infinity) {
  8005. m = isNaN(value) ? 1 : 0
  8006. e = eMax
  8007. } else {
  8008. e = Math.floor(Math.log(value) / Math.LN2)
  8009. if (value * (c = Math.pow(2, -e)) < 1) {
  8010. e--
  8011. c *= 2
  8012. }
  8013. if (e + eBias >= 1) {
  8014. value += rt / c
  8015. } else {
  8016. value += rt * Math.pow(2, 1 - eBias)
  8017. }
  8018. if (value * c >= 2) {
  8019. e++
  8020. c /= 2
  8021. }
  8022. if (e + eBias >= eMax) {
  8023. m = 0
  8024. e = eMax
  8025. } else if (e + eBias >= 1) {
  8026. m = ((value * c) - 1) * Math.pow(2, mLen)
  8027. e = e + eBias
  8028. } else {
  8029. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8030. e = 0
  8031. }
  8032. }
  8033. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8034. e = (e << mLen) | m
  8035. eLen += mLen
  8036. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8037. buffer[offset + i - d] |= s * 128
  8038. }
  8039. /***/ }),
  8040. /***/ "./node_modules/isarray/index.js":
  8041. /*!***************************************!*\
  8042. !*** ./node_modules/isarray/index.js ***!
  8043. \***************************************/
  8044. /*! no static exports found */
  8045. /***/ (function(module, exports) {
  8046. var toString = {}.toString;
  8047. module.exports = Array.isArray || function (arr) {
  8048. return toString.call(arr) == '[object Array]';
  8049. };
  8050. /***/ }),
  8051. /***/ "./node_modules/jquery/dist/jquery.js":
  8052. /*!********************************************!*\
  8053. !*** ./node_modules/jquery/dist/jquery.js ***!
  8054. \********************************************/
  8055. /*! no static exports found */
  8056. /***/ (function(module, exports, __webpack_require__) {
  8057. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8058. * jQuery JavaScript Library v3.4.1
  8059. * https://jquery.com/
  8060. *
  8061. * Includes Sizzle.js
  8062. * https://sizzlejs.com/
  8063. *
  8064. * Copyright JS Foundation and other contributors
  8065. * Released under the MIT license
  8066. * https://jquery.org/license
  8067. *
  8068. * Date: 2019-05-01T21:04Z
  8069. */
  8070. ( function( global, factory ) {
  8071. "use strict";
  8072. if ( true && typeof module.exports === "object" ) {
  8073. // For CommonJS and CommonJS-like environments where a proper `window`
  8074. // is present, execute the factory and get jQuery.
  8075. // For environments that do not have a `window` with a `document`
  8076. // (such as Node.js), expose a factory as module.exports.
  8077. // This accentuates the need for the creation of a real `window`.
  8078. // e.g. var jQuery = require("jquery")(window);
  8079. // See ticket #14549 for more info.
  8080. module.exports = global.document ?
  8081. factory( global, true ) :
  8082. function( w ) {
  8083. if ( !w.document ) {
  8084. throw new Error( "jQuery requires a window with a document" );
  8085. }
  8086. return factory( w );
  8087. };
  8088. } else {
  8089. factory( global );
  8090. }
  8091. // Pass this if window is not defined yet
  8092. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8093. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8094. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8095. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8096. // enough that all such attempts are guarded in a try block.
  8097. "use strict";
  8098. var arr = [];
  8099. var document = window.document;
  8100. var getProto = Object.getPrototypeOf;
  8101. var slice = arr.slice;
  8102. var concat = arr.concat;
  8103. var push = arr.push;
  8104. var indexOf = arr.indexOf;
  8105. var class2type = {};
  8106. var toString = class2type.toString;
  8107. var hasOwn = class2type.hasOwnProperty;
  8108. var fnToString = hasOwn.toString;
  8109. var ObjectFunctionString = fnToString.call( Object );
  8110. var support = {};
  8111. var isFunction = function isFunction( obj ) {
  8112. // Support: Chrome <=57, Firefox <=52
  8113. // In some browsers, typeof returns "function" for HTML <object> elements
  8114. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8115. // We don't want to classify *any* DOM node as a function.
  8116. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8117. };
  8118. var isWindow = function isWindow( obj ) {
  8119. return obj != null && obj === obj.window;
  8120. };
  8121. var preservedScriptAttributes = {
  8122. type: true,
  8123. src: true,
  8124. nonce: true,
  8125. noModule: true
  8126. };
  8127. function DOMEval( code, node, doc ) {
  8128. doc = doc || document;
  8129. var i, val,
  8130. script = doc.createElement( "script" );
  8131. script.text = code;
  8132. if ( node ) {
  8133. for ( i in preservedScriptAttributes ) {
  8134. // Support: Firefox 64+, Edge 18+
  8135. // Some browsers don't support the "nonce" property on scripts.
  8136. // On the other hand, just using `getAttribute` is not enough as
  8137. // the `nonce` attribute is reset to an empty string whenever it
  8138. // becomes browsing-context connected.
  8139. // See https://github.com/whatwg/html/issues/2369
  8140. // See https://html.spec.whatwg.org/#nonce-attributes
  8141. // The `node.getAttribute` check was added for the sake of
  8142. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8143. // via an object.
  8144. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8145. if ( val ) {
  8146. script.setAttribute( i, val );
  8147. }
  8148. }
  8149. }
  8150. doc.head.appendChild( script ).parentNode.removeChild( script );
  8151. }
  8152. function toType( obj ) {
  8153. if ( obj == null ) {
  8154. return obj + "";
  8155. }
  8156. // Support: Android <=2.3 only (functionish RegExp)
  8157. return typeof obj === "object" || typeof obj === "function" ?
  8158. class2type[ toString.call( obj ) ] || "object" :
  8159. typeof obj;
  8160. }
  8161. /* global Symbol */
  8162. // Defining this global in .eslintrc.json would create a danger of using the global
  8163. // unguarded in another place, it seems safer to define global only for this module
  8164. var
  8165. version = "3.4.1",
  8166. // Define a local copy of jQuery
  8167. jQuery = function( selector, context ) {
  8168. // The jQuery object is actually just the init constructor 'enhanced'
  8169. // Need init if jQuery is called (just allow error to be thrown if not included)
  8170. return new jQuery.fn.init( selector, context );
  8171. },
  8172. // Support: Android <=4.0 only
  8173. // Make sure we trim BOM and NBSP
  8174. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8175. jQuery.fn = jQuery.prototype = {
  8176. // The current version of jQuery being used
  8177. jquery: version,
  8178. constructor: jQuery,
  8179. // The default length of a jQuery object is 0
  8180. length: 0,
  8181. toArray: function() {
  8182. return slice.call( this );
  8183. },
  8184. // Get the Nth element in the matched element set OR
  8185. // Get the whole matched element set as a clean array
  8186. get: function( num ) {
  8187. // Return all the elements in a clean array
  8188. if ( num == null ) {
  8189. return slice.call( this );
  8190. }
  8191. // Return just the one element from the set
  8192. return num < 0 ? this[ num + this.length ] : this[ num ];
  8193. },
  8194. // Take an array of elements and push it onto the stack
  8195. // (returning the new matched element set)
  8196. pushStack: function( elems ) {
  8197. // Build a new jQuery matched element set
  8198. var ret = jQuery.merge( this.constructor(), elems );
  8199. // Add the old object onto the stack (as a reference)
  8200. ret.prevObject = this;
  8201. // Return the newly-formed element set
  8202. return ret;
  8203. },
  8204. // Execute a callback for every element in the matched set.
  8205. each: function( callback ) {
  8206. return jQuery.each( this, callback );
  8207. },
  8208. map: function( callback ) {
  8209. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8210. return callback.call( elem, i, elem );
  8211. } ) );
  8212. },
  8213. slice: function() {
  8214. return this.pushStack( slice.apply( this, arguments ) );
  8215. },
  8216. first: function() {
  8217. return this.eq( 0 );
  8218. },
  8219. last: function() {
  8220. return this.eq( -1 );
  8221. },
  8222. eq: function( i ) {
  8223. var len = this.length,
  8224. j = +i + ( i < 0 ? len : 0 );
  8225. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8226. },
  8227. end: function() {
  8228. return this.prevObject || this.constructor();
  8229. },
  8230. // For internal use only.
  8231. // Behaves like an Array's method, not like a jQuery method.
  8232. push: push,
  8233. sort: arr.sort,
  8234. splice: arr.splice
  8235. };
  8236. jQuery.extend = jQuery.fn.extend = function() {
  8237. var options, name, src, copy, copyIsArray, clone,
  8238. target = arguments[ 0 ] || {},
  8239. i = 1,
  8240. length = arguments.length,
  8241. deep = false;
  8242. // Handle a deep copy situation
  8243. if ( typeof target === "boolean" ) {
  8244. deep = target;
  8245. // Skip the boolean and the target
  8246. target = arguments[ i ] || {};
  8247. i++;
  8248. }
  8249. // Handle case when target is a string or something (possible in deep copy)
  8250. if ( typeof target !== "object" && !isFunction( target ) ) {
  8251. target = {};
  8252. }
  8253. // Extend jQuery itself if only one argument is passed
  8254. if ( i === length ) {
  8255. target = this;
  8256. i--;
  8257. }
  8258. for ( ; i < length; i++ ) {
  8259. // Only deal with non-null/undefined values
  8260. if ( ( options = arguments[ i ] ) != null ) {
  8261. // Extend the base object
  8262. for ( name in options ) {
  8263. copy = options[ name ];
  8264. // Prevent Object.prototype pollution
  8265. // Prevent never-ending loop
  8266. if ( name === "__proto__" || target === copy ) {
  8267. continue;
  8268. }
  8269. // Recurse if we're merging plain objects or arrays
  8270. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8271. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8272. src = target[ name ];
  8273. // Ensure proper type for the source value
  8274. if ( copyIsArray && !Array.isArray( src ) ) {
  8275. clone = [];
  8276. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8277. clone = {};
  8278. } else {
  8279. clone = src;
  8280. }
  8281. copyIsArray = false;
  8282. // Never move original objects, clone them
  8283. target[ name ] = jQuery.extend( deep, clone, copy );
  8284. // Don't bring in undefined values
  8285. } else if ( copy !== undefined ) {
  8286. target[ name ] = copy;
  8287. }
  8288. }
  8289. }
  8290. }
  8291. // Return the modified object
  8292. return target;
  8293. };
  8294. jQuery.extend( {
  8295. // Unique for each copy of jQuery on the page
  8296. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8297. // Assume jQuery is ready without the ready module
  8298. isReady: true,
  8299. error: function( msg ) {
  8300. throw new Error( msg );
  8301. },
  8302. noop: function() {},
  8303. isPlainObject: function( obj ) {
  8304. var proto, Ctor;
  8305. // Detect obvious negatives
  8306. // Use toString instead of jQuery.type to catch host objects
  8307. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8308. return false;
  8309. }
  8310. proto = getProto( obj );
  8311. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8312. if ( !proto ) {
  8313. return true;
  8314. }
  8315. // Objects with prototype are plain iff they were constructed by a global Object function
  8316. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8317. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8318. },
  8319. isEmptyObject: function( obj ) {
  8320. var name;
  8321. for ( name in obj ) {
  8322. return false;
  8323. }
  8324. return true;
  8325. },
  8326. // Evaluates a script in a global context
  8327. globalEval: function( code, options ) {
  8328. DOMEval( code, { nonce: options && options.nonce } );
  8329. },
  8330. each: function( obj, callback ) {
  8331. var length, i = 0;
  8332. if ( isArrayLike( obj ) ) {
  8333. length = obj.length;
  8334. for ( ; i < length; i++ ) {
  8335. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8336. break;
  8337. }
  8338. }
  8339. } else {
  8340. for ( i in obj ) {
  8341. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8342. break;
  8343. }
  8344. }
  8345. }
  8346. return obj;
  8347. },
  8348. // Support: Android <=4.0 only
  8349. trim: function( text ) {
  8350. return text == null ?
  8351. "" :
  8352. ( text + "" ).replace( rtrim, "" );
  8353. },
  8354. // results is for internal usage only
  8355. makeArray: function( arr, results ) {
  8356. var ret = results || [];
  8357. if ( arr != null ) {
  8358. if ( isArrayLike( Object( arr ) ) ) {
  8359. jQuery.merge( ret,
  8360. typeof arr === "string" ?
  8361. [ arr ] : arr
  8362. );
  8363. } else {
  8364. push.call( ret, arr );
  8365. }
  8366. }
  8367. return ret;
  8368. },
  8369. inArray: function( elem, arr, i ) {
  8370. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8371. },
  8372. // Support: Android <=4.0 only, PhantomJS 1 only
  8373. // push.apply(_, arraylike) throws on ancient WebKit
  8374. merge: function( first, second ) {
  8375. var len = +second.length,
  8376. j = 0,
  8377. i = first.length;
  8378. for ( ; j < len; j++ ) {
  8379. first[ i++ ] = second[ j ];
  8380. }
  8381. first.length = i;
  8382. return first;
  8383. },
  8384. grep: function( elems, callback, invert ) {
  8385. var callbackInverse,
  8386. matches = [],
  8387. i = 0,
  8388. length = elems.length,
  8389. callbackExpect = !invert;
  8390. // Go through the array, only saving the items
  8391. // that pass the validator function
  8392. for ( ; i < length; i++ ) {
  8393. callbackInverse = !callback( elems[ i ], i );
  8394. if ( callbackInverse !== callbackExpect ) {
  8395. matches.push( elems[ i ] );
  8396. }
  8397. }
  8398. return matches;
  8399. },
  8400. // arg is for internal usage only
  8401. map: function( elems, callback, arg ) {
  8402. var length, value,
  8403. i = 0,
  8404. ret = [];
  8405. // Go through the array, translating each of the items to their new values
  8406. if ( isArrayLike( elems ) ) {
  8407. length = elems.length;
  8408. for ( ; i < length; i++ ) {
  8409. value = callback( elems[ i ], i, arg );
  8410. if ( value != null ) {
  8411. ret.push( value );
  8412. }
  8413. }
  8414. // Go through every key on the object,
  8415. } else {
  8416. for ( i in elems ) {
  8417. value = callback( elems[ i ], i, arg );
  8418. if ( value != null ) {
  8419. ret.push( value );
  8420. }
  8421. }
  8422. }
  8423. // Flatten any nested arrays
  8424. return concat.apply( [], ret );
  8425. },
  8426. // A global GUID counter for objects
  8427. guid: 1,
  8428. // jQuery.support is not used in Core but other projects attach their
  8429. // properties to it so it needs to exist.
  8430. support: support
  8431. } );
  8432. if ( typeof Symbol === "function" ) {
  8433. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8434. }
  8435. // Populate the class2type map
  8436. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8437. function( i, name ) {
  8438. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8439. } );
  8440. function isArrayLike( obj ) {
  8441. // Support: real iOS 8.2 only (not reproducible in simulator)
  8442. // `in` check used to prevent JIT error (gh-2145)
  8443. // hasOwn isn't used here due to false negatives
  8444. // regarding Nodelist length in IE
  8445. var length = !!obj && "length" in obj && obj.length,
  8446. type = toType( obj );
  8447. if ( isFunction( obj ) || isWindow( obj ) ) {
  8448. return false;
  8449. }
  8450. return type === "array" || length === 0 ||
  8451. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8452. }
  8453. var Sizzle =
  8454. /*!
  8455. * Sizzle CSS Selector Engine v2.3.4
  8456. * https://sizzlejs.com/
  8457. *
  8458. * Copyright JS Foundation and other contributors
  8459. * Released under the MIT license
  8460. * https://js.foundation/
  8461. *
  8462. * Date: 2019-04-08
  8463. */
  8464. (function( window ) {
  8465. var i,
  8466. support,
  8467. Expr,
  8468. getText,
  8469. isXML,
  8470. tokenize,
  8471. compile,
  8472. select,
  8473. outermostContext,
  8474. sortInput,
  8475. hasDuplicate,
  8476. // Local document vars
  8477. setDocument,
  8478. document,
  8479. docElem,
  8480. documentIsHTML,
  8481. rbuggyQSA,
  8482. rbuggyMatches,
  8483. matches,
  8484. contains,
  8485. // Instance-specific data
  8486. expando = "sizzle" + 1 * new Date(),
  8487. preferredDoc = window.document,
  8488. dirruns = 0,
  8489. done = 0,
  8490. classCache = createCache(),
  8491. tokenCache = createCache(),
  8492. compilerCache = createCache(),
  8493. nonnativeSelectorCache = createCache(),
  8494. sortOrder = function( a, b ) {
  8495. if ( a === b ) {
  8496. hasDuplicate = true;
  8497. }
  8498. return 0;
  8499. },
  8500. // Instance methods
  8501. hasOwn = ({}).hasOwnProperty,
  8502. arr = [],
  8503. pop = arr.pop,
  8504. push_native = arr.push,
  8505. push = arr.push,
  8506. slice = arr.slice,
  8507. // Use a stripped-down indexOf as it's faster than native
  8508. // https://jsperf.com/thor-indexof-vs-for/5
  8509. indexOf = function( list, elem ) {
  8510. var i = 0,
  8511. len = list.length;
  8512. for ( ; i < len; i++ ) {
  8513. if ( list[i] === elem ) {
  8514. return i;
  8515. }
  8516. }
  8517. return -1;
  8518. },
  8519. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8520. // Regular expressions
  8521. // http://www.w3.org/TR/css3-selectors/#whitespace
  8522. whitespace = "[\\x20\\t\\r\\n\\f]",
  8523. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8524. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8525. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8526. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8527. // Operator (capture 2)
  8528. "*([*^$|!~]?=)" + whitespace +
  8529. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8530. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8531. "*\\]",
  8532. pseudos = ":(" + identifier + ")(?:\\((" +
  8533. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8534. // 1. quoted (capture 3; capture 4 or capture 5)
  8535. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8536. // 2. simple (capture 6)
  8537. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8538. // 3. anything else (capture 2)
  8539. ".*" +
  8540. ")\\)|)",
  8541. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8542. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8543. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8544. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8545. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8546. rdescend = new RegExp( whitespace + "|>" ),
  8547. rpseudo = new RegExp( pseudos ),
  8548. ridentifier = new RegExp( "^" + identifier + "$" ),
  8549. matchExpr = {
  8550. "ID": new RegExp( "^#(" + identifier + ")" ),
  8551. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8552. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8553. "ATTR": new RegExp( "^" + attributes ),
  8554. "PSEUDO": new RegExp( "^" + pseudos ),
  8555. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8556. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8557. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8558. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8559. // For use in libraries implementing .is()
  8560. // We use this for POS matching in `select`
  8561. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8562. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8563. },
  8564. rhtml = /HTML$/i,
  8565. rinputs = /^(?:input|select|textarea|button)$/i,
  8566. rheader = /^h\d$/i,
  8567. rnative = /^[^{]+\{\s*\[native \w/,
  8568. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8569. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8570. rsibling = /[+~]/,
  8571. // CSS escapes
  8572. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8573. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8574. funescape = function( _, escaped, escapedWhitespace ) {
  8575. var high = "0x" + escaped - 0x10000;
  8576. // NaN means non-codepoint
  8577. // Support: Firefox<24
  8578. // Workaround erroneous numeric interpretation of +"0x"
  8579. return high !== high || escapedWhitespace ?
  8580. escaped :
  8581. high < 0 ?
  8582. // BMP codepoint
  8583. String.fromCharCode( high + 0x10000 ) :
  8584. // Supplemental Plane codepoint (surrogate pair)
  8585. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8586. },
  8587. // CSS string/identifier serialization
  8588. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8589. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8590. fcssescape = function( ch, asCodePoint ) {
  8591. if ( asCodePoint ) {
  8592. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8593. if ( ch === "\0" ) {
  8594. return "\uFFFD";
  8595. }
  8596. // Control characters and (dependent upon position) numbers get escaped as code points
  8597. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8598. }
  8599. // Other potentially-special ASCII characters get backslash-escaped
  8600. return "\\" + ch;
  8601. },
  8602. // Used for iframes
  8603. // See setDocument()
  8604. // Removing the function wrapper causes a "Permission Denied"
  8605. // error in IE
  8606. unloadHandler = function() {
  8607. setDocument();
  8608. },
  8609. inDisabledFieldset = addCombinator(
  8610. function( elem ) {
  8611. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8612. },
  8613. { dir: "parentNode", next: "legend" }
  8614. );
  8615. // Optimize for push.apply( _, NodeList )
  8616. try {
  8617. push.apply(
  8618. (arr = slice.call( preferredDoc.childNodes )),
  8619. preferredDoc.childNodes
  8620. );
  8621. // Support: Android<4.0
  8622. // Detect silently failing push.apply
  8623. arr[ preferredDoc.childNodes.length ].nodeType;
  8624. } catch ( e ) {
  8625. push = { apply: arr.length ?
  8626. // Leverage slice if possible
  8627. function( target, els ) {
  8628. push_native.apply( target, slice.call(els) );
  8629. } :
  8630. // Support: IE<9
  8631. // Otherwise append directly
  8632. function( target, els ) {
  8633. var j = target.length,
  8634. i = 0;
  8635. // Can't trust NodeList.length
  8636. while ( (target[j++] = els[i++]) ) {}
  8637. target.length = j - 1;
  8638. }
  8639. };
  8640. }
  8641. function Sizzle( selector, context, results, seed ) {
  8642. var m, i, elem, nid, match, groups, newSelector,
  8643. newContext = context && context.ownerDocument,
  8644. // nodeType defaults to 9, since context defaults to document
  8645. nodeType = context ? context.nodeType : 9;
  8646. results = results || [];
  8647. // Return early from calls with invalid selector or context
  8648. if ( typeof selector !== "string" || !selector ||
  8649. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8650. return results;
  8651. }
  8652. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8653. if ( !seed ) {
  8654. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8655. setDocument( context );
  8656. }
  8657. context = context || document;
  8658. if ( documentIsHTML ) {
  8659. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8660. // (excepting DocumentFragment context, where the methods don't exist)
  8661. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8662. // ID selector
  8663. if ( (m = match[1]) ) {
  8664. // Document context
  8665. if ( nodeType === 9 ) {
  8666. if ( (elem = context.getElementById( m )) ) {
  8667. // Support: IE, Opera, Webkit
  8668. // TODO: identify versions
  8669. // getElementById can match elements by name instead of ID
  8670. if ( elem.id === m ) {
  8671. results.push( elem );
  8672. return results;
  8673. }
  8674. } else {
  8675. return results;
  8676. }
  8677. // Element context
  8678. } else {
  8679. // Support: IE, Opera, Webkit
  8680. // TODO: identify versions
  8681. // getElementById can match elements by name instead of ID
  8682. if ( newContext && (elem = newContext.getElementById( m )) &&
  8683. contains( context, elem ) &&
  8684. elem.id === m ) {
  8685. results.push( elem );
  8686. return results;
  8687. }
  8688. }
  8689. // Type selector
  8690. } else if ( match[2] ) {
  8691. push.apply( results, context.getElementsByTagName( selector ) );
  8692. return results;
  8693. // Class selector
  8694. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8695. context.getElementsByClassName ) {
  8696. push.apply( results, context.getElementsByClassName( m ) );
  8697. return results;
  8698. }
  8699. }
  8700. // Take advantage of querySelectorAll
  8701. if ( support.qsa &&
  8702. !nonnativeSelectorCache[ selector + " " ] &&
  8703. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8704. // Support: IE 8 only
  8705. // Exclude object elements
  8706. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8707. newSelector = selector;
  8708. newContext = context;
  8709. // qSA considers elements outside a scoping root when evaluating child or
  8710. // descendant combinators, which is not what we want.
  8711. // In such cases, we work around the behavior by prefixing every selector in the
  8712. // list with an ID selector referencing the scope context.
  8713. // Thanks to Andrew Dupont for this technique.
  8714. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8715. // Capture the context ID, setting it first if necessary
  8716. if ( (nid = context.getAttribute( "id" )) ) {
  8717. nid = nid.replace( rcssescape, fcssescape );
  8718. } else {
  8719. context.setAttribute( "id", (nid = expando) );
  8720. }
  8721. // Prefix every selector in the list
  8722. groups = tokenize( selector );
  8723. i = groups.length;
  8724. while ( i-- ) {
  8725. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8726. }
  8727. newSelector = groups.join( "," );
  8728. // Expand context for sibling selectors
  8729. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8730. context;
  8731. }
  8732. try {
  8733. push.apply( results,
  8734. newContext.querySelectorAll( newSelector )
  8735. );
  8736. return results;
  8737. } catch ( qsaError ) {
  8738. nonnativeSelectorCache( selector, true );
  8739. } finally {
  8740. if ( nid === expando ) {
  8741. context.removeAttribute( "id" );
  8742. }
  8743. }
  8744. }
  8745. }
  8746. }
  8747. // All others
  8748. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8749. }
  8750. /**
  8751. * Create key-value caches of limited size
  8752. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8753. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8754. * deleting the oldest entry
  8755. */
  8756. function createCache() {
  8757. var keys = [];
  8758. function cache( key, value ) {
  8759. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8760. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8761. // Only keep the most recent entries
  8762. delete cache[ keys.shift() ];
  8763. }
  8764. return (cache[ key + " " ] = value);
  8765. }
  8766. return cache;
  8767. }
  8768. /**
  8769. * Mark a function for special use by Sizzle
  8770. * @param {Function} fn The function to mark
  8771. */
  8772. function markFunction( fn ) {
  8773. fn[ expando ] = true;
  8774. return fn;
  8775. }
  8776. /**
  8777. * Support testing using an element
  8778. * @param {Function} fn Passed the created element and returns a boolean result
  8779. */
  8780. function assert( fn ) {
  8781. var el = document.createElement("fieldset");
  8782. try {
  8783. return !!fn( el );
  8784. } catch (e) {
  8785. return false;
  8786. } finally {
  8787. // Remove from its parent by default
  8788. if ( el.parentNode ) {
  8789. el.parentNode.removeChild( el );
  8790. }
  8791. // release memory in IE
  8792. el = null;
  8793. }
  8794. }
  8795. /**
  8796. * Adds the same handler for all of the specified attrs
  8797. * @param {String} attrs Pipe-separated list of attributes
  8798. * @param {Function} handler The method that will be applied
  8799. */
  8800. function addHandle( attrs, handler ) {
  8801. var arr = attrs.split("|"),
  8802. i = arr.length;
  8803. while ( i-- ) {
  8804. Expr.attrHandle[ arr[i] ] = handler;
  8805. }
  8806. }
  8807. /**
  8808. * Checks document order of two siblings
  8809. * @param {Element} a
  8810. * @param {Element} b
  8811. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  8812. */
  8813. function siblingCheck( a, b ) {
  8814. var cur = b && a,
  8815. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  8816. a.sourceIndex - b.sourceIndex;
  8817. // Use IE sourceIndex if available on both nodes
  8818. if ( diff ) {
  8819. return diff;
  8820. }
  8821. // Check if b follows a
  8822. if ( cur ) {
  8823. while ( (cur = cur.nextSibling) ) {
  8824. if ( cur === b ) {
  8825. return -1;
  8826. }
  8827. }
  8828. }
  8829. return a ? 1 : -1;
  8830. }
  8831. /**
  8832. * Returns a function to use in pseudos for input types
  8833. * @param {String} type
  8834. */
  8835. function createInputPseudo( type ) {
  8836. return function( elem ) {
  8837. var name = elem.nodeName.toLowerCase();
  8838. return name === "input" && elem.type === type;
  8839. };
  8840. }
  8841. /**
  8842. * Returns a function to use in pseudos for buttons
  8843. * @param {String} type
  8844. */
  8845. function createButtonPseudo( type ) {
  8846. return function( elem ) {
  8847. var name = elem.nodeName.toLowerCase();
  8848. return (name === "input" || name === "button") && elem.type === type;
  8849. };
  8850. }
  8851. /**
  8852. * Returns a function to use in pseudos for :enabled/:disabled
  8853. * @param {Boolean} disabled true for :disabled; false for :enabled
  8854. */
  8855. function createDisabledPseudo( disabled ) {
  8856. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  8857. return function( elem ) {
  8858. // Only certain elements can match :enabled or :disabled
  8859. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  8860. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  8861. if ( "form" in elem ) {
  8862. // Check for inherited disabledness on relevant non-disabled elements:
  8863. // * listed form-associated elements in a disabled fieldset
  8864. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  8865. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  8866. // * option elements in a disabled optgroup
  8867. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  8868. // All such elements have a "form" property.
  8869. if ( elem.parentNode && elem.disabled === false ) {
  8870. // Option elements defer to a parent optgroup if present
  8871. if ( "label" in elem ) {
  8872. if ( "label" in elem.parentNode ) {
  8873. return elem.parentNode.disabled === disabled;
  8874. } else {
  8875. return elem.disabled === disabled;
  8876. }
  8877. }
  8878. // Support: IE 6 - 11
  8879. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  8880. return elem.isDisabled === disabled ||
  8881. // Where there is no isDisabled, check manually
  8882. /* jshint -W018 */
  8883. elem.isDisabled !== !disabled &&
  8884. inDisabledFieldset( elem ) === disabled;
  8885. }
  8886. return elem.disabled === disabled;
  8887. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  8888. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  8889. // even exist on them, let alone have a boolean value.
  8890. } else if ( "label" in elem ) {
  8891. return elem.disabled === disabled;
  8892. }
  8893. // Remaining elements are neither :enabled nor :disabled
  8894. return false;
  8895. };
  8896. }
  8897. /**
  8898. * Returns a function to use in pseudos for positionals
  8899. * @param {Function} fn
  8900. */
  8901. function createPositionalPseudo( fn ) {
  8902. return markFunction(function( argument ) {
  8903. argument = +argument;
  8904. return markFunction(function( seed, matches ) {
  8905. var j,
  8906. matchIndexes = fn( [], seed.length, argument ),
  8907. i = matchIndexes.length;
  8908. // Match elements found at the specified indexes
  8909. while ( i-- ) {
  8910. if ( seed[ (j = matchIndexes[i]) ] ) {
  8911. seed[j] = !(matches[j] = seed[j]);
  8912. }
  8913. }
  8914. });
  8915. });
  8916. }
  8917. /**
  8918. * Checks a node for validity as a Sizzle context
  8919. * @param {Element|Object=} context
  8920. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  8921. */
  8922. function testContext( context ) {
  8923. return context && typeof context.getElementsByTagName !== "undefined" && context;
  8924. }
  8925. // Expose support vars for convenience
  8926. support = Sizzle.support = {};
  8927. /**
  8928. * Detects XML nodes
  8929. * @param {Element|Object} elem An element or a document
  8930. * @returns {Boolean} True iff elem is a non-HTML XML node
  8931. */
  8932. isXML = Sizzle.isXML = function( elem ) {
  8933. var namespace = elem.namespaceURI,
  8934. docElem = (elem.ownerDocument || elem).documentElement;
  8935. // Support: IE <=8
  8936. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  8937. // https://bugs.jquery.com/ticket/4833
  8938. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  8939. };
  8940. /**
  8941. * Sets document-related variables once based on the current document
  8942. * @param {Element|Object} [doc] An element or document object to use to set the document
  8943. * @returns {Object} Returns the current document
  8944. */
  8945. setDocument = Sizzle.setDocument = function( node ) {
  8946. var hasCompare, subWindow,
  8947. doc = node ? node.ownerDocument || node : preferredDoc;
  8948. // Return early if doc is invalid or already selected
  8949. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  8950. return document;
  8951. }
  8952. // Update global variables
  8953. document = doc;
  8954. docElem = document.documentElement;
  8955. documentIsHTML = !isXML( document );
  8956. // Support: IE 9-11, Edge
  8957. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  8958. if ( preferredDoc !== document &&
  8959. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  8960. // Support: IE 11, Edge
  8961. if ( subWindow.addEventListener ) {
  8962. subWindow.addEventListener( "unload", unloadHandler, false );
  8963. // Support: IE 9 - 10 only
  8964. } else if ( subWindow.attachEvent ) {
  8965. subWindow.attachEvent( "onunload", unloadHandler );
  8966. }
  8967. }
  8968. /* Attributes
  8969. ---------------------------------------------------------------------- */
  8970. // Support: IE<8
  8971. // Verify that getAttribute really returns attributes and not properties
  8972. // (excepting IE8 booleans)
  8973. support.attributes = assert(function( el ) {
  8974. el.className = "i";
  8975. return !el.getAttribute("className");
  8976. });
  8977. /* getElement(s)By*
  8978. ---------------------------------------------------------------------- */
  8979. // Check if getElementsByTagName("*") returns only elements
  8980. support.getElementsByTagName = assert(function( el ) {
  8981. el.appendChild( document.createComment("") );
  8982. return !el.getElementsByTagName("*").length;
  8983. });
  8984. // Support: IE<9
  8985. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  8986. // Support: IE<10
  8987. // Check if getElementById returns elements by name
  8988. // The broken getElementById methods don't pick up programmatically-set names,
  8989. // so use a roundabout getElementsByName test
  8990. support.getById = assert(function( el ) {
  8991. docElem.appendChild( el ).id = expando;
  8992. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  8993. });
  8994. // ID filter and find
  8995. if ( support.getById ) {
  8996. Expr.filter["ID"] = function( id ) {
  8997. var attrId = id.replace( runescape, funescape );
  8998. return function( elem ) {
  8999. return elem.getAttribute("id") === attrId;
  9000. };
  9001. };
  9002. Expr.find["ID"] = function( id, context ) {
  9003. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9004. var elem = context.getElementById( id );
  9005. return elem ? [ elem ] : [];
  9006. }
  9007. };
  9008. } else {
  9009. Expr.filter["ID"] = function( id ) {
  9010. var attrId = id.replace( runescape, funescape );
  9011. return function( elem ) {
  9012. var node = typeof elem.getAttributeNode !== "undefined" &&
  9013. elem.getAttributeNode("id");
  9014. return node && node.value === attrId;
  9015. };
  9016. };
  9017. // Support: IE 6 - 7 only
  9018. // getElementById is not reliable as a find shortcut
  9019. Expr.find["ID"] = function( id, context ) {
  9020. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9021. var node, i, elems,
  9022. elem = context.getElementById( id );
  9023. if ( elem ) {
  9024. // Verify the id attribute
  9025. node = elem.getAttributeNode("id");
  9026. if ( node && node.value === id ) {
  9027. return [ elem ];
  9028. }
  9029. // Fall back on getElementsByName
  9030. elems = context.getElementsByName( id );
  9031. i = 0;
  9032. while ( (elem = elems[i++]) ) {
  9033. node = elem.getAttributeNode("id");
  9034. if ( node && node.value === id ) {
  9035. return [ elem ];
  9036. }
  9037. }
  9038. }
  9039. return [];
  9040. }
  9041. };
  9042. }
  9043. // Tag
  9044. Expr.find["TAG"] = support.getElementsByTagName ?
  9045. function( tag, context ) {
  9046. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9047. return context.getElementsByTagName( tag );
  9048. // DocumentFragment nodes don't have gEBTN
  9049. } else if ( support.qsa ) {
  9050. return context.querySelectorAll( tag );
  9051. }
  9052. } :
  9053. function( tag, context ) {
  9054. var elem,
  9055. tmp = [],
  9056. i = 0,
  9057. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9058. results = context.getElementsByTagName( tag );
  9059. // Filter out possible comments
  9060. if ( tag === "*" ) {
  9061. while ( (elem = results[i++]) ) {
  9062. if ( elem.nodeType === 1 ) {
  9063. tmp.push( elem );
  9064. }
  9065. }
  9066. return tmp;
  9067. }
  9068. return results;
  9069. };
  9070. // Class
  9071. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9072. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9073. return context.getElementsByClassName( className );
  9074. }
  9075. };
  9076. /* QSA/matchesSelector
  9077. ---------------------------------------------------------------------- */
  9078. // QSA and matchesSelector support
  9079. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9080. rbuggyMatches = [];
  9081. // qSa(:focus) reports false when true (Chrome 21)
  9082. // We allow this because of a bug in IE8/9 that throws an error
  9083. // whenever `document.activeElement` is accessed on an iframe
  9084. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9085. // See https://bugs.jquery.com/ticket/13378
  9086. rbuggyQSA = [];
  9087. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9088. // Build QSA regex
  9089. // Regex strategy adopted from Diego Perini
  9090. assert(function( el ) {
  9091. // Select is set to empty string on purpose
  9092. // This is to test IE's treatment of not explicitly
  9093. // setting a boolean content attribute,
  9094. // since its presence should be enough
  9095. // https://bugs.jquery.com/ticket/12359
  9096. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9097. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9098. "<option selected=''></option></select>";
  9099. // Support: IE8, Opera 11-12.16
  9100. // Nothing should be selected when empty strings follow ^= or $= or *=
  9101. // The test attribute must be unknown in Opera but "safe" for WinRT
  9102. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9103. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9104. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9105. }
  9106. // Support: IE8
  9107. // Boolean attributes and "value" are not treated correctly
  9108. if ( !el.querySelectorAll("[selected]").length ) {
  9109. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9110. }
  9111. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9112. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9113. rbuggyQSA.push("~=");
  9114. }
  9115. // Webkit/Opera - :checked should return selected option elements
  9116. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9117. // IE8 throws error here and will not see later tests
  9118. if ( !el.querySelectorAll(":checked").length ) {
  9119. rbuggyQSA.push(":checked");
  9120. }
  9121. // Support: Safari 8+, iOS 8+
  9122. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9123. // In-page `selector#id sibling-combinator selector` fails
  9124. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9125. rbuggyQSA.push(".#.+[+~]");
  9126. }
  9127. });
  9128. assert(function( el ) {
  9129. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9130. "<select disabled='disabled'><option/></select>";
  9131. // Support: Windows 8 Native Apps
  9132. // The type and name attributes are restricted during .innerHTML assignment
  9133. var input = document.createElement("input");
  9134. input.setAttribute( "type", "hidden" );
  9135. el.appendChild( input ).setAttribute( "name", "D" );
  9136. // Support: IE8
  9137. // Enforce case-sensitivity of name attribute
  9138. if ( el.querySelectorAll("[name=d]").length ) {
  9139. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9140. }
  9141. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9142. // IE8 throws error here and will not see later tests
  9143. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9144. rbuggyQSA.push( ":enabled", ":disabled" );
  9145. }
  9146. // Support: IE9-11+
  9147. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9148. docElem.appendChild( el ).disabled = true;
  9149. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9150. rbuggyQSA.push( ":enabled", ":disabled" );
  9151. }
  9152. // Opera 10-11 does not throw on post-comma invalid pseudos
  9153. el.querySelectorAll("*,:x");
  9154. rbuggyQSA.push(",.*:");
  9155. });
  9156. }
  9157. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9158. docElem.webkitMatchesSelector ||
  9159. docElem.mozMatchesSelector ||
  9160. docElem.oMatchesSelector ||
  9161. docElem.msMatchesSelector) )) ) {
  9162. assert(function( el ) {
  9163. // Check to see if it's possible to do matchesSelector
  9164. // on a disconnected node (IE 9)
  9165. support.disconnectedMatch = matches.call( el, "*" );
  9166. // This should fail with an exception
  9167. // Gecko does not error, returns false instead
  9168. matches.call( el, "[s!='']:x" );
  9169. rbuggyMatches.push( "!=", pseudos );
  9170. });
  9171. }
  9172. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9173. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9174. /* Contains
  9175. ---------------------------------------------------------------------- */
  9176. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9177. // Element contains another
  9178. // Purposefully self-exclusive
  9179. // As in, an element does not contain itself
  9180. contains = hasCompare || rnative.test( docElem.contains ) ?
  9181. function( a, b ) {
  9182. var adown = a.nodeType === 9 ? a.documentElement : a,
  9183. bup = b && b.parentNode;
  9184. return a === bup || !!( bup && bup.nodeType === 1 && (
  9185. adown.contains ?
  9186. adown.contains( bup ) :
  9187. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9188. ));
  9189. } :
  9190. function( a, b ) {
  9191. if ( b ) {
  9192. while ( (b = b.parentNode) ) {
  9193. if ( b === a ) {
  9194. return true;
  9195. }
  9196. }
  9197. }
  9198. return false;
  9199. };
  9200. /* Sorting
  9201. ---------------------------------------------------------------------- */
  9202. // Document order sorting
  9203. sortOrder = hasCompare ?
  9204. function( a, b ) {
  9205. // Flag for duplicate removal
  9206. if ( a === b ) {
  9207. hasDuplicate = true;
  9208. return 0;
  9209. }
  9210. // Sort on method existence if only one input has compareDocumentPosition
  9211. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9212. if ( compare ) {
  9213. return compare;
  9214. }
  9215. // Calculate position if both inputs belong to the same document
  9216. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9217. a.compareDocumentPosition( b ) :
  9218. // Otherwise we know they are disconnected
  9219. 1;
  9220. // Disconnected nodes
  9221. if ( compare & 1 ||
  9222. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9223. // Choose the first element that is related to our preferred document
  9224. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9225. return -1;
  9226. }
  9227. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9228. return 1;
  9229. }
  9230. // Maintain original order
  9231. return sortInput ?
  9232. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9233. 0;
  9234. }
  9235. return compare & 4 ? -1 : 1;
  9236. } :
  9237. function( a, b ) {
  9238. // Exit early if the nodes are identical
  9239. if ( a === b ) {
  9240. hasDuplicate = true;
  9241. return 0;
  9242. }
  9243. var cur,
  9244. i = 0,
  9245. aup = a.parentNode,
  9246. bup = b.parentNode,
  9247. ap = [ a ],
  9248. bp = [ b ];
  9249. // Parentless nodes are either documents or disconnected
  9250. if ( !aup || !bup ) {
  9251. return a === document ? -1 :
  9252. b === document ? 1 :
  9253. aup ? -1 :
  9254. bup ? 1 :
  9255. sortInput ?
  9256. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9257. 0;
  9258. // If the nodes are siblings, we can do a quick check
  9259. } else if ( aup === bup ) {
  9260. return siblingCheck( a, b );
  9261. }
  9262. // Otherwise we need full lists of their ancestors for comparison
  9263. cur = a;
  9264. while ( (cur = cur.parentNode) ) {
  9265. ap.unshift( cur );
  9266. }
  9267. cur = b;
  9268. while ( (cur = cur.parentNode) ) {
  9269. bp.unshift( cur );
  9270. }
  9271. // Walk down the tree looking for a discrepancy
  9272. while ( ap[i] === bp[i] ) {
  9273. i++;
  9274. }
  9275. return i ?
  9276. // Do a sibling check if the nodes have a common ancestor
  9277. siblingCheck( ap[i], bp[i] ) :
  9278. // Otherwise nodes in our document sort first
  9279. ap[i] === preferredDoc ? -1 :
  9280. bp[i] === preferredDoc ? 1 :
  9281. 0;
  9282. };
  9283. return document;
  9284. };
  9285. Sizzle.matches = function( expr, elements ) {
  9286. return Sizzle( expr, null, null, elements );
  9287. };
  9288. Sizzle.matchesSelector = function( elem, expr ) {
  9289. // Set document vars if needed
  9290. if ( ( elem.ownerDocument || elem ) !== document ) {
  9291. setDocument( elem );
  9292. }
  9293. if ( support.matchesSelector && documentIsHTML &&
  9294. !nonnativeSelectorCache[ expr + " " ] &&
  9295. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9296. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9297. try {
  9298. var ret = matches.call( elem, expr );
  9299. // IE 9's matchesSelector returns false on disconnected nodes
  9300. if ( ret || support.disconnectedMatch ||
  9301. // As well, disconnected nodes are said to be in a document
  9302. // fragment in IE 9
  9303. elem.document && elem.document.nodeType !== 11 ) {
  9304. return ret;
  9305. }
  9306. } catch (e) {
  9307. nonnativeSelectorCache( expr, true );
  9308. }
  9309. }
  9310. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9311. };
  9312. Sizzle.contains = function( context, elem ) {
  9313. // Set document vars if needed
  9314. if ( ( context.ownerDocument || context ) !== document ) {
  9315. setDocument( context );
  9316. }
  9317. return contains( context, elem );
  9318. };
  9319. Sizzle.attr = function( elem, name ) {
  9320. // Set document vars if needed
  9321. if ( ( elem.ownerDocument || elem ) !== document ) {
  9322. setDocument( elem );
  9323. }
  9324. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9325. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9326. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9327. fn( elem, name, !documentIsHTML ) :
  9328. undefined;
  9329. return val !== undefined ?
  9330. val :
  9331. support.attributes || !documentIsHTML ?
  9332. elem.getAttribute( name ) :
  9333. (val = elem.getAttributeNode(name)) && val.specified ?
  9334. val.value :
  9335. null;
  9336. };
  9337. Sizzle.escape = function( sel ) {
  9338. return (sel + "").replace( rcssescape, fcssescape );
  9339. };
  9340. Sizzle.error = function( msg ) {
  9341. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9342. };
  9343. /**
  9344. * Document sorting and removing duplicates
  9345. * @param {ArrayLike} results
  9346. */
  9347. Sizzle.uniqueSort = function( results ) {
  9348. var elem,
  9349. duplicates = [],
  9350. j = 0,
  9351. i = 0;
  9352. // Unless we *know* we can detect duplicates, assume their presence
  9353. hasDuplicate = !support.detectDuplicates;
  9354. sortInput = !support.sortStable && results.slice( 0 );
  9355. results.sort( sortOrder );
  9356. if ( hasDuplicate ) {
  9357. while ( (elem = results[i++]) ) {
  9358. if ( elem === results[ i ] ) {
  9359. j = duplicates.push( i );
  9360. }
  9361. }
  9362. while ( j-- ) {
  9363. results.splice( duplicates[ j ], 1 );
  9364. }
  9365. }
  9366. // Clear input after sorting to release objects
  9367. // See https://github.com/jquery/sizzle/pull/225
  9368. sortInput = null;
  9369. return results;
  9370. };
  9371. /**
  9372. * Utility function for retrieving the text value of an array of DOM nodes
  9373. * @param {Array|Element} elem
  9374. */
  9375. getText = Sizzle.getText = function( elem ) {
  9376. var node,
  9377. ret = "",
  9378. i = 0,
  9379. nodeType = elem.nodeType;
  9380. if ( !nodeType ) {
  9381. // If no nodeType, this is expected to be an array
  9382. while ( (node = elem[i++]) ) {
  9383. // Do not traverse comment nodes
  9384. ret += getText( node );
  9385. }
  9386. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9387. // Use textContent for elements
  9388. // innerText usage removed for consistency of new lines (jQuery #11153)
  9389. if ( typeof elem.textContent === "string" ) {
  9390. return elem.textContent;
  9391. } else {
  9392. // Traverse its children
  9393. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9394. ret += getText( elem );
  9395. }
  9396. }
  9397. } else if ( nodeType === 3 || nodeType === 4 ) {
  9398. return elem.nodeValue;
  9399. }
  9400. // Do not include comment or processing instruction nodes
  9401. return ret;
  9402. };
  9403. Expr = Sizzle.selectors = {
  9404. // Can be adjusted by the user
  9405. cacheLength: 50,
  9406. createPseudo: markFunction,
  9407. match: matchExpr,
  9408. attrHandle: {},
  9409. find: {},
  9410. relative: {
  9411. ">": { dir: "parentNode", first: true },
  9412. " ": { dir: "parentNode" },
  9413. "+": { dir: "previousSibling", first: true },
  9414. "~": { dir: "previousSibling" }
  9415. },
  9416. preFilter: {
  9417. "ATTR": function( match ) {
  9418. match[1] = match[1].replace( runescape, funescape );
  9419. // Move the given value to match[3] whether quoted or unquoted
  9420. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9421. if ( match[2] === "~=" ) {
  9422. match[3] = " " + match[3] + " ";
  9423. }
  9424. return match.slice( 0, 4 );
  9425. },
  9426. "CHILD": function( match ) {
  9427. /* matches from matchExpr["CHILD"]
  9428. 1 type (only|nth|...)
  9429. 2 what (child|of-type)
  9430. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9431. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9432. 5 sign of xn-component
  9433. 6 x of xn-component
  9434. 7 sign of y-component
  9435. 8 y of y-component
  9436. */
  9437. match[1] = match[1].toLowerCase();
  9438. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9439. // nth-* requires argument
  9440. if ( !match[3] ) {
  9441. Sizzle.error( match[0] );
  9442. }
  9443. // numeric x and y parameters for Expr.filter.CHILD
  9444. // remember that false/true cast respectively to 0/1
  9445. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9446. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9447. // other types prohibit arguments
  9448. } else if ( match[3] ) {
  9449. Sizzle.error( match[0] );
  9450. }
  9451. return match;
  9452. },
  9453. "PSEUDO": function( match ) {
  9454. var excess,
  9455. unquoted = !match[6] && match[2];
  9456. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9457. return null;
  9458. }
  9459. // Accept quoted arguments as-is
  9460. if ( match[3] ) {
  9461. match[2] = match[4] || match[5] || "";
  9462. // Strip excess characters from unquoted arguments
  9463. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9464. // Get excess from tokenize (recursively)
  9465. (excess = tokenize( unquoted, true )) &&
  9466. // advance to the next closing parenthesis
  9467. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9468. // excess is a negative index
  9469. match[0] = match[0].slice( 0, excess );
  9470. match[2] = unquoted.slice( 0, excess );
  9471. }
  9472. // Return only captures needed by the pseudo filter method (type and argument)
  9473. return match.slice( 0, 3 );
  9474. }
  9475. },
  9476. filter: {
  9477. "TAG": function( nodeNameSelector ) {
  9478. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9479. return nodeNameSelector === "*" ?
  9480. function() { return true; } :
  9481. function( elem ) {
  9482. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9483. };
  9484. },
  9485. "CLASS": function( className ) {
  9486. var pattern = classCache[ className + " " ];
  9487. return pattern ||
  9488. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9489. classCache( className, function( elem ) {
  9490. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9491. });
  9492. },
  9493. "ATTR": function( name, operator, check ) {
  9494. return function( elem ) {
  9495. var result = Sizzle.attr( elem, name );
  9496. if ( result == null ) {
  9497. return operator === "!=";
  9498. }
  9499. if ( !operator ) {
  9500. return true;
  9501. }
  9502. result += "";
  9503. return operator === "=" ? result === check :
  9504. operator === "!=" ? result !== check :
  9505. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9506. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9507. operator === "$=" ? check && result.slice( -check.length ) === check :
  9508. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9509. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9510. false;
  9511. };
  9512. },
  9513. "CHILD": function( type, what, argument, first, last ) {
  9514. var simple = type.slice( 0, 3 ) !== "nth",
  9515. forward = type.slice( -4 ) !== "last",
  9516. ofType = what === "of-type";
  9517. return first === 1 && last === 0 ?
  9518. // Shortcut for :nth-*(n)
  9519. function( elem ) {
  9520. return !!elem.parentNode;
  9521. } :
  9522. function( elem, context, xml ) {
  9523. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9524. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9525. parent = elem.parentNode,
  9526. name = ofType && elem.nodeName.toLowerCase(),
  9527. useCache = !xml && !ofType,
  9528. diff = false;
  9529. if ( parent ) {
  9530. // :(first|last|only)-(child|of-type)
  9531. if ( simple ) {
  9532. while ( dir ) {
  9533. node = elem;
  9534. while ( (node = node[ dir ]) ) {
  9535. if ( ofType ?
  9536. node.nodeName.toLowerCase() === name :
  9537. node.nodeType === 1 ) {
  9538. return false;
  9539. }
  9540. }
  9541. // Reverse direction for :only-* (if we haven't yet done so)
  9542. start = dir = type === "only" && !start && "nextSibling";
  9543. }
  9544. return true;
  9545. }
  9546. start = [ forward ? parent.firstChild : parent.lastChild ];
  9547. // non-xml :nth-child(...) stores cache data on `parent`
  9548. if ( forward && useCache ) {
  9549. // Seek `elem` from a previously-cached index
  9550. // ...in a gzip-friendly way
  9551. node = parent;
  9552. outerCache = node[ expando ] || (node[ expando ] = {});
  9553. // Support: IE <9 only
  9554. // Defend against cloned attroperties (jQuery gh-1709)
  9555. uniqueCache = outerCache[ node.uniqueID ] ||
  9556. (outerCache[ node.uniqueID ] = {});
  9557. cache = uniqueCache[ type ] || [];
  9558. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9559. diff = nodeIndex && cache[ 2 ];
  9560. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9561. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9562. // Fallback to seeking `elem` from the start
  9563. (diff = nodeIndex = 0) || start.pop()) ) {
  9564. // When found, cache indexes on `parent` and break
  9565. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9566. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9567. break;
  9568. }
  9569. }
  9570. } else {
  9571. // Use previously-cached element index if available
  9572. if ( useCache ) {
  9573. // ...in a gzip-friendly way
  9574. node = elem;
  9575. outerCache = node[ expando ] || (node[ expando ] = {});
  9576. // Support: IE <9 only
  9577. // Defend against cloned attroperties (jQuery gh-1709)
  9578. uniqueCache = outerCache[ node.uniqueID ] ||
  9579. (outerCache[ node.uniqueID ] = {});
  9580. cache = uniqueCache[ type ] || [];
  9581. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9582. diff = nodeIndex;
  9583. }
  9584. // xml :nth-child(...)
  9585. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9586. if ( diff === false ) {
  9587. // Use the same loop as above to seek `elem` from the start
  9588. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9589. (diff = nodeIndex = 0) || start.pop()) ) {
  9590. if ( ( ofType ?
  9591. node.nodeName.toLowerCase() === name :
  9592. node.nodeType === 1 ) &&
  9593. ++diff ) {
  9594. // Cache the index of each encountered element
  9595. if ( useCache ) {
  9596. outerCache = node[ expando ] || (node[ expando ] = {});
  9597. // Support: IE <9 only
  9598. // Defend against cloned attroperties (jQuery gh-1709)
  9599. uniqueCache = outerCache[ node.uniqueID ] ||
  9600. (outerCache[ node.uniqueID ] = {});
  9601. uniqueCache[ type ] = [ dirruns, diff ];
  9602. }
  9603. if ( node === elem ) {
  9604. break;
  9605. }
  9606. }
  9607. }
  9608. }
  9609. }
  9610. // Incorporate the offset, then check against cycle size
  9611. diff -= last;
  9612. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9613. }
  9614. };
  9615. },
  9616. "PSEUDO": function( pseudo, argument ) {
  9617. // pseudo-class names are case-insensitive
  9618. // http://www.w3.org/TR/selectors/#pseudo-classes
  9619. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9620. // Remember that setFilters inherits from pseudos
  9621. var args,
  9622. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9623. Sizzle.error( "unsupported pseudo: " + pseudo );
  9624. // The user may use createPseudo to indicate that
  9625. // arguments are needed to create the filter function
  9626. // just as Sizzle does
  9627. if ( fn[ expando ] ) {
  9628. return fn( argument );
  9629. }
  9630. // But maintain support for old signatures
  9631. if ( fn.length > 1 ) {
  9632. args = [ pseudo, pseudo, "", argument ];
  9633. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9634. markFunction(function( seed, matches ) {
  9635. var idx,
  9636. matched = fn( seed, argument ),
  9637. i = matched.length;
  9638. while ( i-- ) {
  9639. idx = indexOf( seed, matched[i] );
  9640. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9641. }
  9642. }) :
  9643. function( elem ) {
  9644. return fn( elem, 0, args );
  9645. };
  9646. }
  9647. return fn;
  9648. }
  9649. },
  9650. pseudos: {
  9651. // Potentially complex pseudos
  9652. "not": markFunction(function( selector ) {
  9653. // Trim the selector passed to compile
  9654. // to avoid treating leading and trailing
  9655. // spaces as combinators
  9656. var input = [],
  9657. results = [],
  9658. matcher = compile( selector.replace( rtrim, "$1" ) );
  9659. return matcher[ expando ] ?
  9660. markFunction(function( seed, matches, context, xml ) {
  9661. var elem,
  9662. unmatched = matcher( seed, null, xml, [] ),
  9663. i = seed.length;
  9664. // Match elements unmatched by `matcher`
  9665. while ( i-- ) {
  9666. if ( (elem = unmatched[i]) ) {
  9667. seed[i] = !(matches[i] = elem);
  9668. }
  9669. }
  9670. }) :
  9671. function( elem, context, xml ) {
  9672. input[0] = elem;
  9673. matcher( input, null, xml, results );
  9674. // Don't keep the element (issue #299)
  9675. input[0] = null;
  9676. return !results.pop();
  9677. };
  9678. }),
  9679. "has": markFunction(function( selector ) {
  9680. return function( elem ) {
  9681. return Sizzle( selector, elem ).length > 0;
  9682. };
  9683. }),
  9684. "contains": markFunction(function( text ) {
  9685. text = text.replace( runescape, funescape );
  9686. return function( elem ) {
  9687. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9688. };
  9689. }),
  9690. // "Whether an element is represented by a :lang() selector
  9691. // is based solely on the element's language value
  9692. // being equal to the identifier C,
  9693. // or beginning with the identifier C immediately followed by "-".
  9694. // The matching of C against the element's language value is performed case-insensitively.
  9695. // The identifier C does not have to be a valid language name."
  9696. // http://www.w3.org/TR/selectors/#lang-pseudo
  9697. "lang": markFunction( function( lang ) {
  9698. // lang value must be a valid identifier
  9699. if ( !ridentifier.test(lang || "") ) {
  9700. Sizzle.error( "unsupported lang: " + lang );
  9701. }
  9702. lang = lang.replace( runescape, funescape ).toLowerCase();
  9703. return function( elem ) {
  9704. var elemLang;
  9705. do {
  9706. if ( (elemLang = documentIsHTML ?
  9707. elem.lang :
  9708. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9709. elemLang = elemLang.toLowerCase();
  9710. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9711. }
  9712. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9713. return false;
  9714. };
  9715. }),
  9716. // Miscellaneous
  9717. "target": function( elem ) {
  9718. var hash = window.location && window.location.hash;
  9719. return hash && hash.slice( 1 ) === elem.id;
  9720. },
  9721. "root": function( elem ) {
  9722. return elem === docElem;
  9723. },
  9724. "focus": function( elem ) {
  9725. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9726. },
  9727. // Boolean properties
  9728. "enabled": createDisabledPseudo( false ),
  9729. "disabled": createDisabledPseudo( true ),
  9730. "checked": function( elem ) {
  9731. // In CSS3, :checked should return both checked and selected elements
  9732. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9733. var nodeName = elem.nodeName.toLowerCase();
  9734. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9735. },
  9736. "selected": function( elem ) {
  9737. // Accessing this property makes selected-by-default
  9738. // options in Safari work properly
  9739. if ( elem.parentNode ) {
  9740. elem.parentNode.selectedIndex;
  9741. }
  9742. return elem.selected === true;
  9743. },
  9744. // Contents
  9745. "empty": function( elem ) {
  9746. // http://www.w3.org/TR/selectors/#empty-pseudo
  9747. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9748. // but not by others (comment: 8; processing instruction: 7; etc.)
  9749. // nodeType < 6 works because attributes (2) do not appear as children
  9750. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9751. if ( elem.nodeType < 6 ) {
  9752. return false;
  9753. }
  9754. }
  9755. return true;
  9756. },
  9757. "parent": function( elem ) {
  9758. return !Expr.pseudos["empty"]( elem );
  9759. },
  9760. // Element/input types
  9761. "header": function( elem ) {
  9762. return rheader.test( elem.nodeName );
  9763. },
  9764. "input": function( elem ) {
  9765. return rinputs.test( elem.nodeName );
  9766. },
  9767. "button": function( elem ) {
  9768. var name = elem.nodeName.toLowerCase();
  9769. return name === "input" && elem.type === "button" || name === "button";
  9770. },
  9771. "text": function( elem ) {
  9772. var attr;
  9773. return elem.nodeName.toLowerCase() === "input" &&
  9774. elem.type === "text" &&
  9775. // Support: IE<8
  9776. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9777. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9778. },
  9779. // Position-in-collection
  9780. "first": createPositionalPseudo(function() {
  9781. return [ 0 ];
  9782. }),
  9783. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9784. return [ length - 1 ];
  9785. }),
  9786. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9787. return [ argument < 0 ? argument + length : argument ];
  9788. }),
  9789. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9790. var i = 0;
  9791. for ( ; i < length; i += 2 ) {
  9792. matchIndexes.push( i );
  9793. }
  9794. return matchIndexes;
  9795. }),
  9796. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9797. var i = 1;
  9798. for ( ; i < length; i += 2 ) {
  9799. matchIndexes.push( i );
  9800. }
  9801. return matchIndexes;
  9802. }),
  9803. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9804. var i = argument < 0 ?
  9805. argument + length :
  9806. argument > length ?
  9807. length :
  9808. argument;
  9809. for ( ; --i >= 0; ) {
  9810. matchIndexes.push( i );
  9811. }
  9812. return matchIndexes;
  9813. }),
  9814. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9815. var i = argument < 0 ? argument + length : argument;
  9816. for ( ; ++i < length; ) {
  9817. matchIndexes.push( i );
  9818. }
  9819. return matchIndexes;
  9820. })
  9821. }
  9822. };
  9823. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  9824. // Add button/input type pseudos
  9825. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  9826. Expr.pseudos[ i ] = createInputPseudo( i );
  9827. }
  9828. for ( i in { submit: true, reset: true } ) {
  9829. Expr.pseudos[ i ] = createButtonPseudo( i );
  9830. }
  9831. // Easy API for creating new setFilters
  9832. function setFilters() {}
  9833. setFilters.prototype = Expr.filters = Expr.pseudos;
  9834. Expr.setFilters = new setFilters();
  9835. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  9836. var matched, match, tokens, type,
  9837. soFar, groups, preFilters,
  9838. cached = tokenCache[ selector + " " ];
  9839. if ( cached ) {
  9840. return parseOnly ? 0 : cached.slice( 0 );
  9841. }
  9842. soFar = selector;
  9843. groups = [];
  9844. preFilters = Expr.preFilter;
  9845. while ( soFar ) {
  9846. // Comma and first run
  9847. if ( !matched || (match = rcomma.exec( soFar )) ) {
  9848. if ( match ) {
  9849. // Don't consume trailing commas as valid
  9850. soFar = soFar.slice( match[0].length ) || soFar;
  9851. }
  9852. groups.push( (tokens = []) );
  9853. }
  9854. matched = false;
  9855. // Combinators
  9856. if ( (match = rcombinators.exec( soFar )) ) {
  9857. matched = match.shift();
  9858. tokens.push({
  9859. value: matched,
  9860. // Cast descendant combinators to space
  9861. type: match[0].replace( rtrim, " " )
  9862. });
  9863. soFar = soFar.slice( matched.length );
  9864. }
  9865. // Filters
  9866. for ( type in Expr.filter ) {
  9867. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  9868. (match = preFilters[ type ]( match ))) ) {
  9869. matched = match.shift();
  9870. tokens.push({
  9871. value: matched,
  9872. type: type,
  9873. matches: match
  9874. });
  9875. soFar = soFar.slice( matched.length );
  9876. }
  9877. }
  9878. if ( !matched ) {
  9879. break;
  9880. }
  9881. }
  9882. // Return the length of the invalid excess
  9883. // if we're just parsing
  9884. // Otherwise, throw an error or return tokens
  9885. return parseOnly ?
  9886. soFar.length :
  9887. soFar ?
  9888. Sizzle.error( selector ) :
  9889. // Cache the tokens
  9890. tokenCache( selector, groups ).slice( 0 );
  9891. };
  9892. function toSelector( tokens ) {
  9893. var i = 0,
  9894. len = tokens.length,
  9895. selector = "";
  9896. for ( ; i < len; i++ ) {
  9897. selector += tokens[i].value;
  9898. }
  9899. return selector;
  9900. }
  9901. function addCombinator( matcher, combinator, base ) {
  9902. var dir = combinator.dir,
  9903. skip = combinator.next,
  9904. key = skip || dir,
  9905. checkNonElements = base && key === "parentNode",
  9906. doneName = done++;
  9907. return combinator.first ?
  9908. // Check against closest ancestor/preceding element
  9909. function( elem, context, xml ) {
  9910. while ( (elem = elem[ dir ]) ) {
  9911. if ( elem.nodeType === 1 || checkNonElements ) {
  9912. return matcher( elem, context, xml );
  9913. }
  9914. }
  9915. return false;
  9916. } :
  9917. // Check against all ancestor/preceding elements
  9918. function( elem, context, xml ) {
  9919. var oldCache, uniqueCache, outerCache,
  9920. newCache = [ dirruns, doneName ];
  9921. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  9922. if ( xml ) {
  9923. while ( (elem = elem[ dir ]) ) {
  9924. if ( elem.nodeType === 1 || checkNonElements ) {
  9925. if ( matcher( elem, context, xml ) ) {
  9926. return true;
  9927. }
  9928. }
  9929. }
  9930. } else {
  9931. while ( (elem = elem[ dir ]) ) {
  9932. if ( elem.nodeType === 1 || checkNonElements ) {
  9933. outerCache = elem[ expando ] || (elem[ expando ] = {});
  9934. // Support: IE <9 only
  9935. // Defend against cloned attroperties (jQuery gh-1709)
  9936. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  9937. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  9938. elem = elem[ dir ] || elem;
  9939. } else if ( (oldCache = uniqueCache[ key ]) &&
  9940. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  9941. // Assign to newCache so results back-propagate to previous elements
  9942. return (newCache[ 2 ] = oldCache[ 2 ]);
  9943. } else {
  9944. // Reuse newcache so results back-propagate to previous elements
  9945. uniqueCache[ key ] = newCache;
  9946. // A match means we're done; a fail means we have to keep checking
  9947. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  9948. return true;
  9949. }
  9950. }
  9951. }
  9952. }
  9953. }
  9954. return false;
  9955. };
  9956. }
  9957. function elementMatcher( matchers ) {
  9958. return matchers.length > 1 ?
  9959. function( elem, context, xml ) {
  9960. var i = matchers.length;
  9961. while ( i-- ) {
  9962. if ( !matchers[i]( elem, context, xml ) ) {
  9963. return false;
  9964. }
  9965. }
  9966. return true;
  9967. } :
  9968. matchers[0];
  9969. }
  9970. function multipleContexts( selector, contexts, results ) {
  9971. var i = 0,
  9972. len = contexts.length;
  9973. for ( ; i < len; i++ ) {
  9974. Sizzle( selector, contexts[i], results );
  9975. }
  9976. return results;
  9977. }
  9978. function condense( unmatched, map, filter, context, xml ) {
  9979. var elem,
  9980. newUnmatched = [],
  9981. i = 0,
  9982. len = unmatched.length,
  9983. mapped = map != null;
  9984. for ( ; i < len; i++ ) {
  9985. if ( (elem = unmatched[i]) ) {
  9986. if ( !filter || filter( elem, context, xml ) ) {
  9987. newUnmatched.push( elem );
  9988. if ( mapped ) {
  9989. map.push( i );
  9990. }
  9991. }
  9992. }
  9993. }
  9994. return newUnmatched;
  9995. }
  9996. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  9997. if ( postFilter && !postFilter[ expando ] ) {
  9998. postFilter = setMatcher( postFilter );
  9999. }
  10000. if ( postFinder && !postFinder[ expando ] ) {
  10001. postFinder = setMatcher( postFinder, postSelector );
  10002. }
  10003. return markFunction(function( seed, results, context, xml ) {
  10004. var temp, i, elem,
  10005. preMap = [],
  10006. postMap = [],
  10007. preexisting = results.length,
  10008. // Get initial elements from seed or context
  10009. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10010. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10011. matcherIn = preFilter && ( seed || !selector ) ?
  10012. condense( elems, preMap, preFilter, context, xml ) :
  10013. elems,
  10014. matcherOut = matcher ?
  10015. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10016. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10017. // ...intermediate processing is necessary
  10018. [] :
  10019. // ...otherwise use results directly
  10020. results :
  10021. matcherIn;
  10022. // Find primary matches
  10023. if ( matcher ) {
  10024. matcher( matcherIn, matcherOut, context, xml );
  10025. }
  10026. // Apply postFilter
  10027. if ( postFilter ) {
  10028. temp = condense( matcherOut, postMap );
  10029. postFilter( temp, [], context, xml );
  10030. // Un-match failing elements by moving them back to matcherIn
  10031. i = temp.length;
  10032. while ( i-- ) {
  10033. if ( (elem = temp[i]) ) {
  10034. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10035. }
  10036. }
  10037. }
  10038. if ( seed ) {
  10039. if ( postFinder || preFilter ) {
  10040. if ( postFinder ) {
  10041. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10042. temp = [];
  10043. i = matcherOut.length;
  10044. while ( i-- ) {
  10045. if ( (elem = matcherOut[i]) ) {
  10046. // Restore matcherIn since elem is not yet a final match
  10047. temp.push( (matcherIn[i] = elem) );
  10048. }
  10049. }
  10050. postFinder( null, (matcherOut = []), temp, xml );
  10051. }
  10052. // Move matched elements from seed to results to keep them synchronized
  10053. i = matcherOut.length;
  10054. while ( i-- ) {
  10055. if ( (elem = matcherOut[i]) &&
  10056. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10057. seed[temp] = !(results[temp] = elem);
  10058. }
  10059. }
  10060. }
  10061. // Add elements to results, through postFinder if defined
  10062. } else {
  10063. matcherOut = condense(
  10064. matcherOut === results ?
  10065. matcherOut.splice( preexisting, matcherOut.length ) :
  10066. matcherOut
  10067. );
  10068. if ( postFinder ) {
  10069. postFinder( null, results, matcherOut, xml );
  10070. } else {
  10071. push.apply( results, matcherOut );
  10072. }
  10073. }
  10074. });
  10075. }
  10076. function matcherFromTokens( tokens ) {
  10077. var checkContext, matcher, j,
  10078. len = tokens.length,
  10079. leadingRelative = Expr.relative[ tokens[0].type ],
  10080. implicitRelative = leadingRelative || Expr.relative[" "],
  10081. i = leadingRelative ? 1 : 0,
  10082. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10083. matchContext = addCombinator( function( elem ) {
  10084. return elem === checkContext;
  10085. }, implicitRelative, true ),
  10086. matchAnyContext = addCombinator( function( elem ) {
  10087. return indexOf( checkContext, elem ) > -1;
  10088. }, implicitRelative, true ),
  10089. matchers = [ function( elem, context, xml ) {
  10090. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10091. (checkContext = context).nodeType ?
  10092. matchContext( elem, context, xml ) :
  10093. matchAnyContext( elem, context, xml ) );
  10094. // Avoid hanging onto element (issue #299)
  10095. checkContext = null;
  10096. return ret;
  10097. } ];
  10098. for ( ; i < len; i++ ) {
  10099. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10100. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10101. } else {
  10102. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10103. // Return special upon seeing a positional matcher
  10104. if ( matcher[ expando ] ) {
  10105. // Find the next relative operator (if any) for proper handling
  10106. j = ++i;
  10107. for ( ; j < len; j++ ) {
  10108. if ( Expr.relative[ tokens[j].type ] ) {
  10109. break;
  10110. }
  10111. }
  10112. return setMatcher(
  10113. i > 1 && elementMatcher( matchers ),
  10114. i > 1 && toSelector(
  10115. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10116. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10117. ).replace( rtrim, "$1" ),
  10118. matcher,
  10119. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10120. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10121. j < len && toSelector( tokens )
  10122. );
  10123. }
  10124. matchers.push( matcher );
  10125. }
  10126. }
  10127. return elementMatcher( matchers );
  10128. }
  10129. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10130. var bySet = setMatchers.length > 0,
  10131. byElement = elementMatchers.length > 0,
  10132. superMatcher = function( seed, context, xml, results, outermost ) {
  10133. var elem, j, matcher,
  10134. matchedCount = 0,
  10135. i = "0",
  10136. unmatched = seed && [],
  10137. setMatched = [],
  10138. contextBackup = outermostContext,
  10139. // We must always have either seed elements or outermost context
  10140. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10141. // Use integer dirruns iff this is the outermost matcher
  10142. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10143. len = elems.length;
  10144. if ( outermost ) {
  10145. outermostContext = context === document || context || outermost;
  10146. }
  10147. // Add elements passing elementMatchers directly to results
  10148. // Support: IE<9, Safari
  10149. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10150. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10151. if ( byElement && elem ) {
  10152. j = 0;
  10153. if ( !context && elem.ownerDocument !== document ) {
  10154. setDocument( elem );
  10155. xml = !documentIsHTML;
  10156. }
  10157. while ( (matcher = elementMatchers[j++]) ) {
  10158. if ( matcher( elem, context || document, xml) ) {
  10159. results.push( elem );
  10160. break;
  10161. }
  10162. }
  10163. if ( outermost ) {
  10164. dirruns = dirrunsUnique;
  10165. }
  10166. }
  10167. // Track unmatched elements for set filters
  10168. if ( bySet ) {
  10169. // They will have gone through all possible matchers
  10170. if ( (elem = !matcher && elem) ) {
  10171. matchedCount--;
  10172. }
  10173. // Lengthen the array for every element, matched or not
  10174. if ( seed ) {
  10175. unmatched.push( elem );
  10176. }
  10177. }
  10178. }
  10179. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10180. // makes the latter nonnegative.
  10181. matchedCount += i;
  10182. // Apply set filters to unmatched elements
  10183. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10184. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10185. // no element matchers and no seed.
  10186. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10187. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10188. // numerically zero.
  10189. if ( bySet && i !== matchedCount ) {
  10190. j = 0;
  10191. while ( (matcher = setMatchers[j++]) ) {
  10192. matcher( unmatched, setMatched, context, xml );
  10193. }
  10194. if ( seed ) {
  10195. // Reintegrate element matches to eliminate the need for sorting
  10196. if ( matchedCount > 0 ) {
  10197. while ( i-- ) {
  10198. if ( !(unmatched[i] || setMatched[i]) ) {
  10199. setMatched[i] = pop.call( results );
  10200. }
  10201. }
  10202. }
  10203. // Discard index placeholder values to get only actual matches
  10204. setMatched = condense( setMatched );
  10205. }
  10206. // Add matches to results
  10207. push.apply( results, setMatched );
  10208. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10209. if ( outermost && !seed && setMatched.length > 0 &&
  10210. ( matchedCount + setMatchers.length ) > 1 ) {
  10211. Sizzle.uniqueSort( results );
  10212. }
  10213. }
  10214. // Override manipulation of globals by nested matchers
  10215. if ( outermost ) {
  10216. dirruns = dirrunsUnique;
  10217. outermostContext = contextBackup;
  10218. }
  10219. return unmatched;
  10220. };
  10221. return bySet ?
  10222. markFunction( superMatcher ) :
  10223. superMatcher;
  10224. }
  10225. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10226. var i,
  10227. setMatchers = [],
  10228. elementMatchers = [],
  10229. cached = compilerCache[ selector + " " ];
  10230. if ( !cached ) {
  10231. // Generate a function of recursive functions that can be used to check each element
  10232. if ( !match ) {
  10233. match = tokenize( selector );
  10234. }
  10235. i = match.length;
  10236. while ( i-- ) {
  10237. cached = matcherFromTokens( match[i] );
  10238. if ( cached[ expando ] ) {
  10239. setMatchers.push( cached );
  10240. } else {
  10241. elementMatchers.push( cached );
  10242. }
  10243. }
  10244. // Cache the compiled function
  10245. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10246. // Save selector and tokenization
  10247. cached.selector = selector;
  10248. }
  10249. return cached;
  10250. };
  10251. /**
  10252. * A low-level selection function that works with Sizzle's compiled
  10253. * selector functions
  10254. * @param {String|Function} selector A selector or a pre-compiled
  10255. * selector function built with Sizzle.compile
  10256. * @param {Element} context
  10257. * @param {Array} [results]
  10258. * @param {Array} [seed] A set of elements to match against
  10259. */
  10260. select = Sizzle.select = function( selector, context, results, seed ) {
  10261. var i, tokens, token, type, find,
  10262. compiled = typeof selector === "function" && selector,
  10263. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10264. results = results || [];
  10265. // Try to minimize operations if there is only one selector in the list and no seed
  10266. // (the latter of which guarantees us context)
  10267. if ( match.length === 1 ) {
  10268. // Reduce context if the leading compound selector is an ID
  10269. tokens = match[0] = match[0].slice( 0 );
  10270. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10271. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10272. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10273. if ( !context ) {
  10274. return results;
  10275. // Precompiled matchers will still verify ancestry, so step up a level
  10276. } else if ( compiled ) {
  10277. context = context.parentNode;
  10278. }
  10279. selector = selector.slice( tokens.shift().value.length );
  10280. }
  10281. // Fetch a seed set for right-to-left matching
  10282. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10283. while ( i-- ) {
  10284. token = tokens[i];
  10285. // Abort if we hit a combinator
  10286. if ( Expr.relative[ (type = token.type) ] ) {
  10287. break;
  10288. }
  10289. if ( (find = Expr.find[ type ]) ) {
  10290. // Search, expanding context for leading sibling combinators
  10291. if ( (seed = find(
  10292. token.matches[0].replace( runescape, funescape ),
  10293. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10294. )) ) {
  10295. // If seed is empty or no tokens remain, we can return early
  10296. tokens.splice( i, 1 );
  10297. selector = seed.length && toSelector( tokens );
  10298. if ( !selector ) {
  10299. push.apply( results, seed );
  10300. return results;
  10301. }
  10302. break;
  10303. }
  10304. }
  10305. }
  10306. }
  10307. // Compile and execute a filtering function if one is not provided
  10308. // Provide `match` to avoid retokenization if we modified the selector above
  10309. ( compiled || compile( selector, match ) )(
  10310. seed,
  10311. context,
  10312. !documentIsHTML,
  10313. results,
  10314. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10315. );
  10316. return results;
  10317. };
  10318. // One-time assignments
  10319. // Sort stability
  10320. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10321. // Support: Chrome 14-35+
  10322. // Always assume duplicates if they aren't passed to the comparison function
  10323. support.detectDuplicates = !!hasDuplicate;
  10324. // Initialize against the default document
  10325. setDocument();
  10326. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10327. // Detached nodes confoundingly follow *each other*
  10328. support.sortDetached = assert(function( el ) {
  10329. // Should return 1, but returns 4 (following)
  10330. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10331. });
  10332. // Support: IE<8
  10333. // Prevent attribute/property "interpolation"
  10334. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10335. if ( !assert(function( el ) {
  10336. el.innerHTML = "<a href='#'></a>";
  10337. return el.firstChild.getAttribute("href") === "#" ;
  10338. }) ) {
  10339. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10340. if ( !isXML ) {
  10341. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10342. }
  10343. });
  10344. }
  10345. // Support: IE<9
  10346. // Use defaultValue in place of getAttribute("value")
  10347. if ( !support.attributes || !assert(function( el ) {
  10348. el.innerHTML = "<input/>";
  10349. el.firstChild.setAttribute( "value", "" );
  10350. return el.firstChild.getAttribute( "value" ) === "";
  10351. }) ) {
  10352. addHandle( "value", function( elem, name, isXML ) {
  10353. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10354. return elem.defaultValue;
  10355. }
  10356. });
  10357. }
  10358. // Support: IE<9
  10359. // Use getAttributeNode to fetch booleans when getAttribute lies
  10360. if ( !assert(function( el ) {
  10361. return el.getAttribute("disabled") == null;
  10362. }) ) {
  10363. addHandle( booleans, function( elem, name, isXML ) {
  10364. var val;
  10365. if ( !isXML ) {
  10366. return elem[ name ] === true ? name.toLowerCase() :
  10367. (val = elem.getAttributeNode( name )) && val.specified ?
  10368. val.value :
  10369. null;
  10370. }
  10371. });
  10372. }
  10373. return Sizzle;
  10374. })( window );
  10375. jQuery.find = Sizzle;
  10376. jQuery.expr = Sizzle.selectors;
  10377. // Deprecated
  10378. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10379. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10380. jQuery.text = Sizzle.getText;
  10381. jQuery.isXMLDoc = Sizzle.isXML;
  10382. jQuery.contains = Sizzle.contains;
  10383. jQuery.escapeSelector = Sizzle.escape;
  10384. var dir = function( elem, dir, until ) {
  10385. var matched = [],
  10386. truncate = until !== undefined;
  10387. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10388. if ( elem.nodeType === 1 ) {
  10389. if ( truncate && jQuery( elem ).is( until ) ) {
  10390. break;
  10391. }
  10392. matched.push( elem );
  10393. }
  10394. }
  10395. return matched;
  10396. };
  10397. var siblings = function( n, elem ) {
  10398. var matched = [];
  10399. for ( ; n; n = n.nextSibling ) {
  10400. if ( n.nodeType === 1 && n !== elem ) {
  10401. matched.push( n );
  10402. }
  10403. }
  10404. return matched;
  10405. };
  10406. var rneedsContext = jQuery.expr.match.needsContext;
  10407. function nodeName( elem, name ) {
  10408. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10409. };
  10410. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10411. // Implement the identical functionality for filter and not
  10412. function winnow( elements, qualifier, not ) {
  10413. if ( isFunction( qualifier ) ) {
  10414. return jQuery.grep( elements, function( elem, i ) {
  10415. return !!qualifier.call( elem, i, elem ) !== not;
  10416. } );
  10417. }
  10418. // Single element
  10419. if ( qualifier.nodeType ) {
  10420. return jQuery.grep( elements, function( elem ) {
  10421. return ( elem === qualifier ) !== not;
  10422. } );
  10423. }
  10424. // Arraylike of elements (jQuery, arguments, Array)
  10425. if ( typeof qualifier !== "string" ) {
  10426. return jQuery.grep( elements, function( elem ) {
  10427. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10428. } );
  10429. }
  10430. // Filtered directly for both simple and complex selectors
  10431. return jQuery.filter( qualifier, elements, not );
  10432. }
  10433. jQuery.filter = function( expr, elems, not ) {
  10434. var elem = elems[ 0 ];
  10435. if ( not ) {
  10436. expr = ":not(" + expr + ")";
  10437. }
  10438. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10439. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10440. }
  10441. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10442. return elem.nodeType === 1;
  10443. } ) );
  10444. };
  10445. jQuery.fn.extend( {
  10446. find: function( selector ) {
  10447. var i, ret,
  10448. len = this.length,
  10449. self = this;
  10450. if ( typeof selector !== "string" ) {
  10451. return this.pushStack( jQuery( selector ).filter( function() {
  10452. for ( i = 0; i < len; i++ ) {
  10453. if ( jQuery.contains( self[ i ], this ) ) {
  10454. return true;
  10455. }
  10456. }
  10457. } ) );
  10458. }
  10459. ret = this.pushStack( [] );
  10460. for ( i = 0; i < len; i++ ) {
  10461. jQuery.find( selector, self[ i ], ret );
  10462. }
  10463. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10464. },
  10465. filter: function( selector ) {
  10466. return this.pushStack( winnow( this, selector || [], false ) );
  10467. },
  10468. not: function( selector ) {
  10469. return this.pushStack( winnow( this, selector || [], true ) );
  10470. },
  10471. is: function( selector ) {
  10472. return !!winnow(
  10473. this,
  10474. // If this is a positional/relative selector, check membership in the returned set
  10475. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10476. typeof selector === "string" && rneedsContext.test( selector ) ?
  10477. jQuery( selector ) :
  10478. selector || [],
  10479. false
  10480. ).length;
  10481. }
  10482. } );
  10483. // Initialize a jQuery object
  10484. // A central reference to the root jQuery(document)
  10485. var rootjQuery,
  10486. // A simple way to check for HTML strings
  10487. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10488. // Strict HTML recognition (#11290: must start with <)
  10489. // Shortcut simple #id case for speed
  10490. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10491. init = jQuery.fn.init = function( selector, context, root ) {
  10492. var match, elem;
  10493. // HANDLE: $(""), $(null), $(undefined), $(false)
  10494. if ( !selector ) {
  10495. return this;
  10496. }
  10497. // Method init() accepts an alternate rootjQuery
  10498. // so migrate can support jQuery.sub (gh-2101)
  10499. root = root || rootjQuery;
  10500. // Handle HTML strings
  10501. if ( typeof selector === "string" ) {
  10502. if ( selector[ 0 ] === "<" &&
  10503. selector[ selector.length - 1 ] === ">" &&
  10504. selector.length >= 3 ) {
  10505. // Assume that strings that start and end with <> are HTML and skip the regex check
  10506. match = [ null, selector, null ];
  10507. } else {
  10508. match = rquickExpr.exec( selector );
  10509. }
  10510. // Match html or make sure no context is specified for #id
  10511. if ( match && ( match[ 1 ] || !context ) ) {
  10512. // HANDLE: $(html) -> $(array)
  10513. if ( match[ 1 ] ) {
  10514. context = context instanceof jQuery ? context[ 0 ] : context;
  10515. // Option to run scripts is true for back-compat
  10516. // Intentionally let the error be thrown if parseHTML is not present
  10517. jQuery.merge( this, jQuery.parseHTML(
  10518. match[ 1 ],
  10519. context && context.nodeType ? context.ownerDocument || context : document,
  10520. true
  10521. ) );
  10522. // HANDLE: $(html, props)
  10523. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10524. for ( match in context ) {
  10525. // Properties of context are called as methods if possible
  10526. if ( isFunction( this[ match ] ) ) {
  10527. this[ match ]( context[ match ] );
  10528. // ...and otherwise set as attributes
  10529. } else {
  10530. this.attr( match, context[ match ] );
  10531. }
  10532. }
  10533. }
  10534. return this;
  10535. // HANDLE: $(#id)
  10536. } else {
  10537. elem = document.getElementById( match[ 2 ] );
  10538. if ( elem ) {
  10539. // Inject the element directly into the jQuery object
  10540. this[ 0 ] = elem;
  10541. this.length = 1;
  10542. }
  10543. return this;
  10544. }
  10545. // HANDLE: $(expr, $(...))
  10546. } else if ( !context || context.jquery ) {
  10547. return ( context || root ).find( selector );
  10548. // HANDLE: $(expr, context)
  10549. // (which is just equivalent to: $(context).find(expr)
  10550. } else {
  10551. return this.constructor( context ).find( selector );
  10552. }
  10553. // HANDLE: $(DOMElement)
  10554. } else if ( selector.nodeType ) {
  10555. this[ 0 ] = selector;
  10556. this.length = 1;
  10557. return this;
  10558. // HANDLE: $(function)
  10559. // Shortcut for document ready
  10560. } else if ( isFunction( selector ) ) {
  10561. return root.ready !== undefined ?
  10562. root.ready( selector ) :
  10563. // Execute immediately if ready is not present
  10564. selector( jQuery );
  10565. }
  10566. return jQuery.makeArray( selector, this );
  10567. };
  10568. // Give the init function the jQuery prototype for later instantiation
  10569. init.prototype = jQuery.fn;
  10570. // Initialize central reference
  10571. rootjQuery = jQuery( document );
  10572. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10573. // Methods guaranteed to produce a unique set when starting from a unique set
  10574. guaranteedUnique = {
  10575. children: true,
  10576. contents: true,
  10577. next: true,
  10578. prev: true
  10579. };
  10580. jQuery.fn.extend( {
  10581. has: function( target ) {
  10582. var targets = jQuery( target, this ),
  10583. l = targets.length;
  10584. return this.filter( function() {
  10585. var i = 0;
  10586. for ( ; i < l; i++ ) {
  10587. if ( jQuery.contains( this, targets[ i ] ) ) {
  10588. return true;
  10589. }
  10590. }
  10591. } );
  10592. },
  10593. closest: function( selectors, context ) {
  10594. var cur,
  10595. i = 0,
  10596. l = this.length,
  10597. matched = [],
  10598. targets = typeof selectors !== "string" && jQuery( selectors );
  10599. // Positional selectors never match, since there's no _selection_ context
  10600. if ( !rneedsContext.test( selectors ) ) {
  10601. for ( ; i < l; i++ ) {
  10602. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10603. // Always skip document fragments
  10604. if ( cur.nodeType < 11 && ( targets ?
  10605. targets.index( cur ) > -1 :
  10606. // Don't pass non-elements to Sizzle
  10607. cur.nodeType === 1 &&
  10608. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10609. matched.push( cur );
  10610. break;
  10611. }
  10612. }
  10613. }
  10614. }
  10615. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10616. },
  10617. // Determine the position of an element within the set
  10618. index: function( elem ) {
  10619. // No argument, return index in parent
  10620. if ( !elem ) {
  10621. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10622. }
  10623. // Index in selector
  10624. if ( typeof elem === "string" ) {
  10625. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10626. }
  10627. // Locate the position of the desired element
  10628. return indexOf.call( this,
  10629. // If it receives a jQuery object, the first element is used
  10630. elem.jquery ? elem[ 0 ] : elem
  10631. );
  10632. },
  10633. add: function( selector, context ) {
  10634. return this.pushStack(
  10635. jQuery.uniqueSort(
  10636. jQuery.merge( this.get(), jQuery( selector, context ) )
  10637. )
  10638. );
  10639. },
  10640. addBack: function( selector ) {
  10641. return this.add( selector == null ?
  10642. this.prevObject : this.prevObject.filter( selector )
  10643. );
  10644. }
  10645. } );
  10646. function sibling( cur, dir ) {
  10647. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10648. return cur;
  10649. }
  10650. jQuery.each( {
  10651. parent: function( elem ) {
  10652. var parent = elem.parentNode;
  10653. return parent && parent.nodeType !== 11 ? parent : null;
  10654. },
  10655. parents: function( elem ) {
  10656. return dir( elem, "parentNode" );
  10657. },
  10658. parentsUntil: function( elem, i, until ) {
  10659. return dir( elem, "parentNode", until );
  10660. },
  10661. next: function( elem ) {
  10662. return sibling( elem, "nextSibling" );
  10663. },
  10664. prev: function( elem ) {
  10665. return sibling( elem, "previousSibling" );
  10666. },
  10667. nextAll: function( elem ) {
  10668. return dir( elem, "nextSibling" );
  10669. },
  10670. prevAll: function( elem ) {
  10671. return dir( elem, "previousSibling" );
  10672. },
  10673. nextUntil: function( elem, i, until ) {
  10674. return dir( elem, "nextSibling", until );
  10675. },
  10676. prevUntil: function( elem, i, until ) {
  10677. return dir( elem, "previousSibling", until );
  10678. },
  10679. siblings: function( elem ) {
  10680. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10681. },
  10682. children: function( elem ) {
  10683. return siblings( elem.firstChild );
  10684. },
  10685. contents: function( elem ) {
  10686. if ( typeof elem.contentDocument !== "undefined" ) {
  10687. return elem.contentDocument;
  10688. }
  10689. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10690. // Treat the template element as a regular one in browsers that
  10691. // don't support it.
  10692. if ( nodeName( elem, "template" ) ) {
  10693. elem = elem.content || elem;
  10694. }
  10695. return jQuery.merge( [], elem.childNodes );
  10696. }
  10697. }, function( name, fn ) {
  10698. jQuery.fn[ name ] = function( until, selector ) {
  10699. var matched = jQuery.map( this, fn, until );
  10700. if ( name.slice( -5 ) !== "Until" ) {
  10701. selector = until;
  10702. }
  10703. if ( selector && typeof selector === "string" ) {
  10704. matched = jQuery.filter( selector, matched );
  10705. }
  10706. if ( this.length > 1 ) {
  10707. // Remove duplicates
  10708. if ( !guaranteedUnique[ name ] ) {
  10709. jQuery.uniqueSort( matched );
  10710. }
  10711. // Reverse order for parents* and prev-derivatives
  10712. if ( rparentsprev.test( name ) ) {
  10713. matched.reverse();
  10714. }
  10715. }
  10716. return this.pushStack( matched );
  10717. };
  10718. } );
  10719. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10720. // Convert String-formatted options into Object-formatted ones
  10721. function createOptions( options ) {
  10722. var object = {};
  10723. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10724. object[ flag ] = true;
  10725. } );
  10726. return object;
  10727. }
  10728. /*
  10729. * Create a callback list using the following parameters:
  10730. *
  10731. * options: an optional list of space-separated options that will change how
  10732. * the callback list behaves or a more traditional option object
  10733. *
  10734. * By default a callback list will act like an event callback list and can be
  10735. * "fired" multiple times.
  10736. *
  10737. * Possible options:
  10738. *
  10739. * once: will ensure the callback list can only be fired once (like a Deferred)
  10740. *
  10741. * memory: will keep track of previous values and will call any callback added
  10742. * after the list has been fired right away with the latest "memorized"
  10743. * values (like a Deferred)
  10744. *
  10745. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10746. *
  10747. * stopOnFalse: interrupt callings when a callback returns false
  10748. *
  10749. */
  10750. jQuery.Callbacks = function( options ) {
  10751. // Convert options from String-formatted to Object-formatted if needed
  10752. // (we check in cache first)
  10753. options = typeof options === "string" ?
  10754. createOptions( options ) :
  10755. jQuery.extend( {}, options );
  10756. var // Flag to know if list is currently firing
  10757. firing,
  10758. // Last fire value for non-forgettable lists
  10759. memory,
  10760. // Flag to know if list was already fired
  10761. fired,
  10762. // Flag to prevent firing
  10763. locked,
  10764. // Actual callback list
  10765. list = [],
  10766. // Queue of execution data for repeatable lists
  10767. queue = [],
  10768. // Index of currently firing callback (modified by add/remove as needed)
  10769. firingIndex = -1,
  10770. // Fire callbacks
  10771. fire = function() {
  10772. // Enforce single-firing
  10773. locked = locked || options.once;
  10774. // Execute callbacks for all pending executions,
  10775. // respecting firingIndex overrides and runtime changes
  10776. fired = firing = true;
  10777. for ( ; queue.length; firingIndex = -1 ) {
  10778. memory = queue.shift();
  10779. while ( ++firingIndex < list.length ) {
  10780. // Run callback and check for early termination
  10781. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10782. options.stopOnFalse ) {
  10783. // Jump to end and forget the data so .add doesn't re-fire
  10784. firingIndex = list.length;
  10785. memory = false;
  10786. }
  10787. }
  10788. }
  10789. // Forget the data if we're done with it
  10790. if ( !options.memory ) {
  10791. memory = false;
  10792. }
  10793. firing = false;
  10794. // Clean up if we're done firing for good
  10795. if ( locked ) {
  10796. // Keep an empty list if we have data for future add calls
  10797. if ( memory ) {
  10798. list = [];
  10799. // Otherwise, this object is spent
  10800. } else {
  10801. list = "";
  10802. }
  10803. }
  10804. },
  10805. // Actual Callbacks object
  10806. self = {
  10807. // Add a callback or a collection of callbacks to the list
  10808. add: function() {
  10809. if ( list ) {
  10810. // If we have memory from a past run, we should fire after adding
  10811. if ( memory && !firing ) {
  10812. firingIndex = list.length - 1;
  10813. queue.push( memory );
  10814. }
  10815. ( function add( args ) {
  10816. jQuery.each( args, function( _, arg ) {
  10817. if ( isFunction( arg ) ) {
  10818. if ( !options.unique || !self.has( arg ) ) {
  10819. list.push( arg );
  10820. }
  10821. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  10822. // Inspect recursively
  10823. add( arg );
  10824. }
  10825. } );
  10826. } )( arguments );
  10827. if ( memory && !firing ) {
  10828. fire();
  10829. }
  10830. }
  10831. return this;
  10832. },
  10833. // Remove a callback from the list
  10834. remove: function() {
  10835. jQuery.each( arguments, function( _, arg ) {
  10836. var index;
  10837. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  10838. list.splice( index, 1 );
  10839. // Handle firing indexes
  10840. if ( index <= firingIndex ) {
  10841. firingIndex--;
  10842. }
  10843. }
  10844. } );
  10845. return this;
  10846. },
  10847. // Check if a given callback is in the list.
  10848. // If no argument is given, return whether or not list has callbacks attached.
  10849. has: function( fn ) {
  10850. return fn ?
  10851. jQuery.inArray( fn, list ) > -1 :
  10852. list.length > 0;
  10853. },
  10854. // Remove all callbacks from the list
  10855. empty: function() {
  10856. if ( list ) {
  10857. list = [];
  10858. }
  10859. return this;
  10860. },
  10861. // Disable .fire and .add
  10862. // Abort any current/pending executions
  10863. // Clear all callbacks and values
  10864. disable: function() {
  10865. locked = queue = [];
  10866. list = memory = "";
  10867. return this;
  10868. },
  10869. disabled: function() {
  10870. return !list;
  10871. },
  10872. // Disable .fire
  10873. // Also disable .add unless we have memory (since it would have no effect)
  10874. // Abort any pending executions
  10875. lock: function() {
  10876. locked = queue = [];
  10877. if ( !memory && !firing ) {
  10878. list = memory = "";
  10879. }
  10880. return this;
  10881. },
  10882. locked: function() {
  10883. return !!locked;
  10884. },
  10885. // Call all callbacks with the given context and arguments
  10886. fireWith: function( context, args ) {
  10887. if ( !locked ) {
  10888. args = args || [];
  10889. args = [ context, args.slice ? args.slice() : args ];
  10890. queue.push( args );
  10891. if ( !firing ) {
  10892. fire();
  10893. }
  10894. }
  10895. return this;
  10896. },
  10897. // Call all the callbacks with the given arguments
  10898. fire: function() {
  10899. self.fireWith( this, arguments );
  10900. return this;
  10901. },
  10902. // To know if the callbacks have already been called at least once
  10903. fired: function() {
  10904. return !!fired;
  10905. }
  10906. };
  10907. return self;
  10908. };
  10909. function Identity( v ) {
  10910. return v;
  10911. }
  10912. function Thrower( ex ) {
  10913. throw ex;
  10914. }
  10915. function adoptValue( value, resolve, reject, noValue ) {
  10916. var method;
  10917. try {
  10918. // Check for promise aspect first to privilege synchronous behavior
  10919. if ( value && isFunction( ( method = value.promise ) ) ) {
  10920. method.call( value ).done( resolve ).fail( reject );
  10921. // Other thenables
  10922. } else if ( value && isFunction( ( method = value.then ) ) ) {
  10923. method.call( value, resolve, reject );
  10924. // Other non-thenables
  10925. } else {
  10926. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  10927. // * false: [ value ].slice( 0 ) => resolve( value )
  10928. // * true: [ value ].slice( 1 ) => resolve()
  10929. resolve.apply( undefined, [ value ].slice( noValue ) );
  10930. }
  10931. // For Promises/A+, convert exceptions into rejections
  10932. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  10933. // Deferred#then to conditionally suppress rejection.
  10934. } catch ( value ) {
  10935. // Support: Android 4.0 only
  10936. // Strict mode functions invoked without .call/.apply get global-object context
  10937. reject.apply( undefined, [ value ] );
  10938. }
  10939. }
  10940. jQuery.extend( {
  10941. Deferred: function( func ) {
  10942. var tuples = [
  10943. // action, add listener, callbacks,
  10944. // ... .then handlers, argument index, [final state]
  10945. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  10946. jQuery.Callbacks( "memory" ), 2 ],
  10947. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  10948. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  10949. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  10950. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  10951. ],
  10952. state = "pending",
  10953. promise = {
  10954. state: function() {
  10955. return state;
  10956. },
  10957. always: function() {
  10958. deferred.done( arguments ).fail( arguments );
  10959. return this;
  10960. },
  10961. "catch": function( fn ) {
  10962. return promise.then( null, fn );
  10963. },
  10964. // Keep pipe for back-compat
  10965. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  10966. var fns = arguments;
  10967. return jQuery.Deferred( function( newDefer ) {
  10968. jQuery.each( tuples, function( i, tuple ) {
  10969. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  10970. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  10971. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  10972. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  10973. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  10974. deferred[ tuple[ 1 ] ]( function() {
  10975. var returned = fn && fn.apply( this, arguments );
  10976. if ( returned && isFunction( returned.promise ) ) {
  10977. returned.promise()
  10978. .progress( newDefer.notify )
  10979. .done( newDefer.resolve )
  10980. .fail( newDefer.reject );
  10981. } else {
  10982. newDefer[ tuple[ 0 ] + "With" ](
  10983. this,
  10984. fn ? [ returned ] : arguments
  10985. );
  10986. }
  10987. } );
  10988. } );
  10989. fns = null;
  10990. } ).promise();
  10991. },
  10992. then: function( onFulfilled, onRejected, onProgress ) {
  10993. var maxDepth = 0;
  10994. function resolve( depth, deferred, handler, special ) {
  10995. return function() {
  10996. var that = this,
  10997. args = arguments,
  10998. mightThrow = function() {
  10999. var returned, then;
  11000. // Support: Promises/A+ section 2.3.3.3.3
  11001. // https://promisesaplus.com/#point-59
  11002. // Ignore double-resolution attempts
  11003. if ( depth < maxDepth ) {
  11004. return;
  11005. }
  11006. returned = handler.apply( that, args );
  11007. // Support: Promises/A+ section 2.3.1
  11008. // https://promisesaplus.com/#point-48
  11009. if ( returned === deferred.promise() ) {
  11010. throw new TypeError( "Thenable self-resolution" );
  11011. }
  11012. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11013. // https://promisesaplus.com/#point-54
  11014. // https://promisesaplus.com/#point-75
  11015. // Retrieve `then` only once
  11016. then = returned &&
  11017. // Support: Promises/A+ section 2.3.4
  11018. // https://promisesaplus.com/#point-64
  11019. // Only check objects and functions for thenability
  11020. ( typeof returned === "object" ||
  11021. typeof returned === "function" ) &&
  11022. returned.then;
  11023. // Handle a returned thenable
  11024. if ( isFunction( then ) ) {
  11025. // Special processors (notify) just wait for resolution
  11026. if ( special ) {
  11027. then.call(
  11028. returned,
  11029. resolve( maxDepth, deferred, Identity, special ),
  11030. resolve( maxDepth, deferred, Thrower, special )
  11031. );
  11032. // Normal processors (resolve) also hook into progress
  11033. } else {
  11034. // ...and disregard older resolution values
  11035. maxDepth++;
  11036. then.call(
  11037. returned,
  11038. resolve( maxDepth, deferred, Identity, special ),
  11039. resolve( maxDepth, deferred, Thrower, special ),
  11040. resolve( maxDepth, deferred, Identity,
  11041. deferred.notifyWith )
  11042. );
  11043. }
  11044. // Handle all other returned values
  11045. } else {
  11046. // Only substitute handlers pass on context
  11047. // and multiple values (non-spec behavior)
  11048. if ( handler !== Identity ) {
  11049. that = undefined;
  11050. args = [ returned ];
  11051. }
  11052. // Process the value(s)
  11053. // Default process is resolve
  11054. ( special || deferred.resolveWith )( that, args );
  11055. }
  11056. },
  11057. // Only normal processors (resolve) catch and reject exceptions
  11058. process = special ?
  11059. mightThrow :
  11060. function() {
  11061. try {
  11062. mightThrow();
  11063. } catch ( e ) {
  11064. if ( jQuery.Deferred.exceptionHook ) {
  11065. jQuery.Deferred.exceptionHook( e,
  11066. process.stackTrace );
  11067. }
  11068. // Support: Promises/A+ section 2.3.3.3.4.1
  11069. // https://promisesaplus.com/#point-61
  11070. // Ignore post-resolution exceptions
  11071. if ( depth + 1 >= maxDepth ) {
  11072. // Only substitute handlers pass on context
  11073. // and multiple values (non-spec behavior)
  11074. if ( handler !== Thrower ) {
  11075. that = undefined;
  11076. args = [ e ];
  11077. }
  11078. deferred.rejectWith( that, args );
  11079. }
  11080. }
  11081. };
  11082. // Support: Promises/A+ section 2.3.3.3.1
  11083. // https://promisesaplus.com/#point-57
  11084. // Re-resolve promises immediately to dodge false rejection from
  11085. // subsequent errors
  11086. if ( depth ) {
  11087. process();
  11088. } else {
  11089. // Call an optional hook to record the stack, in case of exception
  11090. // since it's otherwise lost when execution goes async
  11091. if ( jQuery.Deferred.getStackHook ) {
  11092. process.stackTrace = jQuery.Deferred.getStackHook();
  11093. }
  11094. window.setTimeout( process );
  11095. }
  11096. };
  11097. }
  11098. return jQuery.Deferred( function( newDefer ) {
  11099. // progress_handlers.add( ... )
  11100. tuples[ 0 ][ 3 ].add(
  11101. resolve(
  11102. 0,
  11103. newDefer,
  11104. isFunction( onProgress ) ?
  11105. onProgress :
  11106. Identity,
  11107. newDefer.notifyWith
  11108. )
  11109. );
  11110. // fulfilled_handlers.add( ... )
  11111. tuples[ 1 ][ 3 ].add(
  11112. resolve(
  11113. 0,
  11114. newDefer,
  11115. isFunction( onFulfilled ) ?
  11116. onFulfilled :
  11117. Identity
  11118. )
  11119. );
  11120. // rejected_handlers.add( ... )
  11121. tuples[ 2 ][ 3 ].add(
  11122. resolve(
  11123. 0,
  11124. newDefer,
  11125. isFunction( onRejected ) ?
  11126. onRejected :
  11127. Thrower
  11128. )
  11129. );
  11130. } ).promise();
  11131. },
  11132. // Get a promise for this deferred
  11133. // If obj is provided, the promise aspect is added to the object
  11134. promise: function( obj ) {
  11135. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11136. }
  11137. },
  11138. deferred = {};
  11139. // Add list-specific methods
  11140. jQuery.each( tuples, function( i, tuple ) {
  11141. var list = tuple[ 2 ],
  11142. stateString = tuple[ 5 ];
  11143. // promise.progress = list.add
  11144. // promise.done = list.add
  11145. // promise.fail = list.add
  11146. promise[ tuple[ 1 ] ] = list.add;
  11147. // Handle state
  11148. if ( stateString ) {
  11149. list.add(
  11150. function() {
  11151. // state = "resolved" (i.e., fulfilled)
  11152. // state = "rejected"
  11153. state = stateString;
  11154. },
  11155. // rejected_callbacks.disable
  11156. // fulfilled_callbacks.disable
  11157. tuples[ 3 - i ][ 2 ].disable,
  11158. // rejected_handlers.disable
  11159. // fulfilled_handlers.disable
  11160. tuples[ 3 - i ][ 3 ].disable,
  11161. // progress_callbacks.lock
  11162. tuples[ 0 ][ 2 ].lock,
  11163. // progress_handlers.lock
  11164. tuples[ 0 ][ 3 ].lock
  11165. );
  11166. }
  11167. // progress_handlers.fire
  11168. // fulfilled_handlers.fire
  11169. // rejected_handlers.fire
  11170. list.add( tuple[ 3 ].fire );
  11171. // deferred.notify = function() { deferred.notifyWith(...) }
  11172. // deferred.resolve = function() { deferred.resolveWith(...) }
  11173. // deferred.reject = function() { deferred.rejectWith(...) }
  11174. deferred[ tuple[ 0 ] ] = function() {
  11175. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11176. return this;
  11177. };
  11178. // deferred.notifyWith = list.fireWith
  11179. // deferred.resolveWith = list.fireWith
  11180. // deferred.rejectWith = list.fireWith
  11181. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11182. } );
  11183. // Make the deferred a promise
  11184. promise.promise( deferred );
  11185. // Call given func if any
  11186. if ( func ) {
  11187. func.call( deferred, deferred );
  11188. }
  11189. // All done!
  11190. return deferred;
  11191. },
  11192. // Deferred helper
  11193. when: function( singleValue ) {
  11194. var
  11195. // count of uncompleted subordinates
  11196. remaining = arguments.length,
  11197. // count of unprocessed arguments
  11198. i = remaining,
  11199. // subordinate fulfillment data
  11200. resolveContexts = Array( i ),
  11201. resolveValues = slice.call( arguments ),
  11202. // the master Deferred
  11203. master = jQuery.Deferred(),
  11204. // subordinate callback factory
  11205. updateFunc = function( i ) {
  11206. return function( value ) {
  11207. resolveContexts[ i ] = this;
  11208. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11209. if ( !( --remaining ) ) {
  11210. master.resolveWith( resolveContexts, resolveValues );
  11211. }
  11212. };
  11213. };
  11214. // Single- and empty arguments are adopted like Promise.resolve
  11215. if ( remaining <= 1 ) {
  11216. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11217. !remaining );
  11218. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11219. if ( master.state() === "pending" ||
  11220. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11221. return master.then();
  11222. }
  11223. }
  11224. // Multiple arguments are aggregated like Promise.all array elements
  11225. while ( i-- ) {
  11226. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11227. }
  11228. return master.promise();
  11229. }
  11230. } );
  11231. // These usually indicate a programmer mistake during development,
  11232. // warn about them ASAP rather than swallowing them by default.
  11233. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11234. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11235. // Support: IE 8 - 9 only
  11236. // Console exists when dev tools are open, which can happen at any time
  11237. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11238. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11239. }
  11240. };
  11241. jQuery.readyException = function( error ) {
  11242. window.setTimeout( function() {
  11243. throw error;
  11244. } );
  11245. };
  11246. // The deferred used on DOM ready
  11247. var readyList = jQuery.Deferred();
  11248. jQuery.fn.ready = function( fn ) {
  11249. readyList
  11250. .then( fn )
  11251. // Wrap jQuery.readyException in a function so that the lookup
  11252. // happens at the time of error handling instead of callback
  11253. // registration.
  11254. .catch( function( error ) {
  11255. jQuery.readyException( error );
  11256. } );
  11257. return this;
  11258. };
  11259. jQuery.extend( {
  11260. // Is the DOM ready to be used? Set to true once it occurs.
  11261. isReady: false,
  11262. // A counter to track how many items to wait for before
  11263. // the ready event fires. See #6781
  11264. readyWait: 1,
  11265. // Handle when the DOM is ready
  11266. ready: function( wait ) {
  11267. // Abort if there are pending holds or we're already ready
  11268. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11269. return;
  11270. }
  11271. // Remember that the DOM is ready
  11272. jQuery.isReady = true;
  11273. // If a normal DOM Ready event fired, decrement, and wait if need be
  11274. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11275. return;
  11276. }
  11277. // If there are functions bound, to execute
  11278. readyList.resolveWith( document, [ jQuery ] );
  11279. }
  11280. } );
  11281. jQuery.ready.then = readyList.then;
  11282. // The ready event handler and self cleanup method
  11283. function completed() {
  11284. document.removeEventListener( "DOMContentLoaded", completed );
  11285. window.removeEventListener( "load", completed );
  11286. jQuery.ready();
  11287. }
  11288. // Catch cases where $(document).ready() is called
  11289. // after the browser event has already occurred.
  11290. // Support: IE <=9 - 10 only
  11291. // Older IE sometimes signals "interactive" too soon
  11292. if ( document.readyState === "complete" ||
  11293. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11294. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11295. window.setTimeout( jQuery.ready );
  11296. } else {
  11297. // Use the handy event callback
  11298. document.addEventListener( "DOMContentLoaded", completed );
  11299. // A fallback to window.onload, that will always work
  11300. window.addEventListener( "load", completed );
  11301. }
  11302. // Multifunctional method to get and set values of a collection
  11303. // The value/s can optionally be executed if it's a function
  11304. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11305. var i = 0,
  11306. len = elems.length,
  11307. bulk = key == null;
  11308. // Sets many values
  11309. if ( toType( key ) === "object" ) {
  11310. chainable = true;
  11311. for ( i in key ) {
  11312. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11313. }
  11314. // Sets one value
  11315. } else if ( value !== undefined ) {
  11316. chainable = true;
  11317. if ( !isFunction( value ) ) {
  11318. raw = true;
  11319. }
  11320. if ( bulk ) {
  11321. // Bulk operations run against the entire set
  11322. if ( raw ) {
  11323. fn.call( elems, value );
  11324. fn = null;
  11325. // ...except when executing function values
  11326. } else {
  11327. bulk = fn;
  11328. fn = function( elem, key, value ) {
  11329. return bulk.call( jQuery( elem ), value );
  11330. };
  11331. }
  11332. }
  11333. if ( fn ) {
  11334. for ( ; i < len; i++ ) {
  11335. fn(
  11336. elems[ i ], key, raw ?
  11337. value :
  11338. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11339. );
  11340. }
  11341. }
  11342. }
  11343. if ( chainable ) {
  11344. return elems;
  11345. }
  11346. // Gets
  11347. if ( bulk ) {
  11348. return fn.call( elems );
  11349. }
  11350. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11351. };
  11352. // Matches dashed string for camelizing
  11353. var rmsPrefix = /^-ms-/,
  11354. rdashAlpha = /-([a-z])/g;
  11355. // Used by camelCase as callback to replace()
  11356. function fcamelCase( all, letter ) {
  11357. return letter.toUpperCase();
  11358. }
  11359. // Convert dashed to camelCase; used by the css and data modules
  11360. // Support: IE <=9 - 11, Edge 12 - 15
  11361. // Microsoft forgot to hump their vendor prefix (#9572)
  11362. function camelCase( string ) {
  11363. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11364. }
  11365. var acceptData = function( owner ) {
  11366. // Accepts only:
  11367. // - Node
  11368. // - Node.ELEMENT_NODE
  11369. // - Node.DOCUMENT_NODE
  11370. // - Object
  11371. // - Any
  11372. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11373. };
  11374. function Data() {
  11375. this.expando = jQuery.expando + Data.uid++;
  11376. }
  11377. Data.uid = 1;
  11378. Data.prototype = {
  11379. cache: function( owner ) {
  11380. // Check if the owner object already has a cache
  11381. var value = owner[ this.expando ];
  11382. // If not, create one
  11383. if ( !value ) {
  11384. value = {};
  11385. // We can accept data for non-element nodes in modern browsers,
  11386. // but we should not, see #8335.
  11387. // Always return an empty object.
  11388. if ( acceptData( owner ) ) {
  11389. // If it is a node unlikely to be stringify-ed or looped over
  11390. // use plain assignment
  11391. if ( owner.nodeType ) {
  11392. owner[ this.expando ] = value;
  11393. // Otherwise secure it in a non-enumerable property
  11394. // configurable must be true to allow the property to be
  11395. // deleted when data is removed
  11396. } else {
  11397. Object.defineProperty( owner, this.expando, {
  11398. value: value,
  11399. configurable: true
  11400. } );
  11401. }
  11402. }
  11403. }
  11404. return value;
  11405. },
  11406. set: function( owner, data, value ) {
  11407. var prop,
  11408. cache = this.cache( owner );
  11409. // Handle: [ owner, key, value ] args
  11410. // Always use camelCase key (gh-2257)
  11411. if ( typeof data === "string" ) {
  11412. cache[ camelCase( data ) ] = value;
  11413. // Handle: [ owner, { properties } ] args
  11414. } else {
  11415. // Copy the properties one-by-one to the cache object
  11416. for ( prop in data ) {
  11417. cache[ camelCase( prop ) ] = data[ prop ];
  11418. }
  11419. }
  11420. return cache;
  11421. },
  11422. get: function( owner, key ) {
  11423. return key === undefined ?
  11424. this.cache( owner ) :
  11425. // Always use camelCase key (gh-2257)
  11426. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11427. },
  11428. access: function( owner, key, value ) {
  11429. // In cases where either:
  11430. //
  11431. // 1. No key was specified
  11432. // 2. A string key was specified, but no value provided
  11433. //
  11434. // Take the "read" path and allow the get method to determine
  11435. // which value to return, respectively either:
  11436. //
  11437. // 1. The entire cache object
  11438. // 2. The data stored at the key
  11439. //
  11440. if ( key === undefined ||
  11441. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11442. return this.get( owner, key );
  11443. }
  11444. // When the key is not a string, or both a key and value
  11445. // are specified, set or extend (existing objects) with either:
  11446. //
  11447. // 1. An object of properties
  11448. // 2. A key and value
  11449. //
  11450. this.set( owner, key, value );
  11451. // Since the "set" path can have two possible entry points
  11452. // return the expected data based on which path was taken[*]
  11453. return value !== undefined ? value : key;
  11454. },
  11455. remove: function( owner, key ) {
  11456. var i,
  11457. cache = owner[ this.expando ];
  11458. if ( cache === undefined ) {
  11459. return;
  11460. }
  11461. if ( key !== undefined ) {
  11462. // Support array or space separated string of keys
  11463. if ( Array.isArray( key ) ) {
  11464. // If key is an array of keys...
  11465. // We always set camelCase keys, so remove that.
  11466. key = key.map( camelCase );
  11467. } else {
  11468. key = camelCase( key );
  11469. // If a key with the spaces exists, use it.
  11470. // Otherwise, create an array by matching non-whitespace
  11471. key = key in cache ?
  11472. [ key ] :
  11473. ( key.match( rnothtmlwhite ) || [] );
  11474. }
  11475. i = key.length;
  11476. while ( i-- ) {
  11477. delete cache[ key[ i ] ];
  11478. }
  11479. }
  11480. // Remove the expando if there's no more data
  11481. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11482. // Support: Chrome <=35 - 45
  11483. // Webkit & Blink performance suffers when deleting properties
  11484. // from DOM nodes, so set to undefined instead
  11485. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11486. if ( owner.nodeType ) {
  11487. owner[ this.expando ] = undefined;
  11488. } else {
  11489. delete owner[ this.expando ];
  11490. }
  11491. }
  11492. },
  11493. hasData: function( owner ) {
  11494. var cache = owner[ this.expando ];
  11495. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11496. }
  11497. };
  11498. var dataPriv = new Data();
  11499. var dataUser = new Data();
  11500. // Implementation Summary
  11501. //
  11502. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11503. // 2. Improve the module's maintainability by reducing the storage
  11504. // paths to a single mechanism.
  11505. // 3. Use the same single mechanism to support "private" and "user" data.
  11506. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11507. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11508. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11509. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11510. rmultiDash = /[A-Z]/g;
  11511. function getData( data ) {
  11512. if ( data === "true" ) {
  11513. return true;
  11514. }
  11515. if ( data === "false" ) {
  11516. return false;
  11517. }
  11518. if ( data === "null" ) {
  11519. return null;
  11520. }
  11521. // Only convert to a number if it doesn't change the string
  11522. if ( data === +data + "" ) {
  11523. return +data;
  11524. }
  11525. if ( rbrace.test( data ) ) {
  11526. return JSON.parse( data );
  11527. }
  11528. return data;
  11529. }
  11530. function dataAttr( elem, key, data ) {
  11531. var name;
  11532. // If nothing was found internally, try to fetch any
  11533. // data from the HTML5 data-* attribute
  11534. if ( data === undefined && elem.nodeType === 1 ) {
  11535. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11536. data = elem.getAttribute( name );
  11537. if ( typeof data === "string" ) {
  11538. try {
  11539. data = getData( data );
  11540. } catch ( e ) {}
  11541. // Make sure we set the data so it isn't changed later
  11542. dataUser.set( elem, key, data );
  11543. } else {
  11544. data = undefined;
  11545. }
  11546. }
  11547. return data;
  11548. }
  11549. jQuery.extend( {
  11550. hasData: function( elem ) {
  11551. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11552. },
  11553. data: function( elem, name, data ) {
  11554. return dataUser.access( elem, name, data );
  11555. },
  11556. removeData: function( elem, name ) {
  11557. dataUser.remove( elem, name );
  11558. },
  11559. // TODO: Now that all calls to _data and _removeData have been replaced
  11560. // with direct calls to dataPriv methods, these can be deprecated.
  11561. _data: function( elem, name, data ) {
  11562. return dataPriv.access( elem, name, data );
  11563. },
  11564. _removeData: function( elem, name ) {
  11565. dataPriv.remove( elem, name );
  11566. }
  11567. } );
  11568. jQuery.fn.extend( {
  11569. data: function( key, value ) {
  11570. var i, name, data,
  11571. elem = this[ 0 ],
  11572. attrs = elem && elem.attributes;
  11573. // Gets all values
  11574. if ( key === undefined ) {
  11575. if ( this.length ) {
  11576. data = dataUser.get( elem );
  11577. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11578. i = attrs.length;
  11579. while ( i-- ) {
  11580. // Support: IE 11 only
  11581. // The attrs elements can be null (#14894)
  11582. if ( attrs[ i ] ) {
  11583. name = attrs[ i ].name;
  11584. if ( name.indexOf( "data-" ) === 0 ) {
  11585. name = camelCase( name.slice( 5 ) );
  11586. dataAttr( elem, name, data[ name ] );
  11587. }
  11588. }
  11589. }
  11590. dataPriv.set( elem, "hasDataAttrs", true );
  11591. }
  11592. }
  11593. return data;
  11594. }
  11595. // Sets multiple values
  11596. if ( typeof key === "object" ) {
  11597. return this.each( function() {
  11598. dataUser.set( this, key );
  11599. } );
  11600. }
  11601. return access( this, function( value ) {
  11602. var data;
  11603. // The calling jQuery object (element matches) is not empty
  11604. // (and therefore has an element appears at this[ 0 ]) and the
  11605. // `value` parameter was not undefined. An empty jQuery object
  11606. // will result in `undefined` for elem = this[ 0 ] which will
  11607. // throw an exception if an attempt to read a data cache is made.
  11608. if ( elem && value === undefined ) {
  11609. // Attempt to get data from the cache
  11610. // The key will always be camelCased in Data
  11611. data = dataUser.get( elem, key );
  11612. if ( data !== undefined ) {
  11613. return data;
  11614. }
  11615. // Attempt to "discover" the data in
  11616. // HTML5 custom data-* attrs
  11617. data = dataAttr( elem, key );
  11618. if ( data !== undefined ) {
  11619. return data;
  11620. }
  11621. // We tried really hard, but the data doesn't exist.
  11622. return;
  11623. }
  11624. // Set the data...
  11625. this.each( function() {
  11626. // We always store the camelCased key
  11627. dataUser.set( this, key, value );
  11628. } );
  11629. }, null, value, arguments.length > 1, null, true );
  11630. },
  11631. removeData: function( key ) {
  11632. return this.each( function() {
  11633. dataUser.remove( this, key );
  11634. } );
  11635. }
  11636. } );
  11637. jQuery.extend( {
  11638. queue: function( elem, type, data ) {
  11639. var queue;
  11640. if ( elem ) {
  11641. type = ( type || "fx" ) + "queue";
  11642. queue = dataPriv.get( elem, type );
  11643. // Speed up dequeue by getting out quickly if this is just a lookup
  11644. if ( data ) {
  11645. if ( !queue || Array.isArray( data ) ) {
  11646. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11647. } else {
  11648. queue.push( data );
  11649. }
  11650. }
  11651. return queue || [];
  11652. }
  11653. },
  11654. dequeue: function( elem, type ) {
  11655. type = type || "fx";
  11656. var queue = jQuery.queue( elem, type ),
  11657. startLength = queue.length,
  11658. fn = queue.shift(),
  11659. hooks = jQuery._queueHooks( elem, type ),
  11660. next = function() {
  11661. jQuery.dequeue( elem, type );
  11662. };
  11663. // If the fx queue is dequeued, always remove the progress sentinel
  11664. if ( fn === "inprogress" ) {
  11665. fn = queue.shift();
  11666. startLength--;
  11667. }
  11668. if ( fn ) {
  11669. // Add a progress sentinel to prevent the fx queue from being
  11670. // automatically dequeued
  11671. if ( type === "fx" ) {
  11672. queue.unshift( "inprogress" );
  11673. }
  11674. // Clear up the last queue stop function
  11675. delete hooks.stop;
  11676. fn.call( elem, next, hooks );
  11677. }
  11678. if ( !startLength && hooks ) {
  11679. hooks.empty.fire();
  11680. }
  11681. },
  11682. // Not public - generate a queueHooks object, or return the current one
  11683. _queueHooks: function( elem, type ) {
  11684. var key = type + "queueHooks";
  11685. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11686. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11687. dataPriv.remove( elem, [ type + "queue", key ] );
  11688. } )
  11689. } );
  11690. }
  11691. } );
  11692. jQuery.fn.extend( {
  11693. queue: function( type, data ) {
  11694. var setter = 2;
  11695. if ( typeof type !== "string" ) {
  11696. data = type;
  11697. type = "fx";
  11698. setter--;
  11699. }
  11700. if ( arguments.length < setter ) {
  11701. return jQuery.queue( this[ 0 ], type );
  11702. }
  11703. return data === undefined ?
  11704. this :
  11705. this.each( function() {
  11706. var queue = jQuery.queue( this, type, data );
  11707. // Ensure a hooks for this queue
  11708. jQuery._queueHooks( this, type );
  11709. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11710. jQuery.dequeue( this, type );
  11711. }
  11712. } );
  11713. },
  11714. dequeue: function( type ) {
  11715. return this.each( function() {
  11716. jQuery.dequeue( this, type );
  11717. } );
  11718. },
  11719. clearQueue: function( type ) {
  11720. return this.queue( type || "fx", [] );
  11721. },
  11722. // Get a promise resolved when queues of a certain type
  11723. // are emptied (fx is the type by default)
  11724. promise: function( type, obj ) {
  11725. var tmp,
  11726. count = 1,
  11727. defer = jQuery.Deferred(),
  11728. elements = this,
  11729. i = this.length,
  11730. resolve = function() {
  11731. if ( !( --count ) ) {
  11732. defer.resolveWith( elements, [ elements ] );
  11733. }
  11734. };
  11735. if ( typeof type !== "string" ) {
  11736. obj = type;
  11737. type = undefined;
  11738. }
  11739. type = type || "fx";
  11740. while ( i-- ) {
  11741. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11742. if ( tmp && tmp.empty ) {
  11743. count++;
  11744. tmp.empty.add( resolve );
  11745. }
  11746. }
  11747. resolve();
  11748. return defer.promise( obj );
  11749. }
  11750. } );
  11751. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11752. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11753. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11754. var documentElement = document.documentElement;
  11755. var isAttached = function( elem ) {
  11756. return jQuery.contains( elem.ownerDocument, elem );
  11757. },
  11758. composed = { composed: true };
  11759. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11760. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11761. // Support: iOS 10.0-10.2 only
  11762. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11763. // leading to errors. We need to check for `getRootNode`.
  11764. if ( documentElement.getRootNode ) {
  11765. isAttached = function( elem ) {
  11766. return jQuery.contains( elem.ownerDocument, elem ) ||
  11767. elem.getRootNode( composed ) === elem.ownerDocument;
  11768. };
  11769. }
  11770. var isHiddenWithinTree = function( elem, el ) {
  11771. // isHiddenWithinTree might be called from jQuery#filter function;
  11772. // in that case, element will be second argument
  11773. elem = el || elem;
  11774. // Inline style trumps all
  11775. return elem.style.display === "none" ||
  11776. elem.style.display === "" &&
  11777. // Otherwise, check computed style
  11778. // Support: Firefox <=43 - 45
  11779. // Disconnected elements can have computed display: none, so first confirm that elem is
  11780. // in the document.
  11781. isAttached( elem ) &&
  11782. jQuery.css( elem, "display" ) === "none";
  11783. };
  11784. var swap = function( elem, options, callback, args ) {
  11785. var ret, name,
  11786. old = {};
  11787. // Remember the old values, and insert the new ones
  11788. for ( name in options ) {
  11789. old[ name ] = elem.style[ name ];
  11790. elem.style[ name ] = options[ name ];
  11791. }
  11792. ret = callback.apply( elem, args || [] );
  11793. // Revert the old values
  11794. for ( name in options ) {
  11795. elem.style[ name ] = old[ name ];
  11796. }
  11797. return ret;
  11798. };
  11799. function adjustCSS( elem, prop, valueParts, tween ) {
  11800. var adjusted, scale,
  11801. maxIterations = 20,
  11802. currentValue = tween ?
  11803. function() {
  11804. return tween.cur();
  11805. } :
  11806. function() {
  11807. return jQuery.css( elem, prop, "" );
  11808. },
  11809. initial = currentValue(),
  11810. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  11811. // Starting value computation is required for potential unit mismatches
  11812. initialInUnit = elem.nodeType &&
  11813. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  11814. rcssNum.exec( jQuery.css( elem, prop ) );
  11815. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  11816. // Support: Firefox <=54
  11817. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  11818. initial = initial / 2;
  11819. // Trust units reported by jQuery.css
  11820. unit = unit || initialInUnit[ 3 ];
  11821. // Iteratively approximate from a nonzero starting point
  11822. initialInUnit = +initial || 1;
  11823. while ( maxIterations-- ) {
  11824. // Evaluate and update our best guess (doubling guesses that zero out).
  11825. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  11826. jQuery.style( elem, prop, initialInUnit + unit );
  11827. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  11828. maxIterations = 0;
  11829. }
  11830. initialInUnit = initialInUnit / scale;
  11831. }
  11832. initialInUnit = initialInUnit * 2;
  11833. jQuery.style( elem, prop, initialInUnit + unit );
  11834. // Make sure we update the tween properties later on
  11835. valueParts = valueParts || [];
  11836. }
  11837. if ( valueParts ) {
  11838. initialInUnit = +initialInUnit || +initial || 0;
  11839. // Apply relative offset (+=/-=) if specified
  11840. adjusted = valueParts[ 1 ] ?
  11841. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  11842. +valueParts[ 2 ];
  11843. if ( tween ) {
  11844. tween.unit = unit;
  11845. tween.start = initialInUnit;
  11846. tween.end = adjusted;
  11847. }
  11848. }
  11849. return adjusted;
  11850. }
  11851. var defaultDisplayMap = {};
  11852. function getDefaultDisplay( elem ) {
  11853. var temp,
  11854. doc = elem.ownerDocument,
  11855. nodeName = elem.nodeName,
  11856. display = defaultDisplayMap[ nodeName ];
  11857. if ( display ) {
  11858. return display;
  11859. }
  11860. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  11861. display = jQuery.css( temp, "display" );
  11862. temp.parentNode.removeChild( temp );
  11863. if ( display === "none" ) {
  11864. display = "block";
  11865. }
  11866. defaultDisplayMap[ nodeName ] = display;
  11867. return display;
  11868. }
  11869. function showHide( elements, show ) {
  11870. var display, elem,
  11871. values = [],
  11872. index = 0,
  11873. length = elements.length;
  11874. // Determine new display value for elements that need to change
  11875. for ( ; index < length; index++ ) {
  11876. elem = elements[ index ];
  11877. if ( !elem.style ) {
  11878. continue;
  11879. }
  11880. display = elem.style.display;
  11881. if ( show ) {
  11882. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  11883. // check is required in this first loop unless we have a nonempty display value (either
  11884. // inline or about-to-be-restored)
  11885. if ( display === "none" ) {
  11886. values[ index ] = dataPriv.get( elem, "display" ) || null;
  11887. if ( !values[ index ] ) {
  11888. elem.style.display = "";
  11889. }
  11890. }
  11891. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  11892. values[ index ] = getDefaultDisplay( elem );
  11893. }
  11894. } else {
  11895. if ( display !== "none" ) {
  11896. values[ index ] = "none";
  11897. // Remember what we're overwriting
  11898. dataPriv.set( elem, "display", display );
  11899. }
  11900. }
  11901. }
  11902. // Set the display of the elements in a second loop to avoid constant reflow
  11903. for ( index = 0; index < length; index++ ) {
  11904. if ( values[ index ] != null ) {
  11905. elements[ index ].style.display = values[ index ];
  11906. }
  11907. }
  11908. return elements;
  11909. }
  11910. jQuery.fn.extend( {
  11911. show: function() {
  11912. return showHide( this, true );
  11913. },
  11914. hide: function() {
  11915. return showHide( this );
  11916. },
  11917. toggle: function( state ) {
  11918. if ( typeof state === "boolean" ) {
  11919. return state ? this.show() : this.hide();
  11920. }
  11921. return this.each( function() {
  11922. if ( isHiddenWithinTree( this ) ) {
  11923. jQuery( this ).show();
  11924. } else {
  11925. jQuery( this ).hide();
  11926. }
  11927. } );
  11928. }
  11929. } );
  11930. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  11931. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  11932. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  11933. // We have to close these tags to support XHTML (#13200)
  11934. var wrapMap = {
  11935. // Support: IE <=9 only
  11936. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  11937. // XHTML parsers do not magically insert elements in the
  11938. // same way that tag soup parsers do. So we cannot shorten
  11939. // this by omitting <tbody> or other required elements.
  11940. thead: [ 1, "<table>", "</table>" ],
  11941. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  11942. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  11943. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  11944. _default: [ 0, "", "" ]
  11945. };
  11946. // Support: IE <=9 only
  11947. wrapMap.optgroup = wrapMap.option;
  11948. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  11949. wrapMap.th = wrapMap.td;
  11950. function getAll( context, tag ) {
  11951. // Support: IE <=9 - 11 only
  11952. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  11953. var ret;
  11954. if ( typeof context.getElementsByTagName !== "undefined" ) {
  11955. ret = context.getElementsByTagName( tag || "*" );
  11956. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  11957. ret = context.querySelectorAll( tag || "*" );
  11958. } else {
  11959. ret = [];
  11960. }
  11961. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  11962. return jQuery.merge( [ context ], ret );
  11963. }
  11964. return ret;
  11965. }
  11966. // Mark scripts as having already been evaluated
  11967. function setGlobalEval( elems, refElements ) {
  11968. var i = 0,
  11969. l = elems.length;
  11970. for ( ; i < l; i++ ) {
  11971. dataPriv.set(
  11972. elems[ i ],
  11973. "globalEval",
  11974. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  11975. );
  11976. }
  11977. }
  11978. var rhtml = /<|&#?\w+;/;
  11979. function buildFragment( elems, context, scripts, selection, ignored ) {
  11980. var elem, tmp, tag, wrap, attached, j,
  11981. fragment = context.createDocumentFragment(),
  11982. nodes = [],
  11983. i = 0,
  11984. l = elems.length;
  11985. for ( ; i < l; i++ ) {
  11986. elem = elems[ i ];
  11987. if ( elem || elem === 0 ) {
  11988. // Add nodes directly
  11989. if ( toType( elem ) === "object" ) {
  11990. // Support: Android <=4.0 only, PhantomJS 1 only
  11991. // push.apply(_, arraylike) throws on ancient WebKit
  11992. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  11993. // Convert non-html into a text node
  11994. } else if ( !rhtml.test( elem ) ) {
  11995. nodes.push( context.createTextNode( elem ) );
  11996. // Convert html into DOM nodes
  11997. } else {
  11998. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  11999. // Deserialize a standard representation
  12000. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12001. wrap = wrapMap[ tag ] || wrapMap._default;
  12002. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12003. // Descend through wrappers to the right content
  12004. j = wrap[ 0 ];
  12005. while ( j-- ) {
  12006. tmp = tmp.lastChild;
  12007. }
  12008. // Support: Android <=4.0 only, PhantomJS 1 only
  12009. // push.apply(_, arraylike) throws on ancient WebKit
  12010. jQuery.merge( nodes, tmp.childNodes );
  12011. // Remember the top-level container
  12012. tmp = fragment.firstChild;
  12013. // Ensure the created nodes are orphaned (#12392)
  12014. tmp.textContent = "";
  12015. }
  12016. }
  12017. }
  12018. // Remove wrapper from fragment
  12019. fragment.textContent = "";
  12020. i = 0;
  12021. while ( ( elem = nodes[ i++ ] ) ) {
  12022. // Skip elements already in the context collection (trac-4087)
  12023. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12024. if ( ignored ) {
  12025. ignored.push( elem );
  12026. }
  12027. continue;
  12028. }
  12029. attached = isAttached( elem );
  12030. // Append to fragment
  12031. tmp = getAll( fragment.appendChild( elem ), "script" );
  12032. // Preserve script evaluation history
  12033. if ( attached ) {
  12034. setGlobalEval( tmp );
  12035. }
  12036. // Capture executables
  12037. if ( scripts ) {
  12038. j = 0;
  12039. while ( ( elem = tmp[ j++ ] ) ) {
  12040. if ( rscriptType.test( elem.type || "" ) ) {
  12041. scripts.push( elem );
  12042. }
  12043. }
  12044. }
  12045. }
  12046. return fragment;
  12047. }
  12048. ( function() {
  12049. var fragment = document.createDocumentFragment(),
  12050. div = fragment.appendChild( document.createElement( "div" ) ),
  12051. input = document.createElement( "input" );
  12052. // Support: Android 4.0 - 4.3 only
  12053. // Check state lost if the name is set (#11217)
  12054. // Support: Windows Web Apps (WWA)
  12055. // `name` and `type` must use .setAttribute for WWA (#14901)
  12056. input.setAttribute( "type", "radio" );
  12057. input.setAttribute( "checked", "checked" );
  12058. input.setAttribute( "name", "t" );
  12059. div.appendChild( input );
  12060. // Support: Android <=4.1 only
  12061. // Older WebKit doesn't clone checked state correctly in fragments
  12062. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12063. // Support: IE <=11 only
  12064. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12065. div.innerHTML = "<textarea>x</textarea>";
  12066. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12067. } )();
  12068. var
  12069. rkeyEvent = /^key/,
  12070. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12071. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12072. function returnTrue() {
  12073. return true;
  12074. }
  12075. function returnFalse() {
  12076. return false;
  12077. }
  12078. // Support: IE <=9 - 11+
  12079. // focus() and blur() are asynchronous, except when they are no-op.
  12080. // So expect focus to be synchronous when the element is already active,
  12081. // and blur to be synchronous when the element is not already active.
  12082. // (focus and blur are always synchronous in other supported browsers,
  12083. // this just defines when we can count on it).
  12084. function expectSync( elem, type ) {
  12085. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12086. }
  12087. // Support: IE <=9 only
  12088. // Accessing document.activeElement can throw unexpectedly
  12089. // https://bugs.jquery.com/ticket/13393
  12090. function safeActiveElement() {
  12091. try {
  12092. return document.activeElement;
  12093. } catch ( err ) { }
  12094. }
  12095. function on( elem, types, selector, data, fn, one ) {
  12096. var origFn, type;
  12097. // Types can be a map of types/handlers
  12098. if ( typeof types === "object" ) {
  12099. // ( types-Object, selector, data )
  12100. if ( typeof selector !== "string" ) {
  12101. // ( types-Object, data )
  12102. data = data || selector;
  12103. selector = undefined;
  12104. }
  12105. for ( type in types ) {
  12106. on( elem, type, selector, data, types[ type ], one );
  12107. }
  12108. return elem;
  12109. }
  12110. if ( data == null && fn == null ) {
  12111. // ( types, fn )
  12112. fn = selector;
  12113. data = selector = undefined;
  12114. } else if ( fn == null ) {
  12115. if ( typeof selector === "string" ) {
  12116. // ( types, selector, fn )
  12117. fn = data;
  12118. data = undefined;
  12119. } else {
  12120. // ( types, data, fn )
  12121. fn = data;
  12122. data = selector;
  12123. selector = undefined;
  12124. }
  12125. }
  12126. if ( fn === false ) {
  12127. fn = returnFalse;
  12128. } else if ( !fn ) {
  12129. return elem;
  12130. }
  12131. if ( one === 1 ) {
  12132. origFn = fn;
  12133. fn = function( event ) {
  12134. // Can use an empty set, since event contains the info
  12135. jQuery().off( event );
  12136. return origFn.apply( this, arguments );
  12137. };
  12138. // Use same guid so caller can remove using origFn
  12139. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12140. }
  12141. return elem.each( function() {
  12142. jQuery.event.add( this, types, fn, data, selector );
  12143. } );
  12144. }
  12145. /*
  12146. * Helper functions for managing events -- not part of the public interface.
  12147. * Props to Dean Edwards' addEvent library for many of the ideas.
  12148. */
  12149. jQuery.event = {
  12150. global: {},
  12151. add: function( elem, types, handler, data, selector ) {
  12152. var handleObjIn, eventHandle, tmp,
  12153. events, t, handleObj,
  12154. special, handlers, type, namespaces, origType,
  12155. elemData = dataPriv.get( elem );
  12156. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12157. if ( !elemData ) {
  12158. return;
  12159. }
  12160. // Caller can pass in an object of custom data in lieu of the handler
  12161. if ( handler.handler ) {
  12162. handleObjIn = handler;
  12163. handler = handleObjIn.handler;
  12164. selector = handleObjIn.selector;
  12165. }
  12166. // Ensure that invalid selectors throw exceptions at attach time
  12167. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12168. if ( selector ) {
  12169. jQuery.find.matchesSelector( documentElement, selector );
  12170. }
  12171. // Make sure that the handler has a unique ID, used to find/remove it later
  12172. if ( !handler.guid ) {
  12173. handler.guid = jQuery.guid++;
  12174. }
  12175. // Init the element's event structure and main handler, if this is the first
  12176. if ( !( events = elemData.events ) ) {
  12177. events = elemData.events = {};
  12178. }
  12179. if ( !( eventHandle = elemData.handle ) ) {
  12180. eventHandle = elemData.handle = function( e ) {
  12181. // Discard the second event of a jQuery.event.trigger() and
  12182. // when an event is called after a page has unloaded
  12183. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12184. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12185. };
  12186. }
  12187. // Handle multiple events separated by a space
  12188. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12189. t = types.length;
  12190. while ( t-- ) {
  12191. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12192. type = origType = tmp[ 1 ];
  12193. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12194. // There *must* be a type, no attaching namespace-only handlers
  12195. if ( !type ) {
  12196. continue;
  12197. }
  12198. // If event changes its type, use the special event handlers for the changed type
  12199. special = jQuery.event.special[ type ] || {};
  12200. // If selector defined, determine special event api type, otherwise given type
  12201. type = ( selector ? special.delegateType : special.bindType ) || type;
  12202. // Update special based on newly reset type
  12203. special = jQuery.event.special[ type ] || {};
  12204. // handleObj is passed to all event handlers
  12205. handleObj = jQuery.extend( {
  12206. type: type,
  12207. origType: origType,
  12208. data: data,
  12209. handler: handler,
  12210. guid: handler.guid,
  12211. selector: selector,
  12212. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12213. namespace: namespaces.join( "." )
  12214. }, handleObjIn );
  12215. // Init the event handler queue if we're the first
  12216. if ( !( handlers = events[ type ] ) ) {
  12217. handlers = events[ type ] = [];
  12218. handlers.delegateCount = 0;
  12219. // Only use addEventListener if the special events handler returns false
  12220. if ( !special.setup ||
  12221. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12222. if ( elem.addEventListener ) {
  12223. elem.addEventListener( type, eventHandle );
  12224. }
  12225. }
  12226. }
  12227. if ( special.add ) {
  12228. special.add.call( elem, handleObj );
  12229. if ( !handleObj.handler.guid ) {
  12230. handleObj.handler.guid = handler.guid;
  12231. }
  12232. }
  12233. // Add to the element's handler list, delegates in front
  12234. if ( selector ) {
  12235. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12236. } else {
  12237. handlers.push( handleObj );
  12238. }
  12239. // Keep track of which events have ever been used, for event optimization
  12240. jQuery.event.global[ type ] = true;
  12241. }
  12242. },
  12243. // Detach an event or set of events from an element
  12244. remove: function( elem, types, handler, selector, mappedTypes ) {
  12245. var j, origCount, tmp,
  12246. events, t, handleObj,
  12247. special, handlers, type, namespaces, origType,
  12248. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12249. if ( !elemData || !( events = elemData.events ) ) {
  12250. return;
  12251. }
  12252. // Once for each type.namespace in types; type may be omitted
  12253. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12254. t = types.length;
  12255. while ( t-- ) {
  12256. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12257. type = origType = tmp[ 1 ];
  12258. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12259. // Unbind all events (on this namespace, if provided) for the element
  12260. if ( !type ) {
  12261. for ( type in events ) {
  12262. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12263. }
  12264. continue;
  12265. }
  12266. special = jQuery.event.special[ type ] || {};
  12267. type = ( selector ? special.delegateType : special.bindType ) || type;
  12268. handlers = events[ type ] || [];
  12269. tmp = tmp[ 2 ] &&
  12270. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12271. // Remove matching events
  12272. origCount = j = handlers.length;
  12273. while ( j-- ) {
  12274. handleObj = handlers[ j ];
  12275. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12276. ( !handler || handler.guid === handleObj.guid ) &&
  12277. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12278. ( !selector || selector === handleObj.selector ||
  12279. selector === "**" && handleObj.selector ) ) {
  12280. handlers.splice( j, 1 );
  12281. if ( handleObj.selector ) {
  12282. handlers.delegateCount--;
  12283. }
  12284. if ( special.remove ) {
  12285. special.remove.call( elem, handleObj );
  12286. }
  12287. }
  12288. }
  12289. // Remove generic event handler if we removed something and no more handlers exist
  12290. // (avoids potential for endless recursion during removal of special event handlers)
  12291. if ( origCount && !handlers.length ) {
  12292. if ( !special.teardown ||
  12293. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12294. jQuery.removeEvent( elem, type, elemData.handle );
  12295. }
  12296. delete events[ type ];
  12297. }
  12298. }
  12299. // Remove data and the expando if it's no longer used
  12300. if ( jQuery.isEmptyObject( events ) ) {
  12301. dataPriv.remove( elem, "handle events" );
  12302. }
  12303. },
  12304. dispatch: function( nativeEvent ) {
  12305. // Make a writable jQuery.Event from the native event object
  12306. var event = jQuery.event.fix( nativeEvent );
  12307. var i, j, ret, matched, handleObj, handlerQueue,
  12308. args = new Array( arguments.length ),
  12309. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12310. special = jQuery.event.special[ event.type ] || {};
  12311. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12312. args[ 0 ] = event;
  12313. for ( i = 1; i < arguments.length; i++ ) {
  12314. args[ i ] = arguments[ i ];
  12315. }
  12316. event.delegateTarget = this;
  12317. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12318. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12319. return;
  12320. }
  12321. // Determine handlers
  12322. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12323. // Run delegates first; they may want to stop propagation beneath us
  12324. i = 0;
  12325. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12326. event.currentTarget = matched.elem;
  12327. j = 0;
  12328. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12329. !event.isImmediatePropagationStopped() ) {
  12330. // If the event is namespaced, then each handler is only invoked if it is
  12331. // specially universal or its namespaces are a superset of the event's.
  12332. if ( !event.rnamespace || handleObj.namespace === false ||
  12333. event.rnamespace.test( handleObj.namespace ) ) {
  12334. event.handleObj = handleObj;
  12335. event.data = handleObj.data;
  12336. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12337. handleObj.handler ).apply( matched.elem, args );
  12338. if ( ret !== undefined ) {
  12339. if ( ( event.result = ret ) === false ) {
  12340. event.preventDefault();
  12341. event.stopPropagation();
  12342. }
  12343. }
  12344. }
  12345. }
  12346. }
  12347. // Call the postDispatch hook for the mapped type
  12348. if ( special.postDispatch ) {
  12349. special.postDispatch.call( this, event );
  12350. }
  12351. return event.result;
  12352. },
  12353. handlers: function( event, handlers ) {
  12354. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12355. handlerQueue = [],
  12356. delegateCount = handlers.delegateCount,
  12357. cur = event.target;
  12358. // Find delegate handlers
  12359. if ( delegateCount &&
  12360. // Support: IE <=9
  12361. // Black-hole SVG <use> instance trees (trac-13180)
  12362. cur.nodeType &&
  12363. // Support: Firefox <=42
  12364. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12365. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12366. // Support: IE 11 only
  12367. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12368. !( event.type === "click" && event.button >= 1 ) ) {
  12369. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12370. // Don't check non-elements (#13208)
  12371. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12372. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12373. matchedHandlers = [];
  12374. matchedSelectors = {};
  12375. for ( i = 0; i < delegateCount; i++ ) {
  12376. handleObj = handlers[ i ];
  12377. // Don't conflict with Object.prototype properties (#13203)
  12378. sel = handleObj.selector + " ";
  12379. if ( matchedSelectors[ sel ] === undefined ) {
  12380. matchedSelectors[ sel ] = handleObj.needsContext ?
  12381. jQuery( sel, this ).index( cur ) > -1 :
  12382. jQuery.find( sel, this, null, [ cur ] ).length;
  12383. }
  12384. if ( matchedSelectors[ sel ] ) {
  12385. matchedHandlers.push( handleObj );
  12386. }
  12387. }
  12388. if ( matchedHandlers.length ) {
  12389. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12390. }
  12391. }
  12392. }
  12393. }
  12394. // Add the remaining (directly-bound) handlers
  12395. cur = this;
  12396. if ( delegateCount < handlers.length ) {
  12397. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12398. }
  12399. return handlerQueue;
  12400. },
  12401. addProp: function( name, hook ) {
  12402. Object.defineProperty( jQuery.Event.prototype, name, {
  12403. enumerable: true,
  12404. configurable: true,
  12405. get: isFunction( hook ) ?
  12406. function() {
  12407. if ( this.originalEvent ) {
  12408. return hook( this.originalEvent );
  12409. }
  12410. } :
  12411. function() {
  12412. if ( this.originalEvent ) {
  12413. return this.originalEvent[ name ];
  12414. }
  12415. },
  12416. set: function( value ) {
  12417. Object.defineProperty( this, name, {
  12418. enumerable: true,
  12419. configurable: true,
  12420. writable: true,
  12421. value: value
  12422. } );
  12423. }
  12424. } );
  12425. },
  12426. fix: function( originalEvent ) {
  12427. return originalEvent[ jQuery.expando ] ?
  12428. originalEvent :
  12429. new jQuery.Event( originalEvent );
  12430. },
  12431. special: {
  12432. load: {
  12433. // Prevent triggered image.load events from bubbling to window.load
  12434. noBubble: true
  12435. },
  12436. click: {
  12437. // Utilize native event to ensure correct state for checkable inputs
  12438. setup: function( data ) {
  12439. // For mutual compressibility with _default, replace `this` access with a local var.
  12440. // `|| data` is dead code meant only to preserve the variable through minification.
  12441. var el = this || data;
  12442. // Claim the first handler
  12443. if ( rcheckableType.test( el.type ) &&
  12444. el.click && nodeName( el, "input" ) ) {
  12445. // dataPriv.set( el, "click", ... )
  12446. leverageNative( el, "click", returnTrue );
  12447. }
  12448. // Return false to allow normal processing in the caller
  12449. return false;
  12450. },
  12451. trigger: function( data ) {
  12452. // For mutual compressibility with _default, replace `this` access with a local var.
  12453. // `|| data` is dead code meant only to preserve the variable through minification.
  12454. var el = this || data;
  12455. // Force setup before triggering a click
  12456. if ( rcheckableType.test( el.type ) &&
  12457. el.click && nodeName( el, "input" ) ) {
  12458. leverageNative( el, "click" );
  12459. }
  12460. // Return non-false to allow normal event-path propagation
  12461. return true;
  12462. },
  12463. // For cross-browser consistency, suppress native .click() on links
  12464. // Also prevent it if we're currently inside a leveraged native-event stack
  12465. _default: function( event ) {
  12466. var target = event.target;
  12467. return rcheckableType.test( target.type ) &&
  12468. target.click && nodeName( target, "input" ) &&
  12469. dataPriv.get( target, "click" ) ||
  12470. nodeName( target, "a" );
  12471. }
  12472. },
  12473. beforeunload: {
  12474. postDispatch: function( event ) {
  12475. // Support: Firefox 20+
  12476. // Firefox doesn't alert if the returnValue field is not set.
  12477. if ( event.result !== undefined && event.originalEvent ) {
  12478. event.originalEvent.returnValue = event.result;
  12479. }
  12480. }
  12481. }
  12482. }
  12483. };
  12484. // Ensure the presence of an event listener that handles manually-triggered
  12485. // synthetic events by interrupting progress until reinvoked in response to
  12486. // *native* events that it fires directly, ensuring that state changes have
  12487. // already occurred before other listeners are invoked.
  12488. function leverageNative( el, type, expectSync ) {
  12489. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12490. if ( !expectSync ) {
  12491. if ( dataPriv.get( el, type ) === undefined ) {
  12492. jQuery.event.add( el, type, returnTrue );
  12493. }
  12494. return;
  12495. }
  12496. // Register the controller as a special universal handler for all event namespaces
  12497. dataPriv.set( el, type, false );
  12498. jQuery.event.add( el, type, {
  12499. namespace: false,
  12500. handler: function( event ) {
  12501. var notAsync, result,
  12502. saved = dataPriv.get( this, type );
  12503. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12504. // Interrupt processing of the outer synthetic .trigger()ed event
  12505. // Saved data should be false in such cases, but might be a leftover capture object
  12506. // from an async native handler (gh-4350)
  12507. if ( !saved.length ) {
  12508. // Store arguments for use when handling the inner native event
  12509. // There will always be at least one argument (an event object), so this array
  12510. // will not be confused with a leftover capture object.
  12511. saved = slice.call( arguments );
  12512. dataPriv.set( this, type, saved );
  12513. // Trigger the native event and capture its result
  12514. // Support: IE <=9 - 11+
  12515. // focus() and blur() are asynchronous
  12516. notAsync = expectSync( this, type );
  12517. this[ type ]();
  12518. result = dataPriv.get( this, type );
  12519. if ( saved !== result || notAsync ) {
  12520. dataPriv.set( this, type, false );
  12521. } else {
  12522. result = {};
  12523. }
  12524. if ( saved !== result ) {
  12525. // Cancel the outer synthetic event
  12526. event.stopImmediatePropagation();
  12527. event.preventDefault();
  12528. return result.value;
  12529. }
  12530. // If this is an inner synthetic event for an event with a bubbling surrogate
  12531. // (focus or blur), assume that the surrogate already propagated from triggering the
  12532. // native event and prevent that from happening again here.
  12533. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12534. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12535. // less bad than duplication.
  12536. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12537. event.stopPropagation();
  12538. }
  12539. // If this is a native event triggered above, everything is now in order
  12540. // Fire an inner synthetic event with the original arguments
  12541. } else if ( saved.length ) {
  12542. // ...and capture the result
  12543. dataPriv.set( this, type, {
  12544. value: jQuery.event.trigger(
  12545. // Support: IE <=9 - 11+
  12546. // Extend with the prototype to reset the above stopImmediatePropagation()
  12547. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12548. saved.slice( 1 ),
  12549. this
  12550. )
  12551. } );
  12552. // Abort handling of the native event
  12553. event.stopImmediatePropagation();
  12554. }
  12555. }
  12556. } );
  12557. }
  12558. jQuery.removeEvent = function( elem, type, handle ) {
  12559. // This "if" is needed for plain objects
  12560. if ( elem.removeEventListener ) {
  12561. elem.removeEventListener( type, handle );
  12562. }
  12563. };
  12564. jQuery.Event = function( src, props ) {
  12565. // Allow instantiation without the 'new' keyword
  12566. if ( !( this instanceof jQuery.Event ) ) {
  12567. return new jQuery.Event( src, props );
  12568. }
  12569. // Event object
  12570. if ( src && src.type ) {
  12571. this.originalEvent = src;
  12572. this.type = src.type;
  12573. // Events bubbling up the document may have been marked as prevented
  12574. // by a handler lower down the tree; reflect the correct value.
  12575. this.isDefaultPrevented = src.defaultPrevented ||
  12576. src.defaultPrevented === undefined &&
  12577. // Support: Android <=2.3 only
  12578. src.returnValue === false ?
  12579. returnTrue :
  12580. returnFalse;
  12581. // Create target properties
  12582. // Support: Safari <=6 - 7 only
  12583. // Target should not be a text node (#504, #13143)
  12584. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12585. src.target.parentNode :
  12586. src.target;
  12587. this.currentTarget = src.currentTarget;
  12588. this.relatedTarget = src.relatedTarget;
  12589. // Event type
  12590. } else {
  12591. this.type = src;
  12592. }
  12593. // Put explicitly provided properties onto the event object
  12594. if ( props ) {
  12595. jQuery.extend( this, props );
  12596. }
  12597. // Create a timestamp if incoming event doesn't have one
  12598. this.timeStamp = src && src.timeStamp || Date.now();
  12599. // Mark it as fixed
  12600. this[ jQuery.expando ] = true;
  12601. };
  12602. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12603. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12604. jQuery.Event.prototype = {
  12605. constructor: jQuery.Event,
  12606. isDefaultPrevented: returnFalse,
  12607. isPropagationStopped: returnFalse,
  12608. isImmediatePropagationStopped: returnFalse,
  12609. isSimulated: false,
  12610. preventDefault: function() {
  12611. var e = this.originalEvent;
  12612. this.isDefaultPrevented = returnTrue;
  12613. if ( e && !this.isSimulated ) {
  12614. e.preventDefault();
  12615. }
  12616. },
  12617. stopPropagation: function() {
  12618. var e = this.originalEvent;
  12619. this.isPropagationStopped = returnTrue;
  12620. if ( e && !this.isSimulated ) {
  12621. e.stopPropagation();
  12622. }
  12623. },
  12624. stopImmediatePropagation: function() {
  12625. var e = this.originalEvent;
  12626. this.isImmediatePropagationStopped = returnTrue;
  12627. if ( e && !this.isSimulated ) {
  12628. e.stopImmediatePropagation();
  12629. }
  12630. this.stopPropagation();
  12631. }
  12632. };
  12633. // Includes all common event props including KeyEvent and MouseEvent specific props
  12634. jQuery.each( {
  12635. altKey: true,
  12636. bubbles: true,
  12637. cancelable: true,
  12638. changedTouches: true,
  12639. ctrlKey: true,
  12640. detail: true,
  12641. eventPhase: true,
  12642. metaKey: true,
  12643. pageX: true,
  12644. pageY: true,
  12645. shiftKey: true,
  12646. view: true,
  12647. "char": true,
  12648. code: true,
  12649. charCode: true,
  12650. key: true,
  12651. keyCode: true,
  12652. button: true,
  12653. buttons: true,
  12654. clientX: true,
  12655. clientY: true,
  12656. offsetX: true,
  12657. offsetY: true,
  12658. pointerId: true,
  12659. pointerType: true,
  12660. screenX: true,
  12661. screenY: true,
  12662. targetTouches: true,
  12663. toElement: true,
  12664. touches: true,
  12665. which: function( event ) {
  12666. var button = event.button;
  12667. // Add which for key events
  12668. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12669. return event.charCode != null ? event.charCode : event.keyCode;
  12670. }
  12671. // Add which for click: 1 === left; 2 === middle; 3 === right
  12672. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12673. if ( button & 1 ) {
  12674. return 1;
  12675. }
  12676. if ( button & 2 ) {
  12677. return 3;
  12678. }
  12679. if ( button & 4 ) {
  12680. return 2;
  12681. }
  12682. return 0;
  12683. }
  12684. return event.which;
  12685. }
  12686. }, jQuery.event.addProp );
  12687. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12688. jQuery.event.special[ type ] = {
  12689. // Utilize native event if possible so blur/focus sequence is correct
  12690. setup: function() {
  12691. // Claim the first handler
  12692. // dataPriv.set( this, "focus", ... )
  12693. // dataPriv.set( this, "blur", ... )
  12694. leverageNative( this, type, expectSync );
  12695. // Return false to allow normal processing in the caller
  12696. return false;
  12697. },
  12698. trigger: function() {
  12699. // Force setup before trigger
  12700. leverageNative( this, type );
  12701. // Return non-false to allow normal event-path propagation
  12702. return true;
  12703. },
  12704. delegateType: delegateType
  12705. };
  12706. } );
  12707. // Create mouseenter/leave events using mouseover/out and event-time checks
  12708. // so that event delegation works in jQuery.
  12709. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12710. //
  12711. // Support: Safari 7 only
  12712. // Safari sends mouseenter too often; see:
  12713. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12714. // for the description of the bug (it existed in older Chrome versions as well).
  12715. jQuery.each( {
  12716. mouseenter: "mouseover",
  12717. mouseleave: "mouseout",
  12718. pointerenter: "pointerover",
  12719. pointerleave: "pointerout"
  12720. }, function( orig, fix ) {
  12721. jQuery.event.special[ orig ] = {
  12722. delegateType: fix,
  12723. bindType: fix,
  12724. handle: function( event ) {
  12725. var ret,
  12726. target = this,
  12727. related = event.relatedTarget,
  12728. handleObj = event.handleObj;
  12729. // For mouseenter/leave call the handler if related is outside the target.
  12730. // NB: No relatedTarget if the mouse left/entered the browser window
  12731. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12732. event.type = handleObj.origType;
  12733. ret = handleObj.handler.apply( this, arguments );
  12734. event.type = fix;
  12735. }
  12736. return ret;
  12737. }
  12738. };
  12739. } );
  12740. jQuery.fn.extend( {
  12741. on: function( types, selector, data, fn ) {
  12742. return on( this, types, selector, data, fn );
  12743. },
  12744. one: function( types, selector, data, fn ) {
  12745. return on( this, types, selector, data, fn, 1 );
  12746. },
  12747. off: function( types, selector, fn ) {
  12748. var handleObj, type;
  12749. if ( types && types.preventDefault && types.handleObj ) {
  12750. // ( event ) dispatched jQuery.Event
  12751. handleObj = types.handleObj;
  12752. jQuery( types.delegateTarget ).off(
  12753. handleObj.namespace ?
  12754. handleObj.origType + "." + handleObj.namespace :
  12755. handleObj.origType,
  12756. handleObj.selector,
  12757. handleObj.handler
  12758. );
  12759. return this;
  12760. }
  12761. if ( typeof types === "object" ) {
  12762. // ( types-object [, selector] )
  12763. for ( type in types ) {
  12764. this.off( type, selector, types[ type ] );
  12765. }
  12766. return this;
  12767. }
  12768. if ( selector === false || typeof selector === "function" ) {
  12769. // ( types [, fn] )
  12770. fn = selector;
  12771. selector = undefined;
  12772. }
  12773. if ( fn === false ) {
  12774. fn = returnFalse;
  12775. }
  12776. return this.each( function() {
  12777. jQuery.event.remove( this, types, fn, selector );
  12778. } );
  12779. }
  12780. } );
  12781. var
  12782. /* eslint-disable max-len */
  12783. // See https://github.com/eslint/eslint/issues/3229
  12784. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12785. /* eslint-enable */
  12786. // Support: IE <=10 - 11, Edge 12 - 13 only
  12787. // In IE/Edge using regex groups here causes severe slowdowns.
  12788. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12789. rnoInnerhtml = /<script|<style|<link/i,
  12790. // checked="checked" or checked
  12791. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12792. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12793. // Prefer a tbody over its parent table for containing new rows
  12794. function manipulationTarget( elem, content ) {
  12795. if ( nodeName( elem, "table" ) &&
  12796. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12797. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12798. }
  12799. return elem;
  12800. }
  12801. // Replace/restore the type attribute of script elements for safe DOM manipulation
  12802. function disableScript( elem ) {
  12803. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  12804. return elem;
  12805. }
  12806. function restoreScript( elem ) {
  12807. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  12808. elem.type = elem.type.slice( 5 );
  12809. } else {
  12810. elem.removeAttribute( "type" );
  12811. }
  12812. return elem;
  12813. }
  12814. function cloneCopyEvent( src, dest ) {
  12815. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  12816. if ( dest.nodeType !== 1 ) {
  12817. return;
  12818. }
  12819. // 1. Copy private data: events, handlers, etc.
  12820. if ( dataPriv.hasData( src ) ) {
  12821. pdataOld = dataPriv.access( src );
  12822. pdataCur = dataPriv.set( dest, pdataOld );
  12823. events = pdataOld.events;
  12824. if ( events ) {
  12825. delete pdataCur.handle;
  12826. pdataCur.events = {};
  12827. for ( type in events ) {
  12828. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  12829. jQuery.event.add( dest, type, events[ type ][ i ] );
  12830. }
  12831. }
  12832. }
  12833. }
  12834. // 2. Copy user data
  12835. if ( dataUser.hasData( src ) ) {
  12836. udataOld = dataUser.access( src );
  12837. udataCur = jQuery.extend( {}, udataOld );
  12838. dataUser.set( dest, udataCur );
  12839. }
  12840. }
  12841. // Fix IE bugs, see support tests
  12842. function fixInput( src, dest ) {
  12843. var nodeName = dest.nodeName.toLowerCase();
  12844. // Fails to persist the checked state of a cloned checkbox or radio button.
  12845. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  12846. dest.checked = src.checked;
  12847. // Fails to return the selected option to the default selected state when cloning options
  12848. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  12849. dest.defaultValue = src.defaultValue;
  12850. }
  12851. }
  12852. function domManip( collection, args, callback, ignored ) {
  12853. // Flatten any nested arrays
  12854. args = concat.apply( [], args );
  12855. var fragment, first, scripts, hasScripts, node, doc,
  12856. i = 0,
  12857. l = collection.length,
  12858. iNoClone = l - 1,
  12859. value = args[ 0 ],
  12860. valueIsFunction = isFunction( value );
  12861. // We can't cloneNode fragments that contain checked, in WebKit
  12862. if ( valueIsFunction ||
  12863. ( l > 1 && typeof value === "string" &&
  12864. !support.checkClone && rchecked.test( value ) ) ) {
  12865. return collection.each( function( index ) {
  12866. var self = collection.eq( index );
  12867. if ( valueIsFunction ) {
  12868. args[ 0 ] = value.call( this, index, self.html() );
  12869. }
  12870. domManip( self, args, callback, ignored );
  12871. } );
  12872. }
  12873. if ( l ) {
  12874. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  12875. first = fragment.firstChild;
  12876. if ( fragment.childNodes.length === 1 ) {
  12877. fragment = first;
  12878. }
  12879. // Require either new content or an interest in ignored elements to invoke the callback
  12880. if ( first || ignored ) {
  12881. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  12882. hasScripts = scripts.length;
  12883. // Use the original fragment for the last item
  12884. // instead of the first because it can end up
  12885. // being emptied incorrectly in certain situations (#8070).
  12886. for ( ; i < l; i++ ) {
  12887. node = fragment;
  12888. if ( i !== iNoClone ) {
  12889. node = jQuery.clone( node, true, true );
  12890. // Keep references to cloned scripts for later restoration
  12891. if ( hasScripts ) {
  12892. // Support: Android <=4.0 only, PhantomJS 1 only
  12893. // push.apply(_, arraylike) throws on ancient WebKit
  12894. jQuery.merge( scripts, getAll( node, "script" ) );
  12895. }
  12896. }
  12897. callback.call( collection[ i ], node, i );
  12898. }
  12899. if ( hasScripts ) {
  12900. doc = scripts[ scripts.length - 1 ].ownerDocument;
  12901. // Reenable scripts
  12902. jQuery.map( scripts, restoreScript );
  12903. // Evaluate executable scripts on first document insertion
  12904. for ( i = 0; i < hasScripts; i++ ) {
  12905. node = scripts[ i ];
  12906. if ( rscriptType.test( node.type || "" ) &&
  12907. !dataPriv.access( node, "globalEval" ) &&
  12908. jQuery.contains( doc, node ) ) {
  12909. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  12910. // Optional AJAX dependency, but won't run scripts if not present
  12911. if ( jQuery._evalUrl && !node.noModule ) {
  12912. jQuery._evalUrl( node.src, {
  12913. nonce: node.nonce || node.getAttribute( "nonce" )
  12914. } );
  12915. }
  12916. } else {
  12917. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  12918. }
  12919. }
  12920. }
  12921. }
  12922. }
  12923. }
  12924. return collection;
  12925. }
  12926. function remove( elem, selector, keepData ) {
  12927. var node,
  12928. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  12929. i = 0;
  12930. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  12931. if ( !keepData && node.nodeType === 1 ) {
  12932. jQuery.cleanData( getAll( node ) );
  12933. }
  12934. if ( node.parentNode ) {
  12935. if ( keepData && isAttached( node ) ) {
  12936. setGlobalEval( getAll( node, "script" ) );
  12937. }
  12938. node.parentNode.removeChild( node );
  12939. }
  12940. }
  12941. return elem;
  12942. }
  12943. jQuery.extend( {
  12944. htmlPrefilter: function( html ) {
  12945. return html.replace( rxhtmlTag, "<$1></$2>" );
  12946. },
  12947. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  12948. var i, l, srcElements, destElements,
  12949. clone = elem.cloneNode( true ),
  12950. inPage = isAttached( elem );
  12951. // Fix IE cloning issues
  12952. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  12953. !jQuery.isXMLDoc( elem ) ) {
  12954. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  12955. destElements = getAll( clone );
  12956. srcElements = getAll( elem );
  12957. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  12958. fixInput( srcElements[ i ], destElements[ i ] );
  12959. }
  12960. }
  12961. // Copy the events from the original to the clone
  12962. if ( dataAndEvents ) {
  12963. if ( deepDataAndEvents ) {
  12964. srcElements = srcElements || getAll( elem );
  12965. destElements = destElements || getAll( clone );
  12966. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  12967. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  12968. }
  12969. } else {
  12970. cloneCopyEvent( elem, clone );
  12971. }
  12972. }
  12973. // Preserve script evaluation history
  12974. destElements = getAll( clone, "script" );
  12975. if ( destElements.length > 0 ) {
  12976. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  12977. }
  12978. // Return the cloned set
  12979. return clone;
  12980. },
  12981. cleanData: function( elems ) {
  12982. var data, elem, type,
  12983. special = jQuery.event.special,
  12984. i = 0;
  12985. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  12986. if ( acceptData( elem ) ) {
  12987. if ( ( data = elem[ dataPriv.expando ] ) ) {
  12988. if ( data.events ) {
  12989. for ( type in data.events ) {
  12990. if ( special[ type ] ) {
  12991. jQuery.event.remove( elem, type );
  12992. // This is a shortcut to avoid jQuery.event.remove's overhead
  12993. } else {
  12994. jQuery.removeEvent( elem, type, data.handle );
  12995. }
  12996. }
  12997. }
  12998. // Support: Chrome <=35 - 45+
  12999. // Assign undefined instead of using delete, see Data#remove
  13000. elem[ dataPriv.expando ] = undefined;
  13001. }
  13002. if ( elem[ dataUser.expando ] ) {
  13003. // Support: Chrome <=35 - 45+
  13004. // Assign undefined instead of using delete, see Data#remove
  13005. elem[ dataUser.expando ] = undefined;
  13006. }
  13007. }
  13008. }
  13009. }
  13010. } );
  13011. jQuery.fn.extend( {
  13012. detach: function( selector ) {
  13013. return remove( this, selector, true );
  13014. },
  13015. remove: function( selector ) {
  13016. return remove( this, selector );
  13017. },
  13018. text: function( value ) {
  13019. return access( this, function( value ) {
  13020. return value === undefined ?
  13021. jQuery.text( this ) :
  13022. this.empty().each( function() {
  13023. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13024. this.textContent = value;
  13025. }
  13026. } );
  13027. }, null, value, arguments.length );
  13028. },
  13029. append: function() {
  13030. return domManip( this, arguments, function( elem ) {
  13031. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13032. var target = manipulationTarget( this, elem );
  13033. target.appendChild( elem );
  13034. }
  13035. } );
  13036. },
  13037. prepend: function() {
  13038. return domManip( this, arguments, function( elem ) {
  13039. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13040. var target = manipulationTarget( this, elem );
  13041. target.insertBefore( elem, target.firstChild );
  13042. }
  13043. } );
  13044. },
  13045. before: function() {
  13046. return domManip( this, arguments, function( elem ) {
  13047. if ( this.parentNode ) {
  13048. this.parentNode.insertBefore( elem, this );
  13049. }
  13050. } );
  13051. },
  13052. after: function() {
  13053. return domManip( this, arguments, function( elem ) {
  13054. if ( this.parentNode ) {
  13055. this.parentNode.insertBefore( elem, this.nextSibling );
  13056. }
  13057. } );
  13058. },
  13059. empty: function() {
  13060. var elem,
  13061. i = 0;
  13062. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13063. if ( elem.nodeType === 1 ) {
  13064. // Prevent memory leaks
  13065. jQuery.cleanData( getAll( elem, false ) );
  13066. // Remove any remaining nodes
  13067. elem.textContent = "";
  13068. }
  13069. }
  13070. return this;
  13071. },
  13072. clone: function( dataAndEvents, deepDataAndEvents ) {
  13073. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13074. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13075. return this.map( function() {
  13076. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13077. } );
  13078. },
  13079. html: function( value ) {
  13080. return access( this, function( value ) {
  13081. var elem = this[ 0 ] || {},
  13082. i = 0,
  13083. l = this.length;
  13084. if ( value === undefined && elem.nodeType === 1 ) {
  13085. return elem.innerHTML;
  13086. }
  13087. // See if we can take a shortcut and just use innerHTML
  13088. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13089. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13090. value = jQuery.htmlPrefilter( value );
  13091. try {
  13092. for ( ; i < l; i++ ) {
  13093. elem = this[ i ] || {};
  13094. // Remove element nodes and prevent memory leaks
  13095. if ( elem.nodeType === 1 ) {
  13096. jQuery.cleanData( getAll( elem, false ) );
  13097. elem.innerHTML = value;
  13098. }
  13099. }
  13100. elem = 0;
  13101. // If using innerHTML throws an exception, use the fallback method
  13102. } catch ( e ) {}
  13103. }
  13104. if ( elem ) {
  13105. this.empty().append( value );
  13106. }
  13107. }, null, value, arguments.length );
  13108. },
  13109. replaceWith: function() {
  13110. var ignored = [];
  13111. // Make the changes, replacing each non-ignored context element with the new content
  13112. return domManip( this, arguments, function( elem ) {
  13113. var parent = this.parentNode;
  13114. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13115. jQuery.cleanData( getAll( this ) );
  13116. if ( parent ) {
  13117. parent.replaceChild( elem, this );
  13118. }
  13119. }
  13120. // Force callback invocation
  13121. }, ignored );
  13122. }
  13123. } );
  13124. jQuery.each( {
  13125. appendTo: "append",
  13126. prependTo: "prepend",
  13127. insertBefore: "before",
  13128. insertAfter: "after",
  13129. replaceAll: "replaceWith"
  13130. }, function( name, original ) {
  13131. jQuery.fn[ name ] = function( selector ) {
  13132. var elems,
  13133. ret = [],
  13134. insert = jQuery( selector ),
  13135. last = insert.length - 1,
  13136. i = 0;
  13137. for ( ; i <= last; i++ ) {
  13138. elems = i === last ? this : this.clone( true );
  13139. jQuery( insert[ i ] )[ original ]( elems );
  13140. // Support: Android <=4.0 only, PhantomJS 1 only
  13141. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13142. push.apply( ret, elems.get() );
  13143. }
  13144. return this.pushStack( ret );
  13145. };
  13146. } );
  13147. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13148. var getStyles = function( elem ) {
  13149. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13150. // IE throws on elements created in popups
  13151. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13152. var view = elem.ownerDocument.defaultView;
  13153. if ( !view || !view.opener ) {
  13154. view = window;
  13155. }
  13156. return view.getComputedStyle( elem );
  13157. };
  13158. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13159. ( function() {
  13160. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13161. // so they're executed at the same time to save the second computation.
  13162. function computeStyleTests() {
  13163. // This is a singleton, we need to execute it only once
  13164. if ( !div ) {
  13165. return;
  13166. }
  13167. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13168. "margin-top:1px;padding:0;border:0";
  13169. div.style.cssText =
  13170. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13171. "margin:auto;border:1px;padding:1px;" +
  13172. "width:60%;top:1%";
  13173. documentElement.appendChild( container ).appendChild( div );
  13174. var divStyle = window.getComputedStyle( div );
  13175. pixelPositionVal = divStyle.top !== "1%";
  13176. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13177. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13178. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13179. // Some styles come back with percentage values, even though they shouldn't
  13180. div.style.right = "60%";
  13181. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13182. // Support: IE 9 - 11 only
  13183. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13184. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13185. // Support: IE 9 only
  13186. // Detect overflow:scroll screwiness (gh-3699)
  13187. // Support: Chrome <=64
  13188. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13189. div.style.position = "absolute";
  13190. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13191. documentElement.removeChild( container );
  13192. // Nullify the div so it wouldn't be stored in the memory and
  13193. // it will also be a sign that checks already performed
  13194. div = null;
  13195. }
  13196. function roundPixelMeasures( measure ) {
  13197. return Math.round( parseFloat( measure ) );
  13198. }
  13199. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13200. reliableMarginLeftVal,
  13201. container = document.createElement( "div" ),
  13202. div = document.createElement( "div" );
  13203. // Finish early in limited (non-browser) environments
  13204. if ( !div.style ) {
  13205. return;
  13206. }
  13207. // Support: IE <=9 - 11 only
  13208. // Style of cloned element affects source element cloned (#8908)
  13209. div.style.backgroundClip = "content-box";
  13210. div.cloneNode( true ).style.backgroundClip = "";
  13211. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13212. jQuery.extend( support, {
  13213. boxSizingReliable: function() {
  13214. computeStyleTests();
  13215. return boxSizingReliableVal;
  13216. },
  13217. pixelBoxStyles: function() {
  13218. computeStyleTests();
  13219. return pixelBoxStylesVal;
  13220. },
  13221. pixelPosition: function() {
  13222. computeStyleTests();
  13223. return pixelPositionVal;
  13224. },
  13225. reliableMarginLeft: function() {
  13226. computeStyleTests();
  13227. return reliableMarginLeftVal;
  13228. },
  13229. scrollboxSize: function() {
  13230. computeStyleTests();
  13231. return scrollboxSizeVal;
  13232. }
  13233. } );
  13234. } )();
  13235. function curCSS( elem, name, computed ) {
  13236. var width, minWidth, maxWidth, ret,
  13237. // Support: Firefox 51+
  13238. // Retrieving style before computed somehow
  13239. // fixes an issue with getting wrong values
  13240. // on detached elements
  13241. style = elem.style;
  13242. computed = computed || getStyles( elem );
  13243. // getPropertyValue is needed for:
  13244. // .css('filter') (IE 9 only, #12537)
  13245. // .css('--customProperty) (#3144)
  13246. if ( computed ) {
  13247. ret = computed.getPropertyValue( name ) || computed[ name ];
  13248. if ( ret === "" && !isAttached( elem ) ) {
  13249. ret = jQuery.style( elem, name );
  13250. }
  13251. // A tribute to the "awesome hack by Dean Edwards"
  13252. // Android Browser returns percentage for some values,
  13253. // but width seems to be reliably pixels.
  13254. // This is against the CSSOM draft spec:
  13255. // https://drafts.csswg.org/cssom/#resolved-values
  13256. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13257. // Remember the original values
  13258. width = style.width;
  13259. minWidth = style.minWidth;
  13260. maxWidth = style.maxWidth;
  13261. // Put in the new values to get a computed value out
  13262. style.minWidth = style.maxWidth = style.width = ret;
  13263. ret = computed.width;
  13264. // Revert the changed values
  13265. style.width = width;
  13266. style.minWidth = minWidth;
  13267. style.maxWidth = maxWidth;
  13268. }
  13269. }
  13270. return ret !== undefined ?
  13271. // Support: IE <=9 - 11 only
  13272. // IE returns zIndex value as an integer.
  13273. ret + "" :
  13274. ret;
  13275. }
  13276. function addGetHookIf( conditionFn, hookFn ) {
  13277. // Define the hook, we'll check on the first run if it's really needed.
  13278. return {
  13279. get: function() {
  13280. if ( conditionFn() ) {
  13281. // Hook not needed (or it's not possible to use it due
  13282. // to missing dependency), remove it.
  13283. delete this.get;
  13284. return;
  13285. }
  13286. // Hook needed; redefine it so that the support test is not executed again.
  13287. return ( this.get = hookFn ).apply( this, arguments );
  13288. }
  13289. };
  13290. }
  13291. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13292. emptyStyle = document.createElement( "div" ).style,
  13293. vendorProps = {};
  13294. // Return a vendor-prefixed property or undefined
  13295. function vendorPropName( name ) {
  13296. // Check for vendor prefixed names
  13297. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13298. i = cssPrefixes.length;
  13299. while ( i-- ) {
  13300. name = cssPrefixes[ i ] + capName;
  13301. if ( name in emptyStyle ) {
  13302. return name;
  13303. }
  13304. }
  13305. }
  13306. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13307. function finalPropName( name ) {
  13308. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13309. if ( final ) {
  13310. return final;
  13311. }
  13312. if ( name in emptyStyle ) {
  13313. return name;
  13314. }
  13315. return vendorProps[ name ] = vendorPropName( name ) || name;
  13316. }
  13317. var
  13318. // Swappable if display is none or starts with table
  13319. // except "table", "table-cell", or "table-caption"
  13320. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13321. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13322. rcustomProp = /^--/,
  13323. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13324. cssNormalTransform = {
  13325. letterSpacing: "0",
  13326. fontWeight: "400"
  13327. };
  13328. function setPositiveNumber( elem, value, subtract ) {
  13329. // Any relative (+/-) values have already been
  13330. // normalized at this point
  13331. var matches = rcssNum.exec( value );
  13332. return matches ?
  13333. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13334. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13335. value;
  13336. }
  13337. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13338. var i = dimension === "width" ? 1 : 0,
  13339. extra = 0,
  13340. delta = 0;
  13341. // Adjustment may not be necessary
  13342. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13343. return 0;
  13344. }
  13345. for ( ; i < 4; i += 2 ) {
  13346. // Both box models exclude margin
  13347. if ( box === "margin" ) {
  13348. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13349. }
  13350. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13351. if ( !isBorderBox ) {
  13352. // Add padding
  13353. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13354. // For "border" or "margin", add border
  13355. if ( box !== "padding" ) {
  13356. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13357. // But still keep track of it otherwise
  13358. } else {
  13359. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13360. }
  13361. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13362. // "padding" or "margin"
  13363. } else {
  13364. // For "content", subtract padding
  13365. if ( box === "content" ) {
  13366. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13367. }
  13368. // For "content" or "padding", subtract border
  13369. if ( box !== "margin" ) {
  13370. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13371. }
  13372. }
  13373. }
  13374. // Account for positive content-box scroll gutter when requested by providing computedVal
  13375. if ( !isBorderBox && computedVal >= 0 ) {
  13376. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13377. // Assuming integer scroll gutter, subtract the rest and round down
  13378. delta += Math.max( 0, Math.ceil(
  13379. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13380. computedVal -
  13381. delta -
  13382. extra -
  13383. 0.5
  13384. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13385. // Use an explicit zero to avoid NaN (gh-3964)
  13386. ) ) || 0;
  13387. }
  13388. return delta;
  13389. }
  13390. function getWidthOrHeight( elem, dimension, extra ) {
  13391. // Start with computed style
  13392. var styles = getStyles( elem ),
  13393. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13394. // Fake content-box until we know it's needed to know the true value.
  13395. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13396. isBorderBox = boxSizingNeeded &&
  13397. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13398. valueIsBorderBox = isBorderBox,
  13399. val = curCSS( elem, dimension, styles ),
  13400. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13401. // Support: Firefox <=54
  13402. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13403. if ( rnumnonpx.test( val ) ) {
  13404. if ( !extra ) {
  13405. return val;
  13406. }
  13407. val = "auto";
  13408. }
  13409. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13410. // This happens for inline elements with no explicit setting (gh-3571)
  13411. // Support: Android <=4.1 - 4.3 only
  13412. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13413. // Support: IE 9-11 only
  13414. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13415. // We use getClientRects() to check for hidden/disconnected.
  13416. // In those cases, the computed value can be trusted to be border-box
  13417. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13418. val === "auto" ||
  13419. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13420. elem.getClientRects().length ) {
  13421. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13422. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13423. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13424. // retrieved value as a content box dimension.
  13425. valueIsBorderBox = offsetProp in elem;
  13426. if ( valueIsBorderBox ) {
  13427. val = elem[ offsetProp ];
  13428. }
  13429. }
  13430. // Normalize "" and auto
  13431. val = parseFloat( val ) || 0;
  13432. // Adjust for the element's box model
  13433. return ( val +
  13434. boxModelAdjustment(
  13435. elem,
  13436. dimension,
  13437. extra || ( isBorderBox ? "border" : "content" ),
  13438. valueIsBorderBox,
  13439. styles,
  13440. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13441. val
  13442. )
  13443. ) + "px";
  13444. }
  13445. jQuery.extend( {
  13446. // Add in style property hooks for overriding the default
  13447. // behavior of getting and setting a style property
  13448. cssHooks: {
  13449. opacity: {
  13450. get: function( elem, computed ) {
  13451. if ( computed ) {
  13452. // We should always get a number back from opacity
  13453. var ret = curCSS( elem, "opacity" );
  13454. return ret === "" ? "1" : ret;
  13455. }
  13456. }
  13457. }
  13458. },
  13459. // Don't automatically add "px" to these possibly-unitless properties
  13460. cssNumber: {
  13461. "animationIterationCount": true,
  13462. "columnCount": true,
  13463. "fillOpacity": true,
  13464. "flexGrow": true,
  13465. "flexShrink": true,
  13466. "fontWeight": true,
  13467. "gridArea": true,
  13468. "gridColumn": true,
  13469. "gridColumnEnd": true,
  13470. "gridColumnStart": true,
  13471. "gridRow": true,
  13472. "gridRowEnd": true,
  13473. "gridRowStart": true,
  13474. "lineHeight": true,
  13475. "opacity": true,
  13476. "order": true,
  13477. "orphans": true,
  13478. "widows": true,
  13479. "zIndex": true,
  13480. "zoom": true
  13481. },
  13482. // Add in properties whose names you wish to fix before
  13483. // setting or getting the value
  13484. cssProps: {},
  13485. // Get and set the style property on a DOM Node
  13486. style: function( elem, name, value, extra ) {
  13487. // Don't set styles on text and comment nodes
  13488. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13489. return;
  13490. }
  13491. // Make sure that we're working with the right name
  13492. var ret, type, hooks,
  13493. origName = camelCase( name ),
  13494. isCustomProp = rcustomProp.test( name ),
  13495. style = elem.style;
  13496. // Make sure that we're working with the right name. We don't
  13497. // want to query the value if it is a CSS custom property
  13498. // since they are user-defined.
  13499. if ( !isCustomProp ) {
  13500. name = finalPropName( origName );
  13501. }
  13502. // Gets hook for the prefixed version, then unprefixed version
  13503. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13504. // Check if we're setting a value
  13505. if ( value !== undefined ) {
  13506. type = typeof value;
  13507. // Convert "+=" or "-=" to relative numbers (#7345)
  13508. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13509. value = adjustCSS( elem, name, ret );
  13510. // Fixes bug #9237
  13511. type = "number";
  13512. }
  13513. // Make sure that null and NaN values aren't set (#7116)
  13514. if ( value == null || value !== value ) {
  13515. return;
  13516. }
  13517. // If a number was passed in, add the unit (except for certain CSS properties)
  13518. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13519. // "px" to a few hardcoded values.
  13520. if ( type === "number" && !isCustomProp ) {
  13521. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13522. }
  13523. // background-* props affect original clone's values
  13524. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13525. style[ name ] = "inherit";
  13526. }
  13527. // If a hook was provided, use that value, otherwise just set the specified value
  13528. if ( !hooks || !( "set" in hooks ) ||
  13529. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13530. if ( isCustomProp ) {
  13531. style.setProperty( name, value );
  13532. } else {
  13533. style[ name ] = value;
  13534. }
  13535. }
  13536. } else {
  13537. // If a hook was provided get the non-computed value from there
  13538. if ( hooks && "get" in hooks &&
  13539. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13540. return ret;
  13541. }
  13542. // Otherwise just get the value from the style object
  13543. return style[ name ];
  13544. }
  13545. },
  13546. css: function( elem, name, extra, styles ) {
  13547. var val, num, hooks,
  13548. origName = camelCase( name ),
  13549. isCustomProp = rcustomProp.test( name );
  13550. // Make sure that we're working with the right name. We don't
  13551. // want to modify the value if it is a CSS custom property
  13552. // since they are user-defined.
  13553. if ( !isCustomProp ) {
  13554. name = finalPropName( origName );
  13555. }
  13556. // Try prefixed name followed by the unprefixed name
  13557. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13558. // If a hook was provided get the computed value from there
  13559. if ( hooks && "get" in hooks ) {
  13560. val = hooks.get( elem, true, extra );
  13561. }
  13562. // Otherwise, if a way to get the computed value exists, use that
  13563. if ( val === undefined ) {
  13564. val = curCSS( elem, name, styles );
  13565. }
  13566. // Convert "normal" to computed value
  13567. if ( val === "normal" && name in cssNormalTransform ) {
  13568. val = cssNormalTransform[ name ];
  13569. }
  13570. // Make numeric if forced or a qualifier was provided and val looks numeric
  13571. if ( extra === "" || extra ) {
  13572. num = parseFloat( val );
  13573. return extra === true || isFinite( num ) ? num || 0 : val;
  13574. }
  13575. return val;
  13576. }
  13577. } );
  13578. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13579. jQuery.cssHooks[ dimension ] = {
  13580. get: function( elem, computed, extra ) {
  13581. if ( computed ) {
  13582. // Certain elements can have dimension info if we invisibly show them
  13583. // but it must have a current display style that would benefit
  13584. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13585. // Support: Safari 8+
  13586. // Table columns in Safari have non-zero offsetWidth & zero
  13587. // getBoundingClientRect().width unless display is changed.
  13588. // Support: IE <=11 only
  13589. // Running getBoundingClientRect on a disconnected node
  13590. // in IE throws an error.
  13591. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13592. swap( elem, cssShow, function() {
  13593. return getWidthOrHeight( elem, dimension, extra );
  13594. } ) :
  13595. getWidthOrHeight( elem, dimension, extra );
  13596. }
  13597. },
  13598. set: function( elem, value, extra ) {
  13599. var matches,
  13600. styles = getStyles( elem ),
  13601. // Only read styles.position if the test has a chance to fail
  13602. // to avoid forcing a reflow.
  13603. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13604. styles.position === "absolute",
  13605. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13606. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13607. isBorderBox = boxSizingNeeded &&
  13608. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13609. subtract = extra ?
  13610. boxModelAdjustment(
  13611. elem,
  13612. dimension,
  13613. extra,
  13614. isBorderBox,
  13615. styles
  13616. ) :
  13617. 0;
  13618. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13619. // faking a content-box to get border and padding (gh-3699)
  13620. if ( isBorderBox && scrollboxSizeBuggy ) {
  13621. subtract -= Math.ceil(
  13622. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13623. parseFloat( styles[ dimension ] ) -
  13624. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13625. 0.5
  13626. );
  13627. }
  13628. // Convert to pixels if value adjustment is needed
  13629. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13630. ( matches[ 3 ] || "px" ) !== "px" ) {
  13631. elem.style[ dimension ] = value;
  13632. value = jQuery.css( elem, dimension );
  13633. }
  13634. return setPositiveNumber( elem, value, subtract );
  13635. }
  13636. };
  13637. } );
  13638. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13639. function( elem, computed ) {
  13640. if ( computed ) {
  13641. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13642. elem.getBoundingClientRect().left -
  13643. swap( elem, { marginLeft: 0 }, function() {
  13644. return elem.getBoundingClientRect().left;
  13645. } )
  13646. ) + "px";
  13647. }
  13648. }
  13649. );
  13650. // These hooks are used by animate to expand properties
  13651. jQuery.each( {
  13652. margin: "",
  13653. padding: "",
  13654. border: "Width"
  13655. }, function( prefix, suffix ) {
  13656. jQuery.cssHooks[ prefix + suffix ] = {
  13657. expand: function( value ) {
  13658. var i = 0,
  13659. expanded = {},
  13660. // Assumes a single number if not a string
  13661. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13662. for ( ; i < 4; i++ ) {
  13663. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13664. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13665. }
  13666. return expanded;
  13667. }
  13668. };
  13669. if ( prefix !== "margin" ) {
  13670. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13671. }
  13672. } );
  13673. jQuery.fn.extend( {
  13674. css: function( name, value ) {
  13675. return access( this, function( elem, name, value ) {
  13676. var styles, len,
  13677. map = {},
  13678. i = 0;
  13679. if ( Array.isArray( name ) ) {
  13680. styles = getStyles( elem );
  13681. len = name.length;
  13682. for ( ; i < len; i++ ) {
  13683. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13684. }
  13685. return map;
  13686. }
  13687. return value !== undefined ?
  13688. jQuery.style( elem, name, value ) :
  13689. jQuery.css( elem, name );
  13690. }, name, value, arguments.length > 1 );
  13691. }
  13692. } );
  13693. function Tween( elem, options, prop, end, easing ) {
  13694. return new Tween.prototype.init( elem, options, prop, end, easing );
  13695. }
  13696. jQuery.Tween = Tween;
  13697. Tween.prototype = {
  13698. constructor: Tween,
  13699. init: function( elem, options, prop, end, easing, unit ) {
  13700. this.elem = elem;
  13701. this.prop = prop;
  13702. this.easing = easing || jQuery.easing._default;
  13703. this.options = options;
  13704. this.start = this.now = this.cur();
  13705. this.end = end;
  13706. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13707. },
  13708. cur: function() {
  13709. var hooks = Tween.propHooks[ this.prop ];
  13710. return hooks && hooks.get ?
  13711. hooks.get( this ) :
  13712. Tween.propHooks._default.get( this );
  13713. },
  13714. run: function( percent ) {
  13715. var eased,
  13716. hooks = Tween.propHooks[ this.prop ];
  13717. if ( this.options.duration ) {
  13718. this.pos = eased = jQuery.easing[ this.easing ](
  13719. percent, this.options.duration * percent, 0, 1, this.options.duration
  13720. );
  13721. } else {
  13722. this.pos = eased = percent;
  13723. }
  13724. this.now = ( this.end - this.start ) * eased + this.start;
  13725. if ( this.options.step ) {
  13726. this.options.step.call( this.elem, this.now, this );
  13727. }
  13728. if ( hooks && hooks.set ) {
  13729. hooks.set( this );
  13730. } else {
  13731. Tween.propHooks._default.set( this );
  13732. }
  13733. return this;
  13734. }
  13735. };
  13736. Tween.prototype.init.prototype = Tween.prototype;
  13737. Tween.propHooks = {
  13738. _default: {
  13739. get: function( tween ) {
  13740. var result;
  13741. // Use a property on the element directly when it is not a DOM element,
  13742. // or when there is no matching style property that exists.
  13743. if ( tween.elem.nodeType !== 1 ||
  13744. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13745. return tween.elem[ tween.prop ];
  13746. }
  13747. // Passing an empty string as a 3rd parameter to .css will automatically
  13748. // attempt a parseFloat and fallback to a string if the parse fails.
  13749. // Simple values such as "10px" are parsed to Float;
  13750. // complex values such as "rotate(1rad)" are returned as-is.
  13751. result = jQuery.css( tween.elem, tween.prop, "" );
  13752. // Empty strings, null, undefined and "auto" are converted to 0.
  13753. return !result || result === "auto" ? 0 : result;
  13754. },
  13755. set: function( tween ) {
  13756. // Use step hook for back compat.
  13757. // Use cssHook if its there.
  13758. // Use .style if available and use plain properties where available.
  13759. if ( jQuery.fx.step[ tween.prop ] ) {
  13760. jQuery.fx.step[ tween.prop ]( tween );
  13761. } else if ( tween.elem.nodeType === 1 && (
  13762. jQuery.cssHooks[ tween.prop ] ||
  13763. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13764. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13765. } else {
  13766. tween.elem[ tween.prop ] = tween.now;
  13767. }
  13768. }
  13769. }
  13770. };
  13771. // Support: IE <=9 only
  13772. // Panic based approach to setting things on disconnected nodes
  13773. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13774. set: function( tween ) {
  13775. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13776. tween.elem[ tween.prop ] = tween.now;
  13777. }
  13778. }
  13779. };
  13780. jQuery.easing = {
  13781. linear: function( p ) {
  13782. return p;
  13783. },
  13784. swing: function( p ) {
  13785. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13786. },
  13787. _default: "swing"
  13788. };
  13789. jQuery.fx = Tween.prototype.init;
  13790. // Back compat <1.8 extension point
  13791. jQuery.fx.step = {};
  13792. var
  13793. fxNow, inProgress,
  13794. rfxtypes = /^(?:toggle|show|hide)$/,
  13795. rrun = /queueHooks$/;
  13796. function schedule() {
  13797. if ( inProgress ) {
  13798. if ( document.hidden === false && window.requestAnimationFrame ) {
  13799. window.requestAnimationFrame( schedule );
  13800. } else {
  13801. window.setTimeout( schedule, jQuery.fx.interval );
  13802. }
  13803. jQuery.fx.tick();
  13804. }
  13805. }
  13806. // Animations created synchronously will run synchronously
  13807. function createFxNow() {
  13808. window.setTimeout( function() {
  13809. fxNow = undefined;
  13810. } );
  13811. return ( fxNow = Date.now() );
  13812. }
  13813. // Generate parameters to create a standard animation
  13814. function genFx( type, includeWidth ) {
  13815. var which,
  13816. i = 0,
  13817. attrs = { height: type };
  13818. // If we include width, step value is 1 to do all cssExpand values,
  13819. // otherwise step value is 2 to skip over Left and Right
  13820. includeWidth = includeWidth ? 1 : 0;
  13821. for ( ; i < 4; i += 2 - includeWidth ) {
  13822. which = cssExpand[ i ];
  13823. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  13824. }
  13825. if ( includeWidth ) {
  13826. attrs.opacity = attrs.width = type;
  13827. }
  13828. return attrs;
  13829. }
  13830. function createTween( value, prop, animation ) {
  13831. var tween,
  13832. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  13833. index = 0,
  13834. length = collection.length;
  13835. for ( ; index < length; index++ ) {
  13836. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  13837. // We're done with this property
  13838. return tween;
  13839. }
  13840. }
  13841. }
  13842. function defaultPrefilter( elem, props, opts ) {
  13843. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  13844. isBox = "width" in props || "height" in props,
  13845. anim = this,
  13846. orig = {},
  13847. style = elem.style,
  13848. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  13849. dataShow = dataPriv.get( elem, "fxshow" );
  13850. // Queue-skipping animations hijack the fx hooks
  13851. if ( !opts.queue ) {
  13852. hooks = jQuery._queueHooks( elem, "fx" );
  13853. if ( hooks.unqueued == null ) {
  13854. hooks.unqueued = 0;
  13855. oldfire = hooks.empty.fire;
  13856. hooks.empty.fire = function() {
  13857. if ( !hooks.unqueued ) {
  13858. oldfire();
  13859. }
  13860. };
  13861. }
  13862. hooks.unqueued++;
  13863. anim.always( function() {
  13864. // Ensure the complete handler is called before this completes
  13865. anim.always( function() {
  13866. hooks.unqueued--;
  13867. if ( !jQuery.queue( elem, "fx" ).length ) {
  13868. hooks.empty.fire();
  13869. }
  13870. } );
  13871. } );
  13872. }
  13873. // Detect show/hide animations
  13874. for ( prop in props ) {
  13875. value = props[ prop ];
  13876. if ( rfxtypes.test( value ) ) {
  13877. delete props[ prop ];
  13878. toggle = toggle || value === "toggle";
  13879. if ( value === ( hidden ? "hide" : "show" ) ) {
  13880. // Pretend to be hidden if this is a "show" and
  13881. // there is still data from a stopped show/hide
  13882. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  13883. hidden = true;
  13884. // Ignore all other no-op show/hide data
  13885. } else {
  13886. continue;
  13887. }
  13888. }
  13889. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  13890. }
  13891. }
  13892. // Bail out if this is a no-op like .hide().hide()
  13893. propTween = !jQuery.isEmptyObject( props );
  13894. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  13895. return;
  13896. }
  13897. // Restrict "overflow" and "display" styles during box animations
  13898. if ( isBox && elem.nodeType === 1 ) {
  13899. // Support: IE <=9 - 11, Edge 12 - 15
  13900. // Record all 3 overflow attributes because IE does not infer the shorthand
  13901. // from identically-valued overflowX and overflowY and Edge just mirrors
  13902. // the overflowX value there.
  13903. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  13904. // Identify a display type, preferring old show/hide data over the CSS cascade
  13905. restoreDisplay = dataShow && dataShow.display;
  13906. if ( restoreDisplay == null ) {
  13907. restoreDisplay = dataPriv.get( elem, "display" );
  13908. }
  13909. display = jQuery.css( elem, "display" );
  13910. if ( display === "none" ) {
  13911. if ( restoreDisplay ) {
  13912. display = restoreDisplay;
  13913. } else {
  13914. // Get nonempty value(s) by temporarily forcing visibility
  13915. showHide( [ elem ], true );
  13916. restoreDisplay = elem.style.display || restoreDisplay;
  13917. display = jQuery.css( elem, "display" );
  13918. showHide( [ elem ] );
  13919. }
  13920. }
  13921. // Animate inline elements as inline-block
  13922. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  13923. if ( jQuery.css( elem, "float" ) === "none" ) {
  13924. // Restore the original display value at the end of pure show/hide animations
  13925. if ( !propTween ) {
  13926. anim.done( function() {
  13927. style.display = restoreDisplay;
  13928. } );
  13929. if ( restoreDisplay == null ) {
  13930. display = style.display;
  13931. restoreDisplay = display === "none" ? "" : display;
  13932. }
  13933. }
  13934. style.display = "inline-block";
  13935. }
  13936. }
  13937. }
  13938. if ( opts.overflow ) {
  13939. style.overflow = "hidden";
  13940. anim.always( function() {
  13941. style.overflow = opts.overflow[ 0 ];
  13942. style.overflowX = opts.overflow[ 1 ];
  13943. style.overflowY = opts.overflow[ 2 ];
  13944. } );
  13945. }
  13946. // Implement show/hide animations
  13947. propTween = false;
  13948. for ( prop in orig ) {
  13949. // General show/hide setup for this element animation
  13950. if ( !propTween ) {
  13951. if ( dataShow ) {
  13952. if ( "hidden" in dataShow ) {
  13953. hidden = dataShow.hidden;
  13954. }
  13955. } else {
  13956. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  13957. }
  13958. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  13959. if ( toggle ) {
  13960. dataShow.hidden = !hidden;
  13961. }
  13962. // Show elements before animating them
  13963. if ( hidden ) {
  13964. showHide( [ elem ], true );
  13965. }
  13966. /* eslint-disable no-loop-func */
  13967. anim.done( function() {
  13968. /* eslint-enable no-loop-func */
  13969. // The final step of a "hide" animation is actually hiding the element
  13970. if ( !hidden ) {
  13971. showHide( [ elem ] );
  13972. }
  13973. dataPriv.remove( elem, "fxshow" );
  13974. for ( prop in orig ) {
  13975. jQuery.style( elem, prop, orig[ prop ] );
  13976. }
  13977. } );
  13978. }
  13979. // Per-property setup
  13980. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  13981. if ( !( prop in dataShow ) ) {
  13982. dataShow[ prop ] = propTween.start;
  13983. if ( hidden ) {
  13984. propTween.end = propTween.start;
  13985. propTween.start = 0;
  13986. }
  13987. }
  13988. }
  13989. }
  13990. function propFilter( props, specialEasing ) {
  13991. var index, name, easing, value, hooks;
  13992. // camelCase, specialEasing and expand cssHook pass
  13993. for ( index in props ) {
  13994. name = camelCase( index );
  13995. easing = specialEasing[ name ];
  13996. value = props[ index ];
  13997. if ( Array.isArray( value ) ) {
  13998. easing = value[ 1 ];
  13999. value = props[ index ] = value[ 0 ];
  14000. }
  14001. if ( index !== name ) {
  14002. props[ name ] = value;
  14003. delete props[ index ];
  14004. }
  14005. hooks = jQuery.cssHooks[ name ];
  14006. if ( hooks && "expand" in hooks ) {
  14007. value = hooks.expand( value );
  14008. delete props[ name ];
  14009. // Not quite $.extend, this won't overwrite existing keys.
  14010. // Reusing 'index' because we have the correct "name"
  14011. for ( index in value ) {
  14012. if ( !( index in props ) ) {
  14013. props[ index ] = value[ index ];
  14014. specialEasing[ index ] = easing;
  14015. }
  14016. }
  14017. } else {
  14018. specialEasing[ name ] = easing;
  14019. }
  14020. }
  14021. }
  14022. function Animation( elem, properties, options ) {
  14023. var result,
  14024. stopped,
  14025. index = 0,
  14026. length = Animation.prefilters.length,
  14027. deferred = jQuery.Deferred().always( function() {
  14028. // Don't match elem in the :animated selector
  14029. delete tick.elem;
  14030. } ),
  14031. tick = function() {
  14032. if ( stopped ) {
  14033. return false;
  14034. }
  14035. var currentTime = fxNow || createFxNow(),
  14036. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14037. // Support: Android 2.3 only
  14038. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14039. temp = remaining / animation.duration || 0,
  14040. percent = 1 - temp,
  14041. index = 0,
  14042. length = animation.tweens.length;
  14043. for ( ; index < length; index++ ) {
  14044. animation.tweens[ index ].run( percent );
  14045. }
  14046. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14047. // If there's more to do, yield
  14048. if ( percent < 1 && length ) {
  14049. return remaining;
  14050. }
  14051. // If this was an empty animation, synthesize a final progress notification
  14052. if ( !length ) {
  14053. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14054. }
  14055. // Resolve the animation and report its conclusion
  14056. deferred.resolveWith( elem, [ animation ] );
  14057. return false;
  14058. },
  14059. animation = deferred.promise( {
  14060. elem: elem,
  14061. props: jQuery.extend( {}, properties ),
  14062. opts: jQuery.extend( true, {
  14063. specialEasing: {},
  14064. easing: jQuery.easing._default
  14065. }, options ),
  14066. originalProperties: properties,
  14067. originalOptions: options,
  14068. startTime: fxNow || createFxNow(),
  14069. duration: options.duration,
  14070. tweens: [],
  14071. createTween: function( prop, end ) {
  14072. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14073. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14074. animation.tweens.push( tween );
  14075. return tween;
  14076. },
  14077. stop: function( gotoEnd ) {
  14078. var index = 0,
  14079. // If we are going to the end, we want to run all the tweens
  14080. // otherwise we skip this part
  14081. length = gotoEnd ? animation.tweens.length : 0;
  14082. if ( stopped ) {
  14083. return this;
  14084. }
  14085. stopped = true;
  14086. for ( ; index < length; index++ ) {
  14087. animation.tweens[ index ].run( 1 );
  14088. }
  14089. // Resolve when we played the last frame; otherwise, reject
  14090. if ( gotoEnd ) {
  14091. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14092. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14093. } else {
  14094. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14095. }
  14096. return this;
  14097. }
  14098. } ),
  14099. props = animation.props;
  14100. propFilter( props, animation.opts.specialEasing );
  14101. for ( ; index < length; index++ ) {
  14102. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14103. if ( result ) {
  14104. if ( isFunction( result.stop ) ) {
  14105. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14106. result.stop.bind( result );
  14107. }
  14108. return result;
  14109. }
  14110. }
  14111. jQuery.map( props, createTween, animation );
  14112. if ( isFunction( animation.opts.start ) ) {
  14113. animation.opts.start.call( elem, animation );
  14114. }
  14115. // Attach callbacks from options
  14116. animation
  14117. .progress( animation.opts.progress )
  14118. .done( animation.opts.done, animation.opts.complete )
  14119. .fail( animation.opts.fail )
  14120. .always( animation.opts.always );
  14121. jQuery.fx.timer(
  14122. jQuery.extend( tick, {
  14123. elem: elem,
  14124. anim: animation,
  14125. queue: animation.opts.queue
  14126. } )
  14127. );
  14128. return animation;
  14129. }
  14130. jQuery.Animation = jQuery.extend( Animation, {
  14131. tweeners: {
  14132. "*": [ function( prop, value ) {
  14133. var tween = this.createTween( prop, value );
  14134. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14135. return tween;
  14136. } ]
  14137. },
  14138. tweener: function( props, callback ) {
  14139. if ( isFunction( props ) ) {
  14140. callback = props;
  14141. props = [ "*" ];
  14142. } else {
  14143. props = props.match( rnothtmlwhite );
  14144. }
  14145. var prop,
  14146. index = 0,
  14147. length = props.length;
  14148. for ( ; index < length; index++ ) {
  14149. prop = props[ index ];
  14150. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14151. Animation.tweeners[ prop ].unshift( callback );
  14152. }
  14153. },
  14154. prefilters: [ defaultPrefilter ],
  14155. prefilter: function( callback, prepend ) {
  14156. if ( prepend ) {
  14157. Animation.prefilters.unshift( callback );
  14158. } else {
  14159. Animation.prefilters.push( callback );
  14160. }
  14161. }
  14162. } );
  14163. jQuery.speed = function( speed, easing, fn ) {
  14164. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14165. complete: fn || !fn && easing ||
  14166. isFunction( speed ) && speed,
  14167. duration: speed,
  14168. easing: fn && easing || easing && !isFunction( easing ) && easing
  14169. };
  14170. // Go to the end state if fx are off
  14171. if ( jQuery.fx.off ) {
  14172. opt.duration = 0;
  14173. } else {
  14174. if ( typeof opt.duration !== "number" ) {
  14175. if ( opt.duration in jQuery.fx.speeds ) {
  14176. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14177. } else {
  14178. opt.duration = jQuery.fx.speeds._default;
  14179. }
  14180. }
  14181. }
  14182. // Normalize opt.queue - true/undefined/null -> "fx"
  14183. if ( opt.queue == null || opt.queue === true ) {
  14184. opt.queue = "fx";
  14185. }
  14186. // Queueing
  14187. opt.old = opt.complete;
  14188. opt.complete = function() {
  14189. if ( isFunction( opt.old ) ) {
  14190. opt.old.call( this );
  14191. }
  14192. if ( opt.queue ) {
  14193. jQuery.dequeue( this, opt.queue );
  14194. }
  14195. };
  14196. return opt;
  14197. };
  14198. jQuery.fn.extend( {
  14199. fadeTo: function( speed, to, easing, callback ) {
  14200. // Show any hidden elements after setting opacity to 0
  14201. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14202. // Animate to the value specified
  14203. .end().animate( { opacity: to }, speed, easing, callback );
  14204. },
  14205. animate: function( prop, speed, easing, callback ) {
  14206. var empty = jQuery.isEmptyObject( prop ),
  14207. optall = jQuery.speed( speed, easing, callback ),
  14208. doAnimation = function() {
  14209. // Operate on a copy of prop so per-property easing won't be lost
  14210. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14211. // Empty animations, or finishing resolves immediately
  14212. if ( empty || dataPriv.get( this, "finish" ) ) {
  14213. anim.stop( true );
  14214. }
  14215. };
  14216. doAnimation.finish = doAnimation;
  14217. return empty || optall.queue === false ?
  14218. this.each( doAnimation ) :
  14219. this.queue( optall.queue, doAnimation );
  14220. },
  14221. stop: function( type, clearQueue, gotoEnd ) {
  14222. var stopQueue = function( hooks ) {
  14223. var stop = hooks.stop;
  14224. delete hooks.stop;
  14225. stop( gotoEnd );
  14226. };
  14227. if ( typeof type !== "string" ) {
  14228. gotoEnd = clearQueue;
  14229. clearQueue = type;
  14230. type = undefined;
  14231. }
  14232. if ( clearQueue && type !== false ) {
  14233. this.queue( type || "fx", [] );
  14234. }
  14235. return this.each( function() {
  14236. var dequeue = true,
  14237. index = type != null && type + "queueHooks",
  14238. timers = jQuery.timers,
  14239. data = dataPriv.get( this );
  14240. if ( index ) {
  14241. if ( data[ index ] && data[ index ].stop ) {
  14242. stopQueue( data[ index ] );
  14243. }
  14244. } else {
  14245. for ( index in data ) {
  14246. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14247. stopQueue( data[ index ] );
  14248. }
  14249. }
  14250. }
  14251. for ( index = timers.length; index--; ) {
  14252. if ( timers[ index ].elem === this &&
  14253. ( type == null || timers[ index ].queue === type ) ) {
  14254. timers[ index ].anim.stop( gotoEnd );
  14255. dequeue = false;
  14256. timers.splice( index, 1 );
  14257. }
  14258. }
  14259. // Start the next in the queue if the last step wasn't forced.
  14260. // Timers currently will call their complete callbacks, which
  14261. // will dequeue but only if they were gotoEnd.
  14262. if ( dequeue || !gotoEnd ) {
  14263. jQuery.dequeue( this, type );
  14264. }
  14265. } );
  14266. },
  14267. finish: function( type ) {
  14268. if ( type !== false ) {
  14269. type = type || "fx";
  14270. }
  14271. return this.each( function() {
  14272. var index,
  14273. data = dataPriv.get( this ),
  14274. queue = data[ type + "queue" ],
  14275. hooks = data[ type + "queueHooks" ],
  14276. timers = jQuery.timers,
  14277. length = queue ? queue.length : 0;
  14278. // Enable finishing flag on private data
  14279. data.finish = true;
  14280. // Empty the queue first
  14281. jQuery.queue( this, type, [] );
  14282. if ( hooks && hooks.stop ) {
  14283. hooks.stop.call( this, true );
  14284. }
  14285. // Look for any active animations, and finish them
  14286. for ( index = timers.length; index--; ) {
  14287. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14288. timers[ index ].anim.stop( true );
  14289. timers.splice( index, 1 );
  14290. }
  14291. }
  14292. // Look for any animations in the old queue and finish them
  14293. for ( index = 0; index < length; index++ ) {
  14294. if ( queue[ index ] && queue[ index ].finish ) {
  14295. queue[ index ].finish.call( this );
  14296. }
  14297. }
  14298. // Turn off finishing flag
  14299. delete data.finish;
  14300. } );
  14301. }
  14302. } );
  14303. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14304. var cssFn = jQuery.fn[ name ];
  14305. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14306. return speed == null || typeof speed === "boolean" ?
  14307. cssFn.apply( this, arguments ) :
  14308. this.animate( genFx( name, true ), speed, easing, callback );
  14309. };
  14310. } );
  14311. // Generate shortcuts for custom animations
  14312. jQuery.each( {
  14313. slideDown: genFx( "show" ),
  14314. slideUp: genFx( "hide" ),
  14315. slideToggle: genFx( "toggle" ),
  14316. fadeIn: { opacity: "show" },
  14317. fadeOut: { opacity: "hide" },
  14318. fadeToggle: { opacity: "toggle" }
  14319. }, function( name, props ) {
  14320. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14321. return this.animate( props, speed, easing, callback );
  14322. };
  14323. } );
  14324. jQuery.timers = [];
  14325. jQuery.fx.tick = function() {
  14326. var timer,
  14327. i = 0,
  14328. timers = jQuery.timers;
  14329. fxNow = Date.now();
  14330. for ( ; i < timers.length; i++ ) {
  14331. timer = timers[ i ];
  14332. // Run the timer and safely remove it when done (allowing for external removal)
  14333. if ( !timer() && timers[ i ] === timer ) {
  14334. timers.splice( i--, 1 );
  14335. }
  14336. }
  14337. if ( !timers.length ) {
  14338. jQuery.fx.stop();
  14339. }
  14340. fxNow = undefined;
  14341. };
  14342. jQuery.fx.timer = function( timer ) {
  14343. jQuery.timers.push( timer );
  14344. jQuery.fx.start();
  14345. };
  14346. jQuery.fx.interval = 13;
  14347. jQuery.fx.start = function() {
  14348. if ( inProgress ) {
  14349. return;
  14350. }
  14351. inProgress = true;
  14352. schedule();
  14353. };
  14354. jQuery.fx.stop = function() {
  14355. inProgress = null;
  14356. };
  14357. jQuery.fx.speeds = {
  14358. slow: 600,
  14359. fast: 200,
  14360. // Default speed
  14361. _default: 400
  14362. };
  14363. // Based off of the plugin by Clint Helfers, with permission.
  14364. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14365. jQuery.fn.delay = function( time, type ) {
  14366. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14367. type = type || "fx";
  14368. return this.queue( type, function( next, hooks ) {
  14369. var timeout = window.setTimeout( next, time );
  14370. hooks.stop = function() {
  14371. window.clearTimeout( timeout );
  14372. };
  14373. } );
  14374. };
  14375. ( function() {
  14376. var input = document.createElement( "input" ),
  14377. select = document.createElement( "select" ),
  14378. opt = select.appendChild( document.createElement( "option" ) );
  14379. input.type = "checkbox";
  14380. // Support: Android <=4.3 only
  14381. // Default value for a checkbox should be "on"
  14382. support.checkOn = input.value !== "";
  14383. // Support: IE <=11 only
  14384. // Must access selectedIndex to make default options select
  14385. support.optSelected = opt.selected;
  14386. // Support: IE <=11 only
  14387. // An input loses its value after becoming a radio
  14388. input = document.createElement( "input" );
  14389. input.value = "t";
  14390. input.type = "radio";
  14391. support.radioValue = input.value === "t";
  14392. } )();
  14393. var boolHook,
  14394. attrHandle = jQuery.expr.attrHandle;
  14395. jQuery.fn.extend( {
  14396. attr: function( name, value ) {
  14397. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14398. },
  14399. removeAttr: function( name ) {
  14400. return this.each( function() {
  14401. jQuery.removeAttr( this, name );
  14402. } );
  14403. }
  14404. } );
  14405. jQuery.extend( {
  14406. attr: function( elem, name, value ) {
  14407. var ret, hooks,
  14408. nType = elem.nodeType;
  14409. // Don't get/set attributes on text, comment and attribute nodes
  14410. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14411. return;
  14412. }
  14413. // Fallback to prop when attributes are not supported
  14414. if ( typeof elem.getAttribute === "undefined" ) {
  14415. return jQuery.prop( elem, name, value );
  14416. }
  14417. // Attribute hooks are determined by the lowercase version
  14418. // Grab necessary hook if one is defined
  14419. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14420. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14421. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14422. }
  14423. if ( value !== undefined ) {
  14424. if ( value === null ) {
  14425. jQuery.removeAttr( elem, name );
  14426. return;
  14427. }
  14428. if ( hooks && "set" in hooks &&
  14429. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14430. return ret;
  14431. }
  14432. elem.setAttribute( name, value + "" );
  14433. return value;
  14434. }
  14435. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14436. return ret;
  14437. }
  14438. ret = jQuery.find.attr( elem, name );
  14439. // Non-existent attributes return null, we normalize to undefined
  14440. return ret == null ? undefined : ret;
  14441. },
  14442. attrHooks: {
  14443. type: {
  14444. set: function( elem, value ) {
  14445. if ( !support.radioValue && value === "radio" &&
  14446. nodeName( elem, "input" ) ) {
  14447. var val = elem.value;
  14448. elem.setAttribute( "type", value );
  14449. if ( val ) {
  14450. elem.value = val;
  14451. }
  14452. return value;
  14453. }
  14454. }
  14455. }
  14456. },
  14457. removeAttr: function( elem, value ) {
  14458. var name,
  14459. i = 0,
  14460. // Attribute names can contain non-HTML whitespace characters
  14461. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14462. attrNames = value && value.match( rnothtmlwhite );
  14463. if ( attrNames && elem.nodeType === 1 ) {
  14464. while ( ( name = attrNames[ i++ ] ) ) {
  14465. elem.removeAttribute( name );
  14466. }
  14467. }
  14468. }
  14469. } );
  14470. // Hooks for boolean attributes
  14471. boolHook = {
  14472. set: function( elem, value, name ) {
  14473. if ( value === false ) {
  14474. // Remove boolean attributes when set to false
  14475. jQuery.removeAttr( elem, name );
  14476. } else {
  14477. elem.setAttribute( name, name );
  14478. }
  14479. return name;
  14480. }
  14481. };
  14482. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14483. var getter = attrHandle[ name ] || jQuery.find.attr;
  14484. attrHandle[ name ] = function( elem, name, isXML ) {
  14485. var ret, handle,
  14486. lowercaseName = name.toLowerCase();
  14487. if ( !isXML ) {
  14488. // Avoid an infinite loop by temporarily removing this function from the getter
  14489. handle = attrHandle[ lowercaseName ];
  14490. attrHandle[ lowercaseName ] = ret;
  14491. ret = getter( elem, name, isXML ) != null ?
  14492. lowercaseName :
  14493. null;
  14494. attrHandle[ lowercaseName ] = handle;
  14495. }
  14496. return ret;
  14497. };
  14498. } );
  14499. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14500. rclickable = /^(?:a|area)$/i;
  14501. jQuery.fn.extend( {
  14502. prop: function( name, value ) {
  14503. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14504. },
  14505. removeProp: function( name ) {
  14506. return this.each( function() {
  14507. delete this[ jQuery.propFix[ name ] || name ];
  14508. } );
  14509. }
  14510. } );
  14511. jQuery.extend( {
  14512. prop: function( elem, name, value ) {
  14513. var ret, hooks,
  14514. nType = elem.nodeType;
  14515. // Don't get/set properties on text, comment and attribute nodes
  14516. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14517. return;
  14518. }
  14519. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14520. // Fix name and attach hooks
  14521. name = jQuery.propFix[ name ] || name;
  14522. hooks = jQuery.propHooks[ name ];
  14523. }
  14524. if ( value !== undefined ) {
  14525. if ( hooks && "set" in hooks &&
  14526. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14527. return ret;
  14528. }
  14529. return ( elem[ name ] = value );
  14530. }
  14531. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14532. return ret;
  14533. }
  14534. return elem[ name ];
  14535. },
  14536. propHooks: {
  14537. tabIndex: {
  14538. get: function( elem ) {
  14539. // Support: IE <=9 - 11 only
  14540. // elem.tabIndex doesn't always return the
  14541. // correct value when it hasn't been explicitly set
  14542. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14543. // Use proper attribute retrieval(#12072)
  14544. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14545. if ( tabindex ) {
  14546. return parseInt( tabindex, 10 );
  14547. }
  14548. if (
  14549. rfocusable.test( elem.nodeName ) ||
  14550. rclickable.test( elem.nodeName ) &&
  14551. elem.href
  14552. ) {
  14553. return 0;
  14554. }
  14555. return -1;
  14556. }
  14557. }
  14558. },
  14559. propFix: {
  14560. "for": "htmlFor",
  14561. "class": "className"
  14562. }
  14563. } );
  14564. // Support: IE <=11 only
  14565. // Accessing the selectedIndex property
  14566. // forces the browser to respect setting selected
  14567. // on the option
  14568. // The getter ensures a default option is selected
  14569. // when in an optgroup
  14570. // eslint rule "no-unused-expressions" is disabled for this code
  14571. // since it considers such accessions noop
  14572. if ( !support.optSelected ) {
  14573. jQuery.propHooks.selected = {
  14574. get: function( elem ) {
  14575. /* eslint no-unused-expressions: "off" */
  14576. var parent = elem.parentNode;
  14577. if ( parent && parent.parentNode ) {
  14578. parent.parentNode.selectedIndex;
  14579. }
  14580. return null;
  14581. },
  14582. set: function( elem ) {
  14583. /* eslint no-unused-expressions: "off" */
  14584. var parent = elem.parentNode;
  14585. if ( parent ) {
  14586. parent.selectedIndex;
  14587. if ( parent.parentNode ) {
  14588. parent.parentNode.selectedIndex;
  14589. }
  14590. }
  14591. }
  14592. };
  14593. }
  14594. jQuery.each( [
  14595. "tabIndex",
  14596. "readOnly",
  14597. "maxLength",
  14598. "cellSpacing",
  14599. "cellPadding",
  14600. "rowSpan",
  14601. "colSpan",
  14602. "useMap",
  14603. "frameBorder",
  14604. "contentEditable"
  14605. ], function() {
  14606. jQuery.propFix[ this.toLowerCase() ] = this;
  14607. } );
  14608. // Strip and collapse whitespace according to HTML spec
  14609. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14610. function stripAndCollapse( value ) {
  14611. var tokens = value.match( rnothtmlwhite ) || [];
  14612. return tokens.join( " " );
  14613. }
  14614. function getClass( elem ) {
  14615. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14616. }
  14617. function classesToArray( value ) {
  14618. if ( Array.isArray( value ) ) {
  14619. return value;
  14620. }
  14621. if ( typeof value === "string" ) {
  14622. return value.match( rnothtmlwhite ) || [];
  14623. }
  14624. return [];
  14625. }
  14626. jQuery.fn.extend( {
  14627. addClass: function( value ) {
  14628. var classes, elem, cur, curValue, clazz, j, finalValue,
  14629. i = 0;
  14630. if ( isFunction( value ) ) {
  14631. return this.each( function( j ) {
  14632. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14633. } );
  14634. }
  14635. classes = classesToArray( value );
  14636. if ( classes.length ) {
  14637. while ( ( elem = this[ i++ ] ) ) {
  14638. curValue = getClass( elem );
  14639. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14640. if ( cur ) {
  14641. j = 0;
  14642. while ( ( clazz = classes[ j++ ] ) ) {
  14643. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14644. cur += clazz + " ";
  14645. }
  14646. }
  14647. // Only assign if different to avoid unneeded rendering.
  14648. finalValue = stripAndCollapse( cur );
  14649. if ( curValue !== finalValue ) {
  14650. elem.setAttribute( "class", finalValue );
  14651. }
  14652. }
  14653. }
  14654. }
  14655. return this;
  14656. },
  14657. removeClass: function( value ) {
  14658. var classes, elem, cur, curValue, clazz, j, finalValue,
  14659. i = 0;
  14660. if ( isFunction( value ) ) {
  14661. return this.each( function( j ) {
  14662. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14663. } );
  14664. }
  14665. if ( !arguments.length ) {
  14666. return this.attr( "class", "" );
  14667. }
  14668. classes = classesToArray( value );
  14669. if ( classes.length ) {
  14670. while ( ( elem = this[ i++ ] ) ) {
  14671. curValue = getClass( elem );
  14672. // This expression is here for better compressibility (see addClass)
  14673. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14674. if ( cur ) {
  14675. j = 0;
  14676. while ( ( clazz = classes[ j++ ] ) ) {
  14677. // Remove *all* instances
  14678. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14679. cur = cur.replace( " " + clazz + " ", " " );
  14680. }
  14681. }
  14682. // Only assign if different to avoid unneeded rendering.
  14683. finalValue = stripAndCollapse( cur );
  14684. if ( curValue !== finalValue ) {
  14685. elem.setAttribute( "class", finalValue );
  14686. }
  14687. }
  14688. }
  14689. }
  14690. return this;
  14691. },
  14692. toggleClass: function( value, stateVal ) {
  14693. var type = typeof value,
  14694. isValidValue = type === "string" || Array.isArray( value );
  14695. if ( typeof stateVal === "boolean" && isValidValue ) {
  14696. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14697. }
  14698. if ( isFunction( value ) ) {
  14699. return this.each( function( i ) {
  14700. jQuery( this ).toggleClass(
  14701. value.call( this, i, getClass( this ), stateVal ),
  14702. stateVal
  14703. );
  14704. } );
  14705. }
  14706. return this.each( function() {
  14707. var className, i, self, classNames;
  14708. if ( isValidValue ) {
  14709. // Toggle individual class names
  14710. i = 0;
  14711. self = jQuery( this );
  14712. classNames = classesToArray( value );
  14713. while ( ( className = classNames[ i++ ] ) ) {
  14714. // Check each className given, space separated list
  14715. if ( self.hasClass( className ) ) {
  14716. self.removeClass( className );
  14717. } else {
  14718. self.addClass( className );
  14719. }
  14720. }
  14721. // Toggle whole class name
  14722. } else if ( value === undefined || type === "boolean" ) {
  14723. className = getClass( this );
  14724. if ( className ) {
  14725. // Store className if set
  14726. dataPriv.set( this, "__className__", className );
  14727. }
  14728. // If the element has a class name or if we're passed `false`,
  14729. // then remove the whole classname (if there was one, the above saved it).
  14730. // Otherwise bring back whatever was previously saved (if anything),
  14731. // falling back to the empty string if nothing was stored.
  14732. if ( this.setAttribute ) {
  14733. this.setAttribute( "class",
  14734. className || value === false ?
  14735. "" :
  14736. dataPriv.get( this, "__className__" ) || ""
  14737. );
  14738. }
  14739. }
  14740. } );
  14741. },
  14742. hasClass: function( selector ) {
  14743. var className, elem,
  14744. i = 0;
  14745. className = " " + selector + " ";
  14746. while ( ( elem = this[ i++ ] ) ) {
  14747. if ( elem.nodeType === 1 &&
  14748. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14749. return true;
  14750. }
  14751. }
  14752. return false;
  14753. }
  14754. } );
  14755. var rreturn = /\r/g;
  14756. jQuery.fn.extend( {
  14757. val: function( value ) {
  14758. var hooks, ret, valueIsFunction,
  14759. elem = this[ 0 ];
  14760. if ( !arguments.length ) {
  14761. if ( elem ) {
  14762. hooks = jQuery.valHooks[ elem.type ] ||
  14763. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14764. if ( hooks &&
  14765. "get" in hooks &&
  14766. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14767. ) {
  14768. return ret;
  14769. }
  14770. ret = elem.value;
  14771. // Handle most common string cases
  14772. if ( typeof ret === "string" ) {
  14773. return ret.replace( rreturn, "" );
  14774. }
  14775. // Handle cases where value is null/undef or number
  14776. return ret == null ? "" : ret;
  14777. }
  14778. return;
  14779. }
  14780. valueIsFunction = isFunction( value );
  14781. return this.each( function( i ) {
  14782. var val;
  14783. if ( this.nodeType !== 1 ) {
  14784. return;
  14785. }
  14786. if ( valueIsFunction ) {
  14787. val = value.call( this, i, jQuery( this ).val() );
  14788. } else {
  14789. val = value;
  14790. }
  14791. // Treat null/undefined as ""; convert numbers to string
  14792. if ( val == null ) {
  14793. val = "";
  14794. } else if ( typeof val === "number" ) {
  14795. val += "";
  14796. } else if ( Array.isArray( val ) ) {
  14797. val = jQuery.map( val, function( value ) {
  14798. return value == null ? "" : value + "";
  14799. } );
  14800. }
  14801. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  14802. // If set returns undefined, fall back to normal setting
  14803. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  14804. this.value = val;
  14805. }
  14806. } );
  14807. }
  14808. } );
  14809. jQuery.extend( {
  14810. valHooks: {
  14811. option: {
  14812. get: function( elem ) {
  14813. var val = jQuery.find.attr( elem, "value" );
  14814. return val != null ?
  14815. val :
  14816. // Support: IE <=10 - 11 only
  14817. // option.text throws exceptions (#14686, #14858)
  14818. // Strip and collapse whitespace
  14819. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  14820. stripAndCollapse( jQuery.text( elem ) );
  14821. }
  14822. },
  14823. select: {
  14824. get: function( elem ) {
  14825. var value, option, i,
  14826. options = elem.options,
  14827. index = elem.selectedIndex,
  14828. one = elem.type === "select-one",
  14829. values = one ? null : [],
  14830. max = one ? index + 1 : options.length;
  14831. if ( index < 0 ) {
  14832. i = max;
  14833. } else {
  14834. i = one ? index : 0;
  14835. }
  14836. // Loop through all the selected options
  14837. for ( ; i < max; i++ ) {
  14838. option = options[ i ];
  14839. // Support: IE <=9 only
  14840. // IE8-9 doesn't update selected after form reset (#2551)
  14841. if ( ( option.selected || i === index ) &&
  14842. // Don't return options that are disabled or in a disabled optgroup
  14843. !option.disabled &&
  14844. ( !option.parentNode.disabled ||
  14845. !nodeName( option.parentNode, "optgroup" ) ) ) {
  14846. // Get the specific value for the option
  14847. value = jQuery( option ).val();
  14848. // We don't need an array for one selects
  14849. if ( one ) {
  14850. return value;
  14851. }
  14852. // Multi-Selects return an array
  14853. values.push( value );
  14854. }
  14855. }
  14856. return values;
  14857. },
  14858. set: function( elem, value ) {
  14859. var optionSet, option,
  14860. options = elem.options,
  14861. values = jQuery.makeArray( value ),
  14862. i = options.length;
  14863. while ( i-- ) {
  14864. option = options[ i ];
  14865. /* eslint-disable no-cond-assign */
  14866. if ( option.selected =
  14867. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  14868. ) {
  14869. optionSet = true;
  14870. }
  14871. /* eslint-enable no-cond-assign */
  14872. }
  14873. // Force browsers to behave consistently when non-matching value is set
  14874. if ( !optionSet ) {
  14875. elem.selectedIndex = -1;
  14876. }
  14877. return values;
  14878. }
  14879. }
  14880. }
  14881. } );
  14882. // Radios and checkboxes getter/setter
  14883. jQuery.each( [ "radio", "checkbox" ], function() {
  14884. jQuery.valHooks[ this ] = {
  14885. set: function( elem, value ) {
  14886. if ( Array.isArray( value ) ) {
  14887. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  14888. }
  14889. }
  14890. };
  14891. if ( !support.checkOn ) {
  14892. jQuery.valHooks[ this ].get = function( elem ) {
  14893. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  14894. };
  14895. }
  14896. } );
  14897. // Return jQuery for attributes-only inclusion
  14898. support.focusin = "onfocusin" in window;
  14899. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  14900. stopPropagationCallback = function( e ) {
  14901. e.stopPropagation();
  14902. };
  14903. jQuery.extend( jQuery.event, {
  14904. trigger: function( event, data, elem, onlyHandlers ) {
  14905. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  14906. eventPath = [ elem || document ],
  14907. type = hasOwn.call( event, "type" ) ? event.type : event,
  14908. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  14909. cur = lastElement = tmp = elem = elem || document;
  14910. // Don't do events on text and comment nodes
  14911. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  14912. return;
  14913. }
  14914. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  14915. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  14916. return;
  14917. }
  14918. if ( type.indexOf( "." ) > -1 ) {
  14919. // Namespaced trigger; create a regexp to match event type in handle()
  14920. namespaces = type.split( "." );
  14921. type = namespaces.shift();
  14922. namespaces.sort();
  14923. }
  14924. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  14925. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  14926. event = event[ jQuery.expando ] ?
  14927. event :
  14928. new jQuery.Event( type, typeof event === "object" && event );
  14929. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  14930. event.isTrigger = onlyHandlers ? 2 : 3;
  14931. event.namespace = namespaces.join( "." );
  14932. event.rnamespace = event.namespace ?
  14933. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  14934. null;
  14935. // Clean up the event in case it is being reused
  14936. event.result = undefined;
  14937. if ( !event.target ) {
  14938. event.target = elem;
  14939. }
  14940. // Clone any incoming data and prepend the event, creating the handler arg list
  14941. data = data == null ?
  14942. [ event ] :
  14943. jQuery.makeArray( data, [ event ] );
  14944. // Allow special events to draw outside the lines
  14945. special = jQuery.event.special[ type ] || {};
  14946. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  14947. return;
  14948. }
  14949. // Determine event propagation path in advance, per W3C events spec (#9951)
  14950. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  14951. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  14952. bubbleType = special.delegateType || type;
  14953. if ( !rfocusMorph.test( bubbleType + type ) ) {
  14954. cur = cur.parentNode;
  14955. }
  14956. for ( ; cur; cur = cur.parentNode ) {
  14957. eventPath.push( cur );
  14958. tmp = cur;
  14959. }
  14960. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  14961. if ( tmp === ( elem.ownerDocument || document ) ) {
  14962. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  14963. }
  14964. }
  14965. // Fire handlers on the event path
  14966. i = 0;
  14967. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  14968. lastElement = cur;
  14969. event.type = i > 1 ?
  14970. bubbleType :
  14971. special.bindType || type;
  14972. // jQuery handler
  14973. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  14974. dataPriv.get( cur, "handle" );
  14975. if ( handle ) {
  14976. handle.apply( cur, data );
  14977. }
  14978. // Native handler
  14979. handle = ontype && cur[ ontype ];
  14980. if ( handle && handle.apply && acceptData( cur ) ) {
  14981. event.result = handle.apply( cur, data );
  14982. if ( event.result === false ) {
  14983. event.preventDefault();
  14984. }
  14985. }
  14986. }
  14987. event.type = type;
  14988. // If nobody prevented the default action, do it now
  14989. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  14990. if ( ( !special._default ||
  14991. special._default.apply( eventPath.pop(), data ) === false ) &&
  14992. acceptData( elem ) ) {
  14993. // Call a native DOM method on the target with the same name as the event.
  14994. // Don't do default actions on window, that's where global variables be (#6170)
  14995. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  14996. // Don't re-trigger an onFOO event when we call its FOO() method
  14997. tmp = elem[ ontype ];
  14998. if ( tmp ) {
  14999. elem[ ontype ] = null;
  15000. }
  15001. // Prevent re-triggering of the same event, since we already bubbled it above
  15002. jQuery.event.triggered = type;
  15003. if ( event.isPropagationStopped() ) {
  15004. lastElement.addEventListener( type, stopPropagationCallback );
  15005. }
  15006. elem[ type ]();
  15007. if ( event.isPropagationStopped() ) {
  15008. lastElement.removeEventListener( type, stopPropagationCallback );
  15009. }
  15010. jQuery.event.triggered = undefined;
  15011. if ( tmp ) {
  15012. elem[ ontype ] = tmp;
  15013. }
  15014. }
  15015. }
  15016. }
  15017. return event.result;
  15018. },
  15019. // Piggyback on a donor event to simulate a different one
  15020. // Used only for `focus(in | out)` events
  15021. simulate: function( type, elem, event ) {
  15022. var e = jQuery.extend(
  15023. new jQuery.Event(),
  15024. event,
  15025. {
  15026. type: type,
  15027. isSimulated: true
  15028. }
  15029. );
  15030. jQuery.event.trigger( e, null, elem );
  15031. }
  15032. } );
  15033. jQuery.fn.extend( {
  15034. trigger: function( type, data ) {
  15035. return this.each( function() {
  15036. jQuery.event.trigger( type, data, this );
  15037. } );
  15038. },
  15039. triggerHandler: function( type, data ) {
  15040. var elem = this[ 0 ];
  15041. if ( elem ) {
  15042. return jQuery.event.trigger( type, data, elem, true );
  15043. }
  15044. }
  15045. } );
  15046. // Support: Firefox <=44
  15047. // Firefox doesn't have focus(in | out) events
  15048. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15049. //
  15050. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15051. // focus(in | out) events fire after focus & blur events,
  15052. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15053. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15054. if ( !support.focusin ) {
  15055. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15056. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15057. var handler = function( event ) {
  15058. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15059. };
  15060. jQuery.event.special[ fix ] = {
  15061. setup: function() {
  15062. var doc = this.ownerDocument || this,
  15063. attaches = dataPriv.access( doc, fix );
  15064. if ( !attaches ) {
  15065. doc.addEventListener( orig, handler, true );
  15066. }
  15067. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15068. },
  15069. teardown: function() {
  15070. var doc = this.ownerDocument || this,
  15071. attaches = dataPriv.access( doc, fix ) - 1;
  15072. if ( !attaches ) {
  15073. doc.removeEventListener( orig, handler, true );
  15074. dataPriv.remove( doc, fix );
  15075. } else {
  15076. dataPriv.access( doc, fix, attaches );
  15077. }
  15078. }
  15079. };
  15080. } );
  15081. }
  15082. var location = window.location;
  15083. var nonce = Date.now();
  15084. var rquery = ( /\?/ );
  15085. // Cross-browser xml parsing
  15086. jQuery.parseXML = function( data ) {
  15087. var xml;
  15088. if ( !data || typeof data !== "string" ) {
  15089. return null;
  15090. }
  15091. // Support: IE 9 - 11 only
  15092. // IE throws on parseFromString with invalid input.
  15093. try {
  15094. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15095. } catch ( e ) {
  15096. xml = undefined;
  15097. }
  15098. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15099. jQuery.error( "Invalid XML: " + data );
  15100. }
  15101. return xml;
  15102. };
  15103. var
  15104. rbracket = /\[\]$/,
  15105. rCRLF = /\r?\n/g,
  15106. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15107. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15108. function buildParams( prefix, obj, traditional, add ) {
  15109. var name;
  15110. if ( Array.isArray( obj ) ) {
  15111. // Serialize array item.
  15112. jQuery.each( obj, function( i, v ) {
  15113. if ( traditional || rbracket.test( prefix ) ) {
  15114. // Treat each array item as a scalar.
  15115. add( prefix, v );
  15116. } else {
  15117. // Item is non-scalar (array or object), encode its numeric index.
  15118. buildParams(
  15119. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15120. v,
  15121. traditional,
  15122. add
  15123. );
  15124. }
  15125. } );
  15126. } else if ( !traditional && toType( obj ) === "object" ) {
  15127. // Serialize object item.
  15128. for ( name in obj ) {
  15129. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15130. }
  15131. } else {
  15132. // Serialize scalar item.
  15133. add( prefix, obj );
  15134. }
  15135. }
  15136. // Serialize an array of form elements or a set of
  15137. // key/values into a query string
  15138. jQuery.param = function( a, traditional ) {
  15139. var prefix,
  15140. s = [],
  15141. add = function( key, valueOrFunction ) {
  15142. // If value is a function, invoke it and use its return value
  15143. var value = isFunction( valueOrFunction ) ?
  15144. valueOrFunction() :
  15145. valueOrFunction;
  15146. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15147. encodeURIComponent( value == null ? "" : value );
  15148. };
  15149. if ( a == null ) {
  15150. return "";
  15151. }
  15152. // If an array was passed in, assume that it is an array of form elements.
  15153. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15154. // Serialize the form elements
  15155. jQuery.each( a, function() {
  15156. add( this.name, this.value );
  15157. } );
  15158. } else {
  15159. // If traditional, encode the "old" way (the way 1.3.2 or older
  15160. // did it), otherwise encode params recursively.
  15161. for ( prefix in a ) {
  15162. buildParams( prefix, a[ prefix ], traditional, add );
  15163. }
  15164. }
  15165. // Return the resulting serialization
  15166. return s.join( "&" );
  15167. };
  15168. jQuery.fn.extend( {
  15169. serialize: function() {
  15170. return jQuery.param( this.serializeArray() );
  15171. },
  15172. serializeArray: function() {
  15173. return this.map( function() {
  15174. // Can add propHook for "elements" to filter or add form elements
  15175. var elements = jQuery.prop( this, "elements" );
  15176. return elements ? jQuery.makeArray( elements ) : this;
  15177. } )
  15178. .filter( function() {
  15179. var type = this.type;
  15180. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15181. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15182. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15183. ( this.checked || !rcheckableType.test( type ) );
  15184. } )
  15185. .map( function( i, elem ) {
  15186. var val = jQuery( this ).val();
  15187. if ( val == null ) {
  15188. return null;
  15189. }
  15190. if ( Array.isArray( val ) ) {
  15191. return jQuery.map( val, function( val ) {
  15192. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15193. } );
  15194. }
  15195. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15196. } ).get();
  15197. }
  15198. } );
  15199. var
  15200. r20 = /%20/g,
  15201. rhash = /#.*$/,
  15202. rantiCache = /([?&])_=[^&]*/,
  15203. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15204. // #7653, #8125, #8152: local protocol detection
  15205. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15206. rnoContent = /^(?:GET|HEAD)$/,
  15207. rprotocol = /^\/\//,
  15208. /* Prefilters
  15209. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15210. * 2) These are called:
  15211. * - BEFORE asking for a transport
  15212. * - AFTER param serialization (s.data is a string if s.processData is true)
  15213. * 3) key is the dataType
  15214. * 4) the catchall symbol "*" can be used
  15215. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15216. */
  15217. prefilters = {},
  15218. /* Transports bindings
  15219. * 1) key is the dataType
  15220. * 2) the catchall symbol "*" can be used
  15221. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15222. */
  15223. transports = {},
  15224. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15225. allTypes = "*/".concat( "*" ),
  15226. // Anchor tag for parsing the document origin
  15227. originAnchor = document.createElement( "a" );
  15228. originAnchor.href = location.href;
  15229. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15230. function addToPrefiltersOrTransports( structure ) {
  15231. // dataTypeExpression is optional and defaults to "*"
  15232. return function( dataTypeExpression, func ) {
  15233. if ( typeof dataTypeExpression !== "string" ) {
  15234. func = dataTypeExpression;
  15235. dataTypeExpression = "*";
  15236. }
  15237. var dataType,
  15238. i = 0,
  15239. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15240. if ( isFunction( func ) ) {
  15241. // For each dataType in the dataTypeExpression
  15242. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15243. // Prepend if requested
  15244. if ( dataType[ 0 ] === "+" ) {
  15245. dataType = dataType.slice( 1 ) || "*";
  15246. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15247. // Otherwise append
  15248. } else {
  15249. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15250. }
  15251. }
  15252. }
  15253. };
  15254. }
  15255. // Base inspection function for prefilters and transports
  15256. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15257. var inspected = {},
  15258. seekingTransport = ( structure === transports );
  15259. function inspect( dataType ) {
  15260. var selected;
  15261. inspected[ dataType ] = true;
  15262. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15263. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15264. if ( typeof dataTypeOrTransport === "string" &&
  15265. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15266. options.dataTypes.unshift( dataTypeOrTransport );
  15267. inspect( dataTypeOrTransport );
  15268. return false;
  15269. } else if ( seekingTransport ) {
  15270. return !( selected = dataTypeOrTransport );
  15271. }
  15272. } );
  15273. return selected;
  15274. }
  15275. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15276. }
  15277. // A special extend for ajax options
  15278. // that takes "flat" options (not to be deep extended)
  15279. // Fixes #9887
  15280. function ajaxExtend( target, src ) {
  15281. var key, deep,
  15282. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15283. for ( key in src ) {
  15284. if ( src[ key ] !== undefined ) {
  15285. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15286. }
  15287. }
  15288. if ( deep ) {
  15289. jQuery.extend( true, target, deep );
  15290. }
  15291. return target;
  15292. }
  15293. /* Handles responses to an ajax request:
  15294. * - finds the right dataType (mediates between content-type and expected dataType)
  15295. * - returns the corresponding response
  15296. */
  15297. function ajaxHandleResponses( s, jqXHR, responses ) {
  15298. var ct, type, finalDataType, firstDataType,
  15299. contents = s.contents,
  15300. dataTypes = s.dataTypes;
  15301. // Remove auto dataType and get content-type in the process
  15302. while ( dataTypes[ 0 ] === "*" ) {
  15303. dataTypes.shift();
  15304. if ( ct === undefined ) {
  15305. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15306. }
  15307. }
  15308. // Check if we're dealing with a known content-type
  15309. if ( ct ) {
  15310. for ( type in contents ) {
  15311. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15312. dataTypes.unshift( type );
  15313. break;
  15314. }
  15315. }
  15316. }
  15317. // Check to see if we have a response for the expected dataType
  15318. if ( dataTypes[ 0 ] in responses ) {
  15319. finalDataType = dataTypes[ 0 ];
  15320. } else {
  15321. // Try convertible dataTypes
  15322. for ( type in responses ) {
  15323. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15324. finalDataType = type;
  15325. break;
  15326. }
  15327. if ( !firstDataType ) {
  15328. firstDataType = type;
  15329. }
  15330. }
  15331. // Or just use first one
  15332. finalDataType = finalDataType || firstDataType;
  15333. }
  15334. // If we found a dataType
  15335. // We add the dataType to the list if needed
  15336. // and return the corresponding response
  15337. if ( finalDataType ) {
  15338. if ( finalDataType !== dataTypes[ 0 ] ) {
  15339. dataTypes.unshift( finalDataType );
  15340. }
  15341. return responses[ finalDataType ];
  15342. }
  15343. }
  15344. /* Chain conversions given the request and the original response
  15345. * Also sets the responseXXX fields on the jqXHR instance
  15346. */
  15347. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15348. var conv2, current, conv, tmp, prev,
  15349. converters = {},
  15350. // Work with a copy of dataTypes in case we need to modify it for conversion
  15351. dataTypes = s.dataTypes.slice();
  15352. // Create converters map with lowercased keys
  15353. if ( dataTypes[ 1 ] ) {
  15354. for ( conv in s.converters ) {
  15355. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15356. }
  15357. }
  15358. current = dataTypes.shift();
  15359. // Convert to each sequential dataType
  15360. while ( current ) {
  15361. if ( s.responseFields[ current ] ) {
  15362. jqXHR[ s.responseFields[ current ] ] = response;
  15363. }
  15364. // Apply the dataFilter if provided
  15365. if ( !prev && isSuccess && s.dataFilter ) {
  15366. response = s.dataFilter( response, s.dataType );
  15367. }
  15368. prev = current;
  15369. current = dataTypes.shift();
  15370. if ( current ) {
  15371. // There's only work to do if current dataType is non-auto
  15372. if ( current === "*" ) {
  15373. current = prev;
  15374. // Convert response if prev dataType is non-auto and differs from current
  15375. } else if ( prev !== "*" && prev !== current ) {
  15376. // Seek a direct converter
  15377. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15378. // If none found, seek a pair
  15379. if ( !conv ) {
  15380. for ( conv2 in converters ) {
  15381. // If conv2 outputs current
  15382. tmp = conv2.split( " " );
  15383. if ( tmp[ 1 ] === current ) {
  15384. // If prev can be converted to accepted input
  15385. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15386. converters[ "* " + tmp[ 0 ] ];
  15387. if ( conv ) {
  15388. // Condense equivalence converters
  15389. if ( conv === true ) {
  15390. conv = converters[ conv2 ];
  15391. // Otherwise, insert the intermediate dataType
  15392. } else if ( converters[ conv2 ] !== true ) {
  15393. current = tmp[ 0 ];
  15394. dataTypes.unshift( tmp[ 1 ] );
  15395. }
  15396. break;
  15397. }
  15398. }
  15399. }
  15400. }
  15401. // Apply converter (if not an equivalence)
  15402. if ( conv !== true ) {
  15403. // Unless errors are allowed to bubble, catch and return them
  15404. if ( conv && s.throws ) {
  15405. response = conv( response );
  15406. } else {
  15407. try {
  15408. response = conv( response );
  15409. } catch ( e ) {
  15410. return {
  15411. state: "parsererror",
  15412. error: conv ? e : "No conversion from " + prev + " to " + current
  15413. };
  15414. }
  15415. }
  15416. }
  15417. }
  15418. }
  15419. }
  15420. return { state: "success", data: response };
  15421. }
  15422. jQuery.extend( {
  15423. // Counter for holding the number of active queries
  15424. active: 0,
  15425. // Last-Modified header cache for next request
  15426. lastModified: {},
  15427. etag: {},
  15428. ajaxSettings: {
  15429. url: location.href,
  15430. type: "GET",
  15431. isLocal: rlocalProtocol.test( location.protocol ),
  15432. global: true,
  15433. processData: true,
  15434. async: true,
  15435. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15436. /*
  15437. timeout: 0,
  15438. data: null,
  15439. dataType: null,
  15440. username: null,
  15441. password: null,
  15442. cache: null,
  15443. throws: false,
  15444. traditional: false,
  15445. headers: {},
  15446. */
  15447. accepts: {
  15448. "*": allTypes,
  15449. text: "text/plain",
  15450. html: "text/html",
  15451. xml: "application/xml, text/xml",
  15452. json: "application/json, text/javascript"
  15453. },
  15454. contents: {
  15455. xml: /\bxml\b/,
  15456. html: /\bhtml/,
  15457. json: /\bjson\b/
  15458. },
  15459. responseFields: {
  15460. xml: "responseXML",
  15461. text: "responseText",
  15462. json: "responseJSON"
  15463. },
  15464. // Data converters
  15465. // Keys separate source (or catchall "*") and destination types with a single space
  15466. converters: {
  15467. // Convert anything to text
  15468. "* text": String,
  15469. // Text to html (true = no transformation)
  15470. "text html": true,
  15471. // Evaluate text as a json expression
  15472. "text json": JSON.parse,
  15473. // Parse text as xml
  15474. "text xml": jQuery.parseXML
  15475. },
  15476. // For options that shouldn't be deep extended:
  15477. // you can add your own custom options here if
  15478. // and when you create one that shouldn't be
  15479. // deep extended (see ajaxExtend)
  15480. flatOptions: {
  15481. url: true,
  15482. context: true
  15483. }
  15484. },
  15485. // Creates a full fledged settings object into target
  15486. // with both ajaxSettings and settings fields.
  15487. // If target is omitted, writes into ajaxSettings.
  15488. ajaxSetup: function( target, settings ) {
  15489. return settings ?
  15490. // Building a settings object
  15491. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15492. // Extending ajaxSettings
  15493. ajaxExtend( jQuery.ajaxSettings, target );
  15494. },
  15495. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15496. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15497. // Main method
  15498. ajax: function( url, options ) {
  15499. // If url is an object, simulate pre-1.5 signature
  15500. if ( typeof url === "object" ) {
  15501. options = url;
  15502. url = undefined;
  15503. }
  15504. // Force options to be an object
  15505. options = options || {};
  15506. var transport,
  15507. // URL without anti-cache param
  15508. cacheURL,
  15509. // Response headers
  15510. responseHeadersString,
  15511. responseHeaders,
  15512. // timeout handle
  15513. timeoutTimer,
  15514. // Url cleanup var
  15515. urlAnchor,
  15516. // Request state (becomes false upon send and true upon completion)
  15517. completed,
  15518. // To know if global events are to be dispatched
  15519. fireGlobals,
  15520. // Loop variable
  15521. i,
  15522. // uncached part of the url
  15523. uncached,
  15524. // Create the final options object
  15525. s = jQuery.ajaxSetup( {}, options ),
  15526. // Callbacks context
  15527. callbackContext = s.context || s,
  15528. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15529. globalEventContext = s.context &&
  15530. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15531. jQuery( callbackContext ) :
  15532. jQuery.event,
  15533. // Deferreds
  15534. deferred = jQuery.Deferred(),
  15535. completeDeferred = jQuery.Callbacks( "once memory" ),
  15536. // Status-dependent callbacks
  15537. statusCode = s.statusCode || {},
  15538. // Headers (they are sent all at once)
  15539. requestHeaders = {},
  15540. requestHeadersNames = {},
  15541. // Default abort message
  15542. strAbort = "canceled",
  15543. // Fake xhr
  15544. jqXHR = {
  15545. readyState: 0,
  15546. // Builds headers hashtable if needed
  15547. getResponseHeader: function( key ) {
  15548. var match;
  15549. if ( completed ) {
  15550. if ( !responseHeaders ) {
  15551. responseHeaders = {};
  15552. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15553. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15554. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15555. .concat( match[ 2 ] );
  15556. }
  15557. }
  15558. match = responseHeaders[ key.toLowerCase() + " " ];
  15559. }
  15560. return match == null ? null : match.join( ", " );
  15561. },
  15562. // Raw string
  15563. getAllResponseHeaders: function() {
  15564. return completed ? responseHeadersString : null;
  15565. },
  15566. // Caches the header
  15567. setRequestHeader: function( name, value ) {
  15568. if ( completed == null ) {
  15569. name = requestHeadersNames[ name.toLowerCase() ] =
  15570. requestHeadersNames[ name.toLowerCase() ] || name;
  15571. requestHeaders[ name ] = value;
  15572. }
  15573. return this;
  15574. },
  15575. // Overrides response content-type header
  15576. overrideMimeType: function( type ) {
  15577. if ( completed == null ) {
  15578. s.mimeType = type;
  15579. }
  15580. return this;
  15581. },
  15582. // Status-dependent callbacks
  15583. statusCode: function( map ) {
  15584. var code;
  15585. if ( map ) {
  15586. if ( completed ) {
  15587. // Execute the appropriate callbacks
  15588. jqXHR.always( map[ jqXHR.status ] );
  15589. } else {
  15590. // Lazy-add the new callbacks in a way that preserves old ones
  15591. for ( code in map ) {
  15592. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15593. }
  15594. }
  15595. }
  15596. return this;
  15597. },
  15598. // Cancel the request
  15599. abort: function( statusText ) {
  15600. var finalText = statusText || strAbort;
  15601. if ( transport ) {
  15602. transport.abort( finalText );
  15603. }
  15604. done( 0, finalText );
  15605. return this;
  15606. }
  15607. };
  15608. // Attach deferreds
  15609. deferred.promise( jqXHR );
  15610. // Add protocol if not provided (prefilters might expect it)
  15611. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15612. // We also use the url parameter if available
  15613. s.url = ( ( url || s.url || location.href ) + "" )
  15614. .replace( rprotocol, location.protocol + "//" );
  15615. // Alias method option to type as per ticket #12004
  15616. s.type = options.method || options.type || s.method || s.type;
  15617. // Extract dataTypes list
  15618. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15619. // A cross-domain request is in order when the origin doesn't match the current origin.
  15620. if ( s.crossDomain == null ) {
  15621. urlAnchor = document.createElement( "a" );
  15622. // Support: IE <=8 - 11, Edge 12 - 15
  15623. // IE throws exception on accessing the href property if url is malformed,
  15624. // e.g. http://example.com:80x/
  15625. try {
  15626. urlAnchor.href = s.url;
  15627. // Support: IE <=8 - 11 only
  15628. // Anchor's host property isn't correctly set when s.url is relative
  15629. urlAnchor.href = urlAnchor.href;
  15630. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15631. urlAnchor.protocol + "//" + urlAnchor.host;
  15632. } catch ( e ) {
  15633. // If there is an error parsing the URL, assume it is crossDomain,
  15634. // it can be rejected by the transport if it is invalid
  15635. s.crossDomain = true;
  15636. }
  15637. }
  15638. // Convert data if not already a string
  15639. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15640. s.data = jQuery.param( s.data, s.traditional );
  15641. }
  15642. // Apply prefilters
  15643. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15644. // If request was aborted inside a prefilter, stop there
  15645. if ( completed ) {
  15646. return jqXHR;
  15647. }
  15648. // We can fire global events as of now if asked to
  15649. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15650. fireGlobals = jQuery.event && s.global;
  15651. // Watch for a new set of requests
  15652. if ( fireGlobals && jQuery.active++ === 0 ) {
  15653. jQuery.event.trigger( "ajaxStart" );
  15654. }
  15655. // Uppercase the type
  15656. s.type = s.type.toUpperCase();
  15657. // Determine if request has content
  15658. s.hasContent = !rnoContent.test( s.type );
  15659. // Save the URL in case we're toying with the If-Modified-Since
  15660. // and/or If-None-Match header later on
  15661. // Remove hash to simplify url manipulation
  15662. cacheURL = s.url.replace( rhash, "" );
  15663. // More options handling for requests with no content
  15664. if ( !s.hasContent ) {
  15665. // Remember the hash so we can put it back
  15666. uncached = s.url.slice( cacheURL.length );
  15667. // If data is available and should be processed, append data to url
  15668. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15669. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15670. // #9682: remove data so that it's not used in an eventual retry
  15671. delete s.data;
  15672. }
  15673. // Add or update anti-cache param if needed
  15674. if ( s.cache === false ) {
  15675. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15676. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15677. }
  15678. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15679. s.url = cacheURL + uncached;
  15680. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15681. } else if ( s.data && s.processData &&
  15682. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15683. s.data = s.data.replace( r20, "+" );
  15684. }
  15685. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15686. if ( s.ifModified ) {
  15687. if ( jQuery.lastModified[ cacheURL ] ) {
  15688. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15689. }
  15690. if ( jQuery.etag[ cacheURL ] ) {
  15691. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15692. }
  15693. }
  15694. // Set the correct header, if data is being sent
  15695. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15696. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15697. }
  15698. // Set the Accepts header for the server, depending on the dataType
  15699. jqXHR.setRequestHeader(
  15700. "Accept",
  15701. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15702. s.accepts[ s.dataTypes[ 0 ] ] +
  15703. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15704. s.accepts[ "*" ]
  15705. );
  15706. // Check for headers option
  15707. for ( i in s.headers ) {
  15708. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15709. }
  15710. // Allow custom headers/mimetypes and early abort
  15711. if ( s.beforeSend &&
  15712. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15713. // Abort if not done already and return
  15714. return jqXHR.abort();
  15715. }
  15716. // Aborting is no longer a cancellation
  15717. strAbort = "abort";
  15718. // Install callbacks on deferreds
  15719. completeDeferred.add( s.complete );
  15720. jqXHR.done( s.success );
  15721. jqXHR.fail( s.error );
  15722. // Get transport
  15723. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15724. // If no transport, we auto-abort
  15725. if ( !transport ) {
  15726. done( -1, "No Transport" );
  15727. } else {
  15728. jqXHR.readyState = 1;
  15729. // Send global event
  15730. if ( fireGlobals ) {
  15731. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15732. }
  15733. // If request was aborted inside ajaxSend, stop there
  15734. if ( completed ) {
  15735. return jqXHR;
  15736. }
  15737. // Timeout
  15738. if ( s.async && s.timeout > 0 ) {
  15739. timeoutTimer = window.setTimeout( function() {
  15740. jqXHR.abort( "timeout" );
  15741. }, s.timeout );
  15742. }
  15743. try {
  15744. completed = false;
  15745. transport.send( requestHeaders, done );
  15746. } catch ( e ) {
  15747. // Rethrow post-completion exceptions
  15748. if ( completed ) {
  15749. throw e;
  15750. }
  15751. // Propagate others as results
  15752. done( -1, e );
  15753. }
  15754. }
  15755. // Callback for when everything is done
  15756. function done( status, nativeStatusText, responses, headers ) {
  15757. var isSuccess, success, error, response, modified,
  15758. statusText = nativeStatusText;
  15759. // Ignore repeat invocations
  15760. if ( completed ) {
  15761. return;
  15762. }
  15763. completed = true;
  15764. // Clear timeout if it exists
  15765. if ( timeoutTimer ) {
  15766. window.clearTimeout( timeoutTimer );
  15767. }
  15768. // Dereference transport for early garbage collection
  15769. // (no matter how long the jqXHR object will be used)
  15770. transport = undefined;
  15771. // Cache response headers
  15772. responseHeadersString = headers || "";
  15773. // Set readyState
  15774. jqXHR.readyState = status > 0 ? 4 : 0;
  15775. // Determine if successful
  15776. isSuccess = status >= 200 && status < 300 || status === 304;
  15777. // Get response data
  15778. if ( responses ) {
  15779. response = ajaxHandleResponses( s, jqXHR, responses );
  15780. }
  15781. // Convert no matter what (that way responseXXX fields are always set)
  15782. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15783. // If successful, handle type chaining
  15784. if ( isSuccess ) {
  15785. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15786. if ( s.ifModified ) {
  15787. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15788. if ( modified ) {
  15789. jQuery.lastModified[ cacheURL ] = modified;
  15790. }
  15791. modified = jqXHR.getResponseHeader( "etag" );
  15792. if ( modified ) {
  15793. jQuery.etag[ cacheURL ] = modified;
  15794. }
  15795. }
  15796. // if no content
  15797. if ( status === 204 || s.type === "HEAD" ) {
  15798. statusText = "nocontent";
  15799. // if not modified
  15800. } else if ( status === 304 ) {
  15801. statusText = "notmodified";
  15802. // If we have data, let's convert it
  15803. } else {
  15804. statusText = response.state;
  15805. success = response.data;
  15806. error = response.error;
  15807. isSuccess = !error;
  15808. }
  15809. } else {
  15810. // Extract error from statusText and normalize for non-aborts
  15811. error = statusText;
  15812. if ( status || !statusText ) {
  15813. statusText = "error";
  15814. if ( status < 0 ) {
  15815. status = 0;
  15816. }
  15817. }
  15818. }
  15819. // Set data for the fake xhr object
  15820. jqXHR.status = status;
  15821. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  15822. // Success/Error
  15823. if ( isSuccess ) {
  15824. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  15825. } else {
  15826. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  15827. }
  15828. // Status-dependent callbacks
  15829. jqXHR.statusCode( statusCode );
  15830. statusCode = undefined;
  15831. if ( fireGlobals ) {
  15832. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  15833. [ jqXHR, s, isSuccess ? success : error ] );
  15834. }
  15835. // Complete
  15836. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  15837. if ( fireGlobals ) {
  15838. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  15839. // Handle the global AJAX counter
  15840. if ( !( --jQuery.active ) ) {
  15841. jQuery.event.trigger( "ajaxStop" );
  15842. }
  15843. }
  15844. }
  15845. return jqXHR;
  15846. },
  15847. getJSON: function( url, data, callback ) {
  15848. return jQuery.get( url, data, callback, "json" );
  15849. },
  15850. getScript: function( url, callback ) {
  15851. return jQuery.get( url, undefined, callback, "script" );
  15852. }
  15853. } );
  15854. jQuery.each( [ "get", "post" ], function( i, method ) {
  15855. jQuery[ method ] = function( url, data, callback, type ) {
  15856. // Shift arguments if data argument was omitted
  15857. if ( isFunction( data ) ) {
  15858. type = type || callback;
  15859. callback = data;
  15860. data = undefined;
  15861. }
  15862. // The url can be an options object (which then must have .url)
  15863. return jQuery.ajax( jQuery.extend( {
  15864. url: url,
  15865. type: method,
  15866. dataType: type,
  15867. data: data,
  15868. success: callback
  15869. }, jQuery.isPlainObject( url ) && url ) );
  15870. };
  15871. } );
  15872. jQuery._evalUrl = function( url, options ) {
  15873. return jQuery.ajax( {
  15874. url: url,
  15875. // Make this explicit, since user can override this through ajaxSetup (#11264)
  15876. type: "GET",
  15877. dataType: "script",
  15878. cache: true,
  15879. async: false,
  15880. global: false,
  15881. // Only evaluate the response if it is successful (gh-4126)
  15882. // dataFilter is not invoked for failure responses, so using it instead
  15883. // of the default converter is kludgy but it works.
  15884. converters: {
  15885. "text script": function() {}
  15886. },
  15887. dataFilter: function( response ) {
  15888. jQuery.globalEval( response, options );
  15889. }
  15890. } );
  15891. };
  15892. jQuery.fn.extend( {
  15893. wrapAll: function( html ) {
  15894. var wrap;
  15895. if ( this[ 0 ] ) {
  15896. if ( isFunction( html ) ) {
  15897. html = html.call( this[ 0 ] );
  15898. }
  15899. // The elements to wrap the target around
  15900. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  15901. if ( this[ 0 ].parentNode ) {
  15902. wrap.insertBefore( this[ 0 ] );
  15903. }
  15904. wrap.map( function() {
  15905. var elem = this;
  15906. while ( elem.firstElementChild ) {
  15907. elem = elem.firstElementChild;
  15908. }
  15909. return elem;
  15910. } ).append( this );
  15911. }
  15912. return this;
  15913. },
  15914. wrapInner: function( html ) {
  15915. if ( isFunction( html ) ) {
  15916. return this.each( function( i ) {
  15917. jQuery( this ).wrapInner( html.call( this, i ) );
  15918. } );
  15919. }
  15920. return this.each( function() {
  15921. var self = jQuery( this ),
  15922. contents = self.contents();
  15923. if ( contents.length ) {
  15924. contents.wrapAll( html );
  15925. } else {
  15926. self.append( html );
  15927. }
  15928. } );
  15929. },
  15930. wrap: function( html ) {
  15931. var htmlIsFunction = isFunction( html );
  15932. return this.each( function( i ) {
  15933. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  15934. } );
  15935. },
  15936. unwrap: function( selector ) {
  15937. this.parent( selector ).not( "body" ).each( function() {
  15938. jQuery( this ).replaceWith( this.childNodes );
  15939. } );
  15940. return this;
  15941. }
  15942. } );
  15943. jQuery.expr.pseudos.hidden = function( elem ) {
  15944. return !jQuery.expr.pseudos.visible( elem );
  15945. };
  15946. jQuery.expr.pseudos.visible = function( elem ) {
  15947. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  15948. };
  15949. jQuery.ajaxSettings.xhr = function() {
  15950. try {
  15951. return new window.XMLHttpRequest();
  15952. } catch ( e ) {}
  15953. };
  15954. var xhrSuccessStatus = {
  15955. // File protocol always yields status code 0, assume 200
  15956. 0: 200,
  15957. // Support: IE <=9 only
  15958. // #1450: sometimes IE returns 1223 when it should be 204
  15959. 1223: 204
  15960. },
  15961. xhrSupported = jQuery.ajaxSettings.xhr();
  15962. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  15963. support.ajax = xhrSupported = !!xhrSupported;
  15964. jQuery.ajaxTransport( function( options ) {
  15965. var callback, errorCallback;
  15966. // Cross domain only allowed if supported through XMLHttpRequest
  15967. if ( support.cors || xhrSupported && !options.crossDomain ) {
  15968. return {
  15969. send: function( headers, complete ) {
  15970. var i,
  15971. xhr = options.xhr();
  15972. xhr.open(
  15973. options.type,
  15974. options.url,
  15975. options.async,
  15976. options.username,
  15977. options.password
  15978. );
  15979. // Apply custom fields if provided
  15980. if ( options.xhrFields ) {
  15981. for ( i in options.xhrFields ) {
  15982. xhr[ i ] = options.xhrFields[ i ];
  15983. }
  15984. }
  15985. // Override mime type if needed
  15986. if ( options.mimeType && xhr.overrideMimeType ) {
  15987. xhr.overrideMimeType( options.mimeType );
  15988. }
  15989. // X-Requested-With header
  15990. // For cross-domain requests, seeing as conditions for a preflight are
  15991. // akin to a jigsaw puzzle, we simply never set it to be sure.
  15992. // (it can always be set on a per-request basis or even using ajaxSetup)
  15993. // For same-domain requests, won't change header if already provided.
  15994. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  15995. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  15996. }
  15997. // Set headers
  15998. for ( i in headers ) {
  15999. xhr.setRequestHeader( i, headers[ i ] );
  16000. }
  16001. // Callback
  16002. callback = function( type ) {
  16003. return function() {
  16004. if ( callback ) {
  16005. callback = errorCallback = xhr.onload =
  16006. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16007. xhr.onreadystatechange = null;
  16008. if ( type === "abort" ) {
  16009. xhr.abort();
  16010. } else if ( type === "error" ) {
  16011. // Support: IE <=9 only
  16012. // On a manual native abort, IE9 throws
  16013. // errors on any property access that is not readyState
  16014. if ( typeof xhr.status !== "number" ) {
  16015. complete( 0, "error" );
  16016. } else {
  16017. complete(
  16018. // File: protocol always yields status 0; see #8605, #14207
  16019. xhr.status,
  16020. xhr.statusText
  16021. );
  16022. }
  16023. } else {
  16024. complete(
  16025. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16026. xhr.statusText,
  16027. // Support: IE <=9 only
  16028. // IE9 has no XHR2 but throws on binary (trac-11426)
  16029. // For XHR2 non-text, let the caller handle it (gh-2498)
  16030. ( xhr.responseType || "text" ) !== "text" ||
  16031. typeof xhr.responseText !== "string" ?
  16032. { binary: xhr.response } :
  16033. { text: xhr.responseText },
  16034. xhr.getAllResponseHeaders()
  16035. );
  16036. }
  16037. }
  16038. };
  16039. };
  16040. // Listen to events
  16041. xhr.onload = callback();
  16042. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16043. // Support: IE 9 only
  16044. // Use onreadystatechange to replace onabort
  16045. // to handle uncaught aborts
  16046. if ( xhr.onabort !== undefined ) {
  16047. xhr.onabort = errorCallback;
  16048. } else {
  16049. xhr.onreadystatechange = function() {
  16050. // Check readyState before timeout as it changes
  16051. if ( xhr.readyState === 4 ) {
  16052. // Allow onerror to be called first,
  16053. // but that will not handle a native abort
  16054. // Also, save errorCallback to a variable
  16055. // as xhr.onerror cannot be accessed
  16056. window.setTimeout( function() {
  16057. if ( callback ) {
  16058. errorCallback();
  16059. }
  16060. } );
  16061. }
  16062. };
  16063. }
  16064. // Create the abort callback
  16065. callback = callback( "abort" );
  16066. try {
  16067. // Do send the request (this may raise an exception)
  16068. xhr.send( options.hasContent && options.data || null );
  16069. } catch ( e ) {
  16070. // #14683: Only rethrow if this hasn't been notified as an error yet
  16071. if ( callback ) {
  16072. throw e;
  16073. }
  16074. }
  16075. },
  16076. abort: function() {
  16077. if ( callback ) {
  16078. callback();
  16079. }
  16080. }
  16081. };
  16082. }
  16083. } );
  16084. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16085. jQuery.ajaxPrefilter( function( s ) {
  16086. if ( s.crossDomain ) {
  16087. s.contents.script = false;
  16088. }
  16089. } );
  16090. // Install script dataType
  16091. jQuery.ajaxSetup( {
  16092. accepts: {
  16093. script: "text/javascript, application/javascript, " +
  16094. "application/ecmascript, application/x-ecmascript"
  16095. },
  16096. contents: {
  16097. script: /\b(?:java|ecma)script\b/
  16098. },
  16099. converters: {
  16100. "text script": function( text ) {
  16101. jQuery.globalEval( text );
  16102. return text;
  16103. }
  16104. }
  16105. } );
  16106. // Handle cache's special case and crossDomain
  16107. jQuery.ajaxPrefilter( "script", function( s ) {
  16108. if ( s.cache === undefined ) {
  16109. s.cache = false;
  16110. }
  16111. if ( s.crossDomain ) {
  16112. s.type = "GET";
  16113. }
  16114. } );
  16115. // Bind script tag hack transport
  16116. jQuery.ajaxTransport( "script", function( s ) {
  16117. // This transport only deals with cross domain or forced-by-attrs requests
  16118. if ( s.crossDomain || s.scriptAttrs ) {
  16119. var script, callback;
  16120. return {
  16121. send: function( _, complete ) {
  16122. script = jQuery( "<script>" )
  16123. .attr( s.scriptAttrs || {} )
  16124. .prop( { charset: s.scriptCharset, src: s.url } )
  16125. .on( "load error", callback = function( evt ) {
  16126. script.remove();
  16127. callback = null;
  16128. if ( evt ) {
  16129. complete( evt.type === "error" ? 404 : 200, evt.type );
  16130. }
  16131. } );
  16132. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16133. document.head.appendChild( script[ 0 ] );
  16134. },
  16135. abort: function() {
  16136. if ( callback ) {
  16137. callback();
  16138. }
  16139. }
  16140. };
  16141. }
  16142. } );
  16143. var oldCallbacks = [],
  16144. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16145. // Default jsonp settings
  16146. jQuery.ajaxSetup( {
  16147. jsonp: "callback",
  16148. jsonpCallback: function() {
  16149. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16150. this[ callback ] = true;
  16151. return callback;
  16152. }
  16153. } );
  16154. // Detect, normalize options and install callbacks for jsonp requests
  16155. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16156. var callbackName, overwritten, responseContainer,
  16157. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16158. "url" :
  16159. typeof s.data === "string" &&
  16160. ( s.contentType || "" )
  16161. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16162. rjsonp.test( s.data ) && "data"
  16163. );
  16164. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16165. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16166. // Get callback name, remembering preexisting value associated with it
  16167. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16168. s.jsonpCallback() :
  16169. s.jsonpCallback;
  16170. // Insert callback into url or form data
  16171. if ( jsonProp ) {
  16172. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16173. } else if ( s.jsonp !== false ) {
  16174. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16175. }
  16176. // Use data converter to retrieve json after script execution
  16177. s.converters[ "script json" ] = function() {
  16178. if ( !responseContainer ) {
  16179. jQuery.error( callbackName + " was not called" );
  16180. }
  16181. return responseContainer[ 0 ];
  16182. };
  16183. // Force json dataType
  16184. s.dataTypes[ 0 ] = "json";
  16185. // Install callback
  16186. overwritten = window[ callbackName ];
  16187. window[ callbackName ] = function() {
  16188. responseContainer = arguments;
  16189. };
  16190. // Clean-up function (fires after converters)
  16191. jqXHR.always( function() {
  16192. // If previous value didn't exist - remove it
  16193. if ( overwritten === undefined ) {
  16194. jQuery( window ).removeProp( callbackName );
  16195. // Otherwise restore preexisting value
  16196. } else {
  16197. window[ callbackName ] = overwritten;
  16198. }
  16199. // Save back as free
  16200. if ( s[ callbackName ] ) {
  16201. // Make sure that re-using the options doesn't screw things around
  16202. s.jsonpCallback = originalSettings.jsonpCallback;
  16203. // Save the callback name for future use
  16204. oldCallbacks.push( callbackName );
  16205. }
  16206. // Call if it was a function and we have a response
  16207. if ( responseContainer && isFunction( overwritten ) ) {
  16208. overwritten( responseContainer[ 0 ] );
  16209. }
  16210. responseContainer = overwritten = undefined;
  16211. } );
  16212. // Delegate to script
  16213. return "script";
  16214. }
  16215. } );
  16216. // Support: Safari 8 only
  16217. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16218. // collapse sibling forms: the second one becomes a child of the first one.
  16219. // Because of that, this security measure has to be disabled in Safari 8.
  16220. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16221. support.createHTMLDocument = ( function() {
  16222. var body = document.implementation.createHTMLDocument( "" ).body;
  16223. body.innerHTML = "<form></form><form></form>";
  16224. return body.childNodes.length === 2;
  16225. } )();
  16226. // Argument "data" should be string of html
  16227. // context (optional): If specified, the fragment will be created in this context,
  16228. // defaults to document
  16229. // keepScripts (optional): If true, will include scripts passed in the html string
  16230. jQuery.parseHTML = function( data, context, keepScripts ) {
  16231. if ( typeof data !== "string" ) {
  16232. return [];
  16233. }
  16234. if ( typeof context === "boolean" ) {
  16235. keepScripts = context;
  16236. context = false;
  16237. }
  16238. var base, parsed, scripts;
  16239. if ( !context ) {
  16240. // Stop scripts or inline event handlers from being executed immediately
  16241. // by using document.implementation
  16242. if ( support.createHTMLDocument ) {
  16243. context = document.implementation.createHTMLDocument( "" );
  16244. // Set the base href for the created document
  16245. // so any parsed elements with URLs
  16246. // are based on the document's URL (gh-2965)
  16247. base = context.createElement( "base" );
  16248. base.href = document.location.href;
  16249. context.head.appendChild( base );
  16250. } else {
  16251. context = document;
  16252. }
  16253. }
  16254. parsed = rsingleTag.exec( data );
  16255. scripts = !keepScripts && [];
  16256. // Single tag
  16257. if ( parsed ) {
  16258. return [ context.createElement( parsed[ 1 ] ) ];
  16259. }
  16260. parsed = buildFragment( [ data ], context, scripts );
  16261. if ( scripts && scripts.length ) {
  16262. jQuery( scripts ).remove();
  16263. }
  16264. return jQuery.merge( [], parsed.childNodes );
  16265. };
  16266. /**
  16267. * Load a url into a page
  16268. */
  16269. jQuery.fn.load = function( url, params, callback ) {
  16270. var selector, type, response,
  16271. self = this,
  16272. off = url.indexOf( " " );
  16273. if ( off > -1 ) {
  16274. selector = stripAndCollapse( url.slice( off ) );
  16275. url = url.slice( 0, off );
  16276. }
  16277. // If it's a function
  16278. if ( isFunction( params ) ) {
  16279. // We assume that it's the callback
  16280. callback = params;
  16281. params = undefined;
  16282. // Otherwise, build a param string
  16283. } else if ( params && typeof params === "object" ) {
  16284. type = "POST";
  16285. }
  16286. // If we have elements to modify, make the request
  16287. if ( self.length > 0 ) {
  16288. jQuery.ajax( {
  16289. url: url,
  16290. // If "type" variable is undefined, then "GET" method will be used.
  16291. // Make value of this field explicit since
  16292. // user can override it through ajaxSetup method
  16293. type: type || "GET",
  16294. dataType: "html",
  16295. data: params
  16296. } ).done( function( responseText ) {
  16297. // Save response for use in complete callback
  16298. response = arguments;
  16299. self.html( selector ?
  16300. // If a selector was specified, locate the right elements in a dummy div
  16301. // Exclude scripts to avoid IE 'Permission Denied' errors
  16302. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16303. // Otherwise use the full result
  16304. responseText );
  16305. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16306. // but they are ignored because response was set above.
  16307. // If it fails, this function gets "jqXHR", "status", "error"
  16308. } ).always( callback && function( jqXHR, status ) {
  16309. self.each( function() {
  16310. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16311. } );
  16312. } );
  16313. }
  16314. return this;
  16315. };
  16316. // Attach a bunch of functions for handling common AJAX events
  16317. jQuery.each( [
  16318. "ajaxStart",
  16319. "ajaxStop",
  16320. "ajaxComplete",
  16321. "ajaxError",
  16322. "ajaxSuccess",
  16323. "ajaxSend"
  16324. ], function( i, type ) {
  16325. jQuery.fn[ type ] = function( fn ) {
  16326. return this.on( type, fn );
  16327. };
  16328. } );
  16329. jQuery.expr.pseudos.animated = function( elem ) {
  16330. return jQuery.grep( jQuery.timers, function( fn ) {
  16331. return elem === fn.elem;
  16332. } ).length;
  16333. };
  16334. jQuery.offset = {
  16335. setOffset: function( elem, options, i ) {
  16336. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16337. position = jQuery.css( elem, "position" ),
  16338. curElem = jQuery( elem ),
  16339. props = {};
  16340. // Set position first, in-case top/left are set even on static elem
  16341. if ( position === "static" ) {
  16342. elem.style.position = "relative";
  16343. }
  16344. curOffset = curElem.offset();
  16345. curCSSTop = jQuery.css( elem, "top" );
  16346. curCSSLeft = jQuery.css( elem, "left" );
  16347. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16348. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16349. // Need to be able to calculate position if either
  16350. // top or left is auto and position is either absolute or fixed
  16351. if ( calculatePosition ) {
  16352. curPosition = curElem.position();
  16353. curTop = curPosition.top;
  16354. curLeft = curPosition.left;
  16355. } else {
  16356. curTop = parseFloat( curCSSTop ) || 0;
  16357. curLeft = parseFloat( curCSSLeft ) || 0;
  16358. }
  16359. if ( isFunction( options ) ) {
  16360. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16361. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16362. }
  16363. if ( options.top != null ) {
  16364. props.top = ( options.top - curOffset.top ) + curTop;
  16365. }
  16366. if ( options.left != null ) {
  16367. props.left = ( options.left - curOffset.left ) + curLeft;
  16368. }
  16369. if ( "using" in options ) {
  16370. options.using.call( elem, props );
  16371. } else {
  16372. curElem.css( props );
  16373. }
  16374. }
  16375. };
  16376. jQuery.fn.extend( {
  16377. // offset() relates an element's border box to the document origin
  16378. offset: function( options ) {
  16379. // Preserve chaining for setter
  16380. if ( arguments.length ) {
  16381. return options === undefined ?
  16382. this :
  16383. this.each( function( i ) {
  16384. jQuery.offset.setOffset( this, options, i );
  16385. } );
  16386. }
  16387. var rect, win,
  16388. elem = this[ 0 ];
  16389. if ( !elem ) {
  16390. return;
  16391. }
  16392. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16393. // Support: IE <=11 only
  16394. // Running getBoundingClientRect on a
  16395. // disconnected node in IE throws an error
  16396. if ( !elem.getClientRects().length ) {
  16397. return { top: 0, left: 0 };
  16398. }
  16399. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16400. rect = elem.getBoundingClientRect();
  16401. win = elem.ownerDocument.defaultView;
  16402. return {
  16403. top: rect.top + win.pageYOffset,
  16404. left: rect.left + win.pageXOffset
  16405. };
  16406. },
  16407. // position() relates an element's margin box to its offset parent's padding box
  16408. // This corresponds to the behavior of CSS absolute positioning
  16409. position: function() {
  16410. if ( !this[ 0 ] ) {
  16411. return;
  16412. }
  16413. var offsetParent, offset, doc,
  16414. elem = this[ 0 ],
  16415. parentOffset = { top: 0, left: 0 };
  16416. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16417. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16418. // Assume position:fixed implies availability of getBoundingClientRect
  16419. offset = elem.getBoundingClientRect();
  16420. } else {
  16421. offset = this.offset();
  16422. // Account for the *real* offset parent, which can be the document or its root element
  16423. // when a statically positioned element is identified
  16424. doc = elem.ownerDocument;
  16425. offsetParent = elem.offsetParent || doc.documentElement;
  16426. while ( offsetParent &&
  16427. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16428. jQuery.css( offsetParent, "position" ) === "static" ) {
  16429. offsetParent = offsetParent.parentNode;
  16430. }
  16431. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16432. // Incorporate borders into its offset, since they are outside its content origin
  16433. parentOffset = jQuery( offsetParent ).offset();
  16434. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16435. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16436. }
  16437. }
  16438. // Subtract parent offsets and element margins
  16439. return {
  16440. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16441. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16442. };
  16443. },
  16444. // This method will return documentElement in the following cases:
  16445. // 1) For the element inside the iframe without offsetParent, this method will return
  16446. // documentElement of the parent window
  16447. // 2) For the hidden or detached element
  16448. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16449. //
  16450. // but those exceptions were never presented as a real life use-cases
  16451. // and might be considered as more preferable results.
  16452. //
  16453. // This logic, however, is not guaranteed and can change at any point in the future
  16454. offsetParent: function() {
  16455. return this.map( function() {
  16456. var offsetParent = this.offsetParent;
  16457. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16458. offsetParent = offsetParent.offsetParent;
  16459. }
  16460. return offsetParent || documentElement;
  16461. } );
  16462. }
  16463. } );
  16464. // Create scrollLeft and scrollTop methods
  16465. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16466. var top = "pageYOffset" === prop;
  16467. jQuery.fn[ method ] = function( val ) {
  16468. return access( this, function( elem, method, val ) {
  16469. // Coalesce documents and windows
  16470. var win;
  16471. if ( isWindow( elem ) ) {
  16472. win = elem;
  16473. } else if ( elem.nodeType === 9 ) {
  16474. win = elem.defaultView;
  16475. }
  16476. if ( val === undefined ) {
  16477. return win ? win[ prop ] : elem[ method ];
  16478. }
  16479. if ( win ) {
  16480. win.scrollTo(
  16481. !top ? val : win.pageXOffset,
  16482. top ? val : win.pageYOffset
  16483. );
  16484. } else {
  16485. elem[ method ] = val;
  16486. }
  16487. }, method, val, arguments.length );
  16488. };
  16489. } );
  16490. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16491. // Add the top/left cssHooks using jQuery.fn.position
  16492. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16493. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16494. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16495. // rather than make the css module depend on the offset module, just check for it here
  16496. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16497. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16498. function( elem, computed ) {
  16499. if ( computed ) {
  16500. computed = curCSS( elem, prop );
  16501. // If curCSS returns percentage, fallback to offset
  16502. return rnumnonpx.test( computed ) ?
  16503. jQuery( elem ).position()[ prop ] + "px" :
  16504. computed;
  16505. }
  16506. }
  16507. );
  16508. } );
  16509. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16510. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16511. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16512. function( defaultExtra, funcName ) {
  16513. // Margin is only for outerHeight, outerWidth
  16514. jQuery.fn[ funcName ] = function( margin, value ) {
  16515. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16516. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16517. return access( this, function( elem, type, value ) {
  16518. var doc;
  16519. if ( isWindow( elem ) ) {
  16520. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16521. return funcName.indexOf( "outer" ) === 0 ?
  16522. elem[ "inner" + name ] :
  16523. elem.document.documentElement[ "client" + name ];
  16524. }
  16525. // Get document width or height
  16526. if ( elem.nodeType === 9 ) {
  16527. doc = elem.documentElement;
  16528. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16529. // whichever is greatest
  16530. return Math.max(
  16531. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16532. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16533. doc[ "client" + name ]
  16534. );
  16535. }
  16536. return value === undefined ?
  16537. // Get width or height on the element, requesting but not forcing parseFloat
  16538. jQuery.css( elem, type, extra ) :
  16539. // Set width or height on the element
  16540. jQuery.style( elem, type, value, extra );
  16541. }, type, chainable ? margin : undefined, chainable );
  16542. };
  16543. } );
  16544. } );
  16545. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16546. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16547. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16548. function( i, name ) {
  16549. // Handle event binding
  16550. jQuery.fn[ name ] = function( data, fn ) {
  16551. return arguments.length > 0 ?
  16552. this.on( name, null, data, fn ) :
  16553. this.trigger( name );
  16554. };
  16555. } );
  16556. jQuery.fn.extend( {
  16557. hover: function( fnOver, fnOut ) {
  16558. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16559. }
  16560. } );
  16561. jQuery.fn.extend( {
  16562. bind: function( types, data, fn ) {
  16563. return this.on( types, null, data, fn );
  16564. },
  16565. unbind: function( types, fn ) {
  16566. return this.off( types, null, fn );
  16567. },
  16568. delegate: function( selector, types, data, fn ) {
  16569. return this.on( types, selector, data, fn );
  16570. },
  16571. undelegate: function( selector, types, fn ) {
  16572. // ( namespace ) or ( selector, types [, fn] )
  16573. return arguments.length === 1 ?
  16574. this.off( selector, "**" ) :
  16575. this.off( types, selector || "**", fn );
  16576. }
  16577. } );
  16578. // Bind a function to a context, optionally partially applying any
  16579. // arguments.
  16580. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16581. // However, it is not slated for removal any time soon
  16582. jQuery.proxy = function( fn, context ) {
  16583. var tmp, args, proxy;
  16584. if ( typeof context === "string" ) {
  16585. tmp = fn[ context ];
  16586. context = fn;
  16587. fn = tmp;
  16588. }
  16589. // Quick check to determine if target is callable, in the spec
  16590. // this throws a TypeError, but we will just return undefined.
  16591. if ( !isFunction( fn ) ) {
  16592. return undefined;
  16593. }
  16594. // Simulated bind
  16595. args = slice.call( arguments, 2 );
  16596. proxy = function() {
  16597. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16598. };
  16599. // Set the guid of unique handler to the same of original handler, so it can be removed
  16600. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16601. return proxy;
  16602. };
  16603. jQuery.holdReady = function( hold ) {
  16604. if ( hold ) {
  16605. jQuery.readyWait++;
  16606. } else {
  16607. jQuery.ready( true );
  16608. }
  16609. };
  16610. jQuery.isArray = Array.isArray;
  16611. jQuery.parseJSON = JSON.parse;
  16612. jQuery.nodeName = nodeName;
  16613. jQuery.isFunction = isFunction;
  16614. jQuery.isWindow = isWindow;
  16615. jQuery.camelCase = camelCase;
  16616. jQuery.type = toType;
  16617. jQuery.now = Date.now;
  16618. jQuery.isNumeric = function( obj ) {
  16619. // As of jQuery 3.0, isNumeric is limited to
  16620. // strings and numbers (primitives or objects)
  16621. // that can be coerced to finite numbers (gh-2662)
  16622. var type = jQuery.type( obj );
  16623. return ( type === "number" || type === "string" ) &&
  16624. // parseFloat NaNs numeric-cast false positives ("")
  16625. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16626. // subtraction forces infinities to NaN
  16627. !isNaN( obj - parseFloat( obj ) );
  16628. };
  16629. // Register as a named AMD module, since jQuery can be concatenated with other
  16630. // files that may use define, but not via a proper concatenation script that
  16631. // understands anonymous AMD modules. A named AMD is safest and most robust
  16632. // way to register. Lowercase jquery is used because AMD module names are
  16633. // derived from file names, and jQuery is normally delivered in a lowercase
  16634. // file name. Do this after creating the global so that if an AMD module wants
  16635. // to call noConflict to hide this version of jQuery, it will work.
  16636. // Note that for maximum portability, libraries that are not jQuery should
  16637. // declare themselves as anonymous modules, and avoid setting a global if an
  16638. // AMD loader is present. jQuery is a special case. For more information, see
  16639. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16640. if ( true ) {
  16641. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16642. return jQuery;
  16643. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16644. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16645. }
  16646. var
  16647. // Map over jQuery in case of overwrite
  16648. _jQuery = window.jQuery,
  16649. // Map over the $ in case of overwrite
  16650. _$ = window.$;
  16651. jQuery.noConflict = function( deep ) {
  16652. if ( window.$ === jQuery ) {
  16653. window.$ = _$;
  16654. }
  16655. if ( deep && window.jQuery === jQuery ) {
  16656. window.jQuery = _jQuery;
  16657. }
  16658. return jQuery;
  16659. };
  16660. // Expose jQuery and $ identifiers, even in AMD
  16661. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16662. // and CommonJS for browser emulators (#13566)
  16663. if ( !noGlobal ) {
  16664. window.jQuery = window.$ = jQuery;
  16665. }
  16666. return jQuery;
  16667. } );
  16668. /***/ }),
  16669. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16670. /*!************************************************!*\
  16671. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16672. \************************************************/
  16673. /*! exports provided: default */
  16674. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16675. "use strict";
  16676. __webpack_require__.r(__webpack_exports__);
  16677. var classCallCheck = function (instance, Constructor) {
  16678. if (!(instance instanceof Constructor)) {
  16679. throw new TypeError("Cannot call a class as a function");
  16680. }
  16681. };
  16682. var createClass = function () {
  16683. function defineProperties(target, props) {
  16684. for (var i = 0; i < props.length; i++) {
  16685. var descriptor = props[i];
  16686. descriptor.enumerable = descriptor.enumerable || false;
  16687. descriptor.configurable = true;
  16688. if ("value" in descriptor) descriptor.writable = true;
  16689. Object.defineProperty(target, descriptor.key, descriptor);
  16690. }
  16691. }
  16692. return function (Constructor, protoProps, staticProps) {
  16693. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16694. if (staticProps) defineProperties(Constructor, staticProps);
  16695. return Constructor;
  16696. };
  16697. }();
  16698. var _extends = Object.assign || function (target) {
  16699. for (var i = 1; i < arguments.length; i++) {
  16700. var source = arguments[i];
  16701. for (var key in source) {
  16702. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16703. target[key] = source[key];
  16704. }
  16705. }
  16706. }
  16707. return target;
  16708. };
  16709. var inherits = function (subClass, superClass) {
  16710. if (typeof superClass !== "function" && superClass !== null) {
  16711. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16712. }
  16713. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16714. constructor: {
  16715. value: subClass,
  16716. enumerable: false,
  16717. writable: true,
  16718. configurable: true
  16719. }
  16720. });
  16721. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16722. };
  16723. var possibleConstructorReturn = function (self, call) {
  16724. if (!self) {
  16725. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16726. }
  16727. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16728. };
  16729. var Connector = function () {
  16730. /**
  16731. * Create a new class instance.
  16732. */
  16733. function Connector(options) {
  16734. classCallCheck(this, Connector);
  16735. /**
  16736. * Default connector options.
  16737. */
  16738. this._defaultOptions = {
  16739. auth: {
  16740. headers: {}
  16741. },
  16742. authEndpoint: '/broadcasting/auth',
  16743. broadcaster: 'pusher',
  16744. csrfToken: null,
  16745. host: null,
  16746. key: null,
  16747. namespace: 'App.Events'
  16748. };
  16749. this.setOptions(options);
  16750. this.connect();
  16751. }
  16752. /**
  16753. * Merge the custom options with the defaults.
  16754. */
  16755. createClass(Connector, [{
  16756. key: 'setOptions',
  16757. value: function setOptions(options) {
  16758. this.options = _extends(this._defaultOptions, options);
  16759. if (this.csrfToken()) {
  16760. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16761. }
  16762. return options;
  16763. }
  16764. /**
  16765. * Extract the CSRF token from the page.
  16766. */
  16767. }, {
  16768. key: 'csrfToken',
  16769. value: function csrfToken() {
  16770. var selector = void 0;
  16771. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16772. return window['Laravel'].csrfToken;
  16773. } else if (this.options.csrfToken) {
  16774. return this.options.csrfToken;
  16775. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16776. return selector.getAttribute('content');
  16777. }
  16778. return null;
  16779. }
  16780. }]);
  16781. return Connector;
  16782. }();
  16783. /**
  16784. * This class represents a basic channel.
  16785. */
  16786. var Channel = function () {
  16787. function Channel() {
  16788. classCallCheck(this, Channel);
  16789. }
  16790. createClass(Channel, [{
  16791. key: 'listenForWhisper',
  16792. /**
  16793. * Listen for a whisper event on the channel instance.
  16794. */
  16795. value: function listenForWhisper(event, callback) {
  16796. return this.listen('.client-' + event, callback);
  16797. }
  16798. /**
  16799. * Listen for an event on the channel instance.
  16800. */
  16801. }, {
  16802. key: 'notification',
  16803. value: function notification(callback) {
  16804. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  16805. }
  16806. /**
  16807. * Stop listening for a whispser event on the channel instance.
  16808. */
  16809. }, {
  16810. key: 'stopListeningForWhisper',
  16811. value: function stopListeningForWhisper(event) {
  16812. return this.stopListening('.client-' + event);
  16813. }
  16814. }]);
  16815. return Channel;
  16816. }();
  16817. /**
  16818. * Event name formatter
  16819. */
  16820. var EventFormatter = function () {
  16821. /**
  16822. * Create a new class instance.
  16823. */
  16824. function EventFormatter(namespace) {
  16825. classCallCheck(this, EventFormatter);
  16826. this.setNamespace(namespace);
  16827. }
  16828. /**
  16829. * Format the given event name.
  16830. */
  16831. createClass(EventFormatter, [{
  16832. key: 'format',
  16833. value: function format(event) {
  16834. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  16835. return event.substr(1);
  16836. } else if (this.namespace) {
  16837. event = this.namespace + '.' + event;
  16838. }
  16839. return event.replace(/\./g, '\\');
  16840. }
  16841. /**
  16842. * Set the event namespace.
  16843. */
  16844. }, {
  16845. key: 'setNamespace',
  16846. value: function setNamespace(value) {
  16847. this.namespace = value;
  16848. }
  16849. }]);
  16850. return EventFormatter;
  16851. }();
  16852. /**
  16853. * This class represents a Pusher channel.
  16854. */
  16855. var PusherChannel = function (_Channel) {
  16856. inherits(PusherChannel, _Channel);
  16857. /**
  16858. * Create a new class instance.
  16859. */
  16860. function PusherChannel(pusher, name, options) {
  16861. classCallCheck(this, PusherChannel);
  16862. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  16863. _this.name = name;
  16864. _this.pusher = pusher;
  16865. _this.options = options;
  16866. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  16867. _this.subscribe();
  16868. return _this;
  16869. }
  16870. /**
  16871. * Subscribe to a Pusher channel.
  16872. */
  16873. createClass(PusherChannel, [{
  16874. key: 'subscribe',
  16875. value: function subscribe() {
  16876. this.subscription = this.pusher.subscribe(this.name);
  16877. }
  16878. /**
  16879. * Unsubscribe from a Pusher channel.
  16880. */
  16881. }, {
  16882. key: 'unsubscribe',
  16883. value: function unsubscribe() {
  16884. this.pusher.unsubscribe(this.name);
  16885. }
  16886. /**
  16887. * Listen for an event on the channel instance.
  16888. */
  16889. }, {
  16890. key: 'listen',
  16891. value: function listen(event, callback) {
  16892. this.on(this.eventFormatter.format(event), callback);
  16893. return this;
  16894. }
  16895. /**
  16896. * Stop listening for an event on the channel instance.
  16897. */
  16898. }, {
  16899. key: 'stopListening',
  16900. value: function stopListening(event) {
  16901. this.subscription.unbind(this.eventFormatter.format(event));
  16902. return this;
  16903. }
  16904. /**
  16905. * Bind a channel to an event.
  16906. */
  16907. }, {
  16908. key: 'on',
  16909. value: function on(event, callback) {
  16910. this.subscription.bind(event, callback);
  16911. return this;
  16912. }
  16913. }]);
  16914. return PusherChannel;
  16915. }(Channel);
  16916. /**
  16917. * This class represents a Pusher private channel.
  16918. */
  16919. var PusherPrivateChannel = function (_PusherChannel) {
  16920. inherits(PusherPrivateChannel, _PusherChannel);
  16921. function PusherPrivateChannel() {
  16922. classCallCheck(this, PusherPrivateChannel);
  16923. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  16924. }
  16925. createClass(PusherPrivateChannel, [{
  16926. key: 'whisper',
  16927. /**
  16928. * Trigger client event on the channel.
  16929. */
  16930. value: function whisper(eventName, data) {
  16931. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  16932. return this;
  16933. }
  16934. }]);
  16935. return PusherPrivateChannel;
  16936. }(PusherChannel);
  16937. /**
  16938. * This class represents a Pusher presence channel.
  16939. */
  16940. var PusherPresenceChannel = function (_PusherChannel) {
  16941. inherits(PusherPresenceChannel, _PusherChannel);
  16942. function PusherPresenceChannel() {
  16943. classCallCheck(this, PusherPresenceChannel);
  16944. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  16945. }
  16946. createClass(PusherPresenceChannel, [{
  16947. key: 'here',
  16948. /**
  16949. * Register a callback to be called anytime the member list changes.
  16950. */
  16951. value: function here(callback) {
  16952. this.on('pusher:subscription_succeeded', function (data) {
  16953. callback(Object.keys(data.members).map(function (k) {
  16954. return data.members[k];
  16955. }));
  16956. });
  16957. return this;
  16958. }
  16959. /**
  16960. * Listen for someone joining the channel.
  16961. */
  16962. }, {
  16963. key: 'joining',
  16964. value: function joining(callback) {
  16965. this.on('pusher:member_added', function (member) {
  16966. callback(member.info);
  16967. });
  16968. return this;
  16969. }
  16970. /**
  16971. * Listen for someone leaving the channel.
  16972. */
  16973. }, {
  16974. key: 'leaving',
  16975. value: function leaving(callback) {
  16976. this.on('pusher:member_removed', function (member) {
  16977. callback(member.info);
  16978. });
  16979. return this;
  16980. }
  16981. /**
  16982. * Trigger client event on the channel.
  16983. */
  16984. }, {
  16985. key: 'whisper',
  16986. value: function whisper(eventName, data) {
  16987. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  16988. return this;
  16989. }
  16990. }]);
  16991. return PusherPresenceChannel;
  16992. }(PusherChannel);
  16993. /**
  16994. * This class represents a Socket.io channel.
  16995. */
  16996. var SocketIoChannel = function (_Channel) {
  16997. inherits(SocketIoChannel, _Channel);
  16998. /**
  16999. * Create a new class instance.
  17000. */
  17001. function SocketIoChannel(socket, name, options) {
  17002. classCallCheck(this, SocketIoChannel);
  17003. /**
  17004. * The event callbacks applied to the channel.
  17005. */
  17006. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17007. _this.events = {};
  17008. _this.name = name;
  17009. _this.socket = socket;
  17010. _this.options = options;
  17011. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17012. _this.subscribe();
  17013. _this.configureReconnector();
  17014. return _this;
  17015. }
  17016. /**
  17017. * Subscribe to a Socket.io channel.
  17018. */
  17019. createClass(SocketIoChannel, [{
  17020. key: 'subscribe',
  17021. value: function subscribe() {
  17022. this.socket.emit('subscribe', {
  17023. channel: this.name,
  17024. auth: this.options.auth || {}
  17025. });
  17026. }
  17027. /**
  17028. * Unsubscribe from channel and ubind event callbacks.
  17029. */
  17030. }, {
  17031. key: 'unsubscribe',
  17032. value: function unsubscribe() {
  17033. this.unbind();
  17034. this.socket.emit('unsubscribe', {
  17035. channel: this.name,
  17036. auth: this.options.auth || {}
  17037. });
  17038. }
  17039. /**
  17040. * Listen for an event on the channel instance.
  17041. */
  17042. }, {
  17043. key: 'listen',
  17044. value: function listen(event, callback) {
  17045. this.on(this.eventFormatter.format(event), callback);
  17046. return this;
  17047. }
  17048. /**
  17049. * Stop listening for an event on the channel instance.
  17050. */
  17051. }, {
  17052. key: 'stopListening',
  17053. value: function stopListening(event) {
  17054. var name = this.eventFormatter.format(event);
  17055. this.socket.removeListener(name);
  17056. delete this.events[name];
  17057. return this;
  17058. }
  17059. /**
  17060. * Bind the channel's socket to an event and store the callback.
  17061. */
  17062. }, {
  17063. key: 'on',
  17064. value: function on(event, callback) {
  17065. var _this2 = this;
  17066. var listener = function listener(channel, data) {
  17067. if (_this2.name == channel) {
  17068. callback(data);
  17069. }
  17070. };
  17071. this.socket.on(event, listener);
  17072. this.bind(event, listener);
  17073. }
  17074. /**
  17075. * Attach a 'reconnect' listener and bind the event.
  17076. */
  17077. }, {
  17078. key: 'configureReconnector',
  17079. value: function configureReconnector() {
  17080. var _this3 = this;
  17081. var listener = function listener() {
  17082. _this3.subscribe();
  17083. };
  17084. this.socket.on('reconnect', listener);
  17085. this.bind('reconnect', listener);
  17086. }
  17087. /**
  17088. * Bind the channel's socket to an event and store the callback.
  17089. */
  17090. }, {
  17091. key: 'bind',
  17092. value: function bind(event, callback) {
  17093. this.events[event] = this.events[event] || [];
  17094. this.events[event].push(callback);
  17095. }
  17096. /**
  17097. * Unbind the channel's socket from all stored event callbacks.
  17098. */
  17099. }, {
  17100. key: 'unbind',
  17101. value: function unbind() {
  17102. var _this4 = this;
  17103. Object.keys(this.events).forEach(function (event) {
  17104. _this4.events[event].forEach(function (callback) {
  17105. _this4.socket.removeListener(event, callback);
  17106. });
  17107. delete _this4.events[event];
  17108. });
  17109. }
  17110. }]);
  17111. return SocketIoChannel;
  17112. }(Channel);
  17113. /**
  17114. * This class represents a Socket.io presence channel.
  17115. */
  17116. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17117. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17118. function SocketIoPrivateChannel() {
  17119. classCallCheck(this, SocketIoPrivateChannel);
  17120. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17121. }
  17122. createClass(SocketIoPrivateChannel, [{
  17123. key: 'whisper',
  17124. /**
  17125. * Trigger client event on the channel.
  17126. */
  17127. value: function whisper(eventName, data) {
  17128. this.socket.emit('client event', {
  17129. channel: this.name,
  17130. event: 'client-' + eventName,
  17131. data: data
  17132. });
  17133. return this;
  17134. }
  17135. }]);
  17136. return SocketIoPrivateChannel;
  17137. }(SocketIoChannel);
  17138. /**
  17139. * This class represents a Socket.io presence channel.
  17140. */
  17141. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17142. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17143. function SocketIoPresenceChannel() {
  17144. classCallCheck(this, SocketIoPresenceChannel);
  17145. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17146. }
  17147. createClass(SocketIoPresenceChannel, [{
  17148. key: 'here',
  17149. /**
  17150. * Register a callback to be called anytime the member list changes.
  17151. */
  17152. value: function here(callback) {
  17153. this.on('presence:subscribed', function (members) {
  17154. callback(members.map(function (m) {
  17155. return m.user_info;
  17156. }));
  17157. });
  17158. return this;
  17159. }
  17160. /**
  17161. * Listen for someone joining the channel.
  17162. */
  17163. }, {
  17164. key: 'joining',
  17165. value: function joining(callback) {
  17166. this.on('presence:joining', function (member) {
  17167. return callback(member.user_info);
  17168. });
  17169. return this;
  17170. }
  17171. /**
  17172. * Listen for someone leaving the channel.
  17173. */
  17174. }, {
  17175. key: 'leaving',
  17176. value: function leaving(callback) {
  17177. this.on('presence:leaving', function (member) {
  17178. return callback(member.user_info);
  17179. });
  17180. return this;
  17181. }
  17182. }]);
  17183. return SocketIoPresenceChannel;
  17184. }(SocketIoPrivateChannel);
  17185. /**
  17186. * This class represents a null channel.
  17187. */
  17188. var NullChannel = function (_Channel) {
  17189. inherits(NullChannel, _Channel);
  17190. function NullChannel() {
  17191. classCallCheck(this, NullChannel);
  17192. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17193. }
  17194. createClass(NullChannel, [{
  17195. key: 'subscribe',
  17196. /**
  17197. * Subscribe to a channel.
  17198. */
  17199. value: function subscribe() {}
  17200. //
  17201. /**
  17202. * Unsubscribe from a channel.
  17203. */
  17204. }, {
  17205. key: 'unsubscribe',
  17206. value: function unsubscribe() {}
  17207. //
  17208. /**
  17209. * Listen for an event on the channel instance.
  17210. */
  17211. }, {
  17212. key: 'listen',
  17213. value: function listen(event, callback) {
  17214. return this;
  17215. }
  17216. /**
  17217. * Stop listening for an event on the channel instance.
  17218. */
  17219. }, {
  17220. key: 'stopListening',
  17221. value: function stopListening(event) {
  17222. return this;
  17223. }
  17224. /**
  17225. * Bind a channel to an event.
  17226. */
  17227. }, {
  17228. key: 'on',
  17229. value: function on(event, callback) {
  17230. return this;
  17231. }
  17232. }]);
  17233. return NullChannel;
  17234. }(Channel);
  17235. /**
  17236. * This class represents a null private channel.
  17237. */
  17238. var NullPrivateChannel = function (_NullChannel) {
  17239. inherits(NullPrivateChannel, _NullChannel);
  17240. function NullPrivateChannel() {
  17241. classCallCheck(this, NullPrivateChannel);
  17242. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17243. }
  17244. createClass(NullPrivateChannel, [{
  17245. key: 'whisper',
  17246. /**
  17247. * Trigger client event on the channel.
  17248. */
  17249. value: function whisper(eventName, data) {
  17250. return this;
  17251. }
  17252. }]);
  17253. return NullPrivateChannel;
  17254. }(NullChannel);
  17255. /**
  17256. * This class represents a null presence channel.
  17257. */
  17258. var NullPresenceChannel = function (_NullChannel) {
  17259. inherits(NullPresenceChannel, _NullChannel);
  17260. function NullPresenceChannel() {
  17261. classCallCheck(this, NullPresenceChannel);
  17262. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17263. }
  17264. createClass(NullPresenceChannel, [{
  17265. key: 'here',
  17266. /**
  17267. * Register a callback to be called anytime the member list changes.
  17268. */
  17269. value: function here(callback) {
  17270. return this;
  17271. }
  17272. /**
  17273. * Listen for someone joining the channel.
  17274. */
  17275. }, {
  17276. key: 'joining',
  17277. value: function joining(callback) {
  17278. return this;
  17279. }
  17280. /**
  17281. * Listen for someone leaving the channel.
  17282. */
  17283. }, {
  17284. key: 'leaving',
  17285. value: function leaving(callback) {
  17286. return this;
  17287. }
  17288. /**
  17289. * Trigger client event on the channel.
  17290. */
  17291. }, {
  17292. key: 'whisper',
  17293. value: function whisper(eventName, data) {
  17294. return this;
  17295. }
  17296. }]);
  17297. return NullPresenceChannel;
  17298. }(NullChannel);
  17299. /**
  17300. * This class creates a connector to Pusher.
  17301. */
  17302. var PusherConnector = function (_Connector) {
  17303. inherits(PusherConnector, _Connector);
  17304. function PusherConnector() {
  17305. classCallCheck(this, PusherConnector);
  17306. /**
  17307. * All of the subscribed channel names.
  17308. */
  17309. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17310. _this.channels = {};
  17311. return _this;
  17312. }
  17313. /**
  17314. * Create a fresh Pusher connection.
  17315. */
  17316. createClass(PusherConnector, [{
  17317. key: 'connect',
  17318. value: function connect() {
  17319. if (typeof this.options.client !== 'undefined') {
  17320. this.pusher = this.options.client;
  17321. } else {
  17322. this.pusher = new Pusher(this.options.key, this.options);
  17323. }
  17324. }
  17325. /**
  17326. * Listen for an event on a channel instance.
  17327. */
  17328. }, {
  17329. key: 'listen',
  17330. value: function listen(name, event, callback) {
  17331. return this.channel(name).listen(event, callback);
  17332. }
  17333. /**
  17334. * Get a channel instance by name.
  17335. */
  17336. }, {
  17337. key: 'channel',
  17338. value: function channel(name) {
  17339. if (!this.channels[name]) {
  17340. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17341. }
  17342. return this.channels[name];
  17343. }
  17344. /**
  17345. * Get a private channel instance by name.
  17346. */
  17347. }, {
  17348. key: 'privateChannel',
  17349. value: function privateChannel(name) {
  17350. if (!this.channels['private-' + name]) {
  17351. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17352. }
  17353. return this.channels['private-' + name];
  17354. }
  17355. /**
  17356. * Get a presence channel instance by name.
  17357. */
  17358. }, {
  17359. key: 'presenceChannel',
  17360. value: function presenceChannel(name) {
  17361. if (!this.channels['presence-' + name]) {
  17362. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17363. }
  17364. return this.channels['presence-' + name];
  17365. }
  17366. /**
  17367. * Leave the given channel, as well as its private and presence variants.
  17368. */
  17369. }, {
  17370. key: 'leave',
  17371. value: function leave(name) {
  17372. var _this2 = this;
  17373. var channels = [name, 'private-' + name, 'presence-' + name];
  17374. channels.forEach(function (name, index) {
  17375. _this2.leaveChannel(name);
  17376. });
  17377. }
  17378. /**
  17379. * Leave the given channel.
  17380. */
  17381. }, {
  17382. key: 'leaveChannel',
  17383. value: function leaveChannel(name) {
  17384. if (this.channels[name]) {
  17385. this.channels[name].unsubscribe();
  17386. delete this.channels[name];
  17387. }
  17388. }
  17389. /**
  17390. * Get the socket ID for the connection.
  17391. */
  17392. }, {
  17393. key: 'socketId',
  17394. value: function socketId() {
  17395. return this.pusher.connection.socket_id;
  17396. }
  17397. /**
  17398. * Disconnect Pusher connection.
  17399. */
  17400. }, {
  17401. key: 'disconnect',
  17402. value: function disconnect() {
  17403. this.pusher.disconnect();
  17404. }
  17405. }]);
  17406. return PusherConnector;
  17407. }(Connector);
  17408. /**
  17409. * This class creates a connnector to a Socket.io server.
  17410. */
  17411. var SocketIoConnector = function (_Connector) {
  17412. inherits(SocketIoConnector, _Connector);
  17413. function SocketIoConnector() {
  17414. classCallCheck(this, SocketIoConnector);
  17415. /**
  17416. * All of the subscribed channel names.
  17417. */
  17418. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17419. _this.channels = {};
  17420. return _this;
  17421. }
  17422. /**
  17423. * Create a fresh Socket.io connection.
  17424. */
  17425. createClass(SocketIoConnector, [{
  17426. key: 'connect',
  17427. value: function connect() {
  17428. var io = this.getSocketIO();
  17429. this.socket = io(this.options.host, this.options);
  17430. return this.socket;
  17431. }
  17432. /**
  17433. * Get socket.io module from global scope or options.
  17434. */
  17435. }, {
  17436. key: 'getSocketIO',
  17437. value: function getSocketIO() {
  17438. if (typeof this.options.client !== 'undefined') {
  17439. return this.options.client;
  17440. }
  17441. if (typeof io !== 'undefined') {
  17442. return io;
  17443. }
  17444. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17445. }
  17446. /**
  17447. * Listen for an event on a channel instance.
  17448. */
  17449. }, {
  17450. key: 'listen',
  17451. value: function listen(name, event, callback) {
  17452. return this.channel(name).listen(event, callback);
  17453. }
  17454. /**
  17455. * Get a channel instance by name.
  17456. */
  17457. }, {
  17458. key: 'channel',
  17459. value: function channel(name) {
  17460. if (!this.channels[name]) {
  17461. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17462. }
  17463. return this.channels[name];
  17464. }
  17465. /**
  17466. * Get a private channel instance by name.
  17467. */
  17468. }, {
  17469. key: 'privateChannel',
  17470. value: function privateChannel(name) {
  17471. if (!this.channels['private-' + name]) {
  17472. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17473. }
  17474. return this.channels['private-' + name];
  17475. }
  17476. /**
  17477. * Get a presence channel instance by name.
  17478. */
  17479. }, {
  17480. key: 'presenceChannel',
  17481. value: function presenceChannel(name) {
  17482. if (!this.channels['presence-' + name]) {
  17483. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17484. }
  17485. return this.channels['presence-' + name];
  17486. }
  17487. /**
  17488. * Leave the given channel, as well as its private and presence variants.
  17489. */
  17490. }, {
  17491. key: 'leave',
  17492. value: function leave(name) {
  17493. var _this2 = this;
  17494. var channels = [name, 'private-' + name, 'presence-' + name];
  17495. channels.forEach(function (name) {
  17496. _this2.leaveChannel(name);
  17497. });
  17498. }
  17499. /**
  17500. * Leave the given channel.
  17501. */
  17502. }, {
  17503. key: 'leaveChannel',
  17504. value: function leaveChannel(name) {
  17505. if (this.channels[name]) {
  17506. this.channels[name].unsubscribe();
  17507. delete this.channels[name];
  17508. }
  17509. }
  17510. /**
  17511. * Get the socket ID for the connection.
  17512. */
  17513. }, {
  17514. key: 'socketId',
  17515. value: function socketId() {
  17516. return this.socket.id;
  17517. }
  17518. /**
  17519. * Disconnect Socketio connection.
  17520. */
  17521. }, {
  17522. key: 'disconnect',
  17523. value: function disconnect() {
  17524. this.socket.disconnect();
  17525. }
  17526. }]);
  17527. return SocketIoConnector;
  17528. }(Connector);
  17529. /**
  17530. * This class creates a null connector.
  17531. */
  17532. var NullConnector = function (_Connector) {
  17533. inherits(NullConnector, _Connector);
  17534. function NullConnector() {
  17535. classCallCheck(this, NullConnector);
  17536. /**
  17537. * All of the subscribed channel names.
  17538. */
  17539. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17540. _this.channels = {};
  17541. return _this;
  17542. }
  17543. /**
  17544. * Create a fresh connection.
  17545. */
  17546. createClass(NullConnector, [{
  17547. key: 'connect',
  17548. value: function connect() {}
  17549. //
  17550. /**
  17551. * Listen for an event on a channel instance.
  17552. */
  17553. }, {
  17554. key: 'listen',
  17555. value: function listen(name, event, callback) {
  17556. return new NullChannel();
  17557. }
  17558. /**
  17559. * Get a channel instance by name.
  17560. */
  17561. }, {
  17562. key: 'channel',
  17563. value: function channel(name) {
  17564. return new NullChannel();
  17565. }
  17566. /**
  17567. * Get a private channel instance by name.
  17568. */
  17569. }, {
  17570. key: 'privateChannel',
  17571. value: function privateChannel(name) {
  17572. return new NullPrivateChannel();
  17573. }
  17574. /**
  17575. * Get a presence channel instance by name.
  17576. */
  17577. }, {
  17578. key: 'presenceChannel',
  17579. value: function presenceChannel(name) {
  17580. return new NullPresenceChannel();
  17581. }
  17582. /**
  17583. * Leave the given channel, as well as its private and presence variants.
  17584. */
  17585. }, {
  17586. key: 'leave',
  17587. value: function leave(name) {}
  17588. //
  17589. /**
  17590. * Leave the given channel.
  17591. */
  17592. }, {
  17593. key: 'leaveChannel',
  17594. value: function leaveChannel(name) {}
  17595. //
  17596. /**
  17597. * Get the socket ID for the connection.
  17598. */
  17599. }, {
  17600. key: 'socketId',
  17601. value: function socketId() {
  17602. return 'fake-socket-id';
  17603. }
  17604. /**
  17605. * Disconnect the connection.
  17606. */
  17607. }, {
  17608. key: 'disconnect',
  17609. value: function disconnect() {
  17610. //
  17611. }
  17612. }]);
  17613. return NullConnector;
  17614. }(Connector);
  17615. /**
  17616. * This class is the primary API for interacting with broadcasting.
  17617. */
  17618. var Echo = function () {
  17619. /**
  17620. * Create a new class instance.
  17621. */
  17622. function Echo(options) {
  17623. classCallCheck(this, Echo);
  17624. this.options = options;
  17625. this.connect();
  17626. if (!this.options.withoutInterceptors) {
  17627. this.registerInterceptors();
  17628. }
  17629. }
  17630. /**
  17631. * Get a channel instance by name.
  17632. */
  17633. createClass(Echo, [{
  17634. key: 'channel',
  17635. value: function channel(_channel) {
  17636. return this.connector.channel(_channel);
  17637. }
  17638. /**
  17639. * Create a new connection.
  17640. */
  17641. }, {
  17642. key: 'connect',
  17643. value: function connect() {
  17644. if (this.options.broadcaster == 'pusher') {
  17645. this.connector = new PusherConnector(this.options);
  17646. } else if (this.options.broadcaster == 'socket.io') {
  17647. this.connector = new SocketIoConnector(this.options);
  17648. } else if (this.options.broadcaster == 'null') {
  17649. this.connector = new NullConnector(this.options);
  17650. } else if (typeof this.options.broadcaster == 'function') {
  17651. this.connector = new this.options.broadcaster(this.options);
  17652. }
  17653. }
  17654. /**
  17655. * Disconnect from the Echo server.
  17656. */
  17657. }, {
  17658. key: 'disconnect',
  17659. value: function disconnect() {
  17660. this.connector.disconnect();
  17661. }
  17662. /**
  17663. * Get a presence channel instance by name.
  17664. */
  17665. }, {
  17666. key: 'join',
  17667. value: function join(channel) {
  17668. return this.connector.presenceChannel(channel);
  17669. }
  17670. /**
  17671. * Leave the given channel, as well as its private and presence variants.
  17672. */
  17673. }, {
  17674. key: 'leave',
  17675. value: function leave(channel) {
  17676. this.connector.leave(channel);
  17677. }
  17678. /**
  17679. * Leave the given channel.
  17680. */
  17681. }, {
  17682. key: 'leaveChannel',
  17683. value: function leaveChannel(channel) {
  17684. this.connector.leaveChannel(channel);
  17685. }
  17686. /**
  17687. * Listen for an event on a channel instance.
  17688. */
  17689. }, {
  17690. key: 'listen',
  17691. value: function listen(channel, event, callback) {
  17692. return this.connector.listen(channel, event, callback);
  17693. }
  17694. /**
  17695. * Get a private channel instance by name.
  17696. */
  17697. }, {
  17698. key: 'private',
  17699. value: function _private(channel) {
  17700. return this.connector.privateChannel(channel);
  17701. }
  17702. /**
  17703. * Get the Socket ID for the connection.
  17704. */
  17705. }, {
  17706. key: 'socketId',
  17707. value: function socketId() {
  17708. return this.connector.socketId();
  17709. }
  17710. /**
  17711. * Register 3rd party request interceptiors. These are used to automatically
  17712. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17713. */
  17714. }, {
  17715. key: 'registerInterceptors',
  17716. value: function registerInterceptors() {
  17717. if (typeof Vue === 'function' && Vue.http) {
  17718. this.registerVueRequestInterceptor();
  17719. }
  17720. if (typeof axios === 'function') {
  17721. this.registerAxiosRequestInterceptor();
  17722. }
  17723. if (typeof jQuery === 'function') {
  17724. this.registerjQueryAjaxSetup();
  17725. }
  17726. }
  17727. /**
  17728. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17729. */
  17730. }, {
  17731. key: 'registerVueRequestInterceptor',
  17732. value: function registerVueRequestInterceptor() {
  17733. var _this = this;
  17734. Vue.http.interceptors.push(function (request, next) {
  17735. if (_this.socketId()) {
  17736. request.headers.set('X-Socket-ID', _this.socketId());
  17737. }
  17738. next();
  17739. });
  17740. }
  17741. /**
  17742. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17743. */
  17744. }, {
  17745. key: 'registerAxiosRequestInterceptor',
  17746. value: function registerAxiosRequestInterceptor() {
  17747. var _this2 = this;
  17748. axios.interceptors.request.use(function (config) {
  17749. if (_this2.socketId()) {
  17750. config.headers['X-Socket-Id'] = _this2.socketId();
  17751. }
  17752. return config;
  17753. });
  17754. }
  17755. /**
  17756. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17757. */
  17758. }, {
  17759. key: 'registerjQueryAjaxSetup',
  17760. value: function registerjQueryAjaxSetup() {
  17761. var _this3 = this;
  17762. if (typeof jQuery.ajax != 'undefined') {
  17763. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17764. if (_this3.socketId()) {
  17765. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17766. }
  17767. });
  17768. }
  17769. }
  17770. }]);
  17771. return Echo;
  17772. }();
  17773. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17774. /***/ }),
  17775. /***/ "./node_modules/lodash/lodash.js":
  17776. /*!***************************************!*\
  17777. !*** ./node_modules/lodash/lodash.js ***!
  17778. \***************************************/
  17779. /*! no static exports found */
  17780. /***/ (function(module, exports, __webpack_require__) {
  17781. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17782. * @license
  17783. * Lodash <https://lodash.com/>
  17784. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17785. * Released under MIT license <https://lodash.com/license>
  17786. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17787. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17788. */
  17789. ;(function() {
  17790. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17791. var undefined;
  17792. /** Used as the semantic version number. */
  17793. var VERSION = '4.17.15';
  17794. /** Used as the size to enable large array optimizations. */
  17795. var LARGE_ARRAY_SIZE = 200;
  17796. /** Error message constants. */
  17797. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17798. FUNC_ERROR_TEXT = 'Expected a function';
  17799. /** Used to stand-in for `undefined` hash values. */
  17800. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  17801. /** Used as the maximum memoize cache size. */
  17802. var MAX_MEMOIZE_SIZE = 500;
  17803. /** Used as the internal argument placeholder. */
  17804. var PLACEHOLDER = '__lodash_placeholder__';
  17805. /** Used to compose bitmasks for cloning. */
  17806. var CLONE_DEEP_FLAG = 1,
  17807. CLONE_FLAT_FLAG = 2,
  17808. CLONE_SYMBOLS_FLAG = 4;
  17809. /** Used to compose bitmasks for value comparisons. */
  17810. var COMPARE_PARTIAL_FLAG = 1,
  17811. COMPARE_UNORDERED_FLAG = 2;
  17812. /** Used to compose bitmasks for function metadata. */
  17813. var WRAP_BIND_FLAG = 1,
  17814. WRAP_BIND_KEY_FLAG = 2,
  17815. WRAP_CURRY_BOUND_FLAG = 4,
  17816. WRAP_CURRY_FLAG = 8,
  17817. WRAP_CURRY_RIGHT_FLAG = 16,
  17818. WRAP_PARTIAL_FLAG = 32,
  17819. WRAP_PARTIAL_RIGHT_FLAG = 64,
  17820. WRAP_ARY_FLAG = 128,
  17821. WRAP_REARG_FLAG = 256,
  17822. WRAP_FLIP_FLAG = 512;
  17823. /** Used as default options for `_.truncate`. */
  17824. var DEFAULT_TRUNC_LENGTH = 30,
  17825. DEFAULT_TRUNC_OMISSION = '...';
  17826. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  17827. var HOT_COUNT = 800,
  17828. HOT_SPAN = 16;
  17829. /** Used to indicate the type of lazy iteratees. */
  17830. var LAZY_FILTER_FLAG = 1,
  17831. LAZY_MAP_FLAG = 2,
  17832. LAZY_WHILE_FLAG = 3;
  17833. /** Used as references for various `Number` constants. */
  17834. var INFINITY = 1 / 0,
  17835. MAX_SAFE_INTEGER = 9007199254740991,
  17836. MAX_INTEGER = 1.7976931348623157e+308,
  17837. NAN = 0 / 0;
  17838. /** Used as references for the maximum length and index of an array. */
  17839. var MAX_ARRAY_LENGTH = 4294967295,
  17840. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  17841. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  17842. /** Used to associate wrap methods with their bit flags. */
  17843. var wrapFlags = [
  17844. ['ary', WRAP_ARY_FLAG],
  17845. ['bind', WRAP_BIND_FLAG],
  17846. ['bindKey', WRAP_BIND_KEY_FLAG],
  17847. ['curry', WRAP_CURRY_FLAG],
  17848. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  17849. ['flip', WRAP_FLIP_FLAG],
  17850. ['partial', WRAP_PARTIAL_FLAG],
  17851. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  17852. ['rearg', WRAP_REARG_FLAG]
  17853. ];
  17854. /** `Object#toString` result references. */
  17855. var argsTag = '[object Arguments]',
  17856. arrayTag = '[object Array]',
  17857. asyncTag = '[object AsyncFunction]',
  17858. boolTag = '[object Boolean]',
  17859. dateTag = '[object Date]',
  17860. domExcTag = '[object DOMException]',
  17861. errorTag = '[object Error]',
  17862. funcTag = '[object Function]',
  17863. genTag = '[object GeneratorFunction]',
  17864. mapTag = '[object Map]',
  17865. numberTag = '[object Number]',
  17866. nullTag = '[object Null]',
  17867. objectTag = '[object Object]',
  17868. promiseTag = '[object Promise]',
  17869. proxyTag = '[object Proxy]',
  17870. regexpTag = '[object RegExp]',
  17871. setTag = '[object Set]',
  17872. stringTag = '[object String]',
  17873. symbolTag = '[object Symbol]',
  17874. undefinedTag = '[object Undefined]',
  17875. weakMapTag = '[object WeakMap]',
  17876. weakSetTag = '[object WeakSet]';
  17877. var arrayBufferTag = '[object ArrayBuffer]',
  17878. dataViewTag = '[object DataView]',
  17879. float32Tag = '[object Float32Array]',
  17880. float64Tag = '[object Float64Array]',
  17881. int8Tag = '[object Int8Array]',
  17882. int16Tag = '[object Int16Array]',
  17883. int32Tag = '[object Int32Array]',
  17884. uint8Tag = '[object Uint8Array]',
  17885. uint8ClampedTag = '[object Uint8ClampedArray]',
  17886. uint16Tag = '[object Uint16Array]',
  17887. uint32Tag = '[object Uint32Array]';
  17888. /** Used to match empty string literals in compiled template source. */
  17889. var reEmptyStringLeading = /\b__p \+= '';/g,
  17890. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  17891. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  17892. /** Used to match HTML entities and HTML characters. */
  17893. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  17894. reUnescapedHtml = /[&<>"']/g,
  17895. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  17896. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  17897. /** Used to match template delimiters. */
  17898. var reEscape = /<%-([\s\S]+?)%>/g,
  17899. reEvaluate = /<%([\s\S]+?)%>/g,
  17900. reInterpolate = /<%=([\s\S]+?)%>/g;
  17901. /** Used to match property names within property paths. */
  17902. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  17903. reIsPlainProp = /^\w*$/,
  17904. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  17905. /**
  17906. * Used to match `RegExp`
  17907. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  17908. */
  17909. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  17910. reHasRegExpChar = RegExp(reRegExpChar.source);
  17911. /** Used to match leading and trailing whitespace. */
  17912. var reTrim = /^\s+|\s+$/g,
  17913. reTrimStart = /^\s+/,
  17914. reTrimEnd = /\s+$/;
  17915. /** Used to match wrap detail comments. */
  17916. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  17917. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  17918. reSplitDetails = /,? & /;
  17919. /** Used to match words composed of alphanumeric characters. */
  17920. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  17921. /** Used to match backslashes in property paths. */
  17922. var reEscapeChar = /\\(\\)?/g;
  17923. /**
  17924. * Used to match
  17925. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  17926. */
  17927. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  17928. /** Used to match `RegExp` flags from their coerced string values. */
  17929. var reFlags = /\w*$/;
  17930. /** Used to detect bad signed hexadecimal string values. */
  17931. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  17932. /** Used to detect binary string values. */
  17933. var reIsBinary = /^0b[01]+$/i;
  17934. /** Used to detect host constructors (Safari). */
  17935. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  17936. /** Used to detect octal string values. */
  17937. var reIsOctal = /^0o[0-7]+$/i;
  17938. /** Used to detect unsigned integer values. */
  17939. var reIsUint = /^(?:0|[1-9]\d*)$/;
  17940. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  17941. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  17942. /** Used to ensure capturing order of template delimiters. */
  17943. var reNoMatch = /($^)/;
  17944. /** Used to match unescaped characters in compiled string literals. */
  17945. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  17946. /** Used to compose unicode character classes. */
  17947. var rsAstralRange = '\\ud800-\\udfff',
  17948. rsComboMarksRange = '\\u0300-\\u036f',
  17949. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  17950. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  17951. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  17952. rsDingbatRange = '\\u2700-\\u27bf',
  17953. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  17954. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  17955. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  17956. rsPunctuationRange = '\\u2000-\\u206f',
  17957. 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',
  17958. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  17959. rsVarRange = '\\ufe0e\\ufe0f',
  17960. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  17961. /** Used to compose unicode capture groups. */
  17962. var rsApos = "['\u2019]",
  17963. rsAstral = '[' + rsAstralRange + ']',
  17964. rsBreak = '[' + rsBreakRange + ']',
  17965. rsCombo = '[' + rsComboRange + ']',
  17966. rsDigits = '\\d+',
  17967. rsDingbat = '[' + rsDingbatRange + ']',
  17968. rsLower = '[' + rsLowerRange + ']',
  17969. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  17970. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  17971. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  17972. rsNonAstral = '[^' + rsAstralRange + ']',
  17973. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  17974. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  17975. rsUpper = '[' + rsUpperRange + ']',
  17976. rsZWJ = '\\u200d';
  17977. /** Used to compose unicode regexes. */
  17978. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  17979. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  17980. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  17981. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  17982. reOptMod = rsModifier + '?',
  17983. rsOptVar = '[' + rsVarRange + ']?',
  17984. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  17985. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  17986. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  17987. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  17988. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  17989. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  17990. /** Used to match apostrophes. */
  17991. var reApos = RegExp(rsApos, 'g');
  17992. /**
  17993. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  17994. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  17995. */
  17996. var reComboMark = RegExp(rsCombo, 'g');
  17997. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  17998. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  17999. /** Used to match complex or compound words. */
  18000. var reUnicodeWord = RegExp([
  18001. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18002. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18003. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18004. rsUpper + '+' + rsOptContrUpper,
  18005. rsOrdUpper,
  18006. rsOrdLower,
  18007. rsDigits,
  18008. rsEmoji
  18009. ].join('|'), 'g');
  18010. /** 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/). */
  18011. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18012. /** Used to detect strings that need a more robust regexp to match words. */
  18013. 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 ]/;
  18014. /** Used to assign default `context` object properties. */
  18015. var contextProps = [
  18016. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18017. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18018. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18019. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18020. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18021. ];
  18022. /** Used to make template sourceURLs easier to identify. */
  18023. var templateCounter = -1;
  18024. /** Used to identify `toStringTag` values of typed arrays. */
  18025. var typedArrayTags = {};
  18026. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18027. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18028. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18029. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18030. typedArrayTags[uint32Tag] = true;
  18031. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18032. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18033. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18034. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18035. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18036. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18037. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18038. typedArrayTags[weakMapTag] = false;
  18039. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18040. var cloneableTags = {};
  18041. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18042. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18043. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18044. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18045. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18046. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18047. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18048. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18049. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18050. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18051. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18052. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18053. cloneableTags[weakMapTag] = false;
  18054. /** Used to map Latin Unicode letters to basic Latin letters. */
  18055. var deburredLetters = {
  18056. // Latin-1 Supplement block.
  18057. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18058. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18059. '\xc7': 'C', '\xe7': 'c',
  18060. '\xd0': 'D', '\xf0': 'd',
  18061. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18062. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18063. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18064. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18065. '\xd1': 'N', '\xf1': 'n',
  18066. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18067. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18068. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18069. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18070. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18071. '\xc6': 'Ae', '\xe6': 'ae',
  18072. '\xde': 'Th', '\xfe': 'th',
  18073. '\xdf': 'ss',
  18074. // Latin Extended-A block.
  18075. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18076. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18077. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18078. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18079. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18080. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18081. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18082. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18083. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18084. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18085. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18086. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18087. '\u0134': 'J', '\u0135': 'j',
  18088. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18089. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18090. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18091. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18092. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18093. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18094. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18095. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18096. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18097. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18098. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18099. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18100. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18101. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18102. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18103. '\u0174': 'W', '\u0175': 'w',
  18104. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18105. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18106. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18107. '\u0132': 'IJ', '\u0133': 'ij',
  18108. '\u0152': 'Oe', '\u0153': 'oe',
  18109. '\u0149': "'n", '\u017f': 's'
  18110. };
  18111. /** Used to map characters to HTML entities. */
  18112. var htmlEscapes = {
  18113. '&': '&amp;',
  18114. '<': '&lt;',
  18115. '>': '&gt;',
  18116. '"': '&quot;',
  18117. "'": '&#39;'
  18118. };
  18119. /** Used to map HTML entities to characters. */
  18120. var htmlUnescapes = {
  18121. '&amp;': '&',
  18122. '&lt;': '<',
  18123. '&gt;': '>',
  18124. '&quot;': '"',
  18125. '&#39;': "'"
  18126. };
  18127. /** Used to escape characters for inclusion in compiled string literals. */
  18128. var stringEscapes = {
  18129. '\\': '\\',
  18130. "'": "'",
  18131. '\n': 'n',
  18132. '\r': 'r',
  18133. '\u2028': 'u2028',
  18134. '\u2029': 'u2029'
  18135. };
  18136. /** Built-in method references without a dependency on `root`. */
  18137. var freeParseFloat = parseFloat,
  18138. freeParseInt = parseInt;
  18139. /** Detect free variable `global` from Node.js. */
  18140. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18141. /** Detect free variable `self`. */
  18142. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18143. /** Used as a reference to the global object. */
  18144. var root = freeGlobal || freeSelf || Function('return this')();
  18145. /** Detect free variable `exports`. */
  18146. var freeExports = true && exports && !exports.nodeType && exports;
  18147. /** Detect free variable `module`. */
  18148. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18149. /** Detect the popular CommonJS extension `module.exports`. */
  18150. var moduleExports = freeModule && freeModule.exports === freeExports;
  18151. /** Detect free variable `process` from Node.js. */
  18152. var freeProcess = moduleExports && freeGlobal.process;
  18153. /** Used to access faster Node.js helpers. */
  18154. var nodeUtil = (function() {
  18155. try {
  18156. // Use `util.types` for Node.js 10+.
  18157. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18158. if (types) {
  18159. return types;
  18160. }
  18161. // Legacy `process.binding('util')` for Node.js < 10.
  18162. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18163. } catch (e) {}
  18164. }());
  18165. /* Node.js helper references. */
  18166. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18167. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18168. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18169. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18170. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18171. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18172. /*--------------------------------------------------------------------------*/
  18173. /**
  18174. * A faster alternative to `Function#apply`, this function invokes `func`
  18175. * with the `this` binding of `thisArg` and the arguments of `args`.
  18176. *
  18177. * @private
  18178. * @param {Function} func The function to invoke.
  18179. * @param {*} thisArg The `this` binding of `func`.
  18180. * @param {Array} args The arguments to invoke `func` with.
  18181. * @returns {*} Returns the result of `func`.
  18182. */
  18183. function apply(func, thisArg, args) {
  18184. switch (args.length) {
  18185. case 0: return func.call(thisArg);
  18186. case 1: return func.call(thisArg, args[0]);
  18187. case 2: return func.call(thisArg, args[0], args[1]);
  18188. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18189. }
  18190. return func.apply(thisArg, args);
  18191. }
  18192. /**
  18193. * A specialized version of `baseAggregator` for arrays.
  18194. *
  18195. * @private
  18196. * @param {Array} [array] The array to iterate over.
  18197. * @param {Function} setter The function to set `accumulator` values.
  18198. * @param {Function} iteratee The iteratee to transform keys.
  18199. * @param {Object} accumulator The initial aggregated object.
  18200. * @returns {Function} Returns `accumulator`.
  18201. */
  18202. function arrayAggregator(array, setter, iteratee, accumulator) {
  18203. var index = -1,
  18204. length = array == null ? 0 : array.length;
  18205. while (++index < length) {
  18206. var value = array[index];
  18207. setter(accumulator, value, iteratee(value), array);
  18208. }
  18209. return accumulator;
  18210. }
  18211. /**
  18212. * A specialized version of `_.forEach` for arrays without support for
  18213. * iteratee shorthands.
  18214. *
  18215. * @private
  18216. * @param {Array} [array] The array to iterate over.
  18217. * @param {Function} iteratee The function invoked per iteration.
  18218. * @returns {Array} Returns `array`.
  18219. */
  18220. function arrayEach(array, iteratee) {
  18221. var index = -1,
  18222. length = array == null ? 0 : array.length;
  18223. while (++index < length) {
  18224. if (iteratee(array[index], index, array) === false) {
  18225. break;
  18226. }
  18227. }
  18228. return array;
  18229. }
  18230. /**
  18231. * A specialized version of `_.forEachRight` for arrays without support for
  18232. * iteratee shorthands.
  18233. *
  18234. * @private
  18235. * @param {Array} [array] The array to iterate over.
  18236. * @param {Function} iteratee The function invoked per iteration.
  18237. * @returns {Array} Returns `array`.
  18238. */
  18239. function arrayEachRight(array, iteratee) {
  18240. var length = array == null ? 0 : array.length;
  18241. while (length--) {
  18242. if (iteratee(array[length], length, array) === false) {
  18243. break;
  18244. }
  18245. }
  18246. return array;
  18247. }
  18248. /**
  18249. * A specialized version of `_.every` for arrays without support for
  18250. * iteratee shorthands.
  18251. *
  18252. * @private
  18253. * @param {Array} [array] The array to iterate over.
  18254. * @param {Function} predicate The function invoked per iteration.
  18255. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18256. * else `false`.
  18257. */
  18258. function arrayEvery(array, predicate) {
  18259. var index = -1,
  18260. length = array == null ? 0 : array.length;
  18261. while (++index < length) {
  18262. if (!predicate(array[index], index, array)) {
  18263. return false;
  18264. }
  18265. }
  18266. return true;
  18267. }
  18268. /**
  18269. * A specialized version of `_.filter` for arrays without support for
  18270. * iteratee shorthands.
  18271. *
  18272. * @private
  18273. * @param {Array} [array] The array to iterate over.
  18274. * @param {Function} predicate The function invoked per iteration.
  18275. * @returns {Array} Returns the new filtered array.
  18276. */
  18277. function arrayFilter(array, predicate) {
  18278. var index = -1,
  18279. length = array == null ? 0 : array.length,
  18280. resIndex = 0,
  18281. result = [];
  18282. while (++index < length) {
  18283. var value = array[index];
  18284. if (predicate(value, index, array)) {
  18285. result[resIndex++] = value;
  18286. }
  18287. }
  18288. return result;
  18289. }
  18290. /**
  18291. * A specialized version of `_.includes` for arrays without support for
  18292. * specifying an index to search from.
  18293. *
  18294. * @private
  18295. * @param {Array} [array] The array to inspect.
  18296. * @param {*} target The value to search for.
  18297. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18298. */
  18299. function arrayIncludes(array, value) {
  18300. var length = array == null ? 0 : array.length;
  18301. return !!length && baseIndexOf(array, value, 0) > -1;
  18302. }
  18303. /**
  18304. * This function is like `arrayIncludes` except that it accepts a comparator.
  18305. *
  18306. * @private
  18307. * @param {Array} [array] The array to inspect.
  18308. * @param {*} target The value to search for.
  18309. * @param {Function} comparator The comparator invoked per element.
  18310. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18311. */
  18312. function arrayIncludesWith(array, value, comparator) {
  18313. var index = -1,
  18314. length = array == null ? 0 : array.length;
  18315. while (++index < length) {
  18316. if (comparator(value, array[index])) {
  18317. return true;
  18318. }
  18319. }
  18320. return false;
  18321. }
  18322. /**
  18323. * A specialized version of `_.map` for arrays without support for iteratee
  18324. * shorthands.
  18325. *
  18326. * @private
  18327. * @param {Array} [array] The array to iterate over.
  18328. * @param {Function} iteratee The function invoked per iteration.
  18329. * @returns {Array} Returns the new mapped array.
  18330. */
  18331. function arrayMap(array, iteratee) {
  18332. var index = -1,
  18333. length = array == null ? 0 : array.length,
  18334. result = Array(length);
  18335. while (++index < length) {
  18336. result[index] = iteratee(array[index], index, array);
  18337. }
  18338. return result;
  18339. }
  18340. /**
  18341. * Appends the elements of `values` to `array`.
  18342. *
  18343. * @private
  18344. * @param {Array} array The array to modify.
  18345. * @param {Array} values The values to append.
  18346. * @returns {Array} Returns `array`.
  18347. */
  18348. function arrayPush(array, values) {
  18349. var index = -1,
  18350. length = values.length,
  18351. offset = array.length;
  18352. while (++index < length) {
  18353. array[offset + index] = values[index];
  18354. }
  18355. return array;
  18356. }
  18357. /**
  18358. * A specialized version of `_.reduce` for arrays without support for
  18359. * iteratee shorthands.
  18360. *
  18361. * @private
  18362. * @param {Array} [array] The array to iterate over.
  18363. * @param {Function} iteratee The function invoked per iteration.
  18364. * @param {*} [accumulator] The initial value.
  18365. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18366. * the initial value.
  18367. * @returns {*} Returns the accumulated value.
  18368. */
  18369. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18370. var index = -1,
  18371. length = array == null ? 0 : array.length;
  18372. if (initAccum && length) {
  18373. accumulator = array[++index];
  18374. }
  18375. while (++index < length) {
  18376. accumulator = iteratee(accumulator, array[index], index, array);
  18377. }
  18378. return accumulator;
  18379. }
  18380. /**
  18381. * A specialized version of `_.reduceRight` for arrays without support for
  18382. * iteratee shorthands.
  18383. *
  18384. * @private
  18385. * @param {Array} [array] The array to iterate over.
  18386. * @param {Function} iteratee The function invoked per iteration.
  18387. * @param {*} [accumulator] The initial value.
  18388. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18389. * the initial value.
  18390. * @returns {*} Returns the accumulated value.
  18391. */
  18392. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18393. var length = array == null ? 0 : array.length;
  18394. if (initAccum && length) {
  18395. accumulator = array[--length];
  18396. }
  18397. while (length--) {
  18398. accumulator = iteratee(accumulator, array[length], length, array);
  18399. }
  18400. return accumulator;
  18401. }
  18402. /**
  18403. * A specialized version of `_.some` for arrays without support for iteratee
  18404. * shorthands.
  18405. *
  18406. * @private
  18407. * @param {Array} [array] The array to iterate over.
  18408. * @param {Function} predicate The function invoked per iteration.
  18409. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18410. * else `false`.
  18411. */
  18412. function arraySome(array, predicate) {
  18413. var index = -1,
  18414. length = array == null ? 0 : array.length;
  18415. while (++index < length) {
  18416. if (predicate(array[index], index, array)) {
  18417. return true;
  18418. }
  18419. }
  18420. return false;
  18421. }
  18422. /**
  18423. * Gets the size of an ASCII `string`.
  18424. *
  18425. * @private
  18426. * @param {string} string The string inspect.
  18427. * @returns {number} Returns the string size.
  18428. */
  18429. var asciiSize = baseProperty('length');
  18430. /**
  18431. * Converts an ASCII `string` to an array.
  18432. *
  18433. * @private
  18434. * @param {string} string The string to convert.
  18435. * @returns {Array} Returns the converted array.
  18436. */
  18437. function asciiToArray(string) {
  18438. return string.split('');
  18439. }
  18440. /**
  18441. * Splits an ASCII `string` into an array of its words.
  18442. *
  18443. * @private
  18444. * @param {string} The string to inspect.
  18445. * @returns {Array} Returns the words of `string`.
  18446. */
  18447. function asciiWords(string) {
  18448. return string.match(reAsciiWord) || [];
  18449. }
  18450. /**
  18451. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18452. * without support for iteratee shorthands, which iterates over `collection`
  18453. * using `eachFunc`.
  18454. *
  18455. * @private
  18456. * @param {Array|Object} collection The collection to inspect.
  18457. * @param {Function} predicate The function invoked per iteration.
  18458. * @param {Function} eachFunc The function to iterate over `collection`.
  18459. * @returns {*} Returns the found element or its key, else `undefined`.
  18460. */
  18461. function baseFindKey(collection, predicate, eachFunc) {
  18462. var result;
  18463. eachFunc(collection, function(value, key, collection) {
  18464. if (predicate(value, key, collection)) {
  18465. result = key;
  18466. return false;
  18467. }
  18468. });
  18469. return result;
  18470. }
  18471. /**
  18472. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18473. * support for iteratee shorthands.
  18474. *
  18475. * @private
  18476. * @param {Array} array The array to inspect.
  18477. * @param {Function} predicate The function invoked per iteration.
  18478. * @param {number} fromIndex The index to search from.
  18479. * @param {boolean} [fromRight] Specify iterating from right to left.
  18480. * @returns {number} Returns the index of the matched value, else `-1`.
  18481. */
  18482. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18483. var length = array.length,
  18484. index = fromIndex + (fromRight ? 1 : -1);
  18485. while ((fromRight ? index-- : ++index < length)) {
  18486. if (predicate(array[index], index, array)) {
  18487. return index;
  18488. }
  18489. }
  18490. return -1;
  18491. }
  18492. /**
  18493. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18494. *
  18495. * @private
  18496. * @param {Array} array The array to inspect.
  18497. * @param {*} value The value to search for.
  18498. * @param {number} fromIndex The index to search from.
  18499. * @returns {number} Returns the index of the matched value, else `-1`.
  18500. */
  18501. function baseIndexOf(array, value, fromIndex) {
  18502. return value === value
  18503. ? strictIndexOf(array, value, fromIndex)
  18504. : baseFindIndex(array, baseIsNaN, fromIndex);
  18505. }
  18506. /**
  18507. * This function is like `baseIndexOf` except that it accepts a comparator.
  18508. *
  18509. * @private
  18510. * @param {Array} array The array to inspect.
  18511. * @param {*} value The value to search for.
  18512. * @param {number} fromIndex The index to search from.
  18513. * @param {Function} comparator The comparator invoked per element.
  18514. * @returns {number} Returns the index of the matched value, else `-1`.
  18515. */
  18516. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18517. var index = fromIndex - 1,
  18518. length = array.length;
  18519. while (++index < length) {
  18520. if (comparator(array[index], value)) {
  18521. return index;
  18522. }
  18523. }
  18524. return -1;
  18525. }
  18526. /**
  18527. * The base implementation of `_.isNaN` without support for number objects.
  18528. *
  18529. * @private
  18530. * @param {*} value The value to check.
  18531. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18532. */
  18533. function baseIsNaN(value) {
  18534. return value !== value;
  18535. }
  18536. /**
  18537. * The base implementation of `_.mean` and `_.meanBy` without support for
  18538. * iteratee shorthands.
  18539. *
  18540. * @private
  18541. * @param {Array} array The array to iterate over.
  18542. * @param {Function} iteratee The function invoked per iteration.
  18543. * @returns {number} Returns the mean.
  18544. */
  18545. function baseMean(array, iteratee) {
  18546. var length = array == null ? 0 : array.length;
  18547. return length ? (baseSum(array, iteratee) / length) : NAN;
  18548. }
  18549. /**
  18550. * The base implementation of `_.property` without support for deep paths.
  18551. *
  18552. * @private
  18553. * @param {string} key The key of the property to get.
  18554. * @returns {Function} Returns the new accessor function.
  18555. */
  18556. function baseProperty(key) {
  18557. return function(object) {
  18558. return object == null ? undefined : object[key];
  18559. };
  18560. }
  18561. /**
  18562. * The base implementation of `_.propertyOf` without support for deep paths.
  18563. *
  18564. * @private
  18565. * @param {Object} object The object to query.
  18566. * @returns {Function} Returns the new accessor function.
  18567. */
  18568. function basePropertyOf(object) {
  18569. return function(key) {
  18570. return object == null ? undefined : object[key];
  18571. };
  18572. }
  18573. /**
  18574. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18575. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18576. *
  18577. * @private
  18578. * @param {Array|Object} collection The collection to iterate over.
  18579. * @param {Function} iteratee The function invoked per iteration.
  18580. * @param {*} accumulator The initial value.
  18581. * @param {boolean} initAccum Specify using the first or last element of
  18582. * `collection` as the initial value.
  18583. * @param {Function} eachFunc The function to iterate over `collection`.
  18584. * @returns {*} Returns the accumulated value.
  18585. */
  18586. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18587. eachFunc(collection, function(value, index, collection) {
  18588. accumulator = initAccum
  18589. ? (initAccum = false, value)
  18590. : iteratee(accumulator, value, index, collection);
  18591. });
  18592. return accumulator;
  18593. }
  18594. /**
  18595. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18596. * sort order of `array` and replaces criteria objects with their corresponding
  18597. * values.
  18598. *
  18599. * @private
  18600. * @param {Array} array The array to sort.
  18601. * @param {Function} comparer The function to define sort order.
  18602. * @returns {Array} Returns `array`.
  18603. */
  18604. function baseSortBy(array, comparer) {
  18605. var length = array.length;
  18606. array.sort(comparer);
  18607. while (length--) {
  18608. array[length] = array[length].value;
  18609. }
  18610. return array;
  18611. }
  18612. /**
  18613. * The base implementation of `_.sum` and `_.sumBy` without support for
  18614. * iteratee shorthands.
  18615. *
  18616. * @private
  18617. * @param {Array} array The array to iterate over.
  18618. * @param {Function} iteratee The function invoked per iteration.
  18619. * @returns {number} Returns the sum.
  18620. */
  18621. function baseSum(array, iteratee) {
  18622. var result,
  18623. index = -1,
  18624. length = array.length;
  18625. while (++index < length) {
  18626. var current = iteratee(array[index]);
  18627. if (current !== undefined) {
  18628. result = result === undefined ? current : (result + current);
  18629. }
  18630. }
  18631. return result;
  18632. }
  18633. /**
  18634. * The base implementation of `_.times` without support for iteratee shorthands
  18635. * or max array length checks.
  18636. *
  18637. * @private
  18638. * @param {number} n The number of times to invoke `iteratee`.
  18639. * @param {Function} iteratee The function invoked per iteration.
  18640. * @returns {Array} Returns the array of results.
  18641. */
  18642. function baseTimes(n, iteratee) {
  18643. var index = -1,
  18644. result = Array(n);
  18645. while (++index < n) {
  18646. result[index] = iteratee(index);
  18647. }
  18648. return result;
  18649. }
  18650. /**
  18651. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18652. * of key-value pairs for `object` corresponding to the property names of `props`.
  18653. *
  18654. * @private
  18655. * @param {Object} object The object to query.
  18656. * @param {Array} props The property names to get values for.
  18657. * @returns {Object} Returns the key-value pairs.
  18658. */
  18659. function baseToPairs(object, props) {
  18660. return arrayMap(props, function(key) {
  18661. return [key, object[key]];
  18662. });
  18663. }
  18664. /**
  18665. * The base implementation of `_.unary` without support for storing metadata.
  18666. *
  18667. * @private
  18668. * @param {Function} func The function to cap arguments for.
  18669. * @returns {Function} Returns the new capped function.
  18670. */
  18671. function baseUnary(func) {
  18672. return function(value) {
  18673. return func(value);
  18674. };
  18675. }
  18676. /**
  18677. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18678. * array of `object` property values corresponding to the property names
  18679. * of `props`.
  18680. *
  18681. * @private
  18682. * @param {Object} object The object to query.
  18683. * @param {Array} props The property names to get values for.
  18684. * @returns {Object} Returns the array of property values.
  18685. */
  18686. function baseValues(object, props) {
  18687. return arrayMap(props, function(key) {
  18688. return object[key];
  18689. });
  18690. }
  18691. /**
  18692. * Checks if a `cache` value for `key` exists.
  18693. *
  18694. * @private
  18695. * @param {Object} cache The cache to query.
  18696. * @param {string} key The key of the entry to check.
  18697. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18698. */
  18699. function cacheHas(cache, key) {
  18700. return cache.has(key);
  18701. }
  18702. /**
  18703. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18704. * that is not found in the character symbols.
  18705. *
  18706. * @private
  18707. * @param {Array} strSymbols The string symbols to inspect.
  18708. * @param {Array} chrSymbols The character symbols to find.
  18709. * @returns {number} Returns the index of the first unmatched string symbol.
  18710. */
  18711. function charsStartIndex(strSymbols, chrSymbols) {
  18712. var index = -1,
  18713. length = strSymbols.length;
  18714. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18715. return index;
  18716. }
  18717. /**
  18718. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18719. * that is not found in the character symbols.
  18720. *
  18721. * @private
  18722. * @param {Array} strSymbols The string symbols to inspect.
  18723. * @param {Array} chrSymbols The character symbols to find.
  18724. * @returns {number} Returns the index of the last unmatched string symbol.
  18725. */
  18726. function charsEndIndex(strSymbols, chrSymbols) {
  18727. var index = strSymbols.length;
  18728. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18729. return index;
  18730. }
  18731. /**
  18732. * Gets the number of `placeholder` occurrences in `array`.
  18733. *
  18734. * @private
  18735. * @param {Array} array The array to inspect.
  18736. * @param {*} placeholder The placeholder to search for.
  18737. * @returns {number} Returns the placeholder count.
  18738. */
  18739. function countHolders(array, placeholder) {
  18740. var length = array.length,
  18741. result = 0;
  18742. while (length--) {
  18743. if (array[length] === placeholder) {
  18744. ++result;
  18745. }
  18746. }
  18747. return result;
  18748. }
  18749. /**
  18750. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18751. * letters to basic Latin letters.
  18752. *
  18753. * @private
  18754. * @param {string} letter The matched letter to deburr.
  18755. * @returns {string} Returns the deburred letter.
  18756. */
  18757. var deburrLetter = basePropertyOf(deburredLetters);
  18758. /**
  18759. * Used by `_.escape` to convert characters to HTML entities.
  18760. *
  18761. * @private
  18762. * @param {string} chr The matched character to escape.
  18763. * @returns {string} Returns the escaped character.
  18764. */
  18765. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18766. /**
  18767. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18768. *
  18769. * @private
  18770. * @param {string} chr The matched character to escape.
  18771. * @returns {string} Returns the escaped character.
  18772. */
  18773. function escapeStringChar(chr) {
  18774. return '\\' + stringEscapes[chr];
  18775. }
  18776. /**
  18777. * Gets the value at `key` of `object`.
  18778. *
  18779. * @private
  18780. * @param {Object} [object] The object to query.
  18781. * @param {string} key The key of the property to get.
  18782. * @returns {*} Returns the property value.
  18783. */
  18784. function getValue(object, key) {
  18785. return object == null ? undefined : object[key];
  18786. }
  18787. /**
  18788. * Checks if `string` contains Unicode symbols.
  18789. *
  18790. * @private
  18791. * @param {string} string The string to inspect.
  18792. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18793. */
  18794. function hasUnicode(string) {
  18795. return reHasUnicode.test(string);
  18796. }
  18797. /**
  18798. * Checks if `string` contains a word composed of Unicode symbols.
  18799. *
  18800. * @private
  18801. * @param {string} string The string to inspect.
  18802. * @returns {boolean} Returns `true` if a word is found, else `false`.
  18803. */
  18804. function hasUnicodeWord(string) {
  18805. return reHasUnicodeWord.test(string);
  18806. }
  18807. /**
  18808. * Converts `iterator` to an array.
  18809. *
  18810. * @private
  18811. * @param {Object} iterator The iterator to convert.
  18812. * @returns {Array} Returns the converted array.
  18813. */
  18814. function iteratorToArray(iterator) {
  18815. var data,
  18816. result = [];
  18817. while (!(data = iterator.next()).done) {
  18818. result.push(data.value);
  18819. }
  18820. return result;
  18821. }
  18822. /**
  18823. * Converts `map` to its key-value pairs.
  18824. *
  18825. * @private
  18826. * @param {Object} map The map to convert.
  18827. * @returns {Array} Returns the key-value pairs.
  18828. */
  18829. function mapToArray(map) {
  18830. var index = -1,
  18831. result = Array(map.size);
  18832. map.forEach(function(value, key) {
  18833. result[++index] = [key, value];
  18834. });
  18835. return result;
  18836. }
  18837. /**
  18838. * Creates a unary function that invokes `func` with its argument transformed.
  18839. *
  18840. * @private
  18841. * @param {Function} func The function to wrap.
  18842. * @param {Function} transform The argument transform.
  18843. * @returns {Function} Returns the new function.
  18844. */
  18845. function overArg(func, transform) {
  18846. return function(arg) {
  18847. return func(transform(arg));
  18848. };
  18849. }
  18850. /**
  18851. * Replaces all `placeholder` elements in `array` with an internal placeholder
  18852. * and returns an array of their indexes.
  18853. *
  18854. * @private
  18855. * @param {Array} array The array to modify.
  18856. * @param {*} placeholder The placeholder to replace.
  18857. * @returns {Array} Returns the new array of placeholder indexes.
  18858. */
  18859. function replaceHolders(array, placeholder) {
  18860. var index = -1,
  18861. length = array.length,
  18862. resIndex = 0,
  18863. result = [];
  18864. while (++index < length) {
  18865. var value = array[index];
  18866. if (value === placeholder || value === PLACEHOLDER) {
  18867. array[index] = PLACEHOLDER;
  18868. result[resIndex++] = index;
  18869. }
  18870. }
  18871. return result;
  18872. }
  18873. /**
  18874. * Converts `set` to an array of its values.
  18875. *
  18876. * @private
  18877. * @param {Object} set The set to convert.
  18878. * @returns {Array} Returns the values.
  18879. */
  18880. function setToArray(set) {
  18881. var index = -1,
  18882. result = Array(set.size);
  18883. set.forEach(function(value) {
  18884. result[++index] = value;
  18885. });
  18886. return result;
  18887. }
  18888. /**
  18889. * Converts `set` to its value-value pairs.
  18890. *
  18891. * @private
  18892. * @param {Object} set The set to convert.
  18893. * @returns {Array} Returns the value-value pairs.
  18894. */
  18895. function setToPairs(set) {
  18896. var index = -1,
  18897. result = Array(set.size);
  18898. set.forEach(function(value) {
  18899. result[++index] = [value, value];
  18900. });
  18901. return result;
  18902. }
  18903. /**
  18904. * A specialized version of `_.indexOf` which performs strict equality
  18905. * comparisons of values, i.e. `===`.
  18906. *
  18907. * @private
  18908. * @param {Array} array The array to inspect.
  18909. * @param {*} value The value to search for.
  18910. * @param {number} fromIndex The index to search from.
  18911. * @returns {number} Returns the index of the matched value, else `-1`.
  18912. */
  18913. function strictIndexOf(array, value, fromIndex) {
  18914. var index = fromIndex - 1,
  18915. length = array.length;
  18916. while (++index < length) {
  18917. if (array[index] === value) {
  18918. return index;
  18919. }
  18920. }
  18921. return -1;
  18922. }
  18923. /**
  18924. * A specialized version of `_.lastIndexOf` which performs strict equality
  18925. * comparisons of values, i.e. `===`.
  18926. *
  18927. * @private
  18928. * @param {Array} array The array to inspect.
  18929. * @param {*} value The value to search for.
  18930. * @param {number} fromIndex The index to search from.
  18931. * @returns {number} Returns the index of the matched value, else `-1`.
  18932. */
  18933. function strictLastIndexOf(array, value, fromIndex) {
  18934. var index = fromIndex + 1;
  18935. while (index--) {
  18936. if (array[index] === value) {
  18937. return index;
  18938. }
  18939. }
  18940. return index;
  18941. }
  18942. /**
  18943. * Gets the number of symbols in `string`.
  18944. *
  18945. * @private
  18946. * @param {string} string The string to inspect.
  18947. * @returns {number} Returns the string size.
  18948. */
  18949. function stringSize(string) {
  18950. return hasUnicode(string)
  18951. ? unicodeSize(string)
  18952. : asciiSize(string);
  18953. }
  18954. /**
  18955. * Converts `string` to an array.
  18956. *
  18957. * @private
  18958. * @param {string} string The string to convert.
  18959. * @returns {Array} Returns the converted array.
  18960. */
  18961. function stringToArray(string) {
  18962. return hasUnicode(string)
  18963. ? unicodeToArray(string)
  18964. : asciiToArray(string);
  18965. }
  18966. /**
  18967. * Used by `_.unescape` to convert HTML entities to characters.
  18968. *
  18969. * @private
  18970. * @param {string} chr The matched character to unescape.
  18971. * @returns {string} Returns the unescaped character.
  18972. */
  18973. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  18974. /**
  18975. * Gets the size of a Unicode `string`.
  18976. *
  18977. * @private
  18978. * @param {string} string The string inspect.
  18979. * @returns {number} Returns the string size.
  18980. */
  18981. function unicodeSize(string) {
  18982. var result = reUnicode.lastIndex = 0;
  18983. while (reUnicode.test(string)) {
  18984. ++result;
  18985. }
  18986. return result;
  18987. }
  18988. /**
  18989. * Converts a Unicode `string` to an array.
  18990. *
  18991. * @private
  18992. * @param {string} string The string to convert.
  18993. * @returns {Array} Returns the converted array.
  18994. */
  18995. function unicodeToArray(string) {
  18996. return string.match(reUnicode) || [];
  18997. }
  18998. /**
  18999. * Splits a Unicode `string` into an array of its words.
  19000. *
  19001. * @private
  19002. * @param {string} The string to inspect.
  19003. * @returns {Array} Returns the words of `string`.
  19004. */
  19005. function unicodeWords(string) {
  19006. return string.match(reUnicodeWord) || [];
  19007. }
  19008. /*--------------------------------------------------------------------------*/
  19009. /**
  19010. * Create a new pristine `lodash` function using the `context` object.
  19011. *
  19012. * @static
  19013. * @memberOf _
  19014. * @since 1.1.0
  19015. * @category Util
  19016. * @param {Object} [context=root] The context object.
  19017. * @returns {Function} Returns a new `lodash` function.
  19018. * @example
  19019. *
  19020. * _.mixin({ 'foo': _.constant('foo') });
  19021. *
  19022. * var lodash = _.runInContext();
  19023. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19024. *
  19025. * _.isFunction(_.foo);
  19026. * // => true
  19027. * _.isFunction(_.bar);
  19028. * // => false
  19029. *
  19030. * lodash.isFunction(lodash.foo);
  19031. * // => false
  19032. * lodash.isFunction(lodash.bar);
  19033. * // => true
  19034. *
  19035. * // Create a suped-up `defer` in Node.js.
  19036. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19037. */
  19038. var runInContext = (function runInContext(context) {
  19039. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19040. /** Built-in constructor references. */
  19041. var Array = context.Array,
  19042. Date = context.Date,
  19043. Error = context.Error,
  19044. Function = context.Function,
  19045. Math = context.Math,
  19046. Object = context.Object,
  19047. RegExp = context.RegExp,
  19048. String = context.String,
  19049. TypeError = context.TypeError;
  19050. /** Used for built-in method references. */
  19051. var arrayProto = Array.prototype,
  19052. funcProto = Function.prototype,
  19053. objectProto = Object.prototype;
  19054. /** Used to detect overreaching core-js shims. */
  19055. var coreJsData = context['__core-js_shared__'];
  19056. /** Used to resolve the decompiled source of functions. */
  19057. var funcToString = funcProto.toString;
  19058. /** Used to check objects for own properties. */
  19059. var hasOwnProperty = objectProto.hasOwnProperty;
  19060. /** Used to generate unique IDs. */
  19061. var idCounter = 0;
  19062. /** Used to detect methods masquerading as native. */
  19063. var maskSrcKey = (function() {
  19064. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19065. return uid ? ('Symbol(src)_1.' + uid) : '';
  19066. }());
  19067. /**
  19068. * Used to resolve the
  19069. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19070. * of values.
  19071. */
  19072. var nativeObjectToString = objectProto.toString;
  19073. /** Used to infer the `Object` constructor. */
  19074. var objectCtorString = funcToString.call(Object);
  19075. /** Used to restore the original `_` reference in `_.noConflict`. */
  19076. var oldDash = root._;
  19077. /** Used to detect if a method is native. */
  19078. var reIsNative = RegExp('^' +
  19079. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19080. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19081. );
  19082. /** Built-in value references. */
  19083. var Buffer = moduleExports ? context.Buffer : undefined,
  19084. Symbol = context.Symbol,
  19085. Uint8Array = context.Uint8Array,
  19086. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19087. getPrototype = overArg(Object.getPrototypeOf, Object),
  19088. objectCreate = Object.create,
  19089. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19090. splice = arrayProto.splice,
  19091. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19092. symIterator = Symbol ? Symbol.iterator : undefined,
  19093. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19094. var defineProperty = (function() {
  19095. try {
  19096. var func = getNative(Object, 'defineProperty');
  19097. func({}, '', {});
  19098. return func;
  19099. } catch (e) {}
  19100. }());
  19101. /** Mocked built-ins. */
  19102. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19103. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19104. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19105. /* Built-in method references for those with the same name as other `lodash` methods. */
  19106. var nativeCeil = Math.ceil,
  19107. nativeFloor = Math.floor,
  19108. nativeGetSymbols = Object.getOwnPropertySymbols,
  19109. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19110. nativeIsFinite = context.isFinite,
  19111. nativeJoin = arrayProto.join,
  19112. nativeKeys = overArg(Object.keys, Object),
  19113. nativeMax = Math.max,
  19114. nativeMin = Math.min,
  19115. nativeNow = Date.now,
  19116. nativeParseInt = context.parseInt,
  19117. nativeRandom = Math.random,
  19118. nativeReverse = arrayProto.reverse;
  19119. /* Built-in method references that are verified to be native. */
  19120. var DataView = getNative(context, 'DataView'),
  19121. Map = getNative(context, 'Map'),
  19122. Promise = getNative(context, 'Promise'),
  19123. Set = getNative(context, 'Set'),
  19124. WeakMap = getNative(context, 'WeakMap'),
  19125. nativeCreate = getNative(Object, 'create');
  19126. /** Used to store function metadata. */
  19127. var metaMap = WeakMap && new WeakMap;
  19128. /** Used to lookup unminified function names. */
  19129. var realNames = {};
  19130. /** Used to detect maps, sets, and weakmaps. */
  19131. var dataViewCtorString = toSource(DataView),
  19132. mapCtorString = toSource(Map),
  19133. promiseCtorString = toSource(Promise),
  19134. setCtorString = toSource(Set),
  19135. weakMapCtorString = toSource(WeakMap);
  19136. /** Used to convert symbols to primitives and strings. */
  19137. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19138. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19139. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19140. /*------------------------------------------------------------------------*/
  19141. /**
  19142. * Creates a `lodash` object which wraps `value` to enable implicit method
  19143. * chain sequences. Methods that operate on and return arrays, collections,
  19144. * and functions can be chained together. Methods that retrieve a single value
  19145. * or may return a primitive value will automatically end the chain sequence
  19146. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19147. * with `_#value`.
  19148. *
  19149. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19150. * enabled using `_.chain`.
  19151. *
  19152. * The execution of chained methods is lazy, that is, it's deferred until
  19153. * `_#value` is implicitly or explicitly called.
  19154. *
  19155. * Lazy evaluation allows several methods to support shortcut fusion.
  19156. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19157. * the creation of intermediate arrays and can greatly reduce the number of
  19158. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19159. * fusion if the section is applied to an array and iteratees accept only
  19160. * one argument. The heuristic for whether a section qualifies for shortcut
  19161. * fusion is subject to change.
  19162. *
  19163. * Chaining is supported in custom builds as long as the `_#value` method is
  19164. * directly or indirectly included in the build.
  19165. *
  19166. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19167. *
  19168. * The wrapper `Array` methods are:
  19169. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19170. *
  19171. * The wrapper `String` methods are:
  19172. * `replace` and `split`
  19173. *
  19174. * The wrapper methods that support shortcut fusion are:
  19175. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19176. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19177. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19178. *
  19179. * The chainable wrapper methods are:
  19180. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19181. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19182. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19183. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19184. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19185. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19186. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19187. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19188. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19189. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19190. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19191. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19192. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19193. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19194. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19195. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19196. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19197. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19198. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19199. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19200. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19201. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19202. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19203. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19204. *
  19205. * The wrapper methods that are **not** chainable by default are:
  19206. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19207. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19208. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19209. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19210. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19211. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19212. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19213. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19214. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19215. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19216. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19217. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19218. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19219. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19220. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19221. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19222. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19223. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19224. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19225. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19226. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19227. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19228. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19229. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19230. * `upperFirst`, `value`, and `words`
  19231. *
  19232. * @name _
  19233. * @constructor
  19234. * @category Seq
  19235. * @param {*} value The value to wrap in a `lodash` instance.
  19236. * @returns {Object} Returns the new `lodash` wrapper instance.
  19237. * @example
  19238. *
  19239. * function square(n) {
  19240. * return n * n;
  19241. * }
  19242. *
  19243. * var wrapped = _([1, 2, 3]);
  19244. *
  19245. * // Returns an unwrapped value.
  19246. * wrapped.reduce(_.add);
  19247. * // => 6
  19248. *
  19249. * // Returns a wrapped value.
  19250. * var squares = wrapped.map(square);
  19251. *
  19252. * _.isArray(squares);
  19253. * // => false
  19254. *
  19255. * _.isArray(squares.value());
  19256. * // => true
  19257. */
  19258. function lodash(value) {
  19259. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19260. if (value instanceof LodashWrapper) {
  19261. return value;
  19262. }
  19263. if (hasOwnProperty.call(value, '__wrapped__')) {
  19264. return wrapperClone(value);
  19265. }
  19266. }
  19267. return new LodashWrapper(value);
  19268. }
  19269. /**
  19270. * The base implementation of `_.create` without support for assigning
  19271. * properties to the created object.
  19272. *
  19273. * @private
  19274. * @param {Object} proto The object to inherit from.
  19275. * @returns {Object} Returns the new object.
  19276. */
  19277. var baseCreate = (function() {
  19278. function object() {}
  19279. return function(proto) {
  19280. if (!isObject(proto)) {
  19281. return {};
  19282. }
  19283. if (objectCreate) {
  19284. return objectCreate(proto);
  19285. }
  19286. object.prototype = proto;
  19287. var result = new object;
  19288. object.prototype = undefined;
  19289. return result;
  19290. };
  19291. }());
  19292. /**
  19293. * The function whose prototype chain sequence wrappers inherit from.
  19294. *
  19295. * @private
  19296. */
  19297. function baseLodash() {
  19298. // No operation performed.
  19299. }
  19300. /**
  19301. * The base constructor for creating `lodash` wrapper objects.
  19302. *
  19303. * @private
  19304. * @param {*} value The value to wrap.
  19305. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19306. */
  19307. function LodashWrapper(value, chainAll) {
  19308. this.__wrapped__ = value;
  19309. this.__actions__ = [];
  19310. this.__chain__ = !!chainAll;
  19311. this.__index__ = 0;
  19312. this.__values__ = undefined;
  19313. }
  19314. /**
  19315. * By default, the template delimiters used by lodash are like those in
  19316. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19317. * following template settings to use alternative delimiters.
  19318. *
  19319. * @static
  19320. * @memberOf _
  19321. * @type {Object}
  19322. */
  19323. lodash.templateSettings = {
  19324. /**
  19325. * Used to detect `data` property values to be HTML-escaped.
  19326. *
  19327. * @memberOf _.templateSettings
  19328. * @type {RegExp}
  19329. */
  19330. 'escape': reEscape,
  19331. /**
  19332. * Used to detect code to be evaluated.
  19333. *
  19334. * @memberOf _.templateSettings
  19335. * @type {RegExp}
  19336. */
  19337. 'evaluate': reEvaluate,
  19338. /**
  19339. * Used to detect `data` property values to inject.
  19340. *
  19341. * @memberOf _.templateSettings
  19342. * @type {RegExp}
  19343. */
  19344. 'interpolate': reInterpolate,
  19345. /**
  19346. * Used to reference the data object in the template text.
  19347. *
  19348. * @memberOf _.templateSettings
  19349. * @type {string}
  19350. */
  19351. 'variable': '',
  19352. /**
  19353. * Used to import variables into the compiled template.
  19354. *
  19355. * @memberOf _.templateSettings
  19356. * @type {Object}
  19357. */
  19358. 'imports': {
  19359. /**
  19360. * A reference to the `lodash` function.
  19361. *
  19362. * @memberOf _.templateSettings.imports
  19363. * @type {Function}
  19364. */
  19365. '_': lodash
  19366. }
  19367. };
  19368. // Ensure wrappers are instances of `baseLodash`.
  19369. lodash.prototype = baseLodash.prototype;
  19370. lodash.prototype.constructor = lodash;
  19371. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19372. LodashWrapper.prototype.constructor = LodashWrapper;
  19373. /*------------------------------------------------------------------------*/
  19374. /**
  19375. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19376. *
  19377. * @private
  19378. * @constructor
  19379. * @param {*} value The value to wrap.
  19380. */
  19381. function LazyWrapper(value) {
  19382. this.__wrapped__ = value;
  19383. this.__actions__ = [];
  19384. this.__dir__ = 1;
  19385. this.__filtered__ = false;
  19386. this.__iteratees__ = [];
  19387. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19388. this.__views__ = [];
  19389. }
  19390. /**
  19391. * Creates a clone of the lazy wrapper object.
  19392. *
  19393. * @private
  19394. * @name clone
  19395. * @memberOf LazyWrapper
  19396. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19397. */
  19398. function lazyClone() {
  19399. var result = new LazyWrapper(this.__wrapped__);
  19400. result.__actions__ = copyArray(this.__actions__);
  19401. result.__dir__ = this.__dir__;
  19402. result.__filtered__ = this.__filtered__;
  19403. result.__iteratees__ = copyArray(this.__iteratees__);
  19404. result.__takeCount__ = this.__takeCount__;
  19405. result.__views__ = copyArray(this.__views__);
  19406. return result;
  19407. }
  19408. /**
  19409. * Reverses the direction of lazy iteration.
  19410. *
  19411. * @private
  19412. * @name reverse
  19413. * @memberOf LazyWrapper
  19414. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19415. */
  19416. function lazyReverse() {
  19417. if (this.__filtered__) {
  19418. var result = new LazyWrapper(this);
  19419. result.__dir__ = -1;
  19420. result.__filtered__ = true;
  19421. } else {
  19422. result = this.clone();
  19423. result.__dir__ *= -1;
  19424. }
  19425. return result;
  19426. }
  19427. /**
  19428. * Extracts the unwrapped value from its lazy wrapper.
  19429. *
  19430. * @private
  19431. * @name value
  19432. * @memberOf LazyWrapper
  19433. * @returns {*} Returns the unwrapped value.
  19434. */
  19435. function lazyValue() {
  19436. var array = this.__wrapped__.value(),
  19437. dir = this.__dir__,
  19438. isArr = isArray(array),
  19439. isRight = dir < 0,
  19440. arrLength = isArr ? array.length : 0,
  19441. view = getView(0, arrLength, this.__views__),
  19442. start = view.start,
  19443. end = view.end,
  19444. length = end - start,
  19445. index = isRight ? end : (start - 1),
  19446. iteratees = this.__iteratees__,
  19447. iterLength = iteratees.length,
  19448. resIndex = 0,
  19449. takeCount = nativeMin(length, this.__takeCount__);
  19450. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19451. return baseWrapperValue(array, this.__actions__);
  19452. }
  19453. var result = [];
  19454. outer:
  19455. while (length-- && resIndex < takeCount) {
  19456. index += dir;
  19457. var iterIndex = -1,
  19458. value = array[index];
  19459. while (++iterIndex < iterLength) {
  19460. var data = iteratees[iterIndex],
  19461. iteratee = data.iteratee,
  19462. type = data.type,
  19463. computed = iteratee(value);
  19464. if (type == LAZY_MAP_FLAG) {
  19465. value = computed;
  19466. } else if (!computed) {
  19467. if (type == LAZY_FILTER_FLAG) {
  19468. continue outer;
  19469. } else {
  19470. break outer;
  19471. }
  19472. }
  19473. }
  19474. result[resIndex++] = value;
  19475. }
  19476. return result;
  19477. }
  19478. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19479. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19480. LazyWrapper.prototype.constructor = LazyWrapper;
  19481. /*------------------------------------------------------------------------*/
  19482. /**
  19483. * Creates a hash object.
  19484. *
  19485. * @private
  19486. * @constructor
  19487. * @param {Array} [entries] The key-value pairs to cache.
  19488. */
  19489. function Hash(entries) {
  19490. var index = -1,
  19491. length = entries == null ? 0 : entries.length;
  19492. this.clear();
  19493. while (++index < length) {
  19494. var entry = entries[index];
  19495. this.set(entry[0], entry[1]);
  19496. }
  19497. }
  19498. /**
  19499. * Removes all key-value entries from the hash.
  19500. *
  19501. * @private
  19502. * @name clear
  19503. * @memberOf Hash
  19504. */
  19505. function hashClear() {
  19506. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19507. this.size = 0;
  19508. }
  19509. /**
  19510. * Removes `key` and its value from the hash.
  19511. *
  19512. * @private
  19513. * @name delete
  19514. * @memberOf Hash
  19515. * @param {Object} hash The hash to modify.
  19516. * @param {string} key The key of the value to remove.
  19517. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19518. */
  19519. function hashDelete(key) {
  19520. var result = this.has(key) && delete this.__data__[key];
  19521. this.size -= result ? 1 : 0;
  19522. return result;
  19523. }
  19524. /**
  19525. * Gets the hash value for `key`.
  19526. *
  19527. * @private
  19528. * @name get
  19529. * @memberOf Hash
  19530. * @param {string} key The key of the value to get.
  19531. * @returns {*} Returns the entry value.
  19532. */
  19533. function hashGet(key) {
  19534. var data = this.__data__;
  19535. if (nativeCreate) {
  19536. var result = data[key];
  19537. return result === HASH_UNDEFINED ? undefined : result;
  19538. }
  19539. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19540. }
  19541. /**
  19542. * Checks if a hash value for `key` exists.
  19543. *
  19544. * @private
  19545. * @name has
  19546. * @memberOf Hash
  19547. * @param {string} key The key of the entry to check.
  19548. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19549. */
  19550. function hashHas(key) {
  19551. var data = this.__data__;
  19552. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19553. }
  19554. /**
  19555. * Sets the hash `key` to `value`.
  19556. *
  19557. * @private
  19558. * @name set
  19559. * @memberOf Hash
  19560. * @param {string} key The key of the value to set.
  19561. * @param {*} value The value to set.
  19562. * @returns {Object} Returns the hash instance.
  19563. */
  19564. function hashSet(key, value) {
  19565. var data = this.__data__;
  19566. this.size += this.has(key) ? 0 : 1;
  19567. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19568. return this;
  19569. }
  19570. // Add methods to `Hash`.
  19571. Hash.prototype.clear = hashClear;
  19572. Hash.prototype['delete'] = hashDelete;
  19573. Hash.prototype.get = hashGet;
  19574. Hash.prototype.has = hashHas;
  19575. Hash.prototype.set = hashSet;
  19576. /*------------------------------------------------------------------------*/
  19577. /**
  19578. * Creates an list cache object.
  19579. *
  19580. * @private
  19581. * @constructor
  19582. * @param {Array} [entries] The key-value pairs to cache.
  19583. */
  19584. function ListCache(entries) {
  19585. var index = -1,
  19586. length = entries == null ? 0 : entries.length;
  19587. this.clear();
  19588. while (++index < length) {
  19589. var entry = entries[index];
  19590. this.set(entry[0], entry[1]);
  19591. }
  19592. }
  19593. /**
  19594. * Removes all key-value entries from the list cache.
  19595. *
  19596. * @private
  19597. * @name clear
  19598. * @memberOf ListCache
  19599. */
  19600. function listCacheClear() {
  19601. this.__data__ = [];
  19602. this.size = 0;
  19603. }
  19604. /**
  19605. * Removes `key` and its value from the list cache.
  19606. *
  19607. * @private
  19608. * @name delete
  19609. * @memberOf ListCache
  19610. * @param {string} key The key of the value to remove.
  19611. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19612. */
  19613. function listCacheDelete(key) {
  19614. var data = this.__data__,
  19615. index = assocIndexOf(data, key);
  19616. if (index < 0) {
  19617. return false;
  19618. }
  19619. var lastIndex = data.length - 1;
  19620. if (index == lastIndex) {
  19621. data.pop();
  19622. } else {
  19623. splice.call(data, index, 1);
  19624. }
  19625. --this.size;
  19626. return true;
  19627. }
  19628. /**
  19629. * Gets the list cache value for `key`.
  19630. *
  19631. * @private
  19632. * @name get
  19633. * @memberOf ListCache
  19634. * @param {string} key The key of the value to get.
  19635. * @returns {*} Returns the entry value.
  19636. */
  19637. function listCacheGet(key) {
  19638. var data = this.__data__,
  19639. index = assocIndexOf(data, key);
  19640. return index < 0 ? undefined : data[index][1];
  19641. }
  19642. /**
  19643. * Checks if a list cache value for `key` exists.
  19644. *
  19645. * @private
  19646. * @name has
  19647. * @memberOf ListCache
  19648. * @param {string} key The key of the entry to check.
  19649. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19650. */
  19651. function listCacheHas(key) {
  19652. return assocIndexOf(this.__data__, key) > -1;
  19653. }
  19654. /**
  19655. * Sets the list cache `key` to `value`.
  19656. *
  19657. * @private
  19658. * @name set
  19659. * @memberOf ListCache
  19660. * @param {string} key The key of the value to set.
  19661. * @param {*} value The value to set.
  19662. * @returns {Object} Returns the list cache instance.
  19663. */
  19664. function listCacheSet(key, value) {
  19665. var data = this.__data__,
  19666. index = assocIndexOf(data, key);
  19667. if (index < 0) {
  19668. ++this.size;
  19669. data.push([key, value]);
  19670. } else {
  19671. data[index][1] = value;
  19672. }
  19673. return this;
  19674. }
  19675. // Add methods to `ListCache`.
  19676. ListCache.prototype.clear = listCacheClear;
  19677. ListCache.prototype['delete'] = listCacheDelete;
  19678. ListCache.prototype.get = listCacheGet;
  19679. ListCache.prototype.has = listCacheHas;
  19680. ListCache.prototype.set = listCacheSet;
  19681. /*------------------------------------------------------------------------*/
  19682. /**
  19683. * Creates a map cache object to store key-value pairs.
  19684. *
  19685. * @private
  19686. * @constructor
  19687. * @param {Array} [entries] The key-value pairs to cache.
  19688. */
  19689. function MapCache(entries) {
  19690. var index = -1,
  19691. length = entries == null ? 0 : entries.length;
  19692. this.clear();
  19693. while (++index < length) {
  19694. var entry = entries[index];
  19695. this.set(entry[0], entry[1]);
  19696. }
  19697. }
  19698. /**
  19699. * Removes all key-value entries from the map.
  19700. *
  19701. * @private
  19702. * @name clear
  19703. * @memberOf MapCache
  19704. */
  19705. function mapCacheClear() {
  19706. this.size = 0;
  19707. this.__data__ = {
  19708. 'hash': new Hash,
  19709. 'map': new (Map || ListCache),
  19710. 'string': new Hash
  19711. };
  19712. }
  19713. /**
  19714. * Removes `key` and its value from the map.
  19715. *
  19716. * @private
  19717. * @name delete
  19718. * @memberOf MapCache
  19719. * @param {string} key The key of the value to remove.
  19720. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19721. */
  19722. function mapCacheDelete(key) {
  19723. var result = getMapData(this, key)['delete'](key);
  19724. this.size -= result ? 1 : 0;
  19725. return result;
  19726. }
  19727. /**
  19728. * Gets the map value for `key`.
  19729. *
  19730. * @private
  19731. * @name get
  19732. * @memberOf MapCache
  19733. * @param {string} key The key of the value to get.
  19734. * @returns {*} Returns the entry value.
  19735. */
  19736. function mapCacheGet(key) {
  19737. return getMapData(this, key).get(key);
  19738. }
  19739. /**
  19740. * Checks if a map value for `key` exists.
  19741. *
  19742. * @private
  19743. * @name has
  19744. * @memberOf MapCache
  19745. * @param {string} key The key of the entry to check.
  19746. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19747. */
  19748. function mapCacheHas(key) {
  19749. return getMapData(this, key).has(key);
  19750. }
  19751. /**
  19752. * Sets the map `key` to `value`.
  19753. *
  19754. * @private
  19755. * @name set
  19756. * @memberOf MapCache
  19757. * @param {string} key The key of the value to set.
  19758. * @param {*} value The value to set.
  19759. * @returns {Object} Returns the map cache instance.
  19760. */
  19761. function mapCacheSet(key, value) {
  19762. var data = getMapData(this, key),
  19763. size = data.size;
  19764. data.set(key, value);
  19765. this.size += data.size == size ? 0 : 1;
  19766. return this;
  19767. }
  19768. // Add methods to `MapCache`.
  19769. MapCache.prototype.clear = mapCacheClear;
  19770. MapCache.prototype['delete'] = mapCacheDelete;
  19771. MapCache.prototype.get = mapCacheGet;
  19772. MapCache.prototype.has = mapCacheHas;
  19773. MapCache.prototype.set = mapCacheSet;
  19774. /*------------------------------------------------------------------------*/
  19775. /**
  19776. *
  19777. * Creates an array cache object to store unique values.
  19778. *
  19779. * @private
  19780. * @constructor
  19781. * @param {Array} [values] The values to cache.
  19782. */
  19783. function SetCache(values) {
  19784. var index = -1,
  19785. length = values == null ? 0 : values.length;
  19786. this.__data__ = new MapCache;
  19787. while (++index < length) {
  19788. this.add(values[index]);
  19789. }
  19790. }
  19791. /**
  19792. * Adds `value` to the array cache.
  19793. *
  19794. * @private
  19795. * @name add
  19796. * @memberOf SetCache
  19797. * @alias push
  19798. * @param {*} value The value to cache.
  19799. * @returns {Object} Returns the cache instance.
  19800. */
  19801. function setCacheAdd(value) {
  19802. this.__data__.set(value, HASH_UNDEFINED);
  19803. return this;
  19804. }
  19805. /**
  19806. * Checks if `value` is in the array cache.
  19807. *
  19808. * @private
  19809. * @name has
  19810. * @memberOf SetCache
  19811. * @param {*} value The value to search for.
  19812. * @returns {number} Returns `true` if `value` is found, else `false`.
  19813. */
  19814. function setCacheHas(value) {
  19815. return this.__data__.has(value);
  19816. }
  19817. // Add methods to `SetCache`.
  19818. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  19819. SetCache.prototype.has = setCacheHas;
  19820. /*------------------------------------------------------------------------*/
  19821. /**
  19822. * Creates a stack cache object to store key-value pairs.
  19823. *
  19824. * @private
  19825. * @constructor
  19826. * @param {Array} [entries] The key-value pairs to cache.
  19827. */
  19828. function Stack(entries) {
  19829. var data = this.__data__ = new ListCache(entries);
  19830. this.size = data.size;
  19831. }
  19832. /**
  19833. * Removes all key-value entries from the stack.
  19834. *
  19835. * @private
  19836. * @name clear
  19837. * @memberOf Stack
  19838. */
  19839. function stackClear() {
  19840. this.__data__ = new ListCache;
  19841. this.size = 0;
  19842. }
  19843. /**
  19844. * Removes `key` and its value from the stack.
  19845. *
  19846. * @private
  19847. * @name delete
  19848. * @memberOf Stack
  19849. * @param {string} key The key of the value to remove.
  19850. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19851. */
  19852. function stackDelete(key) {
  19853. var data = this.__data__,
  19854. result = data['delete'](key);
  19855. this.size = data.size;
  19856. return result;
  19857. }
  19858. /**
  19859. * Gets the stack value for `key`.
  19860. *
  19861. * @private
  19862. * @name get
  19863. * @memberOf Stack
  19864. * @param {string} key The key of the value to get.
  19865. * @returns {*} Returns the entry value.
  19866. */
  19867. function stackGet(key) {
  19868. return this.__data__.get(key);
  19869. }
  19870. /**
  19871. * Checks if a stack value for `key` exists.
  19872. *
  19873. * @private
  19874. * @name has
  19875. * @memberOf Stack
  19876. * @param {string} key The key of the entry to check.
  19877. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19878. */
  19879. function stackHas(key) {
  19880. return this.__data__.has(key);
  19881. }
  19882. /**
  19883. * Sets the stack `key` to `value`.
  19884. *
  19885. * @private
  19886. * @name set
  19887. * @memberOf Stack
  19888. * @param {string} key The key of the value to set.
  19889. * @param {*} value The value to set.
  19890. * @returns {Object} Returns the stack cache instance.
  19891. */
  19892. function stackSet(key, value) {
  19893. var data = this.__data__;
  19894. if (data instanceof ListCache) {
  19895. var pairs = data.__data__;
  19896. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  19897. pairs.push([key, value]);
  19898. this.size = ++data.size;
  19899. return this;
  19900. }
  19901. data = this.__data__ = new MapCache(pairs);
  19902. }
  19903. data.set(key, value);
  19904. this.size = data.size;
  19905. return this;
  19906. }
  19907. // Add methods to `Stack`.
  19908. Stack.prototype.clear = stackClear;
  19909. Stack.prototype['delete'] = stackDelete;
  19910. Stack.prototype.get = stackGet;
  19911. Stack.prototype.has = stackHas;
  19912. Stack.prototype.set = stackSet;
  19913. /*------------------------------------------------------------------------*/
  19914. /**
  19915. * Creates an array of the enumerable property names of the array-like `value`.
  19916. *
  19917. * @private
  19918. * @param {*} value The value to query.
  19919. * @param {boolean} inherited Specify returning inherited property names.
  19920. * @returns {Array} Returns the array of property names.
  19921. */
  19922. function arrayLikeKeys(value, inherited) {
  19923. var isArr = isArray(value),
  19924. isArg = !isArr && isArguments(value),
  19925. isBuff = !isArr && !isArg && isBuffer(value),
  19926. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  19927. skipIndexes = isArr || isArg || isBuff || isType,
  19928. result = skipIndexes ? baseTimes(value.length, String) : [],
  19929. length = result.length;
  19930. for (var key in value) {
  19931. if ((inherited || hasOwnProperty.call(value, key)) &&
  19932. !(skipIndexes && (
  19933. // Safari 9 has enumerable `arguments.length` in strict mode.
  19934. key == 'length' ||
  19935. // Node.js 0.10 has enumerable non-index properties on buffers.
  19936. (isBuff && (key == 'offset' || key == 'parent')) ||
  19937. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  19938. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  19939. // Skip index properties.
  19940. isIndex(key, length)
  19941. ))) {
  19942. result.push(key);
  19943. }
  19944. }
  19945. return result;
  19946. }
  19947. /**
  19948. * A specialized version of `_.sample` for arrays.
  19949. *
  19950. * @private
  19951. * @param {Array} array The array to sample.
  19952. * @returns {*} Returns the random element.
  19953. */
  19954. function arraySample(array) {
  19955. var length = array.length;
  19956. return length ? array[baseRandom(0, length - 1)] : undefined;
  19957. }
  19958. /**
  19959. * A specialized version of `_.sampleSize` for arrays.
  19960. *
  19961. * @private
  19962. * @param {Array} array The array to sample.
  19963. * @param {number} n The number of elements to sample.
  19964. * @returns {Array} Returns the random elements.
  19965. */
  19966. function arraySampleSize(array, n) {
  19967. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  19968. }
  19969. /**
  19970. * A specialized version of `_.shuffle` for arrays.
  19971. *
  19972. * @private
  19973. * @param {Array} array The array to shuffle.
  19974. * @returns {Array} Returns the new shuffled array.
  19975. */
  19976. function arrayShuffle(array) {
  19977. return shuffleSelf(copyArray(array));
  19978. }
  19979. /**
  19980. * This function is like `assignValue` except that it doesn't assign
  19981. * `undefined` values.
  19982. *
  19983. * @private
  19984. * @param {Object} object The object to modify.
  19985. * @param {string} key The key of the property to assign.
  19986. * @param {*} value The value to assign.
  19987. */
  19988. function assignMergeValue(object, key, value) {
  19989. if ((value !== undefined && !eq(object[key], value)) ||
  19990. (value === undefined && !(key in object))) {
  19991. baseAssignValue(object, key, value);
  19992. }
  19993. }
  19994. /**
  19995. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  19996. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19997. * for equality comparisons.
  19998. *
  19999. * @private
  20000. * @param {Object} object The object to modify.
  20001. * @param {string} key The key of the property to assign.
  20002. * @param {*} value The value to assign.
  20003. */
  20004. function assignValue(object, key, value) {
  20005. var objValue = object[key];
  20006. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20007. (value === undefined && !(key in object))) {
  20008. baseAssignValue(object, key, value);
  20009. }
  20010. }
  20011. /**
  20012. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20013. *
  20014. * @private
  20015. * @param {Array} array The array to inspect.
  20016. * @param {*} key The key to search for.
  20017. * @returns {number} Returns the index of the matched value, else `-1`.
  20018. */
  20019. function assocIndexOf(array, key) {
  20020. var length = array.length;
  20021. while (length--) {
  20022. if (eq(array[length][0], key)) {
  20023. return length;
  20024. }
  20025. }
  20026. return -1;
  20027. }
  20028. /**
  20029. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20030. * by `iteratee` and values set by `setter`.
  20031. *
  20032. * @private
  20033. * @param {Array|Object} collection The collection to iterate over.
  20034. * @param {Function} setter The function to set `accumulator` values.
  20035. * @param {Function} iteratee The iteratee to transform keys.
  20036. * @param {Object} accumulator The initial aggregated object.
  20037. * @returns {Function} Returns `accumulator`.
  20038. */
  20039. function baseAggregator(collection, setter, iteratee, accumulator) {
  20040. baseEach(collection, function(value, key, collection) {
  20041. setter(accumulator, value, iteratee(value), collection);
  20042. });
  20043. return accumulator;
  20044. }
  20045. /**
  20046. * The base implementation of `_.assign` without support for multiple sources
  20047. * or `customizer` functions.
  20048. *
  20049. * @private
  20050. * @param {Object} object The destination object.
  20051. * @param {Object} source The source object.
  20052. * @returns {Object} Returns `object`.
  20053. */
  20054. function baseAssign(object, source) {
  20055. return object && copyObject(source, keys(source), object);
  20056. }
  20057. /**
  20058. * The base implementation of `_.assignIn` without support for multiple sources
  20059. * or `customizer` functions.
  20060. *
  20061. * @private
  20062. * @param {Object} object The destination object.
  20063. * @param {Object} source The source object.
  20064. * @returns {Object} Returns `object`.
  20065. */
  20066. function baseAssignIn(object, source) {
  20067. return object && copyObject(source, keysIn(source), object);
  20068. }
  20069. /**
  20070. * The base implementation of `assignValue` and `assignMergeValue` without
  20071. * value checks.
  20072. *
  20073. * @private
  20074. * @param {Object} object The object to modify.
  20075. * @param {string} key The key of the property to assign.
  20076. * @param {*} value The value to assign.
  20077. */
  20078. function baseAssignValue(object, key, value) {
  20079. if (key == '__proto__' && defineProperty) {
  20080. defineProperty(object, key, {
  20081. 'configurable': true,
  20082. 'enumerable': true,
  20083. 'value': value,
  20084. 'writable': true
  20085. });
  20086. } else {
  20087. object[key] = value;
  20088. }
  20089. }
  20090. /**
  20091. * The base implementation of `_.at` without support for individual paths.
  20092. *
  20093. * @private
  20094. * @param {Object} object The object to iterate over.
  20095. * @param {string[]} paths The property paths to pick.
  20096. * @returns {Array} Returns the picked elements.
  20097. */
  20098. function baseAt(object, paths) {
  20099. var index = -1,
  20100. length = paths.length,
  20101. result = Array(length),
  20102. skip = object == null;
  20103. while (++index < length) {
  20104. result[index] = skip ? undefined : get(object, paths[index]);
  20105. }
  20106. return result;
  20107. }
  20108. /**
  20109. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20110. *
  20111. * @private
  20112. * @param {number} number The number to clamp.
  20113. * @param {number} [lower] The lower bound.
  20114. * @param {number} upper The upper bound.
  20115. * @returns {number} Returns the clamped number.
  20116. */
  20117. function baseClamp(number, lower, upper) {
  20118. if (number === number) {
  20119. if (upper !== undefined) {
  20120. number = number <= upper ? number : upper;
  20121. }
  20122. if (lower !== undefined) {
  20123. number = number >= lower ? number : lower;
  20124. }
  20125. }
  20126. return number;
  20127. }
  20128. /**
  20129. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20130. * traversed objects.
  20131. *
  20132. * @private
  20133. * @param {*} value The value to clone.
  20134. * @param {boolean} bitmask The bitmask flags.
  20135. * 1 - Deep clone
  20136. * 2 - Flatten inherited properties
  20137. * 4 - Clone symbols
  20138. * @param {Function} [customizer] The function to customize cloning.
  20139. * @param {string} [key] The key of `value`.
  20140. * @param {Object} [object] The parent object of `value`.
  20141. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20142. * @returns {*} Returns the cloned value.
  20143. */
  20144. function baseClone(value, bitmask, customizer, key, object, stack) {
  20145. var result,
  20146. isDeep = bitmask & CLONE_DEEP_FLAG,
  20147. isFlat = bitmask & CLONE_FLAT_FLAG,
  20148. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20149. if (customizer) {
  20150. result = object ? customizer(value, key, object, stack) : customizer(value);
  20151. }
  20152. if (result !== undefined) {
  20153. return result;
  20154. }
  20155. if (!isObject(value)) {
  20156. return value;
  20157. }
  20158. var isArr = isArray(value);
  20159. if (isArr) {
  20160. result = initCloneArray(value);
  20161. if (!isDeep) {
  20162. return copyArray(value, result);
  20163. }
  20164. } else {
  20165. var tag = getTag(value),
  20166. isFunc = tag == funcTag || tag == genTag;
  20167. if (isBuffer(value)) {
  20168. return cloneBuffer(value, isDeep);
  20169. }
  20170. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20171. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20172. if (!isDeep) {
  20173. return isFlat
  20174. ? copySymbolsIn(value, baseAssignIn(result, value))
  20175. : copySymbols(value, baseAssign(result, value));
  20176. }
  20177. } else {
  20178. if (!cloneableTags[tag]) {
  20179. return object ? value : {};
  20180. }
  20181. result = initCloneByTag(value, tag, isDeep);
  20182. }
  20183. }
  20184. // Check for circular references and return its corresponding clone.
  20185. stack || (stack = new Stack);
  20186. var stacked = stack.get(value);
  20187. if (stacked) {
  20188. return stacked;
  20189. }
  20190. stack.set(value, result);
  20191. if (isSet(value)) {
  20192. value.forEach(function(subValue) {
  20193. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20194. });
  20195. } else if (isMap(value)) {
  20196. value.forEach(function(subValue, key) {
  20197. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20198. });
  20199. }
  20200. var keysFunc = isFull
  20201. ? (isFlat ? getAllKeysIn : getAllKeys)
  20202. : (isFlat ? keysIn : keys);
  20203. var props = isArr ? undefined : keysFunc(value);
  20204. arrayEach(props || value, function(subValue, key) {
  20205. if (props) {
  20206. key = subValue;
  20207. subValue = value[key];
  20208. }
  20209. // Recursively populate clone (susceptible to call stack limits).
  20210. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20211. });
  20212. return result;
  20213. }
  20214. /**
  20215. * The base implementation of `_.conforms` which doesn't clone `source`.
  20216. *
  20217. * @private
  20218. * @param {Object} source The object of property predicates to conform to.
  20219. * @returns {Function} Returns the new spec function.
  20220. */
  20221. function baseConforms(source) {
  20222. var props = keys(source);
  20223. return function(object) {
  20224. return baseConformsTo(object, source, props);
  20225. };
  20226. }
  20227. /**
  20228. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20229. *
  20230. * @private
  20231. * @param {Object} object The object to inspect.
  20232. * @param {Object} source The object of property predicates to conform to.
  20233. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20234. */
  20235. function baseConformsTo(object, source, props) {
  20236. var length = props.length;
  20237. if (object == null) {
  20238. return !length;
  20239. }
  20240. object = Object(object);
  20241. while (length--) {
  20242. var key = props[length],
  20243. predicate = source[key],
  20244. value = object[key];
  20245. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20246. return false;
  20247. }
  20248. }
  20249. return true;
  20250. }
  20251. /**
  20252. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20253. * to provide to `func`.
  20254. *
  20255. * @private
  20256. * @param {Function} func The function to delay.
  20257. * @param {number} wait The number of milliseconds to delay invocation.
  20258. * @param {Array} args The arguments to provide to `func`.
  20259. * @returns {number|Object} Returns the timer id or timeout object.
  20260. */
  20261. function baseDelay(func, wait, args) {
  20262. if (typeof func != 'function') {
  20263. throw new TypeError(FUNC_ERROR_TEXT);
  20264. }
  20265. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20266. }
  20267. /**
  20268. * The base implementation of methods like `_.difference` without support
  20269. * for excluding multiple arrays or iteratee shorthands.
  20270. *
  20271. * @private
  20272. * @param {Array} array The array to inspect.
  20273. * @param {Array} values The values to exclude.
  20274. * @param {Function} [iteratee] The iteratee invoked per element.
  20275. * @param {Function} [comparator] The comparator invoked per element.
  20276. * @returns {Array} Returns the new array of filtered values.
  20277. */
  20278. function baseDifference(array, values, iteratee, comparator) {
  20279. var index = -1,
  20280. includes = arrayIncludes,
  20281. isCommon = true,
  20282. length = array.length,
  20283. result = [],
  20284. valuesLength = values.length;
  20285. if (!length) {
  20286. return result;
  20287. }
  20288. if (iteratee) {
  20289. values = arrayMap(values, baseUnary(iteratee));
  20290. }
  20291. if (comparator) {
  20292. includes = arrayIncludesWith;
  20293. isCommon = false;
  20294. }
  20295. else if (values.length >= LARGE_ARRAY_SIZE) {
  20296. includes = cacheHas;
  20297. isCommon = false;
  20298. values = new SetCache(values);
  20299. }
  20300. outer:
  20301. while (++index < length) {
  20302. var value = array[index],
  20303. computed = iteratee == null ? value : iteratee(value);
  20304. value = (comparator || value !== 0) ? value : 0;
  20305. if (isCommon && computed === computed) {
  20306. var valuesIndex = valuesLength;
  20307. while (valuesIndex--) {
  20308. if (values[valuesIndex] === computed) {
  20309. continue outer;
  20310. }
  20311. }
  20312. result.push(value);
  20313. }
  20314. else if (!includes(values, computed, comparator)) {
  20315. result.push(value);
  20316. }
  20317. }
  20318. return result;
  20319. }
  20320. /**
  20321. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20322. *
  20323. * @private
  20324. * @param {Array|Object} collection The collection to iterate over.
  20325. * @param {Function} iteratee The function invoked per iteration.
  20326. * @returns {Array|Object} Returns `collection`.
  20327. */
  20328. var baseEach = createBaseEach(baseForOwn);
  20329. /**
  20330. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20331. *
  20332. * @private
  20333. * @param {Array|Object} collection The collection to iterate over.
  20334. * @param {Function} iteratee The function invoked per iteration.
  20335. * @returns {Array|Object} Returns `collection`.
  20336. */
  20337. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20338. /**
  20339. * The base implementation of `_.every` without support for iteratee shorthands.
  20340. *
  20341. * @private
  20342. * @param {Array|Object} collection The collection to iterate over.
  20343. * @param {Function} predicate The function invoked per iteration.
  20344. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20345. * else `false`
  20346. */
  20347. function baseEvery(collection, predicate) {
  20348. var result = true;
  20349. baseEach(collection, function(value, index, collection) {
  20350. result = !!predicate(value, index, collection);
  20351. return result;
  20352. });
  20353. return result;
  20354. }
  20355. /**
  20356. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20357. * `comparator` to determine the extremum value.
  20358. *
  20359. * @private
  20360. * @param {Array} array The array to iterate over.
  20361. * @param {Function} iteratee The iteratee invoked per iteration.
  20362. * @param {Function} comparator The comparator used to compare values.
  20363. * @returns {*} Returns the extremum value.
  20364. */
  20365. function baseExtremum(array, iteratee, comparator) {
  20366. var index = -1,
  20367. length = array.length;
  20368. while (++index < length) {
  20369. var value = array[index],
  20370. current = iteratee(value);
  20371. if (current != null && (computed === undefined
  20372. ? (current === current && !isSymbol(current))
  20373. : comparator(current, computed)
  20374. )) {
  20375. var computed = current,
  20376. result = value;
  20377. }
  20378. }
  20379. return result;
  20380. }
  20381. /**
  20382. * The base implementation of `_.fill` without an iteratee call guard.
  20383. *
  20384. * @private
  20385. * @param {Array} array The array to fill.
  20386. * @param {*} value The value to fill `array` with.
  20387. * @param {number} [start=0] The start position.
  20388. * @param {number} [end=array.length] The end position.
  20389. * @returns {Array} Returns `array`.
  20390. */
  20391. function baseFill(array, value, start, end) {
  20392. var length = array.length;
  20393. start = toInteger(start);
  20394. if (start < 0) {
  20395. start = -start > length ? 0 : (length + start);
  20396. }
  20397. end = (end === undefined || end > length) ? length : toInteger(end);
  20398. if (end < 0) {
  20399. end += length;
  20400. }
  20401. end = start > end ? 0 : toLength(end);
  20402. while (start < end) {
  20403. array[start++] = value;
  20404. }
  20405. return array;
  20406. }
  20407. /**
  20408. * The base implementation of `_.filter` without support for iteratee shorthands.
  20409. *
  20410. * @private
  20411. * @param {Array|Object} collection The collection to iterate over.
  20412. * @param {Function} predicate The function invoked per iteration.
  20413. * @returns {Array} Returns the new filtered array.
  20414. */
  20415. function baseFilter(collection, predicate) {
  20416. var result = [];
  20417. baseEach(collection, function(value, index, collection) {
  20418. if (predicate(value, index, collection)) {
  20419. result.push(value);
  20420. }
  20421. });
  20422. return result;
  20423. }
  20424. /**
  20425. * The base implementation of `_.flatten` with support for restricting flattening.
  20426. *
  20427. * @private
  20428. * @param {Array} array The array to flatten.
  20429. * @param {number} depth The maximum recursion depth.
  20430. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20431. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20432. * @param {Array} [result=[]] The initial result value.
  20433. * @returns {Array} Returns the new flattened array.
  20434. */
  20435. function baseFlatten(array, depth, predicate, isStrict, result) {
  20436. var index = -1,
  20437. length = array.length;
  20438. predicate || (predicate = isFlattenable);
  20439. result || (result = []);
  20440. while (++index < length) {
  20441. var value = array[index];
  20442. if (depth > 0 && predicate(value)) {
  20443. if (depth > 1) {
  20444. // Recursively flatten arrays (susceptible to call stack limits).
  20445. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20446. } else {
  20447. arrayPush(result, value);
  20448. }
  20449. } else if (!isStrict) {
  20450. result[result.length] = value;
  20451. }
  20452. }
  20453. return result;
  20454. }
  20455. /**
  20456. * The base implementation of `baseForOwn` which iterates over `object`
  20457. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20458. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20459. *
  20460. * @private
  20461. * @param {Object} object The object to iterate over.
  20462. * @param {Function} iteratee The function invoked per iteration.
  20463. * @param {Function} keysFunc The function to get the keys of `object`.
  20464. * @returns {Object} Returns `object`.
  20465. */
  20466. var baseFor = createBaseFor();
  20467. /**
  20468. * This function is like `baseFor` except that it iterates over properties
  20469. * in the opposite order.
  20470. *
  20471. * @private
  20472. * @param {Object} object The object to iterate over.
  20473. * @param {Function} iteratee The function invoked per iteration.
  20474. * @param {Function} keysFunc The function to get the keys of `object`.
  20475. * @returns {Object} Returns `object`.
  20476. */
  20477. var baseForRight = createBaseFor(true);
  20478. /**
  20479. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20480. *
  20481. * @private
  20482. * @param {Object} object The object to iterate over.
  20483. * @param {Function} iteratee The function invoked per iteration.
  20484. * @returns {Object} Returns `object`.
  20485. */
  20486. function baseForOwn(object, iteratee) {
  20487. return object && baseFor(object, iteratee, keys);
  20488. }
  20489. /**
  20490. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20491. *
  20492. * @private
  20493. * @param {Object} object The object to iterate over.
  20494. * @param {Function} iteratee The function invoked per iteration.
  20495. * @returns {Object} Returns `object`.
  20496. */
  20497. function baseForOwnRight(object, iteratee) {
  20498. return object && baseForRight(object, iteratee, keys);
  20499. }
  20500. /**
  20501. * The base implementation of `_.functions` which creates an array of
  20502. * `object` function property names filtered from `props`.
  20503. *
  20504. * @private
  20505. * @param {Object} object The object to inspect.
  20506. * @param {Array} props The property names to filter.
  20507. * @returns {Array} Returns the function names.
  20508. */
  20509. function baseFunctions(object, props) {
  20510. return arrayFilter(props, function(key) {
  20511. return isFunction(object[key]);
  20512. });
  20513. }
  20514. /**
  20515. * The base implementation of `_.get` without support for default values.
  20516. *
  20517. * @private
  20518. * @param {Object} object The object to query.
  20519. * @param {Array|string} path The path of the property to get.
  20520. * @returns {*} Returns the resolved value.
  20521. */
  20522. function baseGet(object, path) {
  20523. path = castPath(path, object);
  20524. var index = 0,
  20525. length = path.length;
  20526. while (object != null && index < length) {
  20527. object = object[toKey(path[index++])];
  20528. }
  20529. return (index && index == length) ? object : undefined;
  20530. }
  20531. /**
  20532. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20533. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20534. * symbols of `object`.
  20535. *
  20536. * @private
  20537. * @param {Object} object The object to query.
  20538. * @param {Function} keysFunc The function to get the keys of `object`.
  20539. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20540. * @returns {Array} Returns the array of property names and symbols.
  20541. */
  20542. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20543. var result = keysFunc(object);
  20544. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20545. }
  20546. /**
  20547. * The base implementation of `getTag` without fallbacks for buggy environments.
  20548. *
  20549. * @private
  20550. * @param {*} value The value to query.
  20551. * @returns {string} Returns the `toStringTag`.
  20552. */
  20553. function baseGetTag(value) {
  20554. if (value == null) {
  20555. return value === undefined ? undefinedTag : nullTag;
  20556. }
  20557. return (symToStringTag && symToStringTag in Object(value))
  20558. ? getRawTag(value)
  20559. : objectToString(value);
  20560. }
  20561. /**
  20562. * The base implementation of `_.gt` which doesn't coerce arguments.
  20563. *
  20564. * @private
  20565. * @param {*} value The value to compare.
  20566. * @param {*} other The other value to compare.
  20567. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20568. * else `false`.
  20569. */
  20570. function baseGt(value, other) {
  20571. return value > other;
  20572. }
  20573. /**
  20574. * The base implementation of `_.has` without support for deep paths.
  20575. *
  20576. * @private
  20577. * @param {Object} [object] The object to query.
  20578. * @param {Array|string} key The key to check.
  20579. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20580. */
  20581. function baseHas(object, key) {
  20582. return object != null && hasOwnProperty.call(object, key);
  20583. }
  20584. /**
  20585. * The base implementation of `_.hasIn` without support for deep paths.
  20586. *
  20587. * @private
  20588. * @param {Object} [object] The object to query.
  20589. * @param {Array|string} key The key to check.
  20590. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20591. */
  20592. function baseHasIn(object, key) {
  20593. return object != null && key in Object(object);
  20594. }
  20595. /**
  20596. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20597. *
  20598. * @private
  20599. * @param {number} number The number to check.
  20600. * @param {number} start The start of the range.
  20601. * @param {number} end The end of the range.
  20602. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20603. */
  20604. function baseInRange(number, start, end) {
  20605. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20606. }
  20607. /**
  20608. * The base implementation of methods like `_.intersection`, without support
  20609. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20610. *
  20611. * @private
  20612. * @param {Array} arrays The arrays to inspect.
  20613. * @param {Function} [iteratee] The iteratee invoked per element.
  20614. * @param {Function} [comparator] The comparator invoked per element.
  20615. * @returns {Array} Returns the new array of shared values.
  20616. */
  20617. function baseIntersection(arrays, iteratee, comparator) {
  20618. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20619. length = arrays[0].length,
  20620. othLength = arrays.length,
  20621. othIndex = othLength,
  20622. caches = Array(othLength),
  20623. maxLength = Infinity,
  20624. result = [];
  20625. while (othIndex--) {
  20626. var array = arrays[othIndex];
  20627. if (othIndex && iteratee) {
  20628. array = arrayMap(array, baseUnary(iteratee));
  20629. }
  20630. maxLength = nativeMin(array.length, maxLength);
  20631. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20632. ? new SetCache(othIndex && array)
  20633. : undefined;
  20634. }
  20635. array = arrays[0];
  20636. var index = -1,
  20637. seen = caches[0];
  20638. outer:
  20639. while (++index < length && result.length < maxLength) {
  20640. var value = array[index],
  20641. computed = iteratee ? iteratee(value) : value;
  20642. value = (comparator || value !== 0) ? value : 0;
  20643. if (!(seen
  20644. ? cacheHas(seen, computed)
  20645. : includes(result, computed, comparator)
  20646. )) {
  20647. othIndex = othLength;
  20648. while (--othIndex) {
  20649. var cache = caches[othIndex];
  20650. if (!(cache
  20651. ? cacheHas(cache, computed)
  20652. : includes(arrays[othIndex], computed, comparator))
  20653. ) {
  20654. continue outer;
  20655. }
  20656. }
  20657. if (seen) {
  20658. seen.push(computed);
  20659. }
  20660. result.push(value);
  20661. }
  20662. }
  20663. return result;
  20664. }
  20665. /**
  20666. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20667. * `object` with values transformed by `iteratee` and set by `setter`.
  20668. *
  20669. * @private
  20670. * @param {Object} object The object to iterate over.
  20671. * @param {Function} setter The function to set `accumulator` values.
  20672. * @param {Function} iteratee The iteratee to transform values.
  20673. * @param {Object} accumulator The initial inverted object.
  20674. * @returns {Function} Returns `accumulator`.
  20675. */
  20676. function baseInverter(object, setter, iteratee, accumulator) {
  20677. baseForOwn(object, function(value, key, object) {
  20678. setter(accumulator, iteratee(value), key, object);
  20679. });
  20680. return accumulator;
  20681. }
  20682. /**
  20683. * The base implementation of `_.invoke` without support for individual
  20684. * method arguments.
  20685. *
  20686. * @private
  20687. * @param {Object} object The object to query.
  20688. * @param {Array|string} path The path of the method to invoke.
  20689. * @param {Array} args The arguments to invoke the method with.
  20690. * @returns {*} Returns the result of the invoked method.
  20691. */
  20692. function baseInvoke(object, path, args) {
  20693. path = castPath(path, object);
  20694. object = parent(object, path);
  20695. var func = object == null ? object : object[toKey(last(path))];
  20696. return func == null ? undefined : apply(func, object, args);
  20697. }
  20698. /**
  20699. * The base implementation of `_.isArguments`.
  20700. *
  20701. * @private
  20702. * @param {*} value The value to check.
  20703. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20704. */
  20705. function baseIsArguments(value) {
  20706. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20707. }
  20708. /**
  20709. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20710. *
  20711. * @private
  20712. * @param {*} value The value to check.
  20713. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20714. */
  20715. function baseIsArrayBuffer(value) {
  20716. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20717. }
  20718. /**
  20719. * The base implementation of `_.isDate` without Node.js optimizations.
  20720. *
  20721. * @private
  20722. * @param {*} value The value to check.
  20723. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20724. */
  20725. function baseIsDate(value) {
  20726. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20727. }
  20728. /**
  20729. * The base implementation of `_.isEqual` which supports partial comparisons
  20730. * and tracks traversed objects.
  20731. *
  20732. * @private
  20733. * @param {*} value The value to compare.
  20734. * @param {*} other The other value to compare.
  20735. * @param {boolean} bitmask The bitmask flags.
  20736. * 1 - Unordered comparison
  20737. * 2 - Partial comparison
  20738. * @param {Function} [customizer] The function to customize comparisons.
  20739. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20740. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20741. */
  20742. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20743. if (value === other) {
  20744. return true;
  20745. }
  20746. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20747. return value !== value && other !== other;
  20748. }
  20749. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20750. }
  20751. /**
  20752. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20753. * deep comparisons and tracks traversed objects enabling objects with circular
  20754. * references to be compared.
  20755. *
  20756. * @private
  20757. * @param {Object} object The object to compare.
  20758. * @param {Object} other The other object to compare.
  20759. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20760. * @param {Function} customizer The function to customize comparisons.
  20761. * @param {Function} equalFunc The function to determine equivalents of values.
  20762. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20763. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20764. */
  20765. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20766. var objIsArr = isArray(object),
  20767. othIsArr = isArray(other),
  20768. objTag = objIsArr ? arrayTag : getTag(object),
  20769. othTag = othIsArr ? arrayTag : getTag(other);
  20770. objTag = objTag == argsTag ? objectTag : objTag;
  20771. othTag = othTag == argsTag ? objectTag : othTag;
  20772. var objIsObj = objTag == objectTag,
  20773. othIsObj = othTag == objectTag,
  20774. isSameTag = objTag == othTag;
  20775. if (isSameTag && isBuffer(object)) {
  20776. if (!isBuffer(other)) {
  20777. return false;
  20778. }
  20779. objIsArr = true;
  20780. objIsObj = false;
  20781. }
  20782. if (isSameTag && !objIsObj) {
  20783. stack || (stack = new Stack);
  20784. return (objIsArr || isTypedArray(object))
  20785. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20786. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20787. }
  20788. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20789. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20790. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20791. if (objIsWrapped || othIsWrapped) {
  20792. var objUnwrapped = objIsWrapped ? object.value() : object,
  20793. othUnwrapped = othIsWrapped ? other.value() : other;
  20794. stack || (stack = new Stack);
  20795. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20796. }
  20797. }
  20798. if (!isSameTag) {
  20799. return false;
  20800. }
  20801. stack || (stack = new Stack);
  20802. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  20803. }
  20804. /**
  20805. * The base implementation of `_.isMap` without Node.js optimizations.
  20806. *
  20807. * @private
  20808. * @param {*} value The value to check.
  20809. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  20810. */
  20811. function baseIsMap(value) {
  20812. return isObjectLike(value) && getTag(value) == mapTag;
  20813. }
  20814. /**
  20815. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  20816. *
  20817. * @private
  20818. * @param {Object} object The object to inspect.
  20819. * @param {Object} source The object of property values to match.
  20820. * @param {Array} matchData The property names, values, and compare flags to match.
  20821. * @param {Function} [customizer] The function to customize comparisons.
  20822. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20823. */
  20824. function baseIsMatch(object, source, matchData, customizer) {
  20825. var index = matchData.length,
  20826. length = index,
  20827. noCustomizer = !customizer;
  20828. if (object == null) {
  20829. return !length;
  20830. }
  20831. object = Object(object);
  20832. while (index--) {
  20833. var data = matchData[index];
  20834. if ((noCustomizer && data[2])
  20835. ? data[1] !== object[data[0]]
  20836. : !(data[0] in object)
  20837. ) {
  20838. return false;
  20839. }
  20840. }
  20841. while (++index < length) {
  20842. data = matchData[index];
  20843. var key = data[0],
  20844. objValue = object[key],
  20845. srcValue = data[1];
  20846. if (noCustomizer && data[2]) {
  20847. if (objValue === undefined && !(key in object)) {
  20848. return false;
  20849. }
  20850. } else {
  20851. var stack = new Stack;
  20852. if (customizer) {
  20853. var result = customizer(objValue, srcValue, key, object, source, stack);
  20854. }
  20855. if (!(result === undefined
  20856. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  20857. : result
  20858. )) {
  20859. return false;
  20860. }
  20861. }
  20862. }
  20863. return true;
  20864. }
  20865. /**
  20866. * The base implementation of `_.isNative` without bad shim checks.
  20867. *
  20868. * @private
  20869. * @param {*} value The value to check.
  20870. * @returns {boolean} Returns `true` if `value` is a native function,
  20871. * else `false`.
  20872. */
  20873. function baseIsNative(value) {
  20874. if (!isObject(value) || isMasked(value)) {
  20875. return false;
  20876. }
  20877. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  20878. return pattern.test(toSource(value));
  20879. }
  20880. /**
  20881. * The base implementation of `_.isRegExp` without Node.js optimizations.
  20882. *
  20883. * @private
  20884. * @param {*} value The value to check.
  20885. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  20886. */
  20887. function baseIsRegExp(value) {
  20888. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  20889. }
  20890. /**
  20891. * The base implementation of `_.isSet` without Node.js optimizations.
  20892. *
  20893. * @private
  20894. * @param {*} value The value to check.
  20895. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  20896. */
  20897. function baseIsSet(value) {
  20898. return isObjectLike(value) && getTag(value) == setTag;
  20899. }
  20900. /**
  20901. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  20902. *
  20903. * @private
  20904. * @param {*} value The value to check.
  20905. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  20906. */
  20907. function baseIsTypedArray(value) {
  20908. return isObjectLike(value) &&
  20909. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  20910. }
  20911. /**
  20912. * The base implementation of `_.iteratee`.
  20913. *
  20914. * @private
  20915. * @param {*} [value=_.identity] The value to convert to an iteratee.
  20916. * @returns {Function} Returns the iteratee.
  20917. */
  20918. function baseIteratee(value) {
  20919. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  20920. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  20921. if (typeof value == 'function') {
  20922. return value;
  20923. }
  20924. if (value == null) {
  20925. return identity;
  20926. }
  20927. if (typeof value == 'object') {
  20928. return isArray(value)
  20929. ? baseMatchesProperty(value[0], value[1])
  20930. : baseMatches(value);
  20931. }
  20932. return property(value);
  20933. }
  20934. /**
  20935. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  20936. *
  20937. * @private
  20938. * @param {Object} object The object to query.
  20939. * @returns {Array} Returns the array of property names.
  20940. */
  20941. function baseKeys(object) {
  20942. if (!isPrototype(object)) {
  20943. return nativeKeys(object);
  20944. }
  20945. var result = [];
  20946. for (var key in Object(object)) {
  20947. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  20948. result.push(key);
  20949. }
  20950. }
  20951. return result;
  20952. }
  20953. /**
  20954. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  20955. *
  20956. * @private
  20957. * @param {Object} object The object to query.
  20958. * @returns {Array} Returns the array of property names.
  20959. */
  20960. function baseKeysIn(object) {
  20961. if (!isObject(object)) {
  20962. return nativeKeysIn(object);
  20963. }
  20964. var isProto = isPrototype(object),
  20965. result = [];
  20966. for (var key in object) {
  20967. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  20968. result.push(key);
  20969. }
  20970. }
  20971. return result;
  20972. }
  20973. /**
  20974. * The base implementation of `_.lt` which doesn't coerce arguments.
  20975. *
  20976. * @private
  20977. * @param {*} value The value to compare.
  20978. * @param {*} other The other value to compare.
  20979. * @returns {boolean} Returns `true` if `value` is less than `other`,
  20980. * else `false`.
  20981. */
  20982. function baseLt(value, other) {
  20983. return value < other;
  20984. }
  20985. /**
  20986. * The base implementation of `_.map` without support for iteratee shorthands.
  20987. *
  20988. * @private
  20989. * @param {Array|Object} collection The collection to iterate over.
  20990. * @param {Function} iteratee The function invoked per iteration.
  20991. * @returns {Array} Returns the new mapped array.
  20992. */
  20993. function baseMap(collection, iteratee) {
  20994. var index = -1,
  20995. result = isArrayLike(collection) ? Array(collection.length) : [];
  20996. baseEach(collection, function(value, key, collection) {
  20997. result[++index] = iteratee(value, key, collection);
  20998. });
  20999. return result;
  21000. }
  21001. /**
  21002. * The base implementation of `_.matches` which doesn't clone `source`.
  21003. *
  21004. * @private
  21005. * @param {Object} source The object of property values to match.
  21006. * @returns {Function} Returns the new spec function.
  21007. */
  21008. function baseMatches(source) {
  21009. var matchData = getMatchData(source);
  21010. if (matchData.length == 1 && matchData[0][2]) {
  21011. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21012. }
  21013. return function(object) {
  21014. return object === source || baseIsMatch(object, source, matchData);
  21015. };
  21016. }
  21017. /**
  21018. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21019. *
  21020. * @private
  21021. * @param {string} path The path of the property to get.
  21022. * @param {*} srcValue The value to match.
  21023. * @returns {Function} Returns the new spec function.
  21024. */
  21025. function baseMatchesProperty(path, srcValue) {
  21026. if (isKey(path) && isStrictComparable(srcValue)) {
  21027. return matchesStrictComparable(toKey(path), srcValue);
  21028. }
  21029. return function(object) {
  21030. var objValue = get(object, path);
  21031. return (objValue === undefined && objValue === srcValue)
  21032. ? hasIn(object, path)
  21033. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21034. };
  21035. }
  21036. /**
  21037. * The base implementation of `_.merge` without support for multiple sources.
  21038. *
  21039. * @private
  21040. * @param {Object} object The destination object.
  21041. * @param {Object} source The source object.
  21042. * @param {number} srcIndex The index of `source`.
  21043. * @param {Function} [customizer] The function to customize merged values.
  21044. * @param {Object} [stack] Tracks traversed source values and their merged
  21045. * counterparts.
  21046. */
  21047. function baseMerge(object, source, srcIndex, customizer, stack) {
  21048. if (object === source) {
  21049. return;
  21050. }
  21051. baseFor(source, function(srcValue, key) {
  21052. stack || (stack = new Stack);
  21053. if (isObject(srcValue)) {
  21054. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21055. }
  21056. else {
  21057. var newValue = customizer
  21058. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21059. : undefined;
  21060. if (newValue === undefined) {
  21061. newValue = srcValue;
  21062. }
  21063. assignMergeValue(object, key, newValue);
  21064. }
  21065. }, keysIn);
  21066. }
  21067. /**
  21068. * A specialized version of `baseMerge` for arrays and objects which performs
  21069. * deep merges and tracks traversed objects enabling objects with circular
  21070. * references to be merged.
  21071. *
  21072. * @private
  21073. * @param {Object} object The destination object.
  21074. * @param {Object} source The source object.
  21075. * @param {string} key The key of the value to merge.
  21076. * @param {number} srcIndex The index of `source`.
  21077. * @param {Function} mergeFunc The function to merge values.
  21078. * @param {Function} [customizer] The function to customize assigned values.
  21079. * @param {Object} [stack] Tracks traversed source values and their merged
  21080. * counterparts.
  21081. */
  21082. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21083. var objValue = safeGet(object, key),
  21084. srcValue = safeGet(source, key),
  21085. stacked = stack.get(srcValue);
  21086. if (stacked) {
  21087. assignMergeValue(object, key, stacked);
  21088. return;
  21089. }
  21090. var newValue = customizer
  21091. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21092. : undefined;
  21093. var isCommon = newValue === undefined;
  21094. if (isCommon) {
  21095. var isArr = isArray(srcValue),
  21096. isBuff = !isArr && isBuffer(srcValue),
  21097. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21098. newValue = srcValue;
  21099. if (isArr || isBuff || isTyped) {
  21100. if (isArray(objValue)) {
  21101. newValue = objValue;
  21102. }
  21103. else if (isArrayLikeObject(objValue)) {
  21104. newValue = copyArray(objValue);
  21105. }
  21106. else if (isBuff) {
  21107. isCommon = false;
  21108. newValue = cloneBuffer(srcValue, true);
  21109. }
  21110. else if (isTyped) {
  21111. isCommon = false;
  21112. newValue = cloneTypedArray(srcValue, true);
  21113. }
  21114. else {
  21115. newValue = [];
  21116. }
  21117. }
  21118. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21119. newValue = objValue;
  21120. if (isArguments(objValue)) {
  21121. newValue = toPlainObject(objValue);
  21122. }
  21123. else if (!isObject(objValue) || isFunction(objValue)) {
  21124. newValue = initCloneObject(srcValue);
  21125. }
  21126. }
  21127. else {
  21128. isCommon = false;
  21129. }
  21130. }
  21131. if (isCommon) {
  21132. // Recursively merge objects and arrays (susceptible to call stack limits).
  21133. stack.set(srcValue, newValue);
  21134. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21135. stack['delete'](srcValue);
  21136. }
  21137. assignMergeValue(object, key, newValue);
  21138. }
  21139. /**
  21140. * The base implementation of `_.nth` which doesn't coerce arguments.
  21141. *
  21142. * @private
  21143. * @param {Array} array The array to query.
  21144. * @param {number} n The index of the element to return.
  21145. * @returns {*} Returns the nth element of `array`.
  21146. */
  21147. function baseNth(array, n) {
  21148. var length = array.length;
  21149. if (!length) {
  21150. return;
  21151. }
  21152. n += n < 0 ? length : 0;
  21153. return isIndex(n, length) ? array[n] : undefined;
  21154. }
  21155. /**
  21156. * The base implementation of `_.orderBy` without param guards.
  21157. *
  21158. * @private
  21159. * @param {Array|Object} collection The collection to iterate over.
  21160. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21161. * @param {string[]} orders The sort orders of `iteratees`.
  21162. * @returns {Array} Returns the new sorted array.
  21163. */
  21164. function baseOrderBy(collection, iteratees, orders) {
  21165. var index = -1;
  21166. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21167. var result = baseMap(collection, function(value, key, collection) {
  21168. var criteria = arrayMap(iteratees, function(iteratee) {
  21169. return iteratee(value);
  21170. });
  21171. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21172. });
  21173. return baseSortBy(result, function(object, other) {
  21174. return compareMultiple(object, other, orders);
  21175. });
  21176. }
  21177. /**
  21178. * The base implementation of `_.pick` without support for individual
  21179. * property identifiers.
  21180. *
  21181. * @private
  21182. * @param {Object} object The source object.
  21183. * @param {string[]} paths The property paths to pick.
  21184. * @returns {Object} Returns the new object.
  21185. */
  21186. function basePick(object, paths) {
  21187. return basePickBy(object, paths, function(value, path) {
  21188. return hasIn(object, path);
  21189. });
  21190. }
  21191. /**
  21192. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21193. *
  21194. * @private
  21195. * @param {Object} object The source object.
  21196. * @param {string[]} paths The property paths to pick.
  21197. * @param {Function} predicate The function invoked per property.
  21198. * @returns {Object} Returns the new object.
  21199. */
  21200. function basePickBy(object, paths, predicate) {
  21201. var index = -1,
  21202. length = paths.length,
  21203. result = {};
  21204. while (++index < length) {
  21205. var path = paths[index],
  21206. value = baseGet(object, path);
  21207. if (predicate(value, path)) {
  21208. baseSet(result, castPath(path, object), value);
  21209. }
  21210. }
  21211. return result;
  21212. }
  21213. /**
  21214. * A specialized version of `baseProperty` which supports deep paths.
  21215. *
  21216. * @private
  21217. * @param {Array|string} path The path of the property to get.
  21218. * @returns {Function} Returns the new accessor function.
  21219. */
  21220. function basePropertyDeep(path) {
  21221. return function(object) {
  21222. return baseGet(object, path);
  21223. };
  21224. }
  21225. /**
  21226. * The base implementation of `_.pullAllBy` without support for iteratee
  21227. * shorthands.
  21228. *
  21229. * @private
  21230. * @param {Array} array The array to modify.
  21231. * @param {Array} values The values to remove.
  21232. * @param {Function} [iteratee] The iteratee invoked per element.
  21233. * @param {Function} [comparator] The comparator invoked per element.
  21234. * @returns {Array} Returns `array`.
  21235. */
  21236. function basePullAll(array, values, iteratee, comparator) {
  21237. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21238. index = -1,
  21239. length = values.length,
  21240. seen = array;
  21241. if (array === values) {
  21242. values = copyArray(values);
  21243. }
  21244. if (iteratee) {
  21245. seen = arrayMap(array, baseUnary(iteratee));
  21246. }
  21247. while (++index < length) {
  21248. var fromIndex = 0,
  21249. value = values[index],
  21250. computed = iteratee ? iteratee(value) : value;
  21251. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21252. if (seen !== array) {
  21253. splice.call(seen, fromIndex, 1);
  21254. }
  21255. splice.call(array, fromIndex, 1);
  21256. }
  21257. }
  21258. return array;
  21259. }
  21260. /**
  21261. * The base implementation of `_.pullAt` without support for individual
  21262. * indexes or capturing the removed elements.
  21263. *
  21264. * @private
  21265. * @param {Array} array The array to modify.
  21266. * @param {number[]} indexes The indexes of elements to remove.
  21267. * @returns {Array} Returns `array`.
  21268. */
  21269. function basePullAt(array, indexes) {
  21270. var length = array ? indexes.length : 0,
  21271. lastIndex = length - 1;
  21272. while (length--) {
  21273. var index = indexes[length];
  21274. if (length == lastIndex || index !== previous) {
  21275. var previous = index;
  21276. if (isIndex(index)) {
  21277. splice.call(array, index, 1);
  21278. } else {
  21279. baseUnset(array, index);
  21280. }
  21281. }
  21282. }
  21283. return array;
  21284. }
  21285. /**
  21286. * The base implementation of `_.random` without support for returning
  21287. * floating-point numbers.
  21288. *
  21289. * @private
  21290. * @param {number} lower The lower bound.
  21291. * @param {number} upper The upper bound.
  21292. * @returns {number} Returns the random number.
  21293. */
  21294. function baseRandom(lower, upper) {
  21295. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21296. }
  21297. /**
  21298. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21299. * coerce arguments.
  21300. *
  21301. * @private
  21302. * @param {number} start The start of the range.
  21303. * @param {number} end The end of the range.
  21304. * @param {number} step The value to increment or decrement by.
  21305. * @param {boolean} [fromRight] Specify iterating from right to left.
  21306. * @returns {Array} Returns the range of numbers.
  21307. */
  21308. function baseRange(start, end, step, fromRight) {
  21309. var index = -1,
  21310. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21311. result = Array(length);
  21312. while (length--) {
  21313. result[fromRight ? length : ++index] = start;
  21314. start += step;
  21315. }
  21316. return result;
  21317. }
  21318. /**
  21319. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21320. *
  21321. * @private
  21322. * @param {string} string The string to repeat.
  21323. * @param {number} n The number of times to repeat the string.
  21324. * @returns {string} Returns the repeated string.
  21325. */
  21326. function baseRepeat(string, n) {
  21327. var result = '';
  21328. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21329. return result;
  21330. }
  21331. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21332. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21333. do {
  21334. if (n % 2) {
  21335. result += string;
  21336. }
  21337. n = nativeFloor(n / 2);
  21338. if (n) {
  21339. string += string;
  21340. }
  21341. } while (n);
  21342. return result;
  21343. }
  21344. /**
  21345. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21346. *
  21347. * @private
  21348. * @param {Function} func The function to apply a rest parameter to.
  21349. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21350. * @returns {Function} Returns the new function.
  21351. */
  21352. function baseRest(func, start) {
  21353. return setToString(overRest(func, start, identity), func + '');
  21354. }
  21355. /**
  21356. * The base implementation of `_.sample`.
  21357. *
  21358. * @private
  21359. * @param {Array|Object} collection The collection to sample.
  21360. * @returns {*} Returns the random element.
  21361. */
  21362. function baseSample(collection) {
  21363. return arraySample(values(collection));
  21364. }
  21365. /**
  21366. * The base implementation of `_.sampleSize` without param guards.
  21367. *
  21368. * @private
  21369. * @param {Array|Object} collection The collection to sample.
  21370. * @param {number} n The number of elements to sample.
  21371. * @returns {Array} Returns the random elements.
  21372. */
  21373. function baseSampleSize(collection, n) {
  21374. var array = values(collection);
  21375. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21376. }
  21377. /**
  21378. * The base implementation of `_.set`.
  21379. *
  21380. * @private
  21381. * @param {Object} object The object to modify.
  21382. * @param {Array|string} path The path of the property to set.
  21383. * @param {*} value The value to set.
  21384. * @param {Function} [customizer] The function to customize path creation.
  21385. * @returns {Object} Returns `object`.
  21386. */
  21387. function baseSet(object, path, value, customizer) {
  21388. if (!isObject(object)) {
  21389. return object;
  21390. }
  21391. path = castPath(path, object);
  21392. var index = -1,
  21393. length = path.length,
  21394. lastIndex = length - 1,
  21395. nested = object;
  21396. while (nested != null && ++index < length) {
  21397. var key = toKey(path[index]),
  21398. newValue = value;
  21399. if (index != lastIndex) {
  21400. var objValue = nested[key];
  21401. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21402. if (newValue === undefined) {
  21403. newValue = isObject(objValue)
  21404. ? objValue
  21405. : (isIndex(path[index + 1]) ? [] : {});
  21406. }
  21407. }
  21408. assignValue(nested, key, newValue);
  21409. nested = nested[key];
  21410. }
  21411. return object;
  21412. }
  21413. /**
  21414. * The base implementation of `setData` without support for hot loop shorting.
  21415. *
  21416. * @private
  21417. * @param {Function} func The function to associate metadata with.
  21418. * @param {*} data The metadata.
  21419. * @returns {Function} Returns `func`.
  21420. */
  21421. var baseSetData = !metaMap ? identity : function(func, data) {
  21422. metaMap.set(func, data);
  21423. return func;
  21424. };
  21425. /**
  21426. * The base implementation of `setToString` without support for hot loop shorting.
  21427. *
  21428. * @private
  21429. * @param {Function} func The function to modify.
  21430. * @param {Function} string The `toString` result.
  21431. * @returns {Function} Returns `func`.
  21432. */
  21433. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21434. return defineProperty(func, 'toString', {
  21435. 'configurable': true,
  21436. 'enumerable': false,
  21437. 'value': constant(string),
  21438. 'writable': true
  21439. });
  21440. };
  21441. /**
  21442. * The base implementation of `_.shuffle`.
  21443. *
  21444. * @private
  21445. * @param {Array|Object} collection The collection to shuffle.
  21446. * @returns {Array} Returns the new shuffled array.
  21447. */
  21448. function baseShuffle(collection) {
  21449. return shuffleSelf(values(collection));
  21450. }
  21451. /**
  21452. * The base implementation of `_.slice` without an iteratee call guard.
  21453. *
  21454. * @private
  21455. * @param {Array} array The array to slice.
  21456. * @param {number} [start=0] The start position.
  21457. * @param {number} [end=array.length] The end position.
  21458. * @returns {Array} Returns the slice of `array`.
  21459. */
  21460. function baseSlice(array, start, end) {
  21461. var index = -1,
  21462. length = array.length;
  21463. if (start < 0) {
  21464. start = -start > length ? 0 : (length + start);
  21465. }
  21466. end = end > length ? length : end;
  21467. if (end < 0) {
  21468. end += length;
  21469. }
  21470. length = start > end ? 0 : ((end - start) >>> 0);
  21471. start >>>= 0;
  21472. var result = Array(length);
  21473. while (++index < length) {
  21474. result[index] = array[index + start];
  21475. }
  21476. return result;
  21477. }
  21478. /**
  21479. * The base implementation of `_.some` without support for iteratee shorthands.
  21480. *
  21481. * @private
  21482. * @param {Array|Object} collection The collection to iterate over.
  21483. * @param {Function} predicate The function invoked per iteration.
  21484. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21485. * else `false`.
  21486. */
  21487. function baseSome(collection, predicate) {
  21488. var result;
  21489. baseEach(collection, function(value, index, collection) {
  21490. result = predicate(value, index, collection);
  21491. return !result;
  21492. });
  21493. return !!result;
  21494. }
  21495. /**
  21496. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21497. * performs a binary search of `array` to determine the index at which `value`
  21498. * should be inserted into `array` in order to maintain its sort order.
  21499. *
  21500. * @private
  21501. * @param {Array} array The sorted array to inspect.
  21502. * @param {*} value The value to evaluate.
  21503. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21504. * @returns {number} Returns the index at which `value` should be inserted
  21505. * into `array`.
  21506. */
  21507. function baseSortedIndex(array, value, retHighest) {
  21508. var low = 0,
  21509. high = array == null ? low : array.length;
  21510. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21511. while (low < high) {
  21512. var mid = (low + high) >>> 1,
  21513. computed = array[mid];
  21514. if (computed !== null && !isSymbol(computed) &&
  21515. (retHighest ? (computed <= value) : (computed < value))) {
  21516. low = mid + 1;
  21517. } else {
  21518. high = mid;
  21519. }
  21520. }
  21521. return high;
  21522. }
  21523. return baseSortedIndexBy(array, value, identity, retHighest);
  21524. }
  21525. /**
  21526. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21527. * which invokes `iteratee` for `value` and each element of `array` to compute
  21528. * their sort ranking. The iteratee is invoked with one argument; (value).
  21529. *
  21530. * @private
  21531. * @param {Array} array The sorted array to inspect.
  21532. * @param {*} value The value to evaluate.
  21533. * @param {Function} iteratee The iteratee invoked per element.
  21534. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21535. * @returns {number} Returns the index at which `value` should be inserted
  21536. * into `array`.
  21537. */
  21538. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21539. value = iteratee(value);
  21540. var low = 0,
  21541. high = array == null ? 0 : array.length,
  21542. valIsNaN = value !== value,
  21543. valIsNull = value === null,
  21544. valIsSymbol = isSymbol(value),
  21545. valIsUndefined = value === undefined;
  21546. while (low < high) {
  21547. var mid = nativeFloor((low + high) / 2),
  21548. computed = iteratee(array[mid]),
  21549. othIsDefined = computed !== undefined,
  21550. othIsNull = computed === null,
  21551. othIsReflexive = computed === computed,
  21552. othIsSymbol = isSymbol(computed);
  21553. if (valIsNaN) {
  21554. var setLow = retHighest || othIsReflexive;
  21555. } else if (valIsUndefined) {
  21556. setLow = othIsReflexive && (retHighest || othIsDefined);
  21557. } else if (valIsNull) {
  21558. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21559. } else if (valIsSymbol) {
  21560. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21561. } else if (othIsNull || othIsSymbol) {
  21562. setLow = false;
  21563. } else {
  21564. setLow = retHighest ? (computed <= value) : (computed < value);
  21565. }
  21566. if (setLow) {
  21567. low = mid + 1;
  21568. } else {
  21569. high = mid;
  21570. }
  21571. }
  21572. return nativeMin(high, MAX_ARRAY_INDEX);
  21573. }
  21574. /**
  21575. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21576. * support for iteratee shorthands.
  21577. *
  21578. * @private
  21579. * @param {Array} array The array to inspect.
  21580. * @param {Function} [iteratee] The iteratee invoked per element.
  21581. * @returns {Array} Returns the new duplicate free array.
  21582. */
  21583. function baseSortedUniq(array, iteratee) {
  21584. var index = -1,
  21585. length = array.length,
  21586. resIndex = 0,
  21587. result = [];
  21588. while (++index < length) {
  21589. var value = array[index],
  21590. computed = iteratee ? iteratee(value) : value;
  21591. if (!index || !eq(computed, seen)) {
  21592. var seen = computed;
  21593. result[resIndex++] = value === 0 ? 0 : value;
  21594. }
  21595. }
  21596. return result;
  21597. }
  21598. /**
  21599. * The base implementation of `_.toNumber` which doesn't ensure correct
  21600. * conversions of binary, hexadecimal, or octal string values.
  21601. *
  21602. * @private
  21603. * @param {*} value The value to process.
  21604. * @returns {number} Returns the number.
  21605. */
  21606. function baseToNumber(value) {
  21607. if (typeof value == 'number') {
  21608. return value;
  21609. }
  21610. if (isSymbol(value)) {
  21611. return NAN;
  21612. }
  21613. return +value;
  21614. }
  21615. /**
  21616. * The base implementation of `_.toString` which doesn't convert nullish
  21617. * values to empty strings.
  21618. *
  21619. * @private
  21620. * @param {*} value The value to process.
  21621. * @returns {string} Returns the string.
  21622. */
  21623. function baseToString(value) {
  21624. // Exit early for strings to avoid a performance hit in some environments.
  21625. if (typeof value == 'string') {
  21626. return value;
  21627. }
  21628. if (isArray(value)) {
  21629. // Recursively convert values (susceptible to call stack limits).
  21630. return arrayMap(value, baseToString) + '';
  21631. }
  21632. if (isSymbol(value)) {
  21633. return symbolToString ? symbolToString.call(value) : '';
  21634. }
  21635. var result = (value + '');
  21636. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21637. }
  21638. /**
  21639. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21640. *
  21641. * @private
  21642. * @param {Array} array The array to inspect.
  21643. * @param {Function} [iteratee] The iteratee invoked per element.
  21644. * @param {Function} [comparator] The comparator invoked per element.
  21645. * @returns {Array} Returns the new duplicate free array.
  21646. */
  21647. function baseUniq(array, iteratee, comparator) {
  21648. var index = -1,
  21649. includes = arrayIncludes,
  21650. length = array.length,
  21651. isCommon = true,
  21652. result = [],
  21653. seen = result;
  21654. if (comparator) {
  21655. isCommon = false;
  21656. includes = arrayIncludesWith;
  21657. }
  21658. else if (length >= LARGE_ARRAY_SIZE) {
  21659. var set = iteratee ? null : createSet(array);
  21660. if (set) {
  21661. return setToArray(set);
  21662. }
  21663. isCommon = false;
  21664. includes = cacheHas;
  21665. seen = new SetCache;
  21666. }
  21667. else {
  21668. seen = iteratee ? [] : result;
  21669. }
  21670. outer:
  21671. while (++index < length) {
  21672. var value = array[index],
  21673. computed = iteratee ? iteratee(value) : value;
  21674. value = (comparator || value !== 0) ? value : 0;
  21675. if (isCommon && computed === computed) {
  21676. var seenIndex = seen.length;
  21677. while (seenIndex--) {
  21678. if (seen[seenIndex] === computed) {
  21679. continue outer;
  21680. }
  21681. }
  21682. if (iteratee) {
  21683. seen.push(computed);
  21684. }
  21685. result.push(value);
  21686. }
  21687. else if (!includes(seen, computed, comparator)) {
  21688. if (seen !== result) {
  21689. seen.push(computed);
  21690. }
  21691. result.push(value);
  21692. }
  21693. }
  21694. return result;
  21695. }
  21696. /**
  21697. * The base implementation of `_.unset`.
  21698. *
  21699. * @private
  21700. * @param {Object} object The object to modify.
  21701. * @param {Array|string} path The property path to unset.
  21702. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21703. */
  21704. function baseUnset(object, path) {
  21705. path = castPath(path, object);
  21706. object = parent(object, path);
  21707. return object == null || delete object[toKey(last(path))];
  21708. }
  21709. /**
  21710. * The base implementation of `_.update`.
  21711. *
  21712. * @private
  21713. * @param {Object} object The object to modify.
  21714. * @param {Array|string} path The path of the property to update.
  21715. * @param {Function} updater The function to produce the updated value.
  21716. * @param {Function} [customizer] The function to customize path creation.
  21717. * @returns {Object} Returns `object`.
  21718. */
  21719. function baseUpdate(object, path, updater, customizer) {
  21720. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21721. }
  21722. /**
  21723. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21724. * without support for iteratee shorthands.
  21725. *
  21726. * @private
  21727. * @param {Array} array The array to query.
  21728. * @param {Function} predicate The function invoked per iteration.
  21729. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21730. * @param {boolean} [fromRight] Specify iterating from right to left.
  21731. * @returns {Array} Returns the slice of `array`.
  21732. */
  21733. function baseWhile(array, predicate, isDrop, fromRight) {
  21734. var length = array.length,
  21735. index = fromRight ? length : -1;
  21736. while ((fromRight ? index-- : ++index < length) &&
  21737. predicate(array[index], index, array)) {}
  21738. return isDrop
  21739. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21740. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21741. }
  21742. /**
  21743. * The base implementation of `wrapperValue` which returns the result of
  21744. * performing a sequence of actions on the unwrapped `value`, where each
  21745. * successive action is supplied the return value of the previous.
  21746. *
  21747. * @private
  21748. * @param {*} value The unwrapped value.
  21749. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21750. * @returns {*} Returns the resolved value.
  21751. */
  21752. function baseWrapperValue(value, actions) {
  21753. var result = value;
  21754. if (result instanceof LazyWrapper) {
  21755. result = result.value();
  21756. }
  21757. return arrayReduce(actions, function(result, action) {
  21758. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21759. }, result);
  21760. }
  21761. /**
  21762. * The base implementation of methods like `_.xor`, without support for
  21763. * iteratee shorthands, that accepts an array of arrays to inspect.
  21764. *
  21765. * @private
  21766. * @param {Array} arrays The arrays to inspect.
  21767. * @param {Function} [iteratee] The iteratee invoked per element.
  21768. * @param {Function} [comparator] The comparator invoked per element.
  21769. * @returns {Array} Returns the new array of values.
  21770. */
  21771. function baseXor(arrays, iteratee, comparator) {
  21772. var length = arrays.length;
  21773. if (length < 2) {
  21774. return length ? baseUniq(arrays[0]) : [];
  21775. }
  21776. var index = -1,
  21777. result = Array(length);
  21778. while (++index < length) {
  21779. var array = arrays[index],
  21780. othIndex = -1;
  21781. while (++othIndex < length) {
  21782. if (othIndex != index) {
  21783. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21784. }
  21785. }
  21786. }
  21787. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21788. }
  21789. /**
  21790. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21791. *
  21792. * @private
  21793. * @param {Array} props The property identifiers.
  21794. * @param {Array} values The property values.
  21795. * @param {Function} assignFunc The function to assign values.
  21796. * @returns {Object} Returns the new object.
  21797. */
  21798. function baseZipObject(props, values, assignFunc) {
  21799. var index = -1,
  21800. length = props.length,
  21801. valsLength = values.length,
  21802. result = {};
  21803. while (++index < length) {
  21804. var value = index < valsLength ? values[index] : undefined;
  21805. assignFunc(result, props[index], value);
  21806. }
  21807. return result;
  21808. }
  21809. /**
  21810. * Casts `value` to an empty array if it's not an array like object.
  21811. *
  21812. * @private
  21813. * @param {*} value The value to inspect.
  21814. * @returns {Array|Object} Returns the cast array-like object.
  21815. */
  21816. function castArrayLikeObject(value) {
  21817. return isArrayLikeObject(value) ? value : [];
  21818. }
  21819. /**
  21820. * Casts `value` to `identity` if it's not a function.
  21821. *
  21822. * @private
  21823. * @param {*} value The value to inspect.
  21824. * @returns {Function} Returns cast function.
  21825. */
  21826. function castFunction(value) {
  21827. return typeof value == 'function' ? value : identity;
  21828. }
  21829. /**
  21830. * Casts `value` to a path array if it's not one.
  21831. *
  21832. * @private
  21833. * @param {*} value The value to inspect.
  21834. * @param {Object} [object] The object to query keys on.
  21835. * @returns {Array} Returns the cast property path array.
  21836. */
  21837. function castPath(value, object) {
  21838. if (isArray(value)) {
  21839. return value;
  21840. }
  21841. return isKey(value, object) ? [value] : stringToPath(toString(value));
  21842. }
  21843. /**
  21844. * A `baseRest` alias which can be replaced with `identity` by module
  21845. * replacement plugins.
  21846. *
  21847. * @private
  21848. * @type {Function}
  21849. * @param {Function} func The function to apply a rest parameter to.
  21850. * @returns {Function} Returns the new function.
  21851. */
  21852. var castRest = baseRest;
  21853. /**
  21854. * Casts `array` to a slice if it's needed.
  21855. *
  21856. * @private
  21857. * @param {Array} array The array to inspect.
  21858. * @param {number} start The start position.
  21859. * @param {number} [end=array.length] The end position.
  21860. * @returns {Array} Returns the cast slice.
  21861. */
  21862. function castSlice(array, start, end) {
  21863. var length = array.length;
  21864. end = end === undefined ? length : end;
  21865. return (!start && end >= length) ? array : baseSlice(array, start, end);
  21866. }
  21867. /**
  21868. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  21869. *
  21870. * @private
  21871. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  21872. */
  21873. var clearTimeout = ctxClearTimeout || function(id) {
  21874. return root.clearTimeout(id);
  21875. };
  21876. /**
  21877. * Creates a clone of `buffer`.
  21878. *
  21879. * @private
  21880. * @param {Buffer} buffer The buffer to clone.
  21881. * @param {boolean} [isDeep] Specify a deep clone.
  21882. * @returns {Buffer} Returns the cloned buffer.
  21883. */
  21884. function cloneBuffer(buffer, isDeep) {
  21885. if (isDeep) {
  21886. return buffer.slice();
  21887. }
  21888. var length = buffer.length,
  21889. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  21890. buffer.copy(result);
  21891. return result;
  21892. }
  21893. /**
  21894. * Creates a clone of `arrayBuffer`.
  21895. *
  21896. * @private
  21897. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  21898. * @returns {ArrayBuffer} Returns the cloned array buffer.
  21899. */
  21900. function cloneArrayBuffer(arrayBuffer) {
  21901. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  21902. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  21903. return result;
  21904. }
  21905. /**
  21906. * Creates a clone of `dataView`.
  21907. *
  21908. * @private
  21909. * @param {Object} dataView The data view to clone.
  21910. * @param {boolean} [isDeep] Specify a deep clone.
  21911. * @returns {Object} Returns the cloned data view.
  21912. */
  21913. function cloneDataView(dataView, isDeep) {
  21914. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  21915. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  21916. }
  21917. /**
  21918. * Creates a clone of `regexp`.
  21919. *
  21920. * @private
  21921. * @param {Object} regexp The regexp to clone.
  21922. * @returns {Object} Returns the cloned regexp.
  21923. */
  21924. function cloneRegExp(regexp) {
  21925. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  21926. result.lastIndex = regexp.lastIndex;
  21927. return result;
  21928. }
  21929. /**
  21930. * Creates a clone of the `symbol` object.
  21931. *
  21932. * @private
  21933. * @param {Object} symbol The symbol object to clone.
  21934. * @returns {Object} Returns the cloned symbol object.
  21935. */
  21936. function cloneSymbol(symbol) {
  21937. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  21938. }
  21939. /**
  21940. * Creates a clone of `typedArray`.
  21941. *
  21942. * @private
  21943. * @param {Object} typedArray The typed array to clone.
  21944. * @param {boolean} [isDeep] Specify a deep clone.
  21945. * @returns {Object} Returns the cloned typed array.
  21946. */
  21947. function cloneTypedArray(typedArray, isDeep) {
  21948. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  21949. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  21950. }
  21951. /**
  21952. * Compares values to sort them in ascending order.
  21953. *
  21954. * @private
  21955. * @param {*} value The value to compare.
  21956. * @param {*} other The other value to compare.
  21957. * @returns {number} Returns the sort order indicator for `value`.
  21958. */
  21959. function compareAscending(value, other) {
  21960. if (value !== other) {
  21961. var valIsDefined = value !== undefined,
  21962. valIsNull = value === null,
  21963. valIsReflexive = value === value,
  21964. valIsSymbol = isSymbol(value);
  21965. var othIsDefined = other !== undefined,
  21966. othIsNull = other === null,
  21967. othIsReflexive = other === other,
  21968. othIsSymbol = isSymbol(other);
  21969. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  21970. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  21971. (valIsNull && othIsDefined && othIsReflexive) ||
  21972. (!valIsDefined && othIsReflexive) ||
  21973. !valIsReflexive) {
  21974. return 1;
  21975. }
  21976. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  21977. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  21978. (othIsNull && valIsDefined && valIsReflexive) ||
  21979. (!othIsDefined && valIsReflexive) ||
  21980. !othIsReflexive) {
  21981. return -1;
  21982. }
  21983. }
  21984. return 0;
  21985. }
  21986. /**
  21987. * Used by `_.orderBy` to compare multiple properties of a value to another
  21988. * and stable sort them.
  21989. *
  21990. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  21991. * specify an order of "desc" for descending or "asc" for ascending sort order
  21992. * of corresponding values.
  21993. *
  21994. * @private
  21995. * @param {Object} object The object to compare.
  21996. * @param {Object} other The other object to compare.
  21997. * @param {boolean[]|string[]} orders The order to sort by for each property.
  21998. * @returns {number} Returns the sort order indicator for `object`.
  21999. */
  22000. function compareMultiple(object, other, orders) {
  22001. var index = -1,
  22002. objCriteria = object.criteria,
  22003. othCriteria = other.criteria,
  22004. length = objCriteria.length,
  22005. ordersLength = orders.length;
  22006. while (++index < length) {
  22007. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22008. if (result) {
  22009. if (index >= ordersLength) {
  22010. return result;
  22011. }
  22012. var order = orders[index];
  22013. return result * (order == 'desc' ? -1 : 1);
  22014. }
  22015. }
  22016. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22017. // that causes it, under certain circumstances, to provide the same value for
  22018. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22019. // for more details.
  22020. //
  22021. // This also ensures a stable sort in V8 and other engines.
  22022. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22023. return object.index - other.index;
  22024. }
  22025. /**
  22026. * Creates an array that is the composition of partially applied arguments,
  22027. * placeholders, and provided arguments into a single array of arguments.
  22028. *
  22029. * @private
  22030. * @param {Array} args The provided arguments.
  22031. * @param {Array} partials The arguments to prepend to those provided.
  22032. * @param {Array} holders The `partials` placeholder indexes.
  22033. * @params {boolean} [isCurried] Specify composing for a curried function.
  22034. * @returns {Array} Returns the new array of composed arguments.
  22035. */
  22036. function composeArgs(args, partials, holders, isCurried) {
  22037. var argsIndex = -1,
  22038. argsLength = args.length,
  22039. holdersLength = holders.length,
  22040. leftIndex = -1,
  22041. leftLength = partials.length,
  22042. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22043. result = Array(leftLength + rangeLength),
  22044. isUncurried = !isCurried;
  22045. while (++leftIndex < leftLength) {
  22046. result[leftIndex] = partials[leftIndex];
  22047. }
  22048. while (++argsIndex < holdersLength) {
  22049. if (isUncurried || argsIndex < argsLength) {
  22050. result[holders[argsIndex]] = args[argsIndex];
  22051. }
  22052. }
  22053. while (rangeLength--) {
  22054. result[leftIndex++] = args[argsIndex++];
  22055. }
  22056. return result;
  22057. }
  22058. /**
  22059. * This function is like `composeArgs` except that the arguments composition
  22060. * is tailored for `_.partialRight`.
  22061. *
  22062. * @private
  22063. * @param {Array} args The provided arguments.
  22064. * @param {Array} partials The arguments to append to those provided.
  22065. * @param {Array} holders The `partials` placeholder indexes.
  22066. * @params {boolean} [isCurried] Specify composing for a curried function.
  22067. * @returns {Array} Returns the new array of composed arguments.
  22068. */
  22069. function composeArgsRight(args, partials, holders, isCurried) {
  22070. var argsIndex = -1,
  22071. argsLength = args.length,
  22072. holdersIndex = -1,
  22073. holdersLength = holders.length,
  22074. rightIndex = -1,
  22075. rightLength = partials.length,
  22076. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22077. result = Array(rangeLength + rightLength),
  22078. isUncurried = !isCurried;
  22079. while (++argsIndex < rangeLength) {
  22080. result[argsIndex] = args[argsIndex];
  22081. }
  22082. var offset = argsIndex;
  22083. while (++rightIndex < rightLength) {
  22084. result[offset + rightIndex] = partials[rightIndex];
  22085. }
  22086. while (++holdersIndex < holdersLength) {
  22087. if (isUncurried || argsIndex < argsLength) {
  22088. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22089. }
  22090. }
  22091. return result;
  22092. }
  22093. /**
  22094. * Copies the values of `source` to `array`.
  22095. *
  22096. * @private
  22097. * @param {Array} source The array to copy values from.
  22098. * @param {Array} [array=[]] The array to copy values to.
  22099. * @returns {Array} Returns `array`.
  22100. */
  22101. function copyArray(source, array) {
  22102. var index = -1,
  22103. length = source.length;
  22104. array || (array = Array(length));
  22105. while (++index < length) {
  22106. array[index] = source[index];
  22107. }
  22108. return array;
  22109. }
  22110. /**
  22111. * Copies properties of `source` to `object`.
  22112. *
  22113. * @private
  22114. * @param {Object} source The object to copy properties from.
  22115. * @param {Array} props The property identifiers to copy.
  22116. * @param {Object} [object={}] The object to copy properties to.
  22117. * @param {Function} [customizer] The function to customize copied values.
  22118. * @returns {Object} Returns `object`.
  22119. */
  22120. function copyObject(source, props, object, customizer) {
  22121. var isNew = !object;
  22122. object || (object = {});
  22123. var index = -1,
  22124. length = props.length;
  22125. while (++index < length) {
  22126. var key = props[index];
  22127. var newValue = customizer
  22128. ? customizer(object[key], source[key], key, object, source)
  22129. : undefined;
  22130. if (newValue === undefined) {
  22131. newValue = source[key];
  22132. }
  22133. if (isNew) {
  22134. baseAssignValue(object, key, newValue);
  22135. } else {
  22136. assignValue(object, key, newValue);
  22137. }
  22138. }
  22139. return object;
  22140. }
  22141. /**
  22142. * Copies own symbols of `source` to `object`.
  22143. *
  22144. * @private
  22145. * @param {Object} source The object to copy symbols from.
  22146. * @param {Object} [object={}] The object to copy symbols to.
  22147. * @returns {Object} Returns `object`.
  22148. */
  22149. function copySymbols(source, object) {
  22150. return copyObject(source, getSymbols(source), object);
  22151. }
  22152. /**
  22153. * Copies own and inherited symbols of `source` to `object`.
  22154. *
  22155. * @private
  22156. * @param {Object} source The object to copy symbols from.
  22157. * @param {Object} [object={}] The object to copy symbols to.
  22158. * @returns {Object} Returns `object`.
  22159. */
  22160. function copySymbolsIn(source, object) {
  22161. return copyObject(source, getSymbolsIn(source), object);
  22162. }
  22163. /**
  22164. * Creates a function like `_.groupBy`.
  22165. *
  22166. * @private
  22167. * @param {Function} setter The function to set accumulator values.
  22168. * @param {Function} [initializer] The accumulator object initializer.
  22169. * @returns {Function} Returns the new aggregator function.
  22170. */
  22171. function createAggregator(setter, initializer) {
  22172. return function(collection, iteratee) {
  22173. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22174. accumulator = initializer ? initializer() : {};
  22175. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22176. };
  22177. }
  22178. /**
  22179. * Creates a function like `_.assign`.
  22180. *
  22181. * @private
  22182. * @param {Function} assigner The function to assign values.
  22183. * @returns {Function} Returns the new assigner function.
  22184. */
  22185. function createAssigner(assigner) {
  22186. return baseRest(function(object, sources) {
  22187. var index = -1,
  22188. length = sources.length,
  22189. customizer = length > 1 ? sources[length - 1] : undefined,
  22190. guard = length > 2 ? sources[2] : undefined;
  22191. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22192. ? (length--, customizer)
  22193. : undefined;
  22194. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22195. customizer = length < 3 ? undefined : customizer;
  22196. length = 1;
  22197. }
  22198. object = Object(object);
  22199. while (++index < length) {
  22200. var source = sources[index];
  22201. if (source) {
  22202. assigner(object, source, index, customizer);
  22203. }
  22204. }
  22205. return object;
  22206. });
  22207. }
  22208. /**
  22209. * Creates a `baseEach` or `baseEachRight` function.
  22210. *
  22211. * @private
  22212. * @param {Function} eachFunc The function to iterate over a collection.
  22213. * @param {boolean} [fromRight] Specify iterating from right to left.
  22214. * @returns {Function} Returns the new base function.
  22215. */
  22216. function createBaseEach(eachFunc, fromRight) {
  22217. return function(collection, iteratee) {
  22218. if (collection == null) {
  22219. return collection;
  22220. }
  22221. if (!isArrayLike(collection)) {
  22222. return eachFunc(collection, iteratee);
  22223. }
  22224. var length = collection.length,
  22225. index = fromRight ? length : -1,
  22226. iterable = Object(collection);
  22227. while ((fromRight ? index-- : ++index < length)) {
  22228. if (iteratee(iterable[index], index, iterable) === false) {
  22229. break;
  22230. }
  22231. }
  22232. return collection;
  22233. };
  22234. }
  22235. /**
  22236. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22237. *
  22238. * @private
  22239. * @param {boolean} [fromRight] Specify iterating from right to left.
  22240. * @returns {Function} Returns the new base function.
  22241. */
  22242. function createBaseFor(fromRight) {
  22243. return function(object, iteratee, keysFunc) {
  22244. var index = -1,
  22245. iterable = Object(object),
  22246. props = keysFunc(object),
  22247. length = props.length;
  22248. while (length--) {
  22249. var key = props[fromRight ? length : ++index];
  22250. if (iteratee(iterable[key], key, iterable) === false) {
  22251. break;
  22252. }
  22253. }
  22254. return object;
  22255. };
  22256. }
  22257. /**
  22258. * Creates a function that wraps `func` to invoke it with the optional `this`
  22259. * binding of `thisArg`.
  22260. *
  22261. * @private
  22262. * @param {Function} func The function to wrap.
  22263. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22264. * @param {*} [thisArg] The `this` binding of `func`.
  22265. * @returns {Function} Returns the new wrapped function.
  22266. */
  22267. function createBind(func, bitmask, thisArg) {
  22268. var isBind = bitmask & WRAP_BIND_FLAG,
  22269. Ctor = createCtor(func);
  22270. function wrapper() {
  22271. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22272. return fn.apply(isBind ? thisArg : this, arguments);
  22273. }
  22274. return wrapper;
  22275. }
  22276. /**
  22277. * Creates a function like `_.lowerFirst`.
  22278. *
  22279. * @private
  22280. * @param {string} methodName The name of the `String` case method to use.
  22281. * @returns {Function} Returns the new case function.
  22282. */
  22283. function createCaseFirst(methodName) {
  22284. return function(string) {
  22285. string = toString(string);
  22286. var strSymbols = hasUnicode(string)
  22287. ? stringToArray(string)
  22288. : undefined;
  22289. var chr = strSymbols
  22290. ? strSymbols[0]
  22291. : string.charAt(0);
  22292. var trailing = strSymbols
  22293. ? castSlice(strSymbols, 1).join('')
  22294. : string.slice(1);
  22295. return chr[methodName]() + trailing;
  22296. };
  22297. }
  22298. /**
  22299. * Creates a function like `_.camelCase`.
  22300. *
  22301. * @private
  22302. * @param {Function} callback The function to combine each word.
  22303. * @returns {Function} Returns the new compounder function.
  22304. */
  22305. function createCompounder(callback) {
  22306. return function(string) {
  22307. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22308. };
  22309. }
  22310. /**
  22311. * Creates a function that produces an instance of `Ctor` regardless of
  22312. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22313. *
  22314. * @private
  22315. * @param {Function} Ctor The constructor to wrap.
  22316. * @returns {Function} Returns the new wrapped function.
  22317. */
  22318. function createCtor(Ctor) {
  22319. return function() {
  22320. // Use a `switch` statement to work with class constructors. See
  22321. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22322. // for more details.
  22323. var args = arguments;
  22324. switch (args.length) {
  22325. case 0: return new Ctor;
  22326. case 1: return new Ctor(args[0]);
  22327. case 2: return new Ctor(args[0], args[1]);
  22328. case 3: return new Ctor(args[0], args[1], args[2]);
  22329. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22330. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22331. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22332. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22333. }
  22334. var thisBinding = baseCreate(Ctor.prototype),
  22335. result = Ctor.apply(thisBinding, args);
  22336. // Mimic the constructor's `return` behavior.
  22337. // See https://es5.github.io/#x13.2.2 for more details.
  22338. return isObject(result) ? result : thisBinding;
  22339. };
  22340. }
  22341. /**
  22342. * Creates a function that wraps `func` to enable currying.
  22343. *
  22344. * @private
  22345. * @param {Function} func The function to wrap.
  22346. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22347. * @param {number} arity The arity of `func`.
  22348. * @returns {Function} Returns the new wrapped function.
  22349. */
  22350. function createCurry(func, bitmask, arity) {
  22351. var Ctor = createCtor(func);
  22352. function wrapper() {
  22353. var length = arguments.length,
  22354. args = Array(length),
  22355. index = length,
  22356. placeholder = getHolder(wrapper);
  22357. while (index--) {
  22358. args[index] = arguments[index];
  22359. }
  22360. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22361. ? []
  22362. : replaceHolders(args, placeholder);
  22363. length -= holders.length;
  22364. if (length < arity) {
  22365. return createRecurry(
  22366. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22367. args, holders, undefined, undefined, arity - length);
  22368. }
  22369. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22370. return apply(fn, this, args);
  22371. }
  22372. return wrapper;
  22373. }
  22374. /**
  22375. * Creates a `_.find` or `_.findLast` function.
  22376. *
  22377. * @private
  22378. * @param {Function} findIndexFunc The function to find the collection index.
  22379. * @returns {Function} Returns the new find function.
  22380. */
  22381. function createFind(findIndexFunc) {
  22382. return function(collection, predicate, fromIndex) {
  22383. var iterable = Object(collection);
  22384. if (!isArrayLike(collection)) {
  22385. var iteratee = getIteratee(predicate, 3);
  22386. collection = keys(collection);
  22387. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22388. }
  22389. var index = findIndexFunc(collection, predicate, fromIndex);
  22390. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22391. };
  22392. }
  22393. /**
  22394. * Creates a `_.flow` or `_.flowRight` function.
  22395. *
  22396. * @private
  22397. * @param {boolean} [fromRight] Specify iterating from right to left.
  22398. * @returns {Function} Returns the new flow function.
  22399. */
  22400. function createFlow(fromRight) {
  22401. return flatRest(function(funcs) {
  22402. var length = funcs.length,
  22403. index = length,
  22404. prereq = LodashWrapper.prototype.thru;
  22405. if (fromRight) {
  22406. funcs.reverse();
  22407. }
  22408. while (index--) {
  22409. var func = funcs[index];
  22410. if (typeof func != 'function') {
  22411. throw new TypeError(FUNC_ERROR_TEXT);
  22412. }
  22413. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22414. var wrapper = new LodashWrapper([], true);
  22415. }
  22416. }
  22417. index = wrapper ? index : length;
  22418. while (++index < length) {
  22419. func = funcs[index];
  22420. var funcName = getFuncName(func),
  22421. data = funcName == 'wrapper' ? getData(func) : undefined;
  22422. if (data && isLaziable(data[0]) &&
  22423. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22424. !data[4].length && data[9] == 1
  22425. ) {
  22426. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22427. } else {
  22428. wrapper = (func.length == 1 && isLaziable(func))
  22429. ? wrapper[funcName]()
  22430. : wrapper.thru(func);
  22431. }
  22432. }
  22433. return function() {
  22434. var args = arguments,
  22435. value = args[0];
  22436. if (wrapper && args.length == 1 && isArray(value)) {
  22437. return wrapper.plant(value).value();
  22438. }
  22439. var index = 0,
  22440. result = length ? funcs[index].apply(this, args) : value;
  22441. while (++index < length) {
  22442. result = funcs[index].call(this, result);
  22443. }
  22444. return result;
  22445. };
  22446. });
  22447. }
  22448. /**
  22449. * Creates a function that wraps `func` to invoke it with optional `this`
  22450. * binding of `thisArg`, partial application, and currying.
  22451. *
  22452. * @private
  22453. * @param {Function|string} func The function or method name to wrap.
  22454. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22455. * @param {*} [thisArg] The `this` binding of `func`.
  22456. * @param {Array} [partials] The arguments to prepend to those provided to
  22457. * the new function.
  22458. * @param {Array} [holders] The `partials` placeholder indexes.
  22459. * @param {Array} [partialsRight] The arguments to append to those provided
  22460. * to the new function.
  22461. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22462. * @param {Array} [argPos] The argument positions of the new function.
  22463. * @param {number} [ary] The arity cap of `func`.
  22464. * @param {number} [arity] The arity of `func`.
  22465. * @returns {Function} Returns the new wrapped function.
  22466. */
  22467. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22468. var isAry = bitmask & WRAP_ARY_FLAG,
  22469. isBind = bitmask & WRAP_BIND_FLAG,
  22470. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22471. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22472. isFlip = bitmask & WRAP_FLIP_FLAG,
  22473. Ctor = isBindKey ? undefined : createCtor(func);
  22474. function wrapper() {
  22475. var length = arguments.length,
  22476. args = Array(length),
  22477. index = length;
  22478. while (index--) {
  22479. args[index] = arguments[index];
  22480. }
  22481. if (isCurried) {
  22482. var placeholder = getHolder(wrapper),
  22483. holdersCount = countHolders(args, placeholder);
  22484. }
  22485. if (partials) {
  22486. args = composeArgs(args, partials, holders, isCurried);
  22487. }
  22488. if (partialsRight) {
  22489. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22490. }
  22491. length -= holdersCount;
  22492. if (isCurried && length < arity) {
  22493. var newHolders = replaceHolders(args, placeholder);
  22494. return createRecurry(
  22495. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22496. args, newHolders, argPos, ary, arity - length
  22497. );
  22498. }
  22499. var thisBinding = isBind ? thisArg : this,
  22500. fn = isBindKey ? thisBinding[func] : func;
  22501. length = args.length;
  22502. if (argPos) {
  22503. args = reorder(args, argPos);
  22504. } else if (isFlip && length > 1) {
  22505. args.reverse();
  22506. }
  22507. if (isAry && ary < length) {
  22508. args.length = ary;
  22509. }
  22510. if (this && this !== root && this instanceof wrapper) {
  22511. fn = Ctor || createCtor(fn);
  22512. }
  22513. return fn.apply(thisBinding, args);
  22514. }
  22515. return wrapper;
  22516. }
  22517. /**
  22518. * Creates a function like `_.invertBy`.
  22519. *
  22520. * @private
  22521. * @param {Function} setter The function to set accumulator values.
  22522. * @param {Function} toIteratee The function to resolve iteratees.
  22523. * @returns {Function} Returns the new inverter function.
  22524. */
  22525. function createInverter(setter, toIteratee) {
  22526. return function(object, iteratee) {
  22527. return baseInverter(object, setter, toIteratee(iteratee), {});
  22528. };
  22529. }
  22530. /**
  22531. * Creates a function that performs a mathematical operation on two values.
  22532. *
  22533. * @private
  22534. * @param {Function} operator The function to perform the operation.
  22535. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22536. * @returns {Function} Returns the new mathematical operation function.
  22537. */
  22538. function createMathOperation(operator, defaultValue) {
  22539. return function(value, other) {
  22540. var result;
  22541. if (value === undefined && other === undefined) {
  22542. return defaultValue;
  22543. }
  22544. if (value !== undefined) {
  22545. result = value;
  22546. }
  22547. if (other !== undefined) {
  22548. if (result === undefined) {
  22549. return other;
  22550. }
  22551. if (typeof value == 'string' || typeof other == 'string') {
  22552. value = baseToString(value);
  22553. other = baseToString(other);
  22554. } else {
  22555. value = baseToNumber(value);
  22556. other = baseToNumber(other);
  22557. }
  22558. result = operator(value, other);
  22559. }
  22560. return result;
  22561. };
  22562. }
  22563. /**
  22564. * Creates a function like `_.over`.
  22565. *
  22566. * @private
  22567. * @param {Function} arrayFunc The function to iterate over iteratees.
  22568. * @returns {Function} Returns the new over function.
  22569. */
  22570. function createOver(arrayFunc) {
  22571. return flatRest(function(iteratees) {
  22572. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22573. return baseRest(function(args) {
  22574. var thisArg = this;
  22575. return arrayFunc(iteratees, function(iteratee) {
  22576. return apply(iteratee, thisArg, args);
  22577. });
  22578. });
  22579. });
  22580. }
  22581. /**
  22582. * Creates the padding for `string` based on `length`. The `chars` string
  22583. * is truncated if the number of characters exceeds `length`.
  22584. *
  22585. * @private
  22586. * @param {number} length The padding length.
  22587. * @param {string} [chars=' '] The string used as padding.
  22588. * @returns {string} Returns the padding for `string`.
  22589. */
  22590. function createPadding(length, chars) {
  22591. chars = chars === undefined ? ' ' : baseToString(chars);
  22592. var charsLength = chars.length;
  22593. if (charsLength < 2) {
  22594. return charsLength ? baseRepeat(chars, length) : chars;
  22595. }
  22596. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22597. return hasUnicode(chars)
  22598. ? castSlice(stringToArray(result), 0, length).join('')
  22599. : result.slice(0, length);
  22600. }
  22601. /**
  22602. * Creates a function that wraps `func` to invoke it with the `this` binding
  22603. * of `thisArg` and `partials` prepended to the arguments it receives.
  22604. *
  22605. * @private
  22606. * @param {Function} func The function to wrap.
  22607. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22608. * @param {*} thisArg The `this` binding of `func`.
  22609. * @param {Array} partials The arguments to prepend to those provided to
  22610. * the new function.
  22611. * @returns {Function} Returns the new wrapped function.
  22612. */
  22613. function createPartial(func, bitmask, thisArg, partials) {
  22614. var isBind = bitmask & WRAP_BIND_FLAG,
  22615. Ctor = createCtor(func);
  22616. function wrapper() {
  22617. var argsIndex = -1,
  22618. argsLength = arguments.length,
  22619. leftIndex = -1,
  22620. leftLength = partials.length,
  22621. args = Array(leftLength + argsLength),
  22622. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22623. while (++leftIndex < leftLength) {
  22624. args[leftIndex] = partials[leftIndex];
  22625. }
  22626. while (argsLength--) {
  22627. args[leftIndex++] = arguments[++argsIndex];
  22628. }
  22629. return apply(fn, isBind ? thisArg : this, args);
  22630. }
  22631. return wrapper;
  22632. }
  22633. /**
  22634. * Creates a `_.range` or `_.rangeRight` function.
  22635. *
  22636. * @private
  22637. * @param {boolean} [fromRight] Specify iterating from right to left.
  22638. * @returns {Function} Returns the new range function.
  22639. */
  22640. function createRange(fromRight) {
  22641. return function(start, end, step) {
  22642. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22643. end = step = undefined;
  22644. }
  22645. // Ensure the sign of `-0` is preserved.
  22646. start = toFinite(start);
  22647. if (end === undefined) {
  22648. end = start;
  22649. start = 0;
  22650. } else {
  22651. end = toFinite(end);
  22652. }
  22653. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22654. return baseRange(start, end, step, fromRight);
  22655. };
  22656. }
  22657. /**
  22658. * Creates a function that performs a relational operation on two values.
  22659. *
  22660. * @private
  22661. * @param {Function} operator The function to perform the operation.
  22662. * @returns {Function} Returns the new relational operation function.
  22663. */
  22664. function createRelationalOperation(operator) {
  22665. return function(value, other) {
  22666. if (!(typeof value == 'string' && typeof other == 'string')) {
  22667. value = toNumber(value);
  22668. other = toNumber(other);
  22669. }
  22670. return operator(value, other);
  22671. };
  22672. }
  22673. /**
  22674. * Creates a function that wraps `func` to continue currying.
  22675. *
  22676. * @private
  22677. * @param {Function} func The function to wrap.
  22678. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22679. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22680. * @param {*} placeholder The placeholder value.
  22681. * @param {*} [thisArg] The `this` binding of `func`.
  22682. * @param {Array} [partials] The arguments to prepend to those provided to
  22683. * the new function.
  22684. * @param {Array} [holders] The `partials` placeholder indexes.
  22685. * @param {Array} [argPos] The argument positions of the new function.
  22686. * @param {number} [ary] The arity cap of `func`.
  22687. * @param {number} [arity] The arity of `func`.
  22688. * @returns {Function} Returns the new wrapped function.
  22689. */
  22690. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22691. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22692. newHolders = isCurry ? holders : undefined,
  22693. newHoldersRight = isCurry ? undefined : holders,
  22694. newPartials = isCurry ? partials : undefined,
  22695. newPartialsRight = isCurry ? undefined : partials;
  22696. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22697. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22698. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22699. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22700. }
  22701. var newData = [
  22702. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22703. newHoldersRight, argPos, ary, arity
  22704. ];
  22705. var result = wrapFunc.apply(undefined, newData);
  22706. if (isLaziable(func)) {
  22707. setData(result, newData);
  22708. }
  22709. result.placeholder = placeholder;
  22710. return setWrapToString(result, func, bitmask);
  22711. }
  22712. /**
  22713. * Creates a function like `_.round`.
  22714. *
  22715. * @private
  22716. * @param {string} methodName The name of the `Math` method to use when rounding.
  22717. * @returns {Function} Returns the new round function.
  22718. */
  22719. function createRound(methodName) {
  22720. var func = Math[methodName];
  22721. return function(number, precision) {
  22722. number = toNumber(number);
  22723. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22724. if (precision && nativeIsFinite(number)) {
  22725. // Shift with exponential notation to avoid floating-point issues.
  22726. // See [MDN](https://mdn.io/round#Examples) for more details.
  22727. var pair = (toString(number) + 'e').split('e'),
  22728. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22729. pair = (toString(value) + 'e').split('e');
  22730. return +(pair[0] + 'e' + (+pair[1] - precision));
  22731. }
  22732. return func(number);
  22733. };
  22734. }
  22735. /**
  22736. * Creates a set object of `values`.
  22737. *
  22738. * @private
  22739. * @param {Array} values The values to add to the set.
  22740. * @returns {Object} Returns the new set.
  22741. */
  22742. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22743. return new Set(values);
  22744. };
  22745. /**
  22746. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22747. *
  22748. * @private
  22749. * @param {Function} keysFunc The function to get the keys of a given object.
  22750. * @returns {Function} Returns the new pairs function.
  22751. */
  22752. function createToPairs(keysFunc) {
  22753. return function(object) {
  22754. var tag = getTag(object);
  22755. if (tag == mapTag) {
  22756. return mapToArray(object);
  22757. }
  22758. if (tag == setTag) {
  22759. return setToPairs(object);
  22760. }
  22761. return baseToPairs(object, keysFunc(object));
  22762. };
  22763. }
  22764. /**
  22765. * Creates a function that either curries or invokes `func` with optional
  22766. * `this` binding and partially applied arguments.
  22767. *
  22768. * @private
  22769. * @param {Function|string} func The function or method name to wrap.
  22770. * @param {number} bitmask The bitmask flags.
  22771. * 1 - `_.bind`
  22772. * 2 - `_.bindKey`
  22773. * 4 - `_.curry` or `_.curryRight` of a bound function
  22774. * 8 - `_.curry`
  22775. * 16 - `_.curryRight`
  22776. * 32 - `_.partial`
  22777. * 64 - `_.partialRight`
  22778. * 128 - `_.rearg`
  22779. * 256 - `_.ary`
  22780. * 512 - `_.flip`
  22781. * @param {*} [thisArg] The `this` binding of `func`.
  22782. * @param {Array} [partials] The arguments to be partially applied.
  22783. * @param {Array} [holders] The `partials` placeholder indexes.
  22784. * @param {Array} [argPos] The argument positions of the new function.
  22785. * @param {number} [ary] The arity cap of `func`.
  22786. * @param {number} [arity] The arity of `func`.
  22787. * @returns {Function} Returns the new wrapped function.
  22788. */
  22789. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22790. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22791. if (!isBindKey && typeof func != 'function') {
  22792. throw new TypeError(FUNC_ERROR_TEXT);
  22793. }
  22794. var length = partials ? partials.length : 0;
  22795. if (!length) {
  22796. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22797. partials = holders = undefined;
  22798. }
  22799. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22800. arity = arity === undefined ? arity : toInteger(arity);
  22801. length -= holders ? holders.length : 0;
  22802. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  22803. var partialsRight = partials,
  22804. holdersRight = holders;
  22805. partials = holders = undefined;
  22806. }
  22807. var data = isBindKey ? undefined : getData(func);
  22808. var newData = [
  22809. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  22810. argPos, ary, arity
  22811. ];
  22812. if (data) {
  22813. mergeData(newData, data);
  22814. }
  22815. func = newData[0];
  22816. bitmask = newData[1];
  22817. thisArg = newData[2];
  22818. partials = newData[3];
  22819. holders = newData[4];
  22820. arity = newData[9] = newData[9] === undefined
  22821. ? (isBindKey ? 0 : func.length)
  22822. : nativeMax(newData[9] - length, 0);
  22823. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  22824. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  22825. }
  22826. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  22827. var result = createBind(func, bitmask, thisArg);
  22828. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  22829. result = createCurry(func, bitmask, arity);
  22830. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  22831. result = createPartial(func, bitmask, thisArg, partials);
  22832. } else {
  22833. result = createHybrid.apply(undefined, newData);
  22834. }
  22835. var setter = data ? baseSetData : setData;
  22836. return setWrapToString(setter(result, newData), func, bitmask);
  22837. }
  22838. /**
  22839. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  22840. * of source objects to the destination object for all destination properties
  22841. * that resolve to `undefined`.
  22842. *
  22843. * @private
  22844. * @param {*} objValue The destination value.
  22845. * @param {*} srcValue The source value.
  22846. * @param {string} key The key of the property to assign.
  22847. * @param {Object} object The parent object of `objValue`.
  22848. * @returns {*} Returns the value to assign.
  22849. */
  22850. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  22851. if (objValue === undefined ||
  22852. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  22853. return srcValue;
  22854. }
  22855. return objValue;
  22856. }
  22857. /**
  22858. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  22859. * objects into destination objects that are passed thru.
  22860. *
  22861. * @private
  22862. * @param {*} objValue The destination value.
  22863. * @param {*} srcValue The source value.
  22864. * @param {string} key The key of the property to merge.
  22865. * @param {Object} object The parent object of `objValue`.
  22866. * @param {Object} source The parent object of `srcValue`.
  22867. * @param {Object} [stack] Tracks traversed source values and their merged
  22868. * counterparts.
  22869. * @returns {*} Returns the value to assign.
  22870. */
  22871. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  22872. if (isObject(objValue) && isObject(srcValue)) {
  22873. // Recursively merge objects and arrays (susceptible to call stack limits).
  22874. stack.set(srcValue, objValue);
  22875. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  22876. stack['delete'](srcValue);
  22877. }
  22878. return objValue;
  22879. }
  22880. /**
  22881. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  22882. * objects.
  22883. *
  22884. * @private
  22885. * @param {*} value The value to inspect.
  22886. * @param {string} key The key of the property to inspect.
  22887. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  22888. */
  22889. function customOmitClone(value) {
  22890. return isPlainObject(value) ? undefined : value;
  22891. }
  22892. /**
  22893. * A specialized version of `baseIsEqualDeep` for arrays with support for
  22894. * partial deep comparisons.
  22895. *
  22896. * @private
  22897. * @param {Array} array The array to compare.
  22898. * @param {Array} other The other array to compare.
  22899. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22900. * @param {Function} customizer The function to customize comparisons.
  22901. * @param {Function} equalFunc The function to determine equivalents of values.
  22902. * @param {Object} stack Tracks traversed `array` and `other` objects.
  22903. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  22904. */
  22905. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  22906. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  22907. arrLength = array.length,
  22908. othLength = other.length;
  22909. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  22910. return false;
  22911. }
  22912. // Assume cyclic values are equal.
  22913. var stacked = stack.get(array);
  22914. if (stacked && stack.get(other)) {
  22915. return stacked == other;
  22916. }
  22917. var index = -1,
  22918. result = true,
  22919. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  22920. stack.set(array, other);
  22921. stack.set(other, array);
  22922. // Ignore non-index properties.
  22923. while (++index < arrLength) {
  22924. var arrValue = array[index],
  22925. othValue = other[index];
  22926. if (customizer) {
  22927. var compared = isPartial
  22928. ? customizer(othValue, arrValue, index, other, array, stack)
  22929. : customizer(arrValue, othValue, index, array, other, stack);
  22930. }
  22931. if (compared !== undefined) {
  22932. if (compared) {
  22933. continue;
  22934. }
  22935. result = false;
  22936. break;
  22937. }
  22938. // Recursively compare arrays (susceptible to call stack limits).
  22939. if (seen) {
  22940. if (!arraySome(other, function(othValue, othIndex) {
  22941. if (!cacheHas(seen, othIndex) &&
  22942. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  22943. return seen.push(othIndex);
  22944. }
  22945. })) {
  22946. result = false;
  22947. break;
  22948. }
  22949. } else if (!(
  22950. arrValue === othValue ||
  22951. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  22952. )) {
  22953. result = false;
  22954. break;
  22955. }
  22956. }
  22957. stack['delete'](array);
  22958. stack['delete'](other);
  22959. return result;
  22960. }
  22961. /**
  22962. * A specialized version of `baseIsEqualDeep` for comparing objects of
  22963. * the same `toStringTag`.
  22964. *
  22965. * **Note:** This function only supports comparing values with tags of
  22966. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  22967. *
  22968. * @private
  22969. * @param {Object} object The object to compare.
  22970. * @param {Object} other The other object to compare.
  22971. * @param {string} tag The `toStringTag` of the objects to compare.
  22972. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22973. * @param {Function} customizer The function to customize comparisons.
  22974. * @param {Function} equalFunc The function to determine equivalents of values.
  22975. * @param {Object} stack Tracks traversed `object` and `other` objects.
  22976. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22977. */
  22978. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  22979. switch (tag) {
  22980. case dataViewTag:
  22981. if ((object.byteLength != other.byteLength) ||
  22982. (object.byteOffset != other.byteOffset)) {
  22983. return false;
  22984. }
  22985. object = object.buffer;
  22986. other = other.buffer;
  22987. case arrayBufferTag:
  22988. if ((object.byteLength != other.byteLength) ||
  22989. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  22990. return false;
  22991. }
  22992. return true;
  22993. case boolTag:
  22994. case dateTag:
  22995. case numberTag:
  22996. // Coerce booleans to `1` or `0` and dates to milliseconds.
  22997. // Invalid dates are coerced to `NaN`.
  22998. return eq(+object, +other);
  22999. case errorTag:
  23000. return object.name == other.name && object.message == other.message;
  23001. case regexpTag:
  23002. case stringTag:
  23003. // Coerce regexes to strings and treat strings, primitives and objects,
  23004. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23005. // for more details.
  23006. return object == (other + '');
  23007. case mapTag:
  23008. var convert = mapToArray;
  23009. case setTag:
  23010. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23011. convert || (convert = setToArray);
  23012. if (object.size != other.size && !isPartial) {
  23013. return false;
  23014. }
  23015. // Assume cyclic values are equal.
  23016. var stacked = stack.get(object);
  23017. if (stacked) {
  23018. return stacked == other;
  23019. }
  23020. bitmask |= COMPARE_UNORDERED_FLAG;
  23021. // Recursively compare objects (susceptible to call stack limits).
  23022. stack.set(object, other);
  23023. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23024. stack['delete'](object);
  23025. return result;
  23026. case symbolTag:
  23027. if (symbolValueOf) {
  23028. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23029. }
  23030. }
  23031. return false;
  23032. }
  23033. /**
  23034. * A specialized version of `baseIsEqualDeep` for objects with support for
  23035. * partial deep comparisons.
  23036. *
  23037. * @private
  23038. * @param {Object} object The object to compare.
  23039. * @param {Object} other The other object to compare.
  23040. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23041. * @param {Function} customizer The function to customize comparisons.
  23042. * @param {Function} equalFunc The function to determine equivalents of values.
  23043. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23044. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23045. */
  23046. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23047. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23048. objProps = getAllKeys(object),
  23049. objLength = objProps.length,
  23050. othProps = getAllKeys(other),
  23051. othLength = othProps.length;
  23052. if (objLength != othLength && !isPartial) {
  23053. return false;
  23054. }
  23055. var index = objLength;
  23056. while (index--) {
  23057. var key = objProps[index];
  23058. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23059. return false;
  23060. }
  23061. }
  23062. // Assume cyclic values are equal.
  23063. var stacked = stack.get(object);
  23064. if (stacked && stack.get(other)) {
  23065. return stacked == other;
  23066. }
  23067. var result = true;
  23068. stack.set(object, other);
  23069. stack.set(other, object);
  23070. var skipCtor = isPartial;
  23071. while (++index < objLength) {
  23072. key = objProps[index];
  23073. var objValue = object[key],
  23074. othValue = other[key];
  23075. if (customizer) {
  23076. var compared = isPartial
  23077. ? customizer(othValue, objValue, key, other, object, stack)
  23078. : customizer(objValue, othValue, key, object, other, stack);
  23079. }
  23080. // Recursively compare objects (susceptible to call stack limits).
  23081. if (!(compared === undefined
  23082. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23083. : compared
  23084. )) {
  23085. result = false;
  23086. break;
  23087. }
  23088. skipCtor || (skipCtor = key == 'constructor');
  23089. }
  23090. if (result && !skipCtor) {
  23091. var objCtor = object.constructor,
  23092. othCtor = other.constructor;
  23093. // Non `Object` object instances with different constructors are not equal.
  23094. if (objCtor != othCtor &&
  23095. ('constructor' in object && 'constructor' in other) &&
  23096. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23097. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23098. result = false;
  23099. }
  23100. }
  23101. stack['delete'](object);
  23102. stack['delete'](other);
  23103. return result;
  23104. }
  23105. /**
  23106. * A specialized version of `baseRest` which flattens the rest array.
  23107. *
  23108. * @private
  23109. * @param {Function} func The function to apply a rest parameter to.
  23110. * @returns {Function} Returns the new function.
  23111. */
  23112. function flatRest(func) {
  23113. return setToString(overRest(func, undefined, flatten), func + '');
  23114. }
  23115. /**
  23116. * Creates an array of own enumerable property names and symbols of `object`.
  23117. *
  23118. * @private
  23119. * @param {Object} object The object to query.
  23120. * @returns {Array} Returns the array of property names and symbols.
  23121. */
  23122. function getAllKeys(object) {
  23123. return baseGetAllKeys(object, keys, getSymbols);
  23124. }
  23125. /**
  23126. * Creates an array of own and inherited enumerable property names and
  23127. * symbols of `object`.
  23128. *
  23129. * @private
  23130. * @param {Object} object The object to query.
  23131. * @returns {Array} Returns the array of property names and symbols.
  23132. */
  23133. function getAllKeysIn(object) {
  23134. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23135. }
  23136. /**
  23137. * Gets metadata for `func`.
  23138. *
  23139. * @private
  23140. * @param {Function} func The function to query.
  23141. * @returns {*} Returns the metadata for `func`.
  23142. */
  23143. var getData = !metaMap ? noop : function(func) {
  23144. return metaMap.get(func);
  23145. };
  23146. /**
  23147. * Gets the name of `func`.
  23148. *
  23149. * @private
  23150. * @param {Function} func The function to query.
  23151. * @returns {string} Returns the function name.
  23152. */
  23153. function getFuncName(func) {
  23154. var result = (func.name + ''),
  23155. array = realNames[result],
  23156. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23157. while (length--) {
  23158. var data = array[length],
  23159. otherFunc = data.func;
  23160. if (otherFunc == null || otherFunc == func) {
  23161. return data.name;
  23162. }
  23163. }
  23164. return result;
  23165. }
  23166. /**
  23167. * Gets the argument placeholder value for `func`.
  23168. *
  23169. * @private
  23170. * @param {Function} func The function to inspect.
  23171. * @returns {*} Returns the placeholder value.
  23172. */
  23173. function getHolder(func) {
  23174. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23175. return object.placeholder;
  23176. }
  23177. /**
  23178. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23179. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23180. * If arguments are provided, the chosen function is invoked with them and
  23181. * its result is returned.
  23182. *
  23183. * @private
  23184. * @param {*} [value] The value to convert to an iteratee.
  23185. * @param {number} [arity] The arity of the created iteratee.
  23186. * @returns {Function} Returns the chosen function or its result.
  23187. */
  23188. function getIteratee() {
  23189. var result = lodash.iteratee || iteratee;
  23190. result = result === iteratee ? baseIteratee : result;
  23191. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23192. }
  23193. /**
  23194. * Gets the data for `map`.
  23195. *
  23196. * @private
  23197. * @param {Object} map The map to query.
  23198. * @param {string} key The reference key.
  23199. * @returns {*} Returns the map data.
  23200. */
  23201. function getMapData(map, key) {
  23202. var data = map.__data__;
  23203. return isKeyable(key)
  23204. ? data[typeof key == 'string' ? 'string' : 'hash']
  23205. : data.map;
  23206. }
  23207. /**
  23208. * Gets the property names, values, and compare flags of `object`.
  23209. *
  23210. * @private
  23211. * @param {Object} object The object to query.
  23212. * @returns {Array} Returns the match data of `object`.
  23213. */
  23214. function getMatchData(object) {
  23215. var result = keys(object),
  23216. length = result.length;
  23217. while (length--) {
  23218. var key = result[length],
  23219. value = object[key];
  23220. result[length] = [key, value, isStrictComparable(value)];
  23221. }
  23222. return result;
  23223. }
  23224. /**
  23225. * Gets the native function at `key` of `object`.
  23226. *
  23227. * @private
  23228. * @param {Object} object The object to query.
  23229. * @param {string} key The key of the method to get.
  23230. * @returns {*} Returns the function if it's native, else `undefined`.
  23231. */
  23232. function getNative(object, key) {
  23233. var value = getValue(object, key);
  23234. return baseIsNative(value) ? value : undefined;
  23235. }
  23236. /**
  23237. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23238. *
  23239. * @private
  23240. * @param {*} value The value to query.
  23241. * @returns {string} Returns the raw `toStringTag`.
  23242. */
  23243. function getRawTag(value) {
  23244. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23245. tag = value[symToStringTag];
  23246. try {
  23247. value[symToStringTag] = undefined;
  23248. var unmasked = true;
  23249. } catch (e) {}
  23250. var result = nativeObjectToString.call(value);
  23251. if (unmasked) {
  23252. if (isOwn) {
  23253. value[symToStringTag] = tag;
  23254. } else {
  23255. delete value[symToStringTag];
  23256. }
  23257. }
  23258. return result;
  23259. }
  23260. /**
  23261. * Creates an array of the own enumerable symbols of `object`.
  23262. *
  23263. * @private
  23264. * @param {Object} object The object to query.
  23265. * @returns {Array} Returns the array of symbols.
  23266. */
  23267. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23268. if (object == null) {
  23269. return [];
  23270. }
  23271. object = Object(object);
  23272. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23273. return propertyIsEnumerable.call(object, symbol);
  23274. });
  23275. };
  23276. /**
  23277. * Creates an array of the own and inherited enumerable symbols of `object`.
  23278. *
  23279. * @private
  23280. * @param {Object} object The object to query.
  23281. * @returns {Array} Returns the array of symbols.
  23282. */
  23283. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23284. var result = [];
  23285. while (object) {
  23286. arrayPush(result, getSymbols(object));
  23287. object = getPrototype(object);
  23288. }
  23289. return result;
  23290. };
  23291. /**
  23292. * Gets the `toStringTag` of `value`.
  23293. *
  23294. * @private
  23295. * @param {*} value The value to query.
  23296. * @returns {string} Returns the `toStringTag`.
  23297. */
  23298. var getTag = baseGetTag;
  23299. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23300. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23301. (Map && getTag(new Map) != mapTag) ||
  23302. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23303. (Set && getTag(new Set) != setTag) ||
  23304. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23305. getTag = function(value) {
  23306. var result = baseGetTag(value),
  23307. Ctor = result == objectTag ? value.constructor : undefined,
  23308. ctorString = Ctor ? toSource(Ctor) : '';
  23309. if (ctorString) {
  23310. switch (ctorString) {
  23311. case dataViewCtorString: return dataViewTag;
  23312. case mapCtorString: return mapTag;
  23313. case promiseCtorString: return promiseTag;
  23314. case setCtorString: return setTag;
  23315. case weakMapCtorString: return weakMapTag;
  23316. }
  23317. }
  23318. return result;
  23319. };
  23320. }
  23321. /**
  23322. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23323. *
  23324. * @private
  23325. * @param {number} start The start of the view.
  23326. * @param {number} end The end of the view.
  23327. * @param {Array} transforms The transformations to apply to the view.
  23328. * @returns {Object} Returns an object containing the `start` and `end`
  23329. * positions of the view.
  23330. */
  23331. function getView(start, end, transforms) {
  23332. var index = -1,
  23333. length = transforms.length;
  23334. while (++index < length) {
  23335. var data = transforms[index],
  23336. size = data.size;
  23337. switch (data.type) {
  23338. case 'drop': start += size; break;
  23339. case 'dropRight': end -= size; break;
  23340. case 'take': end = nativeMin(end, start + size); break;
  23341. case 'takeRight': start = nativeMax(start, end - size); break;
  23342. }
  23343. }
  23344. return { 'start': start, 'end': end };
  23345. }
  23346. /**
  23347. * Extracts wrapper details from the `source` body comment.
  23348. *
  23349. * @private
  23350. * @param {string} source The source to inspect.
  23351. * @returns {Array} Returns the wrapper details.
  23352. */
  23353. function getWrapDetails(source) {
  23354. var match = source.match(reWrapDetails);
  23355. return match ? match[1].split(reSplitDetails) : [];
  23356. }
  23357. /**
  23358. * Checks if `path` exists on `object`.
  23359. *
  23360. * @private
  23361. * @param {Object} object The object to query.
  23362. * @param {Array|string} path The path to check.
  23363. * @param {Function} hasFunc The function to check properties.
  23364. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23365. */
  23366. function hasPath(object, path, hasFunc) {
  23367. path = castPath(path, object);
  23368. var index = -1,
  23369. length = path.length,
  23370. result = false;
  23371. while (++index < length) {
  23372. var key = toKey(path[index]);
  23373. if (!(result = object != null && hasFunc(object, key))) {
  23374. break;
  23375. }
  23376. object = object[key];
  23377. }
  23378. if (result || ++index != length) {
  23379. return result;
  23380. }
  23381. length = object == null ? 0 : object.length;
  23382. return !!length && isLength(length) && isIndex(key, length) &&
  23383. (isArray(object) || isArguments(object));
  23384. }
  23385. /**
  23386. * Initializes an array clone.
  23387. *
  23388. * @private
  23389. * @param {Array} array The array to clone.
  23390. * @returns {Array} Returns the initialized clone.
  23391. */
  23392. function initCloneArray(array) {
  23393. var length = array.length,
  23394. result = new array.constructor(length);
  23395. // Add properties assigned by `RegExp#exec`.
  23396. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23397. result.index = array.index;
  23398. result.input = array.input;
  23399. }
  23400. return result;
  23401. }
  23402. /**
  23403. * Initializes an object clone.
  23404. *
  23405. * @private
  23406. * @param {Object} object The object to clone.
  23407. * @returns {Object} Returns the initialized clone.
  23408. */
  23409. function initCloneObject(object) {
  23410. return (typeof object.constructor == 'function' && !isPrototype(object))
  23411. ? baseCreate(getPrototype(object))
  23412. : {};
  23413. }
  23414. /**
  23415. * Initializes an object clone based on its `toStringTag`.
  23416. *
  23417. * **Note:** This function only supports cloning values with tags of
  23418. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23419. *
  23420. * @private
  23421. * @param {Object} object The object to clone.
  23422. * @param {string} tag The `toStringTag` of the object to clone.
  23423. * @param {boolean} [isDeep] Specify a deep clone.
  23424. * @returns {Object} Returns the initialized clone.
  23425. */
  23426. function initCloneByTag(object, tag, isDeep) {
  23427. var Ctor = object.constructor;
  23428. switch (tag) {
  23429. case arrayBufferTag:
  23430. return cloneArrayBuffer(object);
  23431. case boolTag:
  23432. case dateTag:
  23433. return new Ctor(+object);
  23434. case dataViewTag:
  23435. return cloneDataView(object, isDeep);
  23436. case float32Tag: case float64Tag:
  23437. case int8Tag: case int16Tag: case int32Tag:
  23438. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23439. return cloneTypedArray(object, isDeep);
  23440. case mapTag:
  23441. return new Ctor;
  23442. case numberTag:
  23443. case stringTag:
  23444. return new Ctor(object);
  23445. case regexpTag:
  23446. return cloneRegExp(object);
  23447. case setTag:
  23448. return new Ctor;
  23449. case symbolTag:
  23450. return cloneSymbol(object);
  23451. }
  23452. }
  23453. /**
  23454. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23455. *
  23456. * @private
  23457. * @param {string} source The source to modify.
  23458. * @returns {Array} details The details to insert.
  23459. * @returns {string} Returns the modified source.
  23460. */
  23461. function insertWrapDetails(source, details) {
  23462. var length = details.length;
  23463. if (!length) {
  23464. return source;
  23465. }
  23466. var lastIndex = length - 1;
  23467. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23468. details = details.join(length > 2 ? ', ' : ' ');
  23469. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23470. }
  23471. /**
  23472. * Checks if `value` is a flattenable `arguments` object or array.
  23473. *
  23474. * @private
  23475. * @param {*} value The value to check.
  23476. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23477. */
  23478. function isFlattenable(value) {
  23479. return isArray(value) || isArguments(value) ||
  23480. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23481. }
  23482. /**
  23483. * Checks if `value` is a valid array-like index.
  23484. *
  23485. * @private
  23486. * @param {*} value The value to check.
  23487. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23488. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23489. */
  23490. function isIndex(value, length) {
  23491. var type = typeof value;
  23492. length = length == null ? MAX_SAFE_INTEGER : length;
  23493. return !!length &&
  23494. (type == 'number' ||
  23495. (type != 'symbol' && reIsUint.test(value))) &&
  23496. (value > -1 && value % 1 == 0 && value < length);
  23497. }
  23498. /**
  23499. * Checks if the given arguments are from an iteratee call.
  23500. *
  23501. * @private
  23502. * @param {*} value The potential iteratee value argument.
  23503. * @param {*} index The potential iteratee index or key argument.
  23504. * @param {*} object The potential iteratee object argument.
  23505. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23506. * else `false`.
  23507. */
  23508. function isIterateeCall(value, index, object) {
  23509. if (!isObject(object)) {
  23510. return false;
  23511. }
  23512. var type = typeof index;
  23513. if (type == 'number'
  23514. ? (isArrayLike(object) && isIndex(index, object.length))
  23515. : (type == 'string' && index in object)
  23516. ) {
  23517. return eq(object[index], value);
  23518. }
  23519. return false;
  23520. }
  23521. /**
  23522. * Checks if `value` is a property name and not a property path.
  23523. *
  23524. * @private
  23525. * @param {*} value The value to check.
  23526. * @param {Object} [object] The object to query keys on.
  23527. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23528. */
  23529. function isKey(value, object) {
  23530. if (isArray(value)) {
  23531. return false;
  23532. }
  23533. var type = typeof value;
  23534. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23535. value == null || isSymbol(value)) {
  23536. return true;
  23537. }
  23538. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23539. (object != null && value in Object(object));
  23540. }
  23541. /**
  23542. * Checks if `value` is suitable for use as unique object key.
  23543. *
  23544. * @private
  23545. * @param {*} value The value to check.
  23546. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23547. */
  23548. function isKeyable(value) {
  23549. var type = typeof value;
  23550. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23551. ? (value !== '__proto__')
  23552. : (value === null);
  23553. }
  23554. /**
  23555. * Checks if `func` has a lazy counterpart.
  23556. *
  23557. * @private
  23558. * @param {Function} func The function to check.
  23559. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23560. * else `false`.
  23561. */
  23562. function isLaziable(func) {
  23563. var funcName = getFuncName(func),
  23564. other = lodash[funcName];
  23565. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23566. return false;
  23567. }
  23568. if (func === other) {
  23569. return true;
  23570. }
  23571. var data = getData(other);
  23572. return !!data && func === data[0];
  23573. }
  23574. /**
  23575. * Checks if `func` has its source masked.
  23576. *
  23577. * @private
  23578. * @param {Function} func The function to check.
  23579. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23580. */
  23581. function isMasked(func) {
  23582. return !!maskSrcKey && (maskSrcKey in func);
  23583. }
  23584. /**
  23585. * Checks if `func` is capable of being masked.
  23586. *
  23587. * @private
  23588. * @param {*} value The value to check.
  23589. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23590. */
  23591. var isMaskable = coreJsData ? isFunction : stubFalse;
  23592. /**
  23593. * Checks if `value` is likely a prototype object.
  23594. *
  23595. * @private
  23596. * @param {*} value The value to check.
  23597. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23598. */
  23599. function isPrototype(value) {
  23600. var Ctor = value && value.constructor,
  23601. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23602. return value === proto;
  23603. }
  23604. /**
  23605. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23606. *
  23607. * @private
  23608. * @param {*} value The value to check.
  23609. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23610. * equality comparisons, else `false`.
  23611. */
  23612. function isStrictComparable(value) {
  23613. return value === value && !isObject(value);
  23614. }
  23615. /**
  23616. * A specialized version of `matchesProperty` for source values suitable
  23617. * for strict equality comparisons, i.e. `===`.
  23618. *
  23619. * @private
  23620. * @param {string} key The key of the property to get.
  23621. * @param {*} srcValue The value to match.
  23622. * @returns {Function} Returns the new spec function.
  23623. */
  23624. function matchesStrictComparable(key, srcValue) {
  23625. return function(object) {
  23626. if (object == null) {
  23627. return false;
  23628. }
  23629. return object[key] === srcValue &&
  23630. (srcValue !== undefined || (key in Object(object)));
  23631. };
  23632. }
  23633. /**
  23634. * A specialized version of `_.memoize` which clears the memoized function's
  23635. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23636. *
  23637. * @private
  23638. * @param {Function} func The function to have its output memoized.
  23639. * @returns {Function} Returns the new memoized function.
  23640. */
  23641. function memoizeCapped(func) {
  23642. var result = memoize(func, function(key) {
  23643. if (cache.size === MAX_MEMOIZE_SIZE) {
  23644. cache.clear();
  23645. }
  23646. return key;
  23647. });
  23648. var cache = result.cache;
  23649. return result;
  23650. }
  23651. /**
  23652. * Merges the function metadata of `source` into `data`.
  23653. *
  23654. * Merging metadata reduces the number of wrappers used to invoke a function.
  23655. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23656. * may be applied regardless of execution order. Methods like `_.ary` and
  23657. * `_.rearg` modify function arguments, making the order in which they are
  23658. * executed important, preventing the merging of metadata. However, we make
  23659. * an exception for a safe combined case where curried functions have `_.ary`
  23660. * and or `_.rearg` applied.
  23661. *
  23662. * @private
  23663. * @param {Array} data The destination metadata.
  23664. * @param {Array} source The source metadata.
  23665. * @returns {Array} Returns `data`.
  23666. */
  23667. function mergeData(data, source) {
  23668. var bitmask = data[1],
  23669. srcBitmask = source[1],
  23670. newBitmask = bitmask | srcBitmask,
  23671. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23672. var isCombo =
  23673. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23674. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23675. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23676. // Exit early if metadata can't be merged.
  23677. if (!(isCommon || isCombo)) {
  23678. return data;
  23679. }
  23680. // Use source `thisArg` if available.
  23681. if (srcBitmask & WRAP_BIND_FLAG) {
  23682. data[2] = source[2];
  23683. // Set when currying a bound function.
  23684. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23685. }
  23686. // Compose partial arguments.
  23687. var value = source[3];
  23688. if (value) {
  23689. var partials = data[3];
  23690. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23691. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23692. }
  23693. // Compose partial right arguments.
  23694. value = source[5];
  23695. if (value) {
  23696. partials = data[5];
  23697. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23698. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23699. }
  23700. // Use source `argPos` if available.
  23701. value = source[7];
  23702. if (value) {
  23703. data[7] = value;
  23704. }
  23705. // Use source `ary` if it's smaller.
  23706. if (srcBitmask & WRAP_ARY_FLAG) {
  23707. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23708. }
  23709. // Use source `arity` if one is not provided.
  23710. if (data[9] == null) {
  23711. data[9] = source[9];
  23712. }
  23713. // Use source `func` and merge bitmasks.
  23714. data[0] = source[0];
  23715. data[1] = newBitmask;
  23716. return data;
  23717. }
  23718. /**
  23719. * This function is like
  23720. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23721. * except that it includes inherited enumerable properties.
  23722. *
  23723. * @private
  23724. * @param {Object} object The object to query.
  23725. * @returns {Array} Returns the array of property names.
  23726. */
  23727. function nativeKeysIn(object) {
  23728. var result = [];
  23729. if (object != null) {
  23730. for (var key in Object(object)) {
  23731. result.push(key);
  23732. }
  23733. }
  23734. return result;
  23735. }
  23736. /**
  23737. * Converts `value` to a string using `Object.prototype.toString`.
  23738. *
  23739. * @private
  23740. * @param {*} value The value to convert.
  23741. * @returns {string} Returns the converted string.
  23742. */
  23743. function objectToString(value) {
  23744. return nativeObjectToString.call(value);
  23745. }
  23746. /**
  23747. * A specialized version of `baseRest` which transforms the rest array.
  23748. *
  23749. * @private
  23750. * @param {Function} func The function to apply a rest parameter to.
  23751. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23752. * @param {Function} transform The rest array transform.
  23753. * @returns {Function} Returns the new function.
  23754. */
  23755. function overRest(func, start, transform) {
  23756. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23757. return function() {
  23758. var args = arguments,
  23759. index = -1,
  23760. length = nativeMax(args.length - start, 0),
  23761. array = Array(length);
  23762. while (++index < length) {
  23763. array[index] = args[start + index];
  23764. }
  23765. index = -1;
  23766. var otherArgs = Array(start + 1);
  23767. while (++index < start) {
  23768. otherArgs[index] = args[index];
  23769. }
  23770. otherArgs[start] = transform(array);
  23771. return apply(func, this, otherArgs);
  23772. };
  23773. }
  23774. /**
  23775. * Gets the parent value at `path` of `object`.
  23776. *
  23777. * @private
  23778. * @param {Object} object The object to query.
  23779. * @param {Array} path The path to get the parent value of.
  23780. * @returns {*} Returns the parent value.
  23781. */
  23782. function parent(object, path) {
  23783. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23784. }
  23785. /**
  23786. * Reorder `array` according to the specified indexes where the element at
  23787. * the first index is assigned as the first element, the element at
  23788. * the second index is assigned as the second element, and so on.
  23789. *
  23790. * @private
  23791. * @param {Array} array The array to reorder.
  23792. * @param {Array} indexes The arranged array indexes.
  23793. * @returns {Array} Returns `array`.
  23794. */
  23795. function reorder(array, indexes) {
  23796. var arrLength = array.length,
  23797. length = nativeMin(indexes.length, arrLength),
  23798. oldArray = copyArray(array);
  23799. while (length--) {
  23800. var index = indexes[length];
  23801. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  23802. }
  23803. return array;
  23804. }
  23805. /**
  23806. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  23807. *
  23808. * @private
  23809. * @param {Object} object The object to query.
  23810. * @param {string} key The key of the property to get.
  23811. * @returns {*} Returns the property value.
  23812. */
  23813. function safeGet(object, key) {
  23814. if (key === 'constructor' && typeof object[key] === 'function') {
  23815. return;
  23816. }
  23817. if (key == '__proto__') {
  23818. return;
  23819. }
  23820. return object[key];
  23821. }
  23822. /**
  23823. * Sets metadata for `func`.
  23824. *
  23825. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  23826. * period of time, it will trip its breaker and transition to an identity
  23827. * function to avoid garbage collection pauses in V8. See
  23828. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  23829. * for more details.
  23830. *
  23831. * @private
  23832. * @param {Function} func The function to associate metadata with.
  23833. * @param {*} data The metadata.
  23834. * @returns {Function} Returns `func`.
  23835. */
  23836. var setData = shortOut(baseSetData);
  23837. /**
  23838. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  23839. *
  23840. * @private
  23841. * @param {Function} func The function to delay.
  23842. * @param {number} wait The number of milliseconds to delay invocation.
  23843. * @returns {number|Object} Returns the timer id or timeout object.
  23844. */
  23845. var setTimeout = ctxSetTimeout || function(func, wait) {
  23846. return root.setTimeout(func, wait);
  23847. };
  23848. /**
  23849. * Sets the `toString` method of `func` to return `string`.
  23850. *
  23851. * @private
  23852. * @param {Function} func The function to modify.
  23853. * @param {Function} string The `toString` result.
  23854. * @returns {Function} Returns `func`.
  23855. */
  23856. var setToString = shortOut(baseSetToString);
  23857. /**
  23858. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  23859. * with wrapper details in a comment at the top of the source body.
  23860. *
  23861. * @private
  23862. * @param {Function} wrapper The function to modify.
  23863. * @param {Function} reference The reference function.
  23864. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23865. * @returns {Function} Returns `wrapper`.
  23866. */
  23867. function setWrapToString(wrapper, reference, bitmask) {
  23868. var source = (reference + '');
  23869. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  23870. }
  23871. /**
  23872. * Creates a function that'll short out and invoke `identity` instead
  23873. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  23874. * milliseconds.
  23875. *
  23876. * @private
  23877. * @param {Function} func The function to restrict.
  23878. * @returns {Function} Returns the new shortable function.
  23879. */
  23880. function shortOut(func) {
  23881. var count = 0,
  23882. lastCalled = 0;
  23883. return function() {
  23884. var stamp = nativeNow(),
  23885. remaining = HOT_SPAN - (stamp - lastCalled);
  23886. lastCalled = stamp;
  23887. if (remaining > 0) {
  23888. if (++count >= HOT_COUNT) {
  23889. return arguments[0];
  23890. }
  23891. } else {
  23892. count = 0;
  23893. }
  23894. return func.apply(undefined, arguments);
  23895. };
  23896. }
  23897. /**
  23898. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  23899. *
  23900. * @private
  23901. * @param {Array} array The array to shuffle.
  23902. * @param {number} [size=array.length] The size of `array`.
  23903. * @returns {Array} Returns `array`.
  23904. */
  23905. function shuffleSelf(array, size) {
  23906. var index = -1,
  23907. length = array.length,
  23908. lastIndex = length - 1;
  23909. size = size === undefined ? length : size;
  23910. while (++index < size) {
  23911. var rand = baseRandom(index, lastIndex),
  23912. value = array[rand];
  23913. array[rand] = array[index];
  23914. array[index] = value;
  23915. }
  23916. array.length = size;
  23917. return array;
  23918. }
  23919. /**
  23920. * Converts `string` to a property path array.
  23921. *
  23922. * @private
  23923. * @param {string} string The string to convert.
  23924. * @returns {Array} Returns the property path array.
  23925. */
  23926. var stringToPath = memoizeCapped(function(string) {
  23927. var result = [];
  23928. if (string.charCodeAt(0) === 46 /* . */) {
  23929. result.push('');
  23930. }
  23931. string.replace(rePropName, function(match, number, quote, subString) {
  23932. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  23933. });
  23934. return result;
  23935. });
  23936. /**
  23937. * Converts `value` to a string key if it's not a string or symbol.
  23938. *
  23939. * @private
  23940. * @param {*} value The value to inspect.
  23941. * @returns {string|symbol} Returns the key.
  23942. */
  23943. function toKey(value) {
  23944. if (typeof value == 'string' || isSymbol(value)) {
  23945. return value;
  23946. }
  23947. var result = (value + '');
  23948. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23949. }
  23950. /**
  23951. * Converts `func` to its source code.
  23952. *
  23953. * @private
  23954. * @param {Function} func The function to convert.
  23955. * @returns {string} Returns the source code.
  23956. */
  23957. function toSource(func) {
  23958. if (func != null) {
  23959. try {
  23960. return funcToString.call(func);
  23961. } catch (e) {}
  23962. try {
  23963. return (func + '');
  23964. } catch (e) {}
  23965. }
  23966. return '';
  23967. }
  23968. /**
  23969. * Updates wrapper `details` based on `bitmask` flags.
  23970. *
  23971. * @private
  23972. * @returns {Array} details The details to modify.
  23973. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23974. * @returns {Array} Returns `details`.
  23975. */
  23976. function updateWrapDetails(details, bitmask) {
  23977. arrayEach(wrapFlags, function(pair) {
  23978. var value = '_.' + pair[0];
  23979. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  23980. details.push(value);
  23981. }
  23982. });
  23983. return details.sort();
  23984. }
  23985. /**
  23986. * Creates a clone of `wrapper`.
  23987. *
  23988. * @private
  23989. * @param {Object} wrapper The wrapper to clone.
  23990. * @returns {Object} Returns the cloned wrapper.
  23991. */
  23992. function wrapperClone(wrapper) {
  23993. if (wrapper instanceof LazyWrapper) {
  23994. return wrapper.clone();
  23995. }
  23996. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  23997. result.__actions__ = copyArray(wrapper.__actions__);
  23998. result.__index__ = wrapper.__index__;
  23999. result.__values__ = wrapper.__values__;
  24000. return result;
  24001. }
  24002. /*------------------------------------------------------------------------*/
  24003. /**
  24004. * Creates an array of elements split into groups the length of `size`.
  24005. * If `array` can't be split evenly, the final chunk will be the remaining
  24006. * elements.
  24007. *
  24008. * @static
  24009. * @memberOf _
  24010. * @since 3.0.0
  24011. * @category Array
  24012. * @param {Array} array The array to process.
  24013. * @param {number} [size=1] The length of each chunk
  24014. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24015. * @returns {Array} Returns the new array of chunks.
  24016. * @example
  24017. *
  24018. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24019. * // => [['a', 'b'], ['c', 'd']]
  24020. *
  24021. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24022. * // => [['a', 'b', 'c'], ['d']]
  24023. */
  24024. function chunk(array, size, guard) {
  24025. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24026. size = 1;
  24027. } else {
  24028. size = nativeMax(toInteger(size), 0);
  24029. }
  24030. var length = array == null ? 0 : array.length;
  24031. if (!length || size < 1) {
  24032. return [];
  24033. }
  24034. var index = 0,
  24035. resIndex = 0,
  24036. result = Array(nativeCeil(length / size));
  24037. while (index < length) {
  24038. result[resIndex++] = baseSlice(array, index, (index += size));
  24039. }
  24040. return result;
  24041. }
  24042. /**
  24043. * Creates an array with all falsey values removed. The values `false`, `null`,
  24044. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24045. *
  24046. * @static
  24047. * @memberOf _
  24048. * @since 0.1.0
  24049. * @category Array
  24050. * @param {Array} array The array to compact.
  24051. * @returns {Array} Returns the new array of filtered values.
  24052. * @example
  24053. *
  24054. * _.compact([0, 1, false, 2, '', 3]);
  24055. * // => [1, 2, 3]
  24056. */
  24057. function compact(array) {
  24058. var index = -1,
  24059. length = array == null ? 0 : array.length,
  24060. resIndex = 0,
  24061. result = [];
  24062. while (++index < length) {
  24063. var value = array[index];
  24064. if (value) {
  24065. result[resIndex++] = value;
  24066. }
  24067. }
  24068. return result;
  24069. }
  24070. /**
  24071. * Creates a new array concatenating `array` with any additional arrays
  24072. * and/or values.
  24073. *
  24074. * @static
  24075. * @memberOf _
  24076. * @since 4.0.0
  24077. * @category Array
  24078. * @param {Array} array The array to concatenate.
  24079. * @param {...*} [values] The values to concatenate.
  24080. * @returns {Array} Returns the new concatenated array.
  24081. * @example
  24082. *
  24083. * var array = [1];
  24084. * var other = _.concat(array, 2, [3], [[4]]);
  24085. *
  24086. * console.log(other);
  24087. * // => [1, 2, 3, [4]]
  24088. *
  24089. * console.log(array);
  24090. * // => [1]
  24091. */
  24092. function concat() {
  24093. var length = arguments.length;
  24094. if (!length) {
  24095. return [];
  24096. }
  24097. var args = Array(length - 1),
  24098. array = arguments[0],
  24099. index = length;
  24100. while (index--) {
  24101. args[index - 1] = arguments[index];
  24102. }
  24103. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24104. }
  24105. /**
  24106. * Creates an array of `array` values not included in the other given arrays
  24107. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24108. * for equality comparisons. The order and references of result values are
  24109. * determined by the first array.
  24110. *
  24111. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24112. *
  24113. * @static
  24114. * @memberOf _
  24115. * @since 0.1.0
  24116. * @category Array
  24117. * @param {Array} array The array to inspect.
  24118. * @param {...Array} [values] The values to exclude.
  24119. * @returns {Array} Returns the new array of filtered values.
  24120. * @see _.without, _.xor
  24121. * @example
  24122. *
  24123. * _.difference([2, 1], [2, 3]);
  24124. * // => [1]
  24125. */
  24126. var difference = baseRest(function(array, values) {
  24127. return isArrayLikeObject(array)
  24128. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24129. : [];
  24130. });
  24131. /**
  24132. * This method is like `_.difference` except that it accepts `iteratee` which
  24133. * is invoked for each element of `array` and `values` to generate the criterion
  24134. * by which they're compared. The order and references of result values are
  24135. * determined by the first array. The iteratee is invoked with one argument:
  24136. * (value).
  24137. *
  24138. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24139. *
  24140. * @static
  24141. * @memberOf _
  24142. * @since 4.0.0
  24143. * @category Array
  24144. * @param {Array} array The array to inspect.
  24145. * @param {...Array} [values] The values to exclude.
  24146. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24147. * @returns {Array} Returns the new array of filtered values.
  24148. * @example
  24149. *
  24150. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24151. * // => [1.2]
  24152. *
  24153. * // The `_.property` iteratee shorthand.
  24154. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24155. * // => [{ 'x': 2 }]
  24156. */
  24157. var differenceBy = baseRest(function(array, values) {
  24158. var iteratee = last(values);
  24159. if (isArrayLikeObject(iteratee)) {
  24160. iteratee = undefined;
  24161. }
  24162. return isArrayLikeObject(array)
  24163. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24164. : [];
  24165. });
  24166. /**
  24167. * This method is like `_.difference` except that it accepts `comparator`
  24168. * which is invoked to compare elements of `array` to `values`. The order and
  24169. * references of result values are determined by the first array. The comparator
  24170. * is invoked with two arguments: (arrVal, othVal).
  24171. *
  24172. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24173. *
  24174. * @static
  24175. * @memberOf _
  24176. * @since 4.0.0
  24177. * @category Array
  24178. * @param {Array} array The array to inspect.
  24179. * @param {...Array} [values] The values to exclude.
  24180. * @param {Function} [comparator] The comparator invoked per element.
  24181. * @returns {Array} Returns the new array of filtered values.
  24182. * @example
  24183. *
  24184. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24185. *
  24186. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24187. * // => [{ 'x': 2, 'y': 1 }]
  24188. */
  24189. var differenceWith = baseRest(function(array, values) {
  24190. var comparator = last(values);
  24191. if (isArrayLikeObject(comparator)) {
  24192. comparator = undefined;
  24193. }
  24194. return isArrayLikeObject(array)
  24195. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24196. : [];
  24197. });
  24198. /**
  24199. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24200. *
  24201. * @static
  24202. * @memberOf _
  24203. * @since 0.5.0
  24204. * @category Array
  24205. * @param {Array} array The array to query.
  24206. * @param {number} [n=1] The number of elements to drop.
  24207. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24208. * @returns {Array} Returns the slice of `array`.
  24209. * @example
  24210. *
  24211. * _.drop([1, 2, 3]);
  24212. * // => [2, 3]
  24213. *
  24214. * _.drop([1, 2, 3], 2);
  24215. * // => [3]
  24216. *
  24217. * _.drop([1, 2, 3], 5);
  24218. * // => []
  24219. *
  24220. * _.drop([1, 2, 3], 0);
  24221. * // => [1, 2, 3]
  24222. */
  24223. function drop(array, n, guard) {
  24224. var length = array == null ? 0 : array.length;
  24225. if (!length) {
  24226. return [];
  24227. }
  24228. n = (guard || n === undefined) ? 1 : toInteger(n);
  24229. return baseSlice(array, n < 0 ? 0 : n, length);
  24230. }
  24231. /**
  24232. * Creates a slice of `array` with `n` elements dropped from the end.
  24233. *
  24234. * @static
  24235. * @memberOf _
  24236. * @since 3.0.0
  24237. * @category Array
  24238. * @param {Array} array The array to query.
  24239. * @param {number} [n=1] The number of elements to drop.
  24240. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24241. * @returns {Array} Returns the slice of `array`.
  24242. * @example
  24243. *
  24244. * _.dropRight([1, 2, 3]);
  24245. * // => [1, 2]
  24246. *
  24247. * _.dropRight([1, 2, 3], 2);
  24248. * // => [1]
  24249. *
  24250. * _.dropRight([1, 2, 3], 5);
  24251. * // => []
  24252. *
  24253. * _.dropRight([1, 2, 3], 0);
  24254. * // => [1, 2, 3]
  24255. */
  24256. function dropRight(array, n, guard) {
  24257. var length = array == null ? 0 : array.length;
  24258. if (!length) {
  24259. return [];
  24260. }
  24261. n = (guard || n === undefined) ? 1 : toInteger(n);
  24262. n = length - n;
  24263. return baseSlice(array, 0, n < 0 ? 0 : n);
  24264. }
  24265. /**
  24266. * Creates a slice of `array` excluding elements dropped from the end.
  24267. * Elements are dropped until `predicate` returns falsey. The predicate is
  24268. * invoked with three arguments: (value, index, array).
  24269. *
  24270. * @static
  24271. * @memberOf _
  24272. * @since 3.0.0
  24273. * @category Array
  24274. * @param {Array} array The array to query.
  24275. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24276. * @returns {Array} Returns the slice of `array`.
  24277. * @example
  24278. *
  24279. * var users = [
  24280. * { 'user': 'barney', 'active': true },
  24281. * { 'user': 'fred', 'active': false },
  24282. * { 'user': 'pebbles', 'active': false }
  24283. * ];
  24284. *
  24285. * _.dropRightWhile(users, function(o) { return !o.active; });
  24286. * // => objects for ['barney']
  24287. *
  24288. * // The `_.matches` iteratee shorthand.
  24289. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24290. * // => objects for ['barney', 'fred']
  24291. *
  24292. * // The `_.matchesProperty` iteratee shorthand.
  24293. * _.dropRightWhile(users, ['active', false]);
  24294. * // => objects for ['barney']
  24295. *
  24296. * // The `_.property` iteratee shorthand.
  24297. * _.dropRightWhile(users, 'active');
  24298. * // => objects for ['barney', 'fred', 'pebbles']
  24299. */
  24300. function dropRightWhile(array, predicate) {
  24301. return (array && array.length)
  24302. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24303. : [];
  24304. }
  24305. /**
  24306. * Creates a slice of `array` excluding elements dropped from the beginning.
  24307. * Elements are dropped until `predicate` returns falsey. The predicate is
  24308. * invoked with three arguments: (value, index, array).
  24309. *
  24310. * @static
  24311. * @memberOf _
  24312. * @since 3.0.0
  24313. * @category Array
  24314. * @param {Array} array The array to query.
  24315. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24316. * @returns {Array} Returns the slice of `array`.
  24317. * @example
  24318. *
  24319. * var users = [
  24320. * { 'user': 'barney', 'active': false },
  24321. * { 'user': 'fred', 'active': false },
  24322. * { 'user': 'pebbles', 'active': true }
  24323. * ];
  24324. *
  24325. * _.dropWhile(users, function(o) { return !o.active; });
  24326. * // => objects for ['pebbles']
  24327. *
  24328. * // The `_.matches` iteratee shorthand.
  24329. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24330. * // => objects for ['fred', 'pebbles']
  24331. *
  24332. * // The `_.matchesProperty` iteratee shorthand.
  24333. * _.dropWhile(users, ['active', false]);
  24334. * // => objects for ['pebbles']
  24335. *
  24336. * // The `_.property` iteratee shorthand.
  24337. * _.dropWhile(users, 'active');
  24338. * // => objects for ['barney', 'fred', 'pebbles']
  24339. */
  24340. function dropWhile(array, predicate) {
  24341. return (array && array.length)
  24342. ? baseWhile(array, getIteratee(predicate, 3), true)
  24343. : [];
  24344. }
  24345. /**
  24346. * Fills elements of `array` with `value` from `start` up to, but not
  24347. * including, `end`.
  24348. *
  24349. * **Note:** This method mutates `array`.
  24350. *
  24351. * @static
  24352. * @memberOf _
  24353. * @since 3.2.0
  24354. * @category Array
  24355. * @param {Array} array The array to fill.
  24356. * @param {*} value The value to fill `array` with.
  24357. * @param {number} [start=0] The start position.
  24358. * @param {number} [end=array.length] The end position.
  24359. * @returns {Array} Returns `array`.
  24360. * @example
  24361. *
  24362. * var array = [1, 2, 3];
  24363. *
  24364. * _.fill(array, 'a');
  24365. * console.log(array);
  24366. * // => ['a', 'a', 'a']
  24367. *
  24368. * _.fill(Array(3), 2);
  24369. * // => [2, 2, 2]
  24370. *
  24371. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24372. * // => [4, '*', '*', 10]
  24373. */
  24374. function fill(array, value, start, end) {
  24375. var length = array == null ? 0 : array.length;
  24376. if (!length) {
  24377. return [];
  24378. }
  24379. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24380. start = 0;
  24381. end = length;
  24382. }
  24383. return baseFill(array, value, start, end);
  24384. }
  24385. /**
  24386. * This method is like `_.find` except that it returns the index of the first
  24387. * element `predicate` returns truthy for instead of the element itself.
  24388. *
  24389. * @static
  24390. * @memberOf _
  24391. * @since 1.1.0
  24392. * @category Array
  24393. * @param {Array} array The array to inspect.
  24394. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24395. * @param {number} [fromIndex=0] The index to search from.
  24396. * @returns {number} Returns the index of the found element, else `-1`.
  24397. * @example
  24398. *
  24399. * var users = [
  24400. * { 'user': 'barney', 'active': false },
  24401. * { 'user': 'fred', 'active': false },
  24402. * { 'user': 'pebbles', 'active': true }
  24403. * ];
  24404. *
  24405. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24406. * // => 0
  24407. *
  24408. * // The `_.matches` iteratee shorthand.
  24409. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24410. * // => 1
  24411. *
  24412. * // The `_.matchesProperty` iteratee shorthand.
  24413. * _.findIndex(users, ['active', false]);
  24414. * // => 0
  24415. *
  24416. * // The `_.property` iteratee shorthand.
  24417. * _.findIndex(users, 'active');
  24418. * // => 2
  24419. */
  24420. function findIndex(array, predicate, fromIndex) {
  24421. var length = array == null ? 0 : array.length;
  24422. if (!length) {
  24423. return -1;
  24424. }
  24425. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24426. if (index < 0) {
  24427. index = nativeMax(length + index, 0);
  24428. }
  24429. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24430. }
  24431. /**
  24432. * This method is like `_.findIndex` except that it iterates over elements
  24433. * of `collection` from right to left.
  24434. *
  24435. * @static
  24436. * @memberOf _
  24437. * @since 2.0.0
  24438. * @category Array
  24439. * @param {Array} array The array to inspect.
  24440. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24441. * @param {number} [fromIndex=array.length-1] The index to search from.
  24442. * @returns {number} Returns the index of the found element, else `-1`.
  24443. * @example
  24444. *
  24445. * var users = [
  24446. * { 'user': 'barney', 'active': true },
  24447. * { 'user': 'fred', 'active': false },
  24448. * { 'user': 'pebbles', 'active': false }
  24449. * ];
  24450. *
  24451. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24452. * // => 2
  24453. *
  24454. * // The `_.matches` iteratee shorthand.
  24455. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24456. * // => 0
  24457. *
  24458. * // The `_.matchesProperty` iteratee shorthand.
  24459. * _.findLastIndex(users, ['active', false]);
  24460. * // => 2
  24461. *
  24462. * // The `_.property` iteratee shorthand.
  24463. * _.findLastIndex(users, 'active');
  24464. * // => 0
  24465. */
  24466. function findLastIndex(array, predicate, fromIndex) {
  24467. var length = array == null ? 0 : array.length;
  24468. if (!length) {
  24469. return -1;
  24470. }
  24471. var index = length - 1;
  24472. if (fromIndex !== undefined) {
  24473. index = toInteger(fromIndex);
  24474. index = fromIndex < 0
  24475. ? nativeMax(length + index, 0)
  24476. : nativeMin(index, length - 1);
  24477. }
  24478. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24479. }
  24480. /**
  24481. * Flattens `array` a single level deep.
  24482. *
  24483. * @static
  24484. * @memberOf _
  24485. * @since 0.1.0
  24486. * @category Array
  24487. * @param {Array} array The array to flatten.
  24488. * @returns {Array} Returns the new flattened array.
  24489. * @example
  24490. *
  24491. * _.flatten([1, [2, [3, [4]], 5]]);
  24492. * // => [1, 2, [3, [4]], 5]
  24493. */
  24494. function flatten(array) {
  24495. var length = array == null ? 0 : array.length;
  24496. return length ? baseFlatten(array, 1) : [];
  24497. }
  24498. /**
  24499. * Recursively flattens `array`.
  24500. *
  24501. * @static
  24502. * @memberOf _
  24503. * @since 3.0.0
  24504. * @category Array
  24505. * @param {Array} array The array to flatten.
  24506. * @returns {Array} Returns the new flattened array.
  24507. * @example
  24508. *
  24509. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24510. * // => [1, 2, 3, 4, 5]
  24511. */
  24512. function flattenDeep(array) {
  24513. var length = array == null ? 0 : array.length;
  24514. return length ? baseFlatten(array, INFINITY) : [];
  24515. }
  24516. /**
  24517. * Recursively flatten `array` up to `depth` times.
  24518. *
  24519. * @static
  24520. * @memberOf _
  24521. * @since 4.4.0
  24522. * @category Array
  24523. * @param {Array} array The array to flatten.
  24524. * @param {number} [depth=1] The maximum recursion depth.
  24525. * @returns {Array} Returns the new flattened array.
  24526. * @example
  24527. *
  24528. * var array = [1, [2, [3, [4]], 5]];
  24529. *
  24530. * _.flattenDepth(array, 1);
  24531. * // => [1, 2, [3, [4]], 5]
  24532. *
  24533. * _.flattenDepth(array, 2);
  24534. * // => [1, 2, 3, [4], 5]
  24535. */
  24536. function flattenDepth(array, depth) {
  24537. var length = array == null ? 0 : array.length;
  24538. if (!length) {
  24539. return [];
  24540. }
  24541. depth = depth === undefined ? 1 : toInteger(depth);
  24542. return baseFlatten(array, depth);
  24543. }
  24544. /**
  24545. * The inverse of `_.toPairs`; this method returns an object composed
  24546. * from key-value `pairs`.
  24547. *
  24548. * @static
  24549. * @memberOf _
  24550. * @since 4.0.0
  24551. * @category Array
  24552. * @param {Array} pairs The key-value pairs.
  24553. * @returns {Object} Returns the new object.
  24554. * @example
  24555. *
  24556. * _.fromPairs([['a', 1], ['b', 2]]);
  24557. * // => { 'a': 1, 'b': 2 }
  24558. */
  24559. function fromPairs(pairs) {
  24560. var index = -1,
  24561. length = pairs == null ? 0 : pairs.length,
  24562. result = {};
  24563. while (++index < length) {
  24564. var pair = pairs[index];
  24565. result[pair[0]] = pair[1];
  24566. }
  24567. return result;
  24568. }
  24569. /**
  24570. * Gets the first element of `array`.
  24571. *
  24572. * @static
  24573. * @memberOf _
  24574. * @since 0.1.0
  24575. * @alias first
  24576. * @category Array
  24577. * @param {Array} array The array to query.
  24578. * @returns {*} Returns the first element of `array`.
  24579. * @example
  24580. *
  24581. * _.head([1, 2, 3]);
  24582. * // => 1
  24583. *
  24584. * _.head([]);
  24585. * // => undefined
  24586. */
  24587. function head(array) {
  24588. return (array && array.length) ? array[0] : undefined;
  24589. }
  24590. /**
  24591. * Gets the index at which the first occurrence of `value` is found in `array`
  24592. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24593. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24594. * offset from the end of `array`.
  24595. *
  24596. * @static
  24597. * @memberOf _
  24598. * @since 0.1.0
  24599. * @category Array
  24600. * @param {Array} array The array to inspect.
  24601. * @param {*} value The value to search for.
  24602. * @param {number} [fromIndex=0] The index to search from.
  24603. * @returns {number} Returns the index of the matched value, else `-1`.
  24604. * @example
  24605. *
  24606. * _.indexOf([1, 2, 1, 2], 2);
  24607. * // => 1
  24608. *
  24609. * // Search from the `fromIndex`.
  24610. * _.indexOf([1, 2, 1, 2], 2, 2);
  24611. * // => 3
  24612. */
  24613. function indexOf(array, value, fromIndex) {
  24614. var length = array == null ? 0 : array.length;
  24615. if (!length) {
  24616. return -1;
  24617. }
  24618. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24619. if (index < 0) {
  24620. index = nativeMax(length + index, 0);
  24621. }
  24622. return baseIndexOf(array, value, index);
  24623. }
  24624. /**
  24625. * Gets all but the last element of `array`.
  24626. *
  24627. * @static
  24628. * @memberOf _
  24629. * @since 0.1.0
  24630. * @category Array
  24631. * @param {Array} array The array to query.
  24632. * @returns {Array} Returns the slice of `array`.
  24633. * @example
  24634. *
  24635. * _.initial([1, 2, 3]);
  24636. * // => [1, 2]
  24637. */
  24638. function initial(array) {
  24639. var length = array == null ? 0 : array.length;
  24640. return length ? baseSlice(array, 0, -1) : [];
  24641. }
  24642. /**
  24643. * Creates an array of unique values that are included in all given arrays
  24644. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24645. * for equality comparisons. The order and references of result values are
  24646. * determined by the first array.
  24647. *
  24648. * @static
  24649. * @memberOf _
  24650. * @since 0.1.0
  24651. * @category Array
  24652. * @param {...Array} [arrays] The arrays to inspect.
  24653. * @returns {Array} Returns the new array of intersecting values.
  24654. * @example
  24655. *
  24656. * _.intersection([2, 1], [2, 3]);
  24657. * // => [2]
  24658. */
  24659. var intersection = baseRest(function(arrays) {
  24660. var mapped = arrayMap(arrays, castArrayLikeObject);
  24661. return (mapped.length && mapped[0] === arrays[0])
  24662. ? baseIntersection(mapped)
  24663. : [];
  24664. });
  24665. /**
  24666. * This method is like `_.intersection` except that it accepts `iteratee`
  24667. * which is invoked for each element of each `arrays` to generate the criterion
  24668. * by which they're compared. The order and references of result values are
  24669. * determined by the first array. The iteratee is invoked with one argument:
  24670. * (value).
  24671. *
  24672. * @static
  24673. * @memberOf _
  24674. * @since 4.0.0
  24675. * @category Array
  24676. * @param {...Array} [arrays] The arrays to inspect.
  24677. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24678. * @returns {Array} Returns the new array of intersecting values.
  24679. * @example
  24680. *
  24681. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24682. * // => [2.1]
  24683. *
  24684. * // The `_.property` iteratee shorthand.
  24685. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24686. * // => [{ 'x': 1 }]
  24687. */
  24688. var intersectionBy = baseRest(function(arrays) {
  24689. var iteratee = last(arrays),
  24690. mapped = arrayMap(arrays, castArrayLikeObject);
  24691. if (iteratee === last(mapped)) {
  24692. iteratee = undefined;
  24693. } else {
  24694. mapped.pop();
  24695. }
  24696. return (mapped.length && mapped[0] === arrays[0])
  24697. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24698. : [];
  24699. });
  24700. /**
  24701. * This method is like `_.intersection` except that it accepts `comparator`
  24702. * which is invoked to compare elements of `arrays`. The order and references
  24703. * of result values are determined by the first array. The comparator is
  24704. * invoked with two arguments: (arrVal, othVal).
  24705. *
  24706. * @static
  24707. * @memberOf _
  24708. * @since 4.0.0
  24709. * @category Array
  24710. * @param {...Array} [arrays] The arrays to inspect.
  24711. * @param {Function} [comparator] The comparator invoked per element.
  24712. * @returns {Array} Returns the new array of intersecting values.
  24713. * @example
  24714. *
  24715. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24716. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24717. *
  24718. * _.intersectionWith(objects, others, _.isEqual);
  24719. * // => [{ 'x': 1, 'y': 2 }]
  24720. */
  24721. var intersectionWith = baseRest(function(arrays) {
  24722. var comparator = last(arrays),
  24723. mapped = arrayMap(arrays, castArrayLikeObject);
  24724. comparator = typeof comparator == 'function' ? comparator : undefined;
  24725. if (comparator) {
  24726. mapped.pop();
  24727. }
  24728. return (mapped.length && mapped[0] === arrays[0])
  24729. ? baseIntersection(mapped, undefined, comparator)
  24730. : [];
  24731. });
  24732. /**
  24733. * Converts all elements in `array` into a string separated by `separator`.
  24734. *
  24735. * @static
  24736. * @memberOf _
  24737. * @since 4.0.0
  24738. * @category Array
  24739. * @param {Array} array The array to convert.
  24740. * @param {string} [separator=','] The element separator.
  24741. * @returns {string} Returns the joined string.
  24742. * @example
  24743. *
  24744. * _.join(['a', 'b', 'c'], '~');
  24745. * // => 'a~b~c'
  24746. */
  24747. function join(array, separator) {
  24748. return array == null ? '' : nativeJoin.call(array, separator);
  24749. }
  24750. /**
  24751. * Gets the last element of `array`.
  24752. *
  24753. * @static
  24754. * @memberOf _
  24755. * @since 0.1.0
  24756. * @category Array
  24757. * @param {Array} array The array to query.
  24758. * @returns {*} Returns the last element of `array`.
  24759. * @example
  24760. *
  24761. * _.last([1, 2, 3]);
  24762. * // => 3
  24763. */
  24764. function last(array) {
  24765. var length = array == null ? 0 : array.length;
  24766. return length ? array[length - 1] : undefined;
  24767. }
  24768. /**
  24769. * This method is like `_.indexOf` except that it iterates over elements of
  24770. * `array` from right to left.
  24771. *
  24772. * @static
  24773. * @memberOf _
  24774. * @since 0.1.0
  24775. * @category Array
  24776. * @param {Array} array The array to inspect.
  24777. * @param {*} value The value to search for.
  24778. * @param {number} [fromIndex=array.length-1] The index to search from.
  24779. * @returns {number} Returns the index of the matched value, else `-1`.
  24780. * @example
  24781. *
  24782. * _.lastIndexOf([1, 2, 1, 2], 2);
  24783. * // => 3
  24784. *
  24785. * // Search from the `fromIndex`.
  24786. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24787. * // => 1
  24788. */
  24789. function lastIndexOf(array, value, fromIndex) {
  24790. var length = array == null ? 0 : array.length;
  24791. if (!length) {
  24792. return -1;
  24793. }
  24794. var index = length;
  24795. if (fromIndex !== undefined) {
  24796. index = toInteger(fromIndex);
  24797. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24798. }
  24799. return value === value
  24800. ? strictLastIndexOf(array, value, index)
  24801. : baseFindIndex(array, baseIsNaN, index, true);
  24802. }
  24803. /**
  24804. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  24805. * element from the end is returned.
  24806. *
  24807. * @static
  24808. * @memberOf _
  24809. * @since 4.11.0
  24810. * @category Array
  24811. * @param {Array} array The array to query.
  24812. * @param {number} [n=0] The index of the element to return.
  24813. * @returns {*} Returns the nth element of `array`.
  24814. * @example
  24815. *
  24816. * var array = ['a', 'b', 'c', 'd'];
  24817. *
  24818. * _.nth(array, 1);
  24819. * // => 'b'
  24820. *
  24821. * _.nth(array, -2);
  24822. * // => 'c';
  24823. */
  24824. function nth(array, n) {
  24825. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  24826. }
  24827. /**
  24828. * Removes all given values from `array` using
  24829. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24830. * for equality comparisons.
  24831. *
  24832. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  24833. * to remove elements from an array by predicate.
  24834. *
  24835. * @static
  24836. * @memberOf _
  24837. * @since 2.0.0
  24838. * @category Array
  24839. * @param {Array} array The array to modify.
  24840. * @param {...*} [values] The values to remove.
  24841. * @returns {Array} Returns `array`.
  24842. * @example
  24843. *
  24844. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24845. *
  24846. * _.pull(array, 'a', 'c');
  24847. * console.log(array);
  24848. * // => ['b', 'b']
  24849. */
  24850. var pull = baseRest(pullAll);
  24851. /**
  24852. * This method is like `_.pull` except that it accepts an array of values to remove.
  24853. *
  24854. * **Note:** Unlike `_.difference`, this method mutates `array`.
  24855. *
  24856. * @static
  24857. * @memberOf _
  24858. * @since 4.0.0
  24859. * @category Array
  24860. * @param {Array} array The array to modify.
  24861. * @param {Array} values The values to remove.
  24862. * @returns {Array} Returns `array`.
  24863. * @example
  24864. *
  24865. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24866. *
  24867. * _.pullAll(array, ['a', 'c']);
  24868. * console.log(array);
  24869. * // => ['b', 'b']
  24870. */
  24871. function pullAll(array, values) {
  24872. return (array && array.length && values && values.length)
  24873. ? basePullAll(array, values)
  24874. : array;
  24875. }
  24876. /**
  24877. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  24878. * invoked for each element of `array` and `values` to generate the criterion
  24879. * by which they're compared. The iteratee is invoked with one argument: (value).
  24880. *
  24881. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  24882. *
  24883. * @static
  24884. * @memberOf _
  24885. * @since 4.0.0
  24886. * @category Array
  24887. * @param {Array} array The array to modify.
  24888. * @param {Array} values The values to remove.
  24889. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24890. * @returns {Array} Returns `array`.
  24891. * @example
  24892. *
  24893. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  24894. *
  24895. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  24896. * console.log(array);
  24897. * // => [{ 'x': 2 }]
  24898. */
  24899. function pullAllBy(array, values, iteratee) {
  24900. return (array && array.length && values && values.length)
  24901. ? basePullAll(array, values, getIteratee(iteratee, 2))
  24902. : array;
  24903. }
  24904. /**
  24905. * This method is like `_.pullAll` except that it accepts `comparator` which
  24906. * is invoked to compare elements of `array` to `values`. The comparator is
  24907. * invoked with two arguments: (arrVal, othVal).
  24908. *
  24909. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  24910. *
  24911. * @static
  24912. * @memberOf _
  24913. * @since 4.6.0
  24914. * @category Array
  24915. * @param {Array} array The array to modify.
  24916. * @param {Array} values The values to remove.
  24917. * @param {Function} [comparator] The comparator invoked per element.
  24918. * @returns {Array} Returns `array`.
  24919. * @example
  24920. *
  24921. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  24922. *
  24923. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  24924. * console.log(array);
  24925. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  24926. */
  24927. function pullAllWith(array, values, comparator) {
  24928. return (array && array.length && values && values.length)
  24929. ? basePullAll(array, values, undefined, comparator)
  24930. : array;
  24931. }
  24932. /**
  24933. * Removes elements from `array` corresponding to `indexes` and returns an
  24934. * array of removed elements.
  24935. *
  24936. * **Note:** Unlike `_.at`, this method mutates `array`.
  24937. *
  24938. * @static
  24939. * @memberOf _
  24940. * @since 3.0.0
  24941. * @category Array
  24942. * @param {Array} array The array to modify.
  24943. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  24944. * @returns {Array} Returns the new array of removed elements.
  24945. * @example
  24946. *
  24947. * var array = ['a', 'b', 'c', 'd'];
  24948. * var pulled = _.pullAt(array, [1, 3]);
  24949. *
  24950. * console.log(array);
  24951. * // => ['a', 'c']
  24952. *
  24953. * console.log(pulled);
  24954. * // => ['b', 'd']
  24955. */
  24956. var pullAt = flatRest(function(array, indexes) {
  24957. var length = array == null ? 0 : array.length,
  24958. result = baseAt(array, indexes);
  24959. basePullAt(array, arrayMap(indexes, function(index) {
  24960. return isIndex(index, length) ? +index : index;
  24961. }).sort(compareAscending));
  24962. return result;
  24963. });
  24964. /**
  24965. * Removes all elements from `array` that `predicate` returns truthy for
  24966. * and returns an array of the removed elements. The predicate is invoked
  24967. * with three arguments: (value, index, array).
  24968. *
  24969. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  24970. * to pull elements from an array by value.
  24971. *
  24972. * @static
  24973. * @memberOf _
  24974. * @since 2.0.0
  24975. * @category Array
  24976. * @param {Array} array The array to modify.
  24977. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24978. * @returns {Array} Returns the new array of removed elements.
  24979. * @example
  24980. *
  24981. * var array = [1, 2, 3, 4];
  24982. * var evens = _.remove(array, function(n) {
  24983. * return n % 2 == 0;
  24984. * });
  24985. *
  24986. * console.log(array);
  24987. * // => [1, 3]
  24988. *
  24989. * console.log(evens);
  24990. * // => [2, 4]
  24991. */
  24992. function remove(array, predicate) {
  24993. var result = [];
  24994. if (!(array && array.length)) {
  24995. return result;
  24996. }
  24997. var index = -1,
  24998. indexes = [],
  24999. length = array.length;
  25000. predicate = getIteratee(predicate, 3);
  25001. while (++index < length) {
  25002. var value = array[index];
  25003. if (predicate(value, index, array)) {
  25004. result.push(value);
  25005. indexes.push(index);
  25006. }
  25007. }
  25008. basePullAt(array, indexes);
  25009. return result;
  25010. }
  25011. /**
  25012. * Reverses `array` so that the first element becomes the last, the second
  25013. * element becomes the second to last, and so on.
  25014. *
  25015. * **Note:** This method mutates `array` and is based on
  25016. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25017. *
  25018. * @static
  25019. * @memberOf _
  25020. * @since 4.0.0
  25021. * @category Array
  25022. * @param {Array} array The array to modify.
  25023. * @returns {Array} Returns `array`.
  25024. * @example
  25025. *
  25026. * var array = [1, 2, 3];
  25027. *
  25028. * _.reverse(array);
  25029. * // => [3, 2, 1]
  25030. *
  25031. * console.log(array);
  25032. * // => [3, 2, 1]
  25033. */
  25034. function reverse(array) {
  25035. return array == null ? array : nativeReverse.call(array);
  25036. }
  25037. /**
  25038. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25039. *
  25040. * **Note:** This method is used instead of
  25041. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25042. * returned.
  25043. *
  25044. * @static
  25045. * @memberOf _
  25046. * @since 3.0.0
  25047. * @category Array
  25048. * @param {Array} array The array to slice.
  25049. * @param {number} [start=0] The start position.
  25050. * @param {number} [end=array.length] The end position.
  25051. * @returns {Array} Returns the slice of `array`.
  25052. */
  25053. function slice(array, start, end) {
  25054. var length = array == null ? 0 : array.length;
  25055. if (!length) {
  25056. return [];
  25057. }
  25058. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25059. start = 0;
  25060. end = length;
  25061. }
  25062. else {
  25063. start = start == null ? 0 : toInteger(start);
  25064. end = end === undefined ? length : toInteger(end);
  25065. }
  25066. return baseSlice(array, start, end);
  25067. }
  25068. /**
  25069. * Uses a binary search to determine the lowest index at which `value`
  25070. * should be inserted into `array` in order to maintain its sort order.
  25071. *
  25072. * @static
  25073. * @memberOf _
  25074. * @since 0.1.0
  25075. * @category Array
  25076. * @param {Array} array The sorted array to inspect.
  25077. * @param {*} value The value to evaluate.
  25078. * @returns {number} Returns the index at which `value` should be inserted
  25079. * into `array`.
  25080. * @example
  25081. *
  25082. * _.sortedIndex([30, 50], 40);
  25083. * // => 1
  25084. */
  25085. function sortedIndex(array, value) {
  25086. return baseSortedIndex(array, value);
  25087. }
  25088. /**
  25089. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25090. * which is invoked for `value` and each element of `array` to compute their
  25091. * sort ranking. The iteratee is invoked with one argument: (value).
  25092. *
  25093. * @static
  25094. * @memberOf _
  25095. * @since 4.0.0
  25096. * @category Array
  25097. * @param {Array} array The sorted array to inspect.
  25098. * @param {*} value The value to evaluate.
  25099. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25100. * @returns {number} Returns the index at which `value` should be inserted
  25101. * into `array`.
  25102. * @example
  25103. *
  25104. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25105. *
  25106. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25107. * // => 0
  25108. *
  25109. * // The `_.property` iteratee shorthand.
  25110. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25111. * // => 0
  25112. */
  25113. function sortedIndexBy(array, value, iteratee) {
  25114. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25115. }
  25116. /**
  25117. * This method is like `_.indexOf` except that it performs a binary
  25118. * search on a sorted `array`.
  25119. *
  25120. * @static
  25121. * @memberOf _
  25122. * @since 4.0.0
  25123. * @category Array
  25124. * @param {Array} array The array to inspect.
  25125. * @param {*} value The value to search for.
  25126. * @returns {number} Returns the index of the matched value, else `-1`.
  25127. * @example
  25128. *
  25129. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25130. * // => 1
  25131. */
  25132. function sortedIndexOf(array, value) {
  25133. var length = array == null ? 0 : array.length;
  25134. if (length) {
  25135. var index = baseSortedIndex(array, value);
  25136. if (index < length && eq(array[index], value)) {
  25137. return index;
  25138. }
  25139. }
  25140. return -1;
  25141. }
  25142. /**
  25143. * This method is like `_.sortedIndex` except that it returns the highest
  25144. * index at which `value` should be inserted into `array` in order to
  25145. * maintain its sort order.
  25146. *
  25147. * @static
  25148. * @memberOf _
  25149. * @since 3.0.0
  25150. * @category Array
  25151. * @param {Array} array The sorted array to inspect.
  25152. * @param {*} value The value to evaluate.
  25153. * @returns {number} Returns the index at which `value` should be inserted
  25154. * into `array`.
  25155. * @example
  25156. *
  25157. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25158. * // => 4
  25159. */
  25160. function sortedLastIndex(array, value) {
  25161. return baseSortedIndex(array, value, true);
  25162. }
  25163. /**
  25164. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25165. * which is invoked for `value` and each element of `array` to compute their
  25166. * sort ranking. The iteratee is invoked with one argument: (value).
  25167. *
  25168. * @static
  25169. * @memberOf _
  25170. * @since 4.0.0
  25171. * @category Array
  25172. * @param {Array} array The sorted array to inspect.
  25173. * @param {*} value The value to evaluate.
  25174. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25175. * @returns {number} Returns the index at which `value` should be inserted
  25176. * into `array`.
  25177. * @example
  25178. *
  25179. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25180. *
  25181. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25182. * // => 1
  25183. *
  25184. * // The `_.property` iteratee shorthand.
  25185. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25186. * // => 1
  25187. */
  25188. function sortedLastIndexBy(array, value, iteratee) {
  25189. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25190. }
  25191. /**
  25192. * This method is like `_.lastIndexOf` except that it performs a binary
  25193. * search on a sorted `array`.
  25194. *
  25195. * @static
  25196. * @memberOf _
  25197. * @since 4.0.0
  25198. * @category Array
  25199. * @param {Array} array The array to inspect.
  25200. * @param {*} value The value to search for.
  25201. * @returns {number} Returns the index of the matched value, else `-1`.
  25202. * @example
  25203. *
  25204. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25205. * // => 3
  25206. */
  25207. function sortedLastIndexOf(array, value) {
  25208. var length = array == null ? 0 : array.length;
  25209. if (length) {
  25210. var index = baseSortedIndex(array, value, true) - 1;
  25211. if (eq(array[index], value)) {
  25212. return index;
  25213. }
  25214. }
  25215. return -1;
  25216. }
  25217. /**
  25218. * This method is like `_.uniq` except that it's designed and optimized
  25219. * for sorted arrays.
  25220. *
  25221. * @static
  25222. * @memberOf _
  25223. * @since 4.0.0
  25224. * @category Array
  25225. * @param {Array} array The array to inspect.
  25226. * @returns {Array} Returns the new duplicate free array.
  25227. * @example
  25228. *
  25229. * _.sortedUniq([1, 1, 2]);
  25230. * // => [1, 2]
  25231. */
  25232. function sortedUniq(array) {
  25233. return (array && array.length)
  25234. ? baseSortedUniq(array)
  25235. : [];
  25236. }
  25237. /**
  25238. * This method is like `_.uniqBy` except that it's designed and optimized
  25239. * for sorted arrays.
  25240. *
  25241. * @static
  25242. * @memberOf _
  25243. * @since 4.0.0
  25244. * @category Array
  25245. * @param {Array} array The array to inspect.
  25246. * @param {Function} [iteratee] The iteratee invoked per element.
  25247. * @returns {Array} Returns the new duplicate free array.
  25248. * @example
  25249. *
  25250. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25251. * // => [1.1, 2.3]
  25252. */
  25253. function sortedUniqBy(array, iteratee) {
  25254. return (array && array.length)
  25255. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25256. : [];
  25257. }
  25258. /**
  25259. * Gets all but the first element of `array`.
  25260. *
  25261. * @static
  25262. * @memberOf _
  25263. * @since 4.0.0
  25264. * @category Array
  25265. * @param {Array} array The array to query.
  25266. * @returns {Array} Returns the slice of `array`.
  25267. * @example
  25268. *
  25269. * _.tail([1, 2, 3]);
  25270. * // => [2, 3]
  25271. */
  25272. function tail(array) {
  25273. var length = array == null ? 0 : array.length;
  25274. return length ? baseSlice(array, 1, length) : [];
  25275. }
  25276. /**
  25277. * Creates a slice of `array` with `n` elements taken from the beginning.
  25278. *
  25279. * @static
  25280. * @memberOf _
  25281. * @since 0.1.0
  25282. * @category Array
  25283. * @param {Array} array The array to query.
  25284. * @param {number} [n=1] The number of elements to take.
  25285. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25286. * @returns {Array} Returns the slice of `array`.
  25287. * @example
  25288. *
  25289. * _.take([1, 2, 3]);
  25290. * // => [1]
  25291. *
  25292. * _.take([1, 2, 3], 2);
  25293. * // => [1, 2]
  25294. *
  25295. * _.take([1, 2, 3], 5);
  25296. * // => [1, 2, 3]
  25297. *
  25298. * _.take([1, 2, 3], 0);
  25299. * // => []
  25300. */
  25301. function take(array, n, guard) {
  25302. if (!(array && array.length)) {
  25303. return [];
  25304. }
  25305. n = (guard || n === undefined) ? 1 : toInteger(n);
  25306. return baseSlice(array, 0, n < 0 ? 0 : n);
  25307. }
  25308. /**
  25309. * Creates a slice of `array` with `n` elements taken from the end.
  25310. *
  25311. * @static
  25312. * @memberOf _
  25313. * @since 3.0.0
  25314. * @category Array
  25315. * @param {Array} array The array to query.
  25316. * @param {number} [n=1] The number of elements to take.
  25317. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25318. * @returns {Array} Returns the slice of `array`.
  25319. * @example
  25320. *
  25321. * _.takeRight([1, 2, 3]);
  25322. * // => [3]
  25323. *
  25324. * _.takeRight([1, 2, 3], 2);
  25325. * // => [2, 3]
  25326. *
  25327. * _.takeRight([1, 2, 3], 5);
  25328. * // => [1, 2, 3]
  25329. *
  25330. * _.takeRight([1, 2, 3], 0);
  25331. * // => []
  25332. */
  25333. function takeRight(array, n, guard) {
  25334. var length = array == null ? 0 : array.length;
  25335. if (!length) {
  25336. return [];
  25337. }
  25338. n = (guard || n === undefined) ? 1 : toInteger(n);
  25339. n = length - n;
  25340. return baseSlice(array, n < 0 ? 0 : n, length);
  25341. }
  25342. /**
  25343. * Creates a slice of `array` with elements taken from the end. Elements are
  25344. * taken until `predicate` returns falsey. The predicate is invoked with
  25345. * three arguments: (value, index, array).
  25346. *
  25347. * @static
  25348. * @memberOf _
  25349. * @since 3.0.0
  25350. * @category Array
  25351. * @param {Array} array The array to query.
  25352. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25353. * @returns {Array} Returns the slice of `array`.
  25354. * @example
  25355. *
  25356. * var users = [
  25357. * { 'user': 'barney', 'active': true },
  25358. * { 'user': 'fred', 'active': false },
  25359. * { 'user': 'pebbles', 'active': false }
  25360. * ];
  25361. *
  25362. * _.takeRightWhile(users, function(o) { return !o.active; });
  25363. * // => objects for ['fred', 'pebbles']
  25364. *
  25365. * // The `_.matches` iteratee shorthand.
  25366. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25367. * // => objects for ['pebbles']
  25368. *
  25369. * // The `_.matchesProperty` iteratee shorthand.
  25370. * _.takeRightWhile(users, ['active', false]);
  25371. * // => objects for ['fred', 'pebbles']
  25372. *
  25373. * // The `_.property` iteratee shorthand.
  25374. * _.takeRightWhile(users, 'active');
  25375. * // => []
  25376. */
  25377. function takeRightWhile(array, predicate) {
  25378. return (array && array.length)
  25379. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25380. : [];
  25381. }
  25382. /**
  25383. * Creates a slice of `array` with elements taken from the beginning. Elements
  25384. * are taken until `predicate` returns falsey. The predicate is invoked with
  25385. * three arguments: (value, index, array).
  25386. *
  25387. * @static
  25388. * @memberOf _
  25389. * @since 3.0.0
  25390. * @category Array
  25391. * @param {Array} array The array to query.
  25392. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25393. * @returns {Array} Returns the slice of `array`.
  25394. * @example
  25395. *
  25396. * var users = [
  25397. * { 'user': 'barney', 'active': false },
  25398. * { 'user': 'fred', 'active': false },
  25399. * { 'user': 'pebbles', 'active': true }
  25400. * ];
  25401. *
  25402. * _.takeWhile(users, function(o) { return !o.active; });
  25403. * // => objects for ['barney', 'fred']
  25404. *
  25405. * // The `_.matches` iteratee shorthand.
  25406. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25407. * // => objects for ['barney']
  25408. *
  25409. * // The `_.matchesProperty` iteratee shorthand.
  25410. * _.takeWhile(users, ['active', false]);
  25411. * // => objects for ['barney', 'fred']
  25412. *
  25413. * // The `_.property` iteratee shorthand.
  25414. * _.takeWhile(users, 'active');
  25415. * // => []
  25416. */
  25417. function takeWhile(array, predicate) {
  25418. return (array && array.length)
  25419. ? baseWhile(array, getIteratee(predicate, 3))
  25420. : [];
  25421. }
  25422. /**
  25423. * Creates an array of unique values, in order, from all given arrays using
  25424. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25425. * for equality comparisons.
  25426. *
  25427. * @static
  25428. * @memberOf _
  25429. * @since 0.1.0
  25430. * @category Array
  25431. * @param {...Array} [arrays] The arrays to inspect.
  25432. * @returns {Array} Returns the new array of combined values.
  25433. * @example
  25434. *
  25435. * _.union([2], [1, 2]);
  25436. * // => [2, 1]
  25437. */
  25438. var union = baseRest(function(arrays) {
  25439. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25440. });
  25441. /**
  25442. * This method is like `_.union` except that it accepts `iteratee` which is
  25443. * invoked for each element of each `arrays` to generate the criterion by
  25444. * which uniqueness is computed. Result values are chosen from the first
  25445. * array in which the value occurs. The iteratee is invoked with one argument:
  25446. * (value).
  25447. *
  25448. * @static
  25449. * @memberOf _
  25450. * @since 4.0.0
  25451. * @category Array
  25452. * @param {...Array} [arrays] The arrays to inspect.
  25453. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25454. * @returns {Array} Returns the new array of combined values.
  25455. * @example
  25456. *
  25457. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25458. * // => [2.1, 1.2]
  25459. *
  25460. * // The `_.property` iteratee shorthand.
  25461. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25462. * // => [{ 'x': 1 }, { 'x': 2 }]
  25463. */
  25464. var unionBy = baseRest(function(arrays) {
  25465. var iteratee = last(arrays);
  25466. if (isArrayLikeObject(iteratee)) {
  25467. iteratee = undefined;
  25468. }
  25469. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25470. });
  25471. /**
  25472. * This method is like `_.union` except that it accepts `comparator` which
  25473. * is invoked to compare elements of `arrays`. Result values are chosen from
  25474. * the first array in which the value occurs. The comparator is invoked
  25475. * with two arguments: (arrVal, othVal).
  25476. *
  25477. * @static
  25478. * @memberOf _
  25479. * @since 4.0.0
  25480. * @category Array
  25481. * @param {...Array} [arrays] The arrays to inspect.
  25482. * @param {Function} [comparator] The comparator invoked per element.
  25483. * @returns {Array} Returns the new array of combined values.
  25484. * @example
  25485. *
  25486. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25487. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25488. *
  25489. * _.unionWith(objects, others, _.isEqual);
  25490. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25491. */
  25492. var unionWith = baseRest(function(arrays) {
  25493. var comparator = last(arrays);
  25494. comparator = typeof comparator == 'function' ? comparator : undefined;
  25495. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25496. });
  25497. /**
  25498. * Creates a duplicate-free version of an array, using
  25499. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25500. * for equality comparisons, in which only the first occurrence of each element
  25501. * is kept. The order of result values is determined by the order they occur
  25502. * in the array.
  25503. *
  25504. * @static
  25505. * @memberOf _
  25506. * @since 0.1.0
  25507. * @category Array
  25508. * @param {Array} array The array to inspect.
  25509. * @returns {Array} Returns the new duplicate free array.
  25510. * @example
  25511. *
  25512. * _.uniq([2, 1, 2]);
  25513. * // => [2, 1]
  25514. */
  25515. function uniq(array) {
  25516. return (array && array.length) ? baseUniq(array) : [];
  25517. }
  25518. /**
  25519. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25520. * invoked for each element in `array` to generate the criterion by which
  25521. * uniqueness is computed. The order of result values is determined by the
  25522. * order they occur in the array. The iteratee is invoked with one argument:
  25523. * (value).
  25524. *
  25525. * @static
  25526. * @memberOf _
  25527. * @since 4.0.0
  25528. * @category Array
  25529. * @param {Array} array The array to inspect.
  25530. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25531. * @returns {Array} Returns the new duplicate free array.
  25532. * @example
  25533. *
  25534. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25535. * // => [2.1, 1.2]
  25536. *
  25537. * // The `_.property` iteratee shorthand.
  25538. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25539. * // => [{ 'x': 1 }, { 'x': 2 }]
  25540. */
  25541. function uniqBy(array, iteratee) {
  25542. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25543. }
  25544. /**
  25545. * This method is like `_.uniq` except that it accepts `comparator` which
  25546. * is invoked to compare elements of `array`. The order of result values is
  25547. * determined by the order they occur in the array.The comparator is invoked
  25548. * with two arguments: (arrVal, othVal).
  25549. *
  25550. * @static
  25551. * @memberOf _
  25552. * @since 4.0.0
  25553. * @category Array
  25554. * @param {Array} array The array to inspect.
  25555. * @param {Function} [comparator] The comparator invoked per element.
  25556. * @returns {Array} Returns the new duplicate free array.
  25557. * @example
  25558. *
  25559. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25560. *
  25561. * _.uniqWith(objects, _.isEqual);
  25562. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25563. */
  25564. function uniqWith(array, comparator) {
  25565. comparator = typeof comparator == 'function' ? comparator : undefined;
  25566. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25567. }
  25568. /**
  25569. * This method is like `_.zip` except that it accepts an array of grouped
  25570. * elements and creates an array regrouping the elements to their pre-zip
  25571. * configuration.
  25572. *
  25573. * @static
  25574. * @memberOf _
  25575. * @since 1.2.0
  25576. * @category Array
  25577. * @param {Array} array The array of grouped elements to process.
  25578. * @returns {Array} Returns the new array of regrouped elements.
  25579. * @example
  25580. *
  25581. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25582. * // => [['a', 1, true], ['b', 2, false]]
  25583. *
  25584. * _.unzip(zipped);
  25585. * // => [['a', 'b'], [1, 2], [true, false]]
  25586. */
  25587. function unzip(array) {
  25588. if (!(array && array.length)) {
  25589. return [];
  25590. }
  25591. var length = 0;
  25592. array = arrayFilter(array, function(group) {
  25593. if (isArrayLikeObject(group)) {
  25594. length = nativeMax(group.length, length);
  25595. return true;
  25596. }
  25597. });
  25598. return baseTimes(length, function(index) {
  25599. return arrayMap(array, baseProperty(index));
  25600. });
  25601. }
  25602. /**
  25603. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25604. * how regrouped values should be combined. The iteratee is invoked with the
  25605. * elements of each group: (...group).
  25606. *
  25607. * @static
  25608. * @memberOf _
  25609. * @since 3.8.0
  25610. * @category Array
  25611. * @param {Array} array The array of grouped elements to process.
  25612. * @param {Function} [iteratee=_.identity] The function to combine
  25613. * regrouped values.
  25614. * @returns {Array} Returns the new array of regrouped elements.
  25615. * @example
  25616. *
  25617. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25618. * // => [[1, 10, 100], [2, 20, 200]]
  25619. *
  25620. * _.unzipWith(zipped, _.add);
  25621. * // => [3, 30, 300]
  25622. */
  25623. function unzipWith(array, iteratee) {
  25624. if (!(array && array.length)) {
  25625. return [];
  25626. }
  25627. var result = unzip(array);
  25628. if (iteratee == null) {
  25629. return result;
  25630. }
  25631. return arrayMap(result, function(group) {
  25632. return apply(iteratee, undefined, group);
  25633. });
  25634. }
  25635. /**
  25636. * Creates an array excluding all given values using
  25637. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25638. * for equality comparisons.
  25639. *
  25640. * **Note:** Unlike `_.pull`, this method returns a new array.
  25641. *
  25642. * @static
  25643. * @memberOf _
  25644. * @since 0.1.0
  25645. * @category Array
  25646. * @param {Array} array The array to inspect.
  25647. * @param {...*} [values] The values to exclude.
  25648. * @returns {Array} Returns the new array of filtered values.
  25649. * @see _.difference, _.xor
  25650. * @example
  25651. *
  25652. * _.without([2, 1, 2, 3], 1, 2);
  25653. * // => [3]
  25654. */
  25655. var without = baseRest(function(array, values) {
  25656. return isArrayLikeObject(array)
  25657. ? baseDifference(array, values)
  25658. : [];
  25659. });
  25660. /**
  25661. * Creates an array of unique values that is the
  25662. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25663. * of the given arrays. The order of result values is determined by the order
  25664. * they occur in the arrays.
  25665. *
  25666. * @static
  25667. * @memberOf _
  25668. * @since 2.4.0
  25669. * @category Array
  25670. * @param {...Array} [arrays] The arrays to inspect.
  25671. * @returns {Array} Returns the new array of filtered values.
  25672. * @see _.difference, _.without
  25673. * @example
  25674. *
  25675. * _.xor([2, 1], [2, 3]);
  25676. * // => [1, 3]
  25677. */
  25678. var xor = baseRest(function(arrays) {
  25679. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25680. });
  25681. /**
  25682. * This method is like `_.xor` except that it accepts `iteratee` which is
  25683. * invoked for each element of each `arrays` to generate the criterion by
  25684. * which by which they're compared. The order of result values is determined
  25685. * by the order they occur in the arrays. The iteratee is invoked with one
  25686. * argument: (value).
  25687. *
  25688. * @static
  25689. * @memberOf _
  25690. * @since 4.0.0
  25691. * @category Array
  25692. * @param {...Array} [arrays] The arrays to inspect.
  25693. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25694. * @returns {Array} Returns the new array of filtered values.
  25695. * @example
  25696. *
  25697. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25698. * // => [1.2, 3.4]
  25699. *
  25700. * // The `_.property` iteratee shorthand.
  25701. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25702. * // => [{ 'x': 2 }]
  25703. */
  25704. var xorBy = baseRest(function(arrays) {
  25705. var iteratee = last(arrays);
  25706. if (isArrayLikeObject(iteratee)) {
  25707. iteratee = undefined;
  25708. }
  25709. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25710. });
  25711. /**
  25712. * This method is like `_.xor` except that it accepts `comparator` which is
  25713. * invoked to compare elements of `arrays`. The order of result values is
  25714. * determined by the order they occur in the arrays. The comparator is invoked
  25715. * with two arguments: (arrVal, othVal).
  25716. *
  25717. * @static
  25718. * @memberOf _
  25719. * @since 4.0.0
  25720. * @category Array
  25721. * @param {...Array} [arrays] The arrays to inspect.
  25722. * @param {Function} [comparator] The comparator invoked per element.
  25723. * @returns {Array} Returns the new array of filtered values.
  25724. * @example
  25725. *
  25726. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25727. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25728. *
  25729. * _.xorWith(objects, others, _.isEqual);
  25730. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25731. */
  25732. var xorWith = baseRest(function(arrays) {
  25733. var comparator = last(arrays);
  25734. comparator = typeof comparator == 'function' ? comparator : undefined;
  25735. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25736. });
  25737. /**
  25738. * Creates an array of grouped elements, the first of which contains the
  25739. * first elements of the given arrays, the second of which contains the
  25740. * second elements of the given arrays, and so on.
  25741. *
  25742. * @static
  25743. * @memberOf _
  25744. * @since 0.1.0
  25745. * @category Array
  25746. * @param {...Array} [arrays] The arrays to process.
  25747. * @returns {Array} Returns the new array of grouped elements.
  25748. * @example
  25749. *
  25750. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25751. * // => [['a', 1, true], ['b', 2, false]]
  25752. */
  25753. var zip = baseRest(unzip);
  25754. /**
  25755. * This method is like `_.fromPairs` except that it accepts two arrays,
  25756. * one of property identifiers and one of corresponding values.
  25757. *
  25758. * @static
  25759. * @memberOf _
  25760. * @since 0.4.0
  25761. * @category Array
  25762. * @param {Array} [props=[]] The property identifiers.
  25763. * @param {Array} [values=[]] The property values.
  25764. * @returns {Object} Returns the new object.
  25765. * @example
  25766. *
  25767. * _.zipObject(['a', 'b'], [1, 2]);
  25768. * // => { 'a': 1, 'b': 2 }
  25769. */
  25770. function zipObject(props, values) {
  25771. return baseZipObject(props || [], values || [], assignValue);
  25772. }
  25773. /**
  25774. * This method is like `_.zipObject` except that it supports property paths.
  25775. *
  25776. * @static
  25777. * @memberOf _
  25778. * @since 4.1.0
  25779. * @category Array
  25780. * @param {Array} [props=[]] The property identifiers.
  25781. * @param {Array} [values=[]] The property values.
  25782. * @returns {Object} Returns the new object.
  25783. * @example
  25784. *
  25785. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25786. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25787. */
  25788. function zipObjectDeep(props, values) {
  25789. return baseZipObject(props || [], values || [], baseSet);
  25790. }
  25791. /**
  25792. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25793. * how grouped values should be combined. The iteratee is invoked with the
  25794. * elements of each group: (...group).
  25795. *
  25796. * @static
  25797. * @memberOf _
  25798. * @since 3.8.0
  25799. * @category Array
  25800. * @param {...Array} [arrays] The arrays to process.
  25801. * @param {Function} [iteratee=_.identity] The function to combine
  25802. * grouped values.
  25803. * @returns {Array} Returns the new array of grouped elements.
  25804. * @example
  25805. *
  25806. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  25807. * return a + b + c;
  25808. * });
  25809. * // => [111, 222]
  25810. */
  25811. var zipWith = baseRest(function(arrays) {
  25812. var length = arrays.length,
  25813. iteratee = length > 1 ? arrays[length - 1] : undefined;
  25814. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  25815. return unzipWith(arrays, iteratee);
  25816. });
  25817. /*------------------------------------------------------------------------*/
  25818. /**
  25819. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  25820. * chain sequences enabled. The result of such sequences must be unwrapped
  25821. * with `_#value`.
  25822. *
  25823. * @static
  25824. * @memberOf _
  25825. * @since 1.3.0
  25826. * @category Seq
  25827. * @param {*} value The value to wrap.
  25828. * @returns {Object} Returns the new `lodash` wrapper instance.
  25829. * @example
  25830. *
  25831. * var users = [
  25832. * { 'user': 'barney', 'age': 36 },
  25833. * { 'user': 'fred', 'age': 40 },
  25834. * { 'user': 'pebbles', 'age': 1 }
  25835. * ];
  25836. *
  25837. * var youngest = _
  25838. * .chain(users)
  25839. * .sortBy('age')
  25840. * .map(function(o) {
  25841. * return o.user + ' is ' + o.age;
  25842. * })
  25843. * .head()
  25844. * .value();
  25845. * // => 'pebbles is 1'
  25846. */
  25847. function chain(value) {
  25848. var result = lodash(value);
  25849. result.__chain__ = true;
  25850. return result;
  25851. }
  25852. /**
  25853. * This method invokes `interceptor` and returns `value`. The interceptor
  25854. * is invoked with one argument; (value). The purpose of this method is to
  25855. * "tap into" a method chain sequence in order to modify intermediate results.
  25856. *
  25857. * @static
  25858. * @memberOf _
  25859. * @since 0.1.0
  25860. * @category Seq
  25861. * @param {*} value The value to provide to `interceptor`.
  25862. * @param {Function} interceptor The function to invoke.
  25863. * @returns {*} Returns `value`.
  25864. * @example
  25865. *
  25866. * _([1, 2, 3])
  25867. * .tap(function(array) {
  25868. * // Mutate input array.
  25869. * array.pop();
  25870. * })
  25871. * .reverse()
  25872. * .value();
  25873. * // => [2, 1]
  25874. */
  25875. function tap(value, interceptor) {
  25876. interceptor(value);
  25877. return value;
  25878. }
  25879. /**
  25880. * This method is like `_.tap` except that it returns the result of `interceptor`.
  25881. * The purpose of this method is to "pass thru" values replacing intermediate
  25882. * results in a method chain sequence.
  25883. *
  25884. * @static
  25885. * @memberOf _
  25886. * @since 3.0.0
  25887. * @category Seq
  25888. * @param {*} value The value to provide to `interceptor`.
  25889. * @param {Function} interceptor The function to invoke.
  25890. * @returns {*} Returns the result of `interceptor`.
  25891. * @example
  25892. *
  25893. * _(' abc ')
  25894. * .chain()
  25895. * .trim()
  25896. * .thru(function(value) {
  25897. * return [value];
  25898. * })
  25899. * .value();
  25900. * // => ['abc']
  25901. */
  25902. function thru(value, interceptor) {
  25903. return interceptor(value);
  25904. }
  25905. /**
  25906. * This method is the wrapper version of `_.at`.
  25907. *
  25908. * @name at
  25909. * @memberOf _
  25910. * @since 1.0.0
  25911. * @category Seq
  25912. * @param {...(string|string[])} [paths] The property paths to pick.
  25913. * @returns {Object} Returns the new `lodash` wrapper instance.
  25914. * @example
  25915. *
  25916. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25917. *
  25918. * _(object).at(['a[0].b.c', 'a[1]']).value();
  25919. * // => [3, 4]
  25920. */
  25921. var wrapperAt = flatRest(function(paths) {
  25922. var length = paths.length,
  25923. start = length ? paths[0] : 0,
  25924. value = this.__wrapped__,
  25925. interceptor = function(object) { return baseAt(object, paths); };
  25926. if (length > 1 || this.__actions__.length ||
  25927. !(value instanceof LazyWrapper) || !isIndex(start)) {
  25928. return this.thru(interceptor);
  25929. }
  25930. value = value.slice(start, +start + (length ? 1 : 0));
  25931. value.__actions__.push({
  25932. 'func': thru,
  25933. 'args': [interceptor],
  25934. 'thisArg': undefined
  25935. });
  25936. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  25937. if (length && !array.length) {
  25938. array.push(undefined);
  25939. }
  25940. return array;
  25941. });
  25942. });
  25943. /**
  25944. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  25945. *
  25946. * @name chain
  25947. * @memberOf _
  25948. * @since 0.1.0
  25949. * @category Seq
  25950. * @returns {Object} Returns the new `lodash` wrapper instance.
  25951. * @example
  25952. *
  25953. * var users = [
  25954. * { 'user': 'barney', 'age': 36 },
  25955. * { 'user': 'fred', 'age': 40 }
  25956. * ];
  25957. *
  25958. * // A sequence without explicit chaining.
  25959. * _(users).head();
  25960. * // => { 'user': 'barney', 'age': 36 }
  25961. *
  25962. * // A sequence with explicit chaining.
  25963. * _(users)
  25964. * .chain()
  25965. * .head()
  25966. * .pick('user')
  25967. * .value();
  25968. * // => { 'user': 'barney' }
  25969. */
  25970. function wrapperChain() {
  25971. return chain(this);
  25972. }
  25973. /**
  25974. * Executes the chain sequence and returns the wrapped result.
  25975. *
  25976. * @name commit
  25977. * @memberOf _
  25978. * @since 3.2.0
  25979. * @category Seq
  25980. * @returns {Object} Returns the new `lodash` wrapper instance.
  25981. * @example
  25982. *
  25983. * var array = [1, 2];
  25984. * var wrapped = _(array).push(3);
  25985. *
  25986. * console.log(array);
  25987. * // => [1, 2]
  25988. *
  25989. * wrapped = wrapped.commit();
  25990. * console.log(array);
  25991. * // => [1, 2, 3]
  25992. *
  25993. * wrapped.last();
  25994. * // => 3
  25995. *
  25996. * console.log(array);
  25997. * // => [1, 2, 3]
  25998. */
  25999. function wrapperCommit() {
  26000. return new LodashWrapper(this.value(), this.__chain__);
  26001. }
  26002. /**
  26003. * Gets the next value on a wrapped object following the
  26004. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26005. *
  26006. * @name next
  26007. * @memberOf _
  26008. * @since 4.0.0
  26009. * @category Seq
  26010. * @returns {Object} Returns the next iterator value.
  26011. * @example
  26012. *
  26013. * var wrapped = _([1, 2]);
  26014. *
  26015. * wrapped.next();
  26016. * // => { 'done': false, 'value': 1 }
  26017. *
  26018. * wrapped.next();
  26019. * // => { 'done': false, 'value': 2 }
  26020. *
  26021. * wrapped.next();
  26022. * // => { 'done': true, 'value': undefined }
  26023. */
  26024. function wrapperNext() {
  26025. if (this.__values__ === undefined) {
  26026. this.__values__ = toArray(this.value());
  26027. }
  26028. var done = this.__index__ >= this.__values__.length,
  26029. value = done ? undefined : this.__values__[this.__index__++];
  26030. return { 'done': done, 'value': value };
  26031. }
  26032. /**
  26033. * Enables the wrapper to be iterable.
  26034. *
  26035. * @name Symbol.iterator
  26036. * @memberOf _
  26037. * @since 4.0.0
  26038. * @category Seq
  26039. * @returns {Object} Returns the wrapper object.
  26040. * @example
  26041. *
  26042. * var wrapped = _([1, 2]);
  26043. *
  26044. * wrapped[Symbol.iterator]() === wrapped;
  26045. * // => true
  26046. *
  26047. * Array.from(wrapped);
  26048. * // => [1, 2]
  26049. */
  26050. function wrapperToIterator() {
  26051. return this;
  26052. }
  26053. /**
  26054. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26055. *
  26056. * @name plant
  26057. * @memberOf _
  26058. * @since 3.2.0
  26059. * @category Seq
  26060. * @param {*} value The value to plant.
  26061. * @returns {Object} Returns the new `lodash` wrapper instance.
  26062. * @example
  26063. *
  26064. * function square(n) {
  26065. * return n * n;
  26066. * }
  26067. *
  26068. * var wrapped = _([1, 2]).map(square);
  26069. * var other = wrapped.plant([3, 4]);
  26070. *
  26071. * other.value();
  26072. * // => [9, 16]
  26073. *
  26074. * wrapped.value();
  26075. * // => [1, 4]
  26076. */
  26077. function wrapperPlant(value) {
  26078. var result,
  26079. parent = this;
  26080. while (parent instanceof baseLodash) {
  26081. var clone = wrapperClone(parent);
  26082. clone.__index__ = 0;
  26083. clone.__values__ = undefined;
  26084. if (result) {
  26085. previous.__wrapped__ = clone;
  26086. } else {
  26087. result = clone;
  26088. }
  26089. var previous = clone;
  26090. parent = parent.__wrapped__;
  26091. }
  26092. previous.__wrapped__ = value;
  26093. return result;
  26094. }
  26095. /**
  26096. * This method is the wrapper version of `_.reverse`.
  26097. *
  26098. * **Note:** This method mutates the wrapped array.
  26099. *
  26100. * @name reverse
  26101. * @memberOf _
  26102. * @since 0.1.0
  26103. * @category Seq
  26104. * @returns {Object} Returns the new `lodash` wrapper instance.
  26105. * @example
  26106. *
  26107. * var array = [1, 2, 3];
  26108. *
  26109. * _(array).reverse().value()
  26110. * // => [3, 2, 1]
  26111. *
  26112. * console.log(array);
  26113. * // => [3, 2, 1]
  26114. */
  26115. function wrapperReverse() {
  26116. var value = this.__wrapped__;
  26117. if (value instanceof LazyWrapper) {
  26118. var wrapped = value;
  26119. if (this.__actions__.length) {
  26120. wrapped = new LazyWrapper(this);
  26121. }
  26122. wrapped = wrapped.reverse();
  26123. wrapped.__actions__.push({
  26124. 'func': thru,
  26125. 'args': [reverse],
  26126. 'thisArg': undefined
  26127. });
  26128. return new LodashWrapper(wrapped, this.__chain__);
  26129. }
  26130. return this.thru(reverse);
  26131. }
  26132. /**
  26133. * Executes the chain sequence to resolve the unwrapped value.
  26134. *
  26135. * @name value
  26136. * @memberOf _
  26137. * @since 0.1.0
  26138. * @alias toJSON, valueOf
  26139. * @category Seq
  26140. * @returns {*} Returns the resolved unwrapped value.
  26141. * @example
  26142. *
  26143. * _([1, 2, 3]).value();
  26144. * // => [1, 2, 3]
  26145. */
  26146. function wrapperValue() {
  26147. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26148. }
  26149. /*------------------------------------------------------------------------*/
  26150. /**
  26151. * Creates an object composed of keys generated from the results of running
  26152. * each element of `collection` thru `iteratee`. The corresponding value of
  26153. * each key is the number of times the key was returned by `iteratee`. The
  26154. * iteratee is invoked with one argument: (value).
  26155. *
  26156. * @static
  26157. * @memberOf _
  26158. * @since 0.5.0
  26159. * @category Collection
  26160. * @param {Array|Object} collection The collection to iterate over.
  26161. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26162. * @returns {Object} Returns the composed aggregate object.
  26163. * @example
  26164. *
  26165. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26166. * // => { '4': 1, '6': 2 }
  26167. *
  26168. * // The `_.property` iteratee shorthand.
  26169. * _.countBy(['one', 'two', 'three'], 'length');
  26170. * // => { '3': 2, '5': 1 }
  26171. */
  26172. var countBy = createAggregator(function(result, value, key) {
  26173. if (hasOwnProperty.call(result, key)) {
  26174. ++result[key];
  26175. } else {
  26176. baseAssignValue(result, key, 1);
  26177. }
  26178. });
  26179. /**
  26180. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26181. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26182. * invoked with three arguments: (value, index|key, collection).
  26183. *
  26184. * **Note:** This method returns `true` for
  26185. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26186. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26187. * elements of empty collections.
  26188. *
  26189. * @static
  26190. * @memberOf _
  26191. * @since 0.1.0
  26192. * @category Collection
  26193. * @param {Array|Object} collection The collection to iterate over.
  26194. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26195. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26196. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26197. * else `false`.
  26198. * @example
  26199. *
  26200. * _.every([true, 1, null, 'yes'], Boolean);
  26201. * // => false
  26202. *
  26203. * var users = [
  26204. * { 'user': 'barney', 'age': 36, 'active': false },
  26205. * { 'user': 'fred', 'age': 40, 'active': false }
  26206. * ];
  26207. *
  26208. * // The `_.matches` iteratee shorthand.
  26209. * _.every(users, { 'user': 'barney', 'active': false });
  26210. * // => false
  26211. *
  26212. * // The `_.matchesProperty` iteratee shorthand.
  26213. * _.every(users, ['active', false]);
  26214. * // => true
  26215. *
  26216. * // The `_.property` iteratee shorthand.
  26217. * _.every(users, 'active');
  26218. * // => false
  26219. */
  26220. function every(collection, predicate, guard) {
  26221. var func = isArray(collection) ? arrayEvery : baseEvery;
  26222. if (guard && isIterateeCall(collection, predicate, guard)) {
  26223. predicate = undefined;
  26224. }
  26225. return func(collection, getIteratee(predicate, 3));
  26226. }
  26227. /**
  26228. * Iterates over elements of `collection`, returning an array of all elements
  26229. * `predicate` returns truthy for. The predicate is invoked with three
  26230. * arguments: (value, index|key, collection).
  26231. *
  26232. * **Note:** Unlike `_.remove`, this method returns a new array.
  26233. *
  26234. * @static
  26235. * @memberOf _
  26236. * @since 0.1.0
  26237. * @category Collection
  26238. * @param {Array|Object} collection The collection to iterate over.
  26239. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26240. * @returns {Array} Returns the new filtered array.
  26241. * @see _.reject
  26242. * @example
  26243. *
  26244. * var users = [
  26245. * { 'user': 'barney', 'age': 36, 'active': true },
  26246. * { 'user': 'fred', 'age': 40, 'active': false }
  26247. * ];
  26248. *
  26249. * _.filter(users, function(o) { return !o.active; });
  26250. * // => objects for ['fred']
  26251. *
  26252. * // The `_.matches` iteratee shorthand.
  26253. * _.filter(users, { 'age': 36, 'active': true });
  26254. * // => objects for ['barney']
  26255. *
  26256. * // The `_.matchesProperty` iteratee shorthand.
  26257. * _.filter(users, ['active', false]);
  26258. * // => objects for ['fred']
  26259. *
  26260. * // The `_.property` iteratee shorthand.
  26261. * _.filter(users, 'active');
  26262. * // => objects for ['barney']
  26263. */
  26264. function filter(collection, predicate) {
  26265. var func = isArray(collection) ? arrayFilter : baseFilter;
  26266. return func(collection, getIteratee(predicate, 3));
  26267. }
  26268. /**
  26269. * Iterates over elements of `collection`, returning the first element
  26270. * `predicate` returns truthy for. The predicate is invoked with three
  26271. * arguments: (value, index|key, collection).
  26272. *
  26273. * @static
  26274. * @memberOf _
  26275. * @since 0.1.0
  26276. * @category Collection
  26277. * @param {Array|Object} collection The collection to inspect.
  26278. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26279. * @param {number} [fromIndex=0] The index to search from.
  26280. * @returns {*} Returns the matched element, else `undefined`.
  26281. * @example
  26282. *
  26283. * var users = [
  26284. * { 'user': 'barney', 'age': 36, 'active': true },
  26285. * { 'user': 'fred', 'age': 40, 'active': false },
  26286. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26287. * ];
  26288. *
  26289. * _.find(users, function(o) { return o.age < 40; });
  26290. * // => object for 'barney'
  26291. *
  26292. * // The `_.matches` iteratee shorthand.
  26293. * _.find(users, { 'age': 1, 'active': true });
  26294. * // => object for 'pebbles'
  26295. *
  26296. * // The `_.matchesProperty` iteratee shorthand.
  26297. * _.find(users, ['active', false]);
  26298. * // => object for 'fred'
  26299. *
  26300. * // The `_.property` iteratee shorthand.
  26301. * _.find(users, 'active');
  26302. * // => object for 'barney'
  26303. */
  26304. var find = createFind(findIndex);
  26305. /**
  26306. * This method is like `_.find` except that it iterates over elements of
  26307. * `collection` from right to left.
  26308. *
  26309. * @static
  26310. * @memberOf _
  26311. * @since 2.0.0
  26312. * @category Collection
  26313. * @param {Array|Object} collection The collection to inspect.
  26314. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26315. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26316. * @returns {*} Returns the matched element, else `undefined`.
  26317. * @example
  26318. *
  26319. * _.findLast([1, 2, 3, 4], function(n) {
  26320. * return n % 2 == 1;
  26321. * });
  26322. * // => 3
  26323. */
  26324. var findLast = createFind(findLastIndex);
  26325. /**
  26326. * Creates a flattened array of values by running each element in `collection`
  26327. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26328. * with three arguments: (value, index|key, collection).
  26329. *
  26330. * @static
  26331. * @memberOf _
  26332. * @since 4.0.0
  26333. * @category Collection
  26334. * @param {Array|Object} collection The collection to iterate over.
  26335. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26336. * @returns {Array} Returns the new flattened array.
  26337. * @example
  26338. *
  26339. * function duplicate(n) {
  26340. * return [n, n];
  26341. * }
  26342. *
  26343. * _.flatMap([1, 2], duplicate);
  26344. * // => [1, 1, 2, 2]
  26345. */
  26346. function flatMap(collection, iteratee) {
  26347. return baseFlatten(map(collection, iteratee), 1);
  26348. }
  26349. /**
  26350. * This method is like `_.flatMap` except that it recursively flattens the
  26351. * mapped results.
  26352. *
  26353. * @static
  26354. * @memberOf _
  26355. * @since 4.7.0
  26356. * @category Collection
  26357. * @param {Array|Object} collection The collection to iterate over.
  26358. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26359. * @returns {Array} Returns the new flattened array.
  26360. * @example
  26361. *
  26362. * function duplicate(n) {
  26363. * return [[[n, n]]];
  26364. * }
  26365. *
  26366. * _.flatMapDeep([1, 2], duplicate);
  26367. * // => [1, 1, 2, 2]
  26368. */
  26369. function flatMapDeep(collection, iteratee) {
  26370. return baseFlatten(map(collection, iteratee), INFINITY);
  26371. }
  26372. /**
  26373. * This method is like `_.flatMap` except that it recursively flattens the
  26374. * mapped results up to `depth` times.
  26375. *
  26376. * @static
  26377. * @memberOf _
  26378. * @since 4.7.0
  26379. * @category Collection
  26380. * @param {Array|Object} collection The collection to iterate over.
  26381. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26382. * @param {number} [depth=1] The maximum recursion depth.
  26383. * @returns {Array} Returns the new flattened array.
  26384. * @example
  26385. *
  26386. * function duplicate(n) {
  26387. * return [[[n, n]]];
  26388. * }
  26389. *
  26390. * _.flatMapDepth([1, 2], duplicate, 2);
  26391. * // => [[1, 1], [2, 2]]
  26392. */
  26393. function flatMapDepth(collection, iteratee, depth) {
  26394. depth = depth === undefined ? 1 : toInteger(depth);
  26395. return baseFlatten(map(collection, iteratee), depth);
  26396. }
  26397. /**
  26398. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26399. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26400. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26401. *
  26402. * **Note:** As with other "Collections" methods, objects with a "length"
  26403. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26404. * or `_.forOwn` for object iteration.
  26405. *
  26406. * @static
  26407. * @memberOf _
  26408. * @since 0.1.0
  26409. * @alias each
  26410. * @category Collection
  26411. * @param {Array|Object} collection The collection to iterate over.
  26412. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26413. * @returns {Array|Object} Returns `collection`.
  26414. * @see _.forEachRight
  26415. * @example
  26416. *
  26417. * _.forEach([1, 2], function(value) {
  26418. * console.log(value);
  26419. * });
  26420. * // => Logs `1` then `2`.
  26421. *
  26422. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26423. * console.log(key);
  26424. * });
  26425. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26426. */
  26427. function forEach(collection, iteratee) {
  26428. var func = isArray(collection) ? arrayEach : baseEach;
  26429. return func(collection, getIteratee(iteratee, 3));
  26430. }
  26431. /**
  26432. * This method is like `_.forEach` except that it iterates over elements of
  26433. * `collection` from right to left.
  26434. *
  26435. * @static
  26436. * @memberOf _
  26437. * @since 2.0.0
  26438. * @alias eachRight
  26439. * @category Collection
  26440. * @param {Array|Object} collection The collection to iterate over.
  26441. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26442. * @returns {Array|Object} Returns `collection`.
  26443. * @see _.forEach
  26444. * @example
  26445. *
  26446. * _.forEachRight([1, 2], function(value) {
  26447. * console.log(value);
  26448. * });
  26449. * // => Logs `2` then `1`.
  26450. */
  26451. function forEachRight(collection, iteratee) {
  26452. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26453. return func(collection, getIteratee(iteratee, 3));
  26454. }
  26455. /**
  26456. * Creates an object composed of keys generated from the results of running
  26457. * each element of `collection` thru `iteratee`. The order of grouped values
  26458. * is determined by the order they occur in `collection`. The corresponding
  26459. * value of each key is an array of elements responsible for generating the
  26460. * key. The iteratee is invoked with one argument: (value).
  26461. *
  26462. * @static
  26463. * @memberOf _
  26464. * @since 0.1.0
  26465. * @category Collection
  26466. * @param {Array|Object} collection The collection to iterate over.
  26467. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26468. * @returns {Object} Returns the composed aggregate object.
  26469. * @example
  26470. *
  26471. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26472. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26473. *
  26474. * // The `_.property` iteratee shorthand.
  26475. * _.groupBy(['one', 'two', 'three'], 'length');
  26476. * // => { '3': ['one', 'two'], '5': ['three'] }
  26477. */
  26478. var groupBy = createAggregator(function(result, value, key) {
  26479. if (hasOwnProperty.call(result, key)) {
  26480. result[key].push(value);
  26481. } else {
  26482. baseAssignValue(result, key, [value]);
  26483. }
  26484. });
  26485. /**
  26486. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26487. * checked for a substring of `value`, otherwise
  26488. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26489. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26490. * the offset from the end of `collection`.
  26491. *
  26492. * @static
  26493. * @memberOf _
  26494. * @since 0.1.0
  26495. * @category Collection
  26496. * @param {Array|Object|string} collection The collection to inspect.
  26497. * @param {*} value The value to search for.
  26498. * @param {number} [fromIndex=0] The index to search from.
  26499. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26500. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26501. * @example
  26502. *
  26503. * _.includes([1, 2, 3], 1);
  26504. * // => true
  26505. *
  26506. * _.includes([1, 2, 3], 1, 2);
  26507. * // => false
  26508. *
  26509. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26510. * // => true
  26511. *
  26512. * _.includes('abcd', 'bc');
  26513. * // => true
  26514. */
  26515. function includes(collection, value, fromIndex, guard) {
  26516. collection = isArrayLike(collection) ? collection : values(collection);
  26517. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26518. var length = collection.length;
  26519. if (fromIndex < 0) {
  26520. fromIndex = nativeMax(length + fromIndex, 0);
  26521. }
  26522. return isString(collection)
  26523. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26524. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26525. }
  26526. /**
  26527. * Invokes the method at `path` of each element in `collection`, returning
  26528. * an array of the results of each invoked method. Any additional arguments
  26529. * are provided to each invoked method. If `path` is a function, it's invoked
  26530. * for, and `this` bound to, each element in `collection`.
  26531. *
  26532. * @static
  26533. * @memberOf _
  26534. * @since 4.0.0
  26535. * @category Collection
  26536. * @param {Array|Object} collection The collection to iterate over.
  26537. * @param {Array|Function|string} path The path of the method to invoke or
  26538. * the function invoked per iteration.
  26539. * @param {...*} [args] The arguments to invoke each method with.
  26540. * @returns {Array} Returns the array of results.
  26541. * @example
  26542. *
  26543. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26544. * // => [[1, 5, 7], [1, 2, 3]]
  26545. *
  26546. * _.invokeMap([123, 456], String.prototype.split, '');
  26547. * // => [['1', '2', '3'], ['4', '5', '6']]
  26548. */
  26549. var invokeMap = baseRest(function(collection, path, args) {
  26550. var index = -1,
  26551. isFunc = typeof path == 'function',
  26552. result = isArrayLike(collection) ? Array(collection.length) : [];
  26553. baseEach(collection, function(value) {
  26554. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26555. });
  26556. return result;
  26557. });
  26558. /**
  26559. * Creates an object composed of keys generated from the results of running
  26560. * each element of `collection` thru `iteratee`. The corresponding value of
  26561. * each key is the last element responsible for generating the key. The
  26562. * iteratee is invoked with one argument: (value).
  26563. *
  26564. * @static
  26565. * @memberOf _
  26566. * @since 4.0.0
  26567. * @category Collection
  26568. * @param {Array|Object} collection The collection to iterate over.
  26569. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26570. * @returns {Object} Returns the composed aggregate object.
  26571. * @example
  26572. *
  26573. * var array = [
  26574. * { 'dir': 'left', 'code': 97 },
  26575. * { 'dir': 'right', 'code': 100 }
  26576. * ];
  26577. *
  26578. * _.keyBy(array, function(o) {
  26579. * return String.fromCharCode(o.code);
  26580. * });
  26581. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26582. *
  26583. * _.keyBy(array, 'dir');
  26584. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26585. */
  26586. var keyBy = createAggregator(function(result, value, key) {
  26587. baseAssignValue(result, key, value);
  26588. });
  26589. /**
  26590. * Creates an array of values by running each element in `collection` thru
  26591. * `iteratee`. The iteratee is invoked with three arguments:
  26592. * (value, index|key, collection).
  26593. *
  26594. * Many lodash methods are guarded to work as iteratees for methods like
  26595. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26596. *
  26597. * The guarded methods are:
  26598. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26599. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26600. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26601. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26602. *
  26603. * @static
  26604. * @memberOf _
  26605. * @since 0.1.0
  26606. * @category Collection
  26607. * @param {Array|Object} collection The collection to iterate over.
  26608. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26609. * @returns {Array} Returns the new mapped array.
  26610. * @example
  26611. *
  26612. * function square(n) {
  26613. * return n * n;
  26614. * }
  26615. *
  26616. * _.map([4, 8], square);
  26617. * // => [16, 64]
  26618. *
  26619. * _.map({ 'a': 4, 'b': 8 }, square);
  26620. * // => [16, 64] (iteration order is not guaranteed)
  26621. *
  26622. * var users = [
  26623. * { 'user': 'barney' },
  26624. * { 'user': 'fred' }
  26625. * ];
  26626. *
  26627. * // The `_.property` iteratee shorthand.
  26628. * _.map(users, 'user');
  26629. * // => ['barney', 'fred']
  26630. */
  26631. function map(collection, iteratee) {
  26632. var func = isArray(collection) ? arrayMap : baseMap;
  26633. return func(collection, getIteratee(iteratee, 3));
  26634. }
  26635. /**
  26636. * This method is like `_.sortBy` except that it allows specifying the sort
  26637. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26638. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26639. * descending or "asc" for ascending sort order of corresponding values.
  26640. *
  26641. * @static
  26642. * @memberOf _
  26643. * @since 4.0.0
  26644. * @category Collection
  26645. * @param {Array|Object} collection The collection to iterate over.
  26646. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26647. * The iteratees to sort by.
  26648. * @param {string[]} [orders] The sort orders of `iteratees`.
  26649. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26650. * @returns {Array} Returns the new sorted array.
  26651. * @example
  26652. *
  26653. * var users = [
  26654. * { 'user': 'fred', 'age': 48 },
  26655. * { 'user': 'barney', 'age': 34 },
  26656. * { 'user': 'fred', 'age': 40 },
  26657. * { 'user': 'barney', 'age': 36 }
  26658. * ];
  26659. *
  26660. * // Sort by `user` in ascending order and by `age` in descending order.
  26661. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26662. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26663. */
  26664. function orderBy(collection, iteratees, orders, guard) {
  26665. if (collection == null) {
  26666. return [];
  26667. }
  26668. if (!isArray(iteratees)) {
  26669. iteratees = iteratees == null ? [] : [iteratees];
  26670. }
  26671. orders = guard ? undefined : orders;
  26672. if (!isArray(orders)) {
  26673. orders = orders == null ? [] : [orders];
  26674. }
  26675. return baseOrderBy(collection, iteratees, orders);
  26676. }
  26677. /**
  26678. * Creates an array of elements split into two groups, the first of which
  26679. * contains elements `predicate` returns truthy for, the second of which
  26680. * contains elements `predicate` returns falsey for. The predicate is
  26681. * invoked with one argument: (value).
  26682. *
  26683. * @static
  26684. * @memberOf _
  26685. * @since 3.0.0
  26686. * @category Collection
  26687. * @param {Array|Object} collection The collection to iterate over.
  26688. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26689. * @returns {Array} Returns the array of grouped elements.
  26690. * @example
  26691. *
  26692. * var users = [
  26693. * { 'user': 'barney', 'age': 36, 'active': false },
  26694. * { 'user': 'fred', 'age': 40, 'active': true },
  26695. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26696. * ];
  26697. *
  26698. * _.partition(users, function(o) { return o.active; });
  26699. * // => objects for [['fred'], ['barney', 'pebbles']]
  26700. *
  26701. * // The `_.matches` iteratee shorthand.
  26702. * _.partition(users, { 'age': 1, 'active': false });
  26703. * // => objects for [['pebbles'], ['barney', 'fred']]
  26704. *
  26705. * // The `_.matchesProperty` iteratee shorthand.
  26706. * _.partition(users, ['active', false]);
  26707. * // => objects for [['barney', 'pebbles'], ['fred']]
  26708. *
  26709. * // The `_.property` iteratee shorthand.
  26710. * _.partition(users, 'active');
  26711. * // => objects for [['fred'], ['barney', 'pebbles']]
  26712. */
  26713. var partition = createAggregator(function(result, value, key) {
  26714. result[key ? 0 : 1].push(value);
  26715. }, function() { return [[], []]; });
  26716. /**
  26717. * Reduces `collection` to a value which is the accumulated result of running
  26718. * each element in `collection` thru `iteratee`, where each successive
  26719. * invocation is supplied the return value of the previous. If `accumulator`
  26720. * is not given, the first element of `collection` is used as the initial
  26721. * value. The iteratee is invoked with four arguments:
  26722. * (accumulator, value, index|key, collection).
  26723. *
  26724. * Many lodash methods are guarded to work as iteratees for methods like
  26725. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26726. *
  26727. * The guarded methods are:
  26728. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26729. * and `sortBy`
  26730. *
  26731. * @static
  26732. * @memberOf _
  26733. * @since 0.1.0
  26734. * @category Collection
  26735. * @param {Array|Object} collection The collection to iterate over.
  26736. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26737. * @param {*} [accumulator] The initial value.
  26738. * @returns {*} Returns the accumulated value.
  26739. * @see _.reduceRight
  26740. * @example
  26741. *
  26742. * _.reduce([1, 2], function(sum, n) {
  26743. * return sum + n;
  26744. * }, 0);
  26745. * // => 3
  26746. *
  26747. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26748. * (result[value] || (result[value] = [])).push(key);
  26749. * return result;
  26750. * }, {});
  26751. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26752. */
  26753. function reduce(collection, iteratee, accumulator) {
  26754. var func = isArray(collection) ? arrayReduce : baseReduce,
  26755. initAccum = arguments.length < 3;
  26756. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26757. }
  26758. /**
  26759. * This method is like `_.reduce` except that it iterates over elements of
  26760. * `collection` from right to left.
  26761. *
  26762. * @static
  26763. * @memberOf _
  26764. * @since 0.1.0
  26765. * @category Collection
  26766. * @param {Array|Object} collection The collection to iterate over.
  26767. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26768. * @param {*} [accumulator] The initial value.
  26769. * @returns {*} Returns the accumulated value.
  26770. * @see _.reduce
  26771. * @example
  26772. *
  26773. * var array = [[0, 1], [2, 3], [4, 5]];
  26774. *
  26775. * _.reduceRight(array, function(flattened, other) {
  26776. * return flattened.concat(other);
  26777. * }, []);
  26778. * // => [4, 5, 2, 3, 0, 1]
  26779. */
  26780. function reduceRight(collection, iteratee, accumulator) {
  26781. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26782. initAccum = arguments.length < 3;
  26783. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26784. }
  26785. /**
  26786. * The opposite of `_.filter`; this method returns the elements of `collection`
  26787. * that `predicate` does **not** return truthy for.
  26788. *
  26789. * @static
  26790. * @memberOf _
  26791. * @since 0.1.0
  26792. * @category Collection
  26793. * @param {Array|Object} collection The collection to iterate over.
  26794. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26795. * @returns {Array} Returns the new filtered array.
  26796. * @see _.filter
  26797. * @example
  26798. *
  26799. * var users = [
  26800. * { 'user': 'barney', 'age': 36, 'active': false },
  26801. * { 'user': 'fred', 'age': 40, 'active': true }
  26802. * ];
  26803. *
  26804. * _.reject(users, function(o) { return !o.active; });
  26805. * // => objects for ['fred']
  26806. *
  26807. * // The `_.matches` iteratee shorthand.
  26808. * _.reject(users, { 'age': 40, 'active': true });
  26809. * // => objects for ['barney']
  26810. *
  26811. * // The `_.matchesProperty` iteratee shorthand.
  26812. * _.reject(users, ['active', false]);
  26813. * // => objects for ['fred']
  26814. *
  26815. * // The `_.property` iteratee shorthand.
  26816. * _.reject(users, 'active');
  26817. * // => objects for ['barney']
  26818. */
  26819. function reject(collection, predicate) {
  26820. var func = isArray(collection) ? arrayFilter : baseFilter;
  26821. return func(collection, negate(getIteratee(predicate, 3)));
  26822. }
  26823. /**
  26824. * Gets a random element from `collection`.
  26825. *
  26826. * @static
  26827. * @memberOf _
  26828. * @since 2.0.0
  26829. * @category Collection
  26830. * @param {Array|Object} collection The collection to sample.
  26831. * @returns {*} Returns the random element.
  26832. * @example
  26833. *
  26834. * _.sample([1, 2, 3, 4]);
  26835. * // => 2
  26836. */
  26837. function sample(collection) {
  26838. var func = isArray(collection) ? arraySample : baseSample;
  26839. return func(collection);
  26840. }
  26841. /**
  26842. * Gets `n` random elements at unique keys from `collection` up to the
  26843. * size of `collection`.
  26844. *
  26845. * @static
  26846. * @memberOf _
  26847. * @since 4.0.0
  26848. * @category Collection
  26849. * @param {Array|Object} collection The collection to sample.
  26850. * @param {number} [n=1] The number of elements to sample.
  26851. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26852. * @returns {Array} Returns the random elements.
  26853. * @example
  26854. *
  26855. * _.sampleSize([1, 2, 3], 2);
  26856. * // => [3, 1]
  26857. *
  26858. * _.sampleSize([1, 2, 3], 4);
  26859. * // => [2, 3, 1]
  26860. */
  26861. function sampleSize(collection, n, guard) {
  26862. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  26863. n = 1;
  26864. } else {
  26865. n = toInteger(n);
  26866. }
  26867. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  26868. return func(collection, n);
  26869. }
  26870. /**
  26871. * Creates an array of shuffled values, using a version of the
  26872. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  26873. *
  26874. * @static
  26875. * @memberOf _
  26876. * @since 0.1.0
  26877. * @category Collection
  26878. * @param {Array|Object} collection The collection to shuffle.
  26879. * @returns {Array} Returns the new shuffled array.
  26880. * @example
  26881. *
  26882. * _.shuffle([1, 2, 3, 4]);
  26883. * // => [4, 1, 3, 2]
  26884. */
  26885. function shuffle(collection) {
  26886. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  26887. return func(collection);
  26888. }
  26889. /**
  26890. * Gets the size of `collection` by returning its length for array-like
  26891. * values or the number of own enumerable string keyed properties for objects.
  26892. *
  26893. * @static
  26894. * @memberOf _
  26895. * @since 0.1.0
  26896. * @category Collection
  26897. * @param {Array|Object|string} collection The collection to inspect.
  26898. * @returns {number} Returns the collection size.
  26899. * @example
  26900. *
  26901. * _.size([1, 2, 3]);
  26902. * // => 3
  26903. *
  26904. * _.size({ 'a': 1, 'b': 2 });
  26905. * // => 2
  26906. *
  26907. * _.size('pebbles');
  26908. * // => 7
  26909. */
  26910. function size(collection) {
  26911. if (collection == null) {
  26912. return 0;
  26913. }
  26914. if (isArrayLike(collection)) {
  26915. return isString(collection) ? stringSize(collection) : collection.length;
  26916. }
  26917. var tag = getTag(collection);
  26918. if (tag == mapTag || tag == setTag) {
  26919. return collection.size;
  26920. }
  26921. return baseKeys(collection).length;
  26922. }
  26923. /**
  26924. * Checks if `predicate` returns truthy for **any** element of `collection`.
  26925. * Iteration is stopped once `predicate` returns truthy. The predicate is
  26926. * invoked with three arguments: (value, index|key, collection).
  26927. *
  26928. * @static
  26929. * @memberOf _
  26930. * @since 0.1.0
  26931. * @category Collection
  26932. * @param {Array|Object} collection The collection to iterate over.
  26933. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26934. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26935. * @returns {boolean} Returns `true` if any element passes the predicate check,
  26936. * else `false`.
  26937. * @example
  26938. *
  26939. * _.some([null, 0, 'yes', false], Boolean);
  26940. * // => true
  26941. *
  26942. * var users = [
  26943. * { 'user': 'barney', 'active': true },
  26944. * { 'user': 'fred', 'active': false }
  26945. * ];
  26946. *
  26947. * // The `_.matches` iteratee shorthand.
  26948. * _.some(users, { 'user': 'barney', 'active': false });
  26949. * // => false
  26950. *
  26951. * // The `_.matchesProperty` iteratee shorthand.
  26952. * _.some(users, ['active', false]);
  26953. * // => true
  26954. *
  26955. * // The `_.property` iteratee shorthand.
  26956. * _.some(users, 'active');
  26957. * // => true
  26958. */
  26959. function some(collection, predicate, guard) {
  26960. var func = isArray(collection) ? arraySome : baseSome;
  26961. if (guard && isIterateeCall(collection, predicate, guard)) {
  26962. predicate = undefined;
  26963. }
  26964. return func(collection, getIteratee(predicate, 3));
  26965. }
  26966. /**
  26967. * Creates an array of elements, sorted in ascending order by the results of
  26968. * running each element in a collection thru each iteratee. This method
  26969. * performs a stable sort, that is, it preserves the original sort order of
  26970. * equal elements. The iteratees are invoked with one argument: (value).
  26971. *
  26972. * @static
  26973. * @memberOf _
  26974. * @since 0.1.0
  26975. * @category Collection
  26976. * @param {Array|Object} collection The collection to iterate over.
  26977. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  26978. * The iteratees to sort by.
  26979. * @returns {Array} Returns the new sorted array.
  26980. * @example
  26981. *
  26982. * var users = [
  26983. * { 'user': 'fred', 'age': 48 },
  26984. * { 'user': 'barney', 'age': 36 },
  26985. * { 'user': 'fred', 'age': 40 },
  26986. * { 'user': 'barney', 'age': 34 }
  26987. * ];
  26988. *
  26989. * _.sortBy(users, [function(o) { return o.user; }]);
  26990. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26991. *
  26992. * _.sortBy(users, ['user', 'age']);
  26993. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  26994. */
  26995. var sortBy = baseRest(function(collection, iteratees) {
  26996. if (collection == null) {
  26997. return [];
  26998. }
  26999. var length = iteratees.length;
  27000. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27001. iteratees = [];
  27002. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27003. iteratees = [iteratees[0]];
  27004. }
  27005. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27006. });
  27007. /*------------------------------------------------------------------------*/
  27008. /**
  27009. * Gets the timestamp of the number of milliseconds that have elapsed since
  27010. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27011. *
  27012. * @static
  27013. * @memberOf _
  27014. * @since 2.4.0
  27015. * @category Date
  27016. * @returns {number} Returns the timestamp.
  27017. * @example
  27018. *
  27019. * _.defer(function(stamp) {
  27020. * console.log(_.now() - stamp);
  27021. * }, _.now());
  27022. * // => Logs the number of milliseconds it took for the deferred invocation.
  27023. */
  27024. var now = ctxNow || function() {
  27025. return root.Date.now();
  27026. };
  27027. /*------------------------------------------------------------------------*/
  27028. /**
  27029. * The opposite of `_.before`; this method creates a function that invokes
  27030. * `func` once it's called `n` or more times.
  27031. *
  27032. * @static
  27033. * @memberOf _
  27034. * @since 0.1.0
  27035. * @category Function
  27036. * @param {number} n The number of calls before `func` is invoked.
  27037. * @param {Function} func The function to restrict.
  27038. * @returns {Function} Returns the new restricted function.
  27039. * @example
  27040. *
  27041. * var saves = ['profile', 'settings'];
  27042. *
  27043. * var done = _.after(saves.length, function() {
  27044. * console.log('done saving!');
  27045. * });
  27046. *
  27047. * _.forEach(saves, function(type) {
  27048. * asyncSave({ 'type': type, 'complete': done });
  27049. * });
  27050. * // => Logs 'done saving!' after the two async saves have completed.
  27051. */
  27052. function after(n, func) {
  27053. if (typeof func != 'function') {
  27054. throw new TypeError(FUNC_ERROR_TEXT);
  27055. }
  27056. n = toInteger(n);
  27057. return function() {
  27058. if (--n < 1) {
  27059. return func.apply(this, arguments);
  27060. }
  27061. };
  27062. }
  27063. /**
  27064. * Creates a function that invokes `func`, with up to `n` arguments,
  27065. * ignoring any additional arguments.
  27066. *
  27067. * @static
  27068. * @memberOf _
  27069. * @since 3.0.0
  27070. * @category Function
  27071. * @param {Function} func The function to cap arguments for.
  27072. * @param {number} [n=func.length] The arity cap.
  27073. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27074. * @returns {Function} Returns the new capped function.
  27075. * @example
  27076. *
  27077. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27078. * // => [6, 8, 10]
  27079. */
  27080. function ary(func, n, guard) {
  27081. n = guard ? undefined : n;
  27082. n = (func && n == null) ? func.length : n;
  27083. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27084. }
  27085. /**
  27086. * Creates a function that invokes `func`, with the `this` binding and arguments
  27087. * of the created function, while it's called less than `n` times. Subsequent
  27088. * calls to the created function return the result of the last `func` invocation.
  27089. *
  27090. * @static
  27091. * @memberOf _
  27092. * @since 3.0.0
  27093. * @category Function
  27094. * @param {number} n The number of calls at which `func` is no longer invoked.
  27095. * @param {Function} func The function to restrict.
  27096. * @returns {Function} Returns the new restricted function.
  27097. * @example
  27098. *
  27099. * jQuery(element).on('click', _.before(5, addContactToList));
  27100. * // => Allows adding up to 4 contacts to the list.
  27101. */
  27102. function before(n, func) {
  27103. var result;
  27104. if (typeof func != 'function') {
  27105. throw new TypeError(FUNC_ERROR_TEXT);
  27106. }
  27107. n = toInteger(n);
  27108. return function() {
  27109. if (--n > 0) {
  27110. result = func.apply(this, arguments);
  27111. }
  27112. if (n <= 1) {
  27113. func = undefined;
  27114. }
  27115. return result;
  27116. };
  27117. }
  27118. /**
  27119. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27120. * and `partials` prepended to the arguments it receives.
  27121. *
  27122. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27123. * may be used as a placeholder for partially applied arguments.
  27124. *
  27125. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27126. * property of bound functions.
  27127. *
  27128. * @static
  27129. * @memberOf _
  27130. * @since 0.1.0
  27131. * @category Function
  27132. * @param {Function} func The function to bind.
  27133. * @param {*} thisArg The `this` binding of `func`.
  27134. * @param {...*} [partials] The arguments to be partially applied.
  27135. * @returns {Function} Returns the new bound function.
  27136. * @example
  27137. *
  27138. * function greet(greeting, punctuation) {
  27139. * return greeting + ' ' + this.user + punctuation;
  27140. * }
  27141. *
  27142. * var object = { 'user': 'fred' };
  27143. *
  27144. * var bound = _.bind(greet, object, 'hi');
  27145. * bound('!');
  27146. * // => 'hi fred!'
  27147. *
  27148. * // Bound with placeholders.
  27149. * var bound = _.bind(greet, object, _, '!');
  27150. * bound('hi');
  27151. * // => 'hi fred!'
  27152. */
  27153. var bind = baseRest(function(func, thisArg, partials) {
  27154. var bitmask = WRAP_BIND_FLAG;
  27155. if (partials.length) {
  27156. var holders = replaceHolders(partials, getHolder(bind));
  27157. bitmask |= WRAP_PARTIAL_FLAG;
  27158. }
  27159. return createWrap(func, bitmask, thisArg, partials, holders);
  27160. });
  27161. /**
  27162. * Creates a function that invokes the method at `object[key]` with `partials`
  27163. * prepended to the arguments it receives.
  27164. *
  27165. * This method differs from `_.bind` by allowing bound functions to reference
  27166. * methods that may be redefined or don't yet exist. See
  27167. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27168. * for more details.
  27169. *
  27170. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27171. * builds, may be used as a placeholder for partially applied arguments.
  27172. *
  27173. * @static
  27174. * @memberOf _
  27175. * @since 0.10.0
  27176. * @category Function
  27177. * @param {Object} object The object to invoke the method on.
  27178. * @param {string} key The key of the method.
  27179. * @param {...*} [partials] The arguments to be partially applied.
  27180. * @returns {Function} Returns the new bound function.
  27181. * @example
  27182. *
  27183. * var object = {
  27184. * 'user': 'fred',
  27185. * 'greet': function(greeting, punctuation) {
  27186. * return greeting + ' ' + this.user + punctuation;
  27187. * }
  27188. * };
  27189. *
  27190. * var bound = _.bindKey(object, 'greet', 'hi');
  27191. * bound('!');
  27192. * // => 'hi fred!'
  27193. *
  27194. * object.greet = function(greeting, punctuation) {
  27195. * return greeting + 'ya ' + this.user + punctuation;
  27196. * };
  27197. *
  27198. * bound('!');
  27199. * // => 'hiya fred!'
  27200. *
  27201. * // Bound with placeholders.
  27202. * var bound = _.bindKey(object, 'greet', _, '!');
  27203. * bound('hi');
  27204. * // => 'hiya fred!'
  27205. */
  27206. var bindKey = baseRest(function(object, key, partials) {
  27207. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27208. if (partials.length) {
  27209. var holders = replaceHolders(partials, getHolder(bindKey));
  27210. bitmask |= WRAP_PARTIAL_FLAG;
  27211. }
  27212. return createWrap(key, bitmask, object, partials, holders);
  27213. });
  27214. /**
  27215. * Creates a function that accepts arguments of `func` and either invokes
  27216. * `func` returning its result, if at least `arity` number of arguments have
  27217. * been provided, or returns a function that accepts the remaining `func`
  27218. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27219. * is not sufficient.
  27220. *
  27221. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27222. * may be used as a placeholder for provided arguments.
  27223. *
  27224. * **Note:** This method doesn't set the "length" property of curried functions.
  27225. *
  27226. * @static
  27227. * @memberOf _
  27228. * @since 2.0.0
  27229. * @category Function
  27230. * @param {Function} func The function to curry.
  27231. * @param {number} [arity=func.length] The arity of `func`.
  27232. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27233. * @returns {Function} Returns the new curried function.
  27234. * @example
  27235. *
  27236. * var abc = function(a, b, c) {
  27237. * return [a, b, c];
  27238. * };
  27239. *
  27240. * var curried = _.curry(abc);
  27241. *
  27242. * curried(1)(2)(3);
  27243. * // => [1, 2, 3]
  27244. *
  27245. * curried(1, 2)(3);
  27246. * // => [1, 2, 3]
  27247. *
  27248. * curried(1, 2, 3);
  27249. * // => [1, 2, 3]
  27250. *
  27251. * // Curried with placeholders.
  27252. * curried(1)(_, 3)(2);
  27253. * // => [1, 2, 3]
  27254. */
  27255. function curry(func, arity, guard) {
  27256. arity = guard ? undefined : arity;
  27257. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27258. result.placeholder = curry.placeholder;
  27259. return result;
  27260. }
  27261. /**
  27262. * This method is like `_.curry` except that arguments are applied to `func`
  27263. * in the manner of `_.partialRight` instead of `_.partial`.
  27264. *
  27265. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27266. * builds, may be used as a placeholder for provided arguments.
  27267. *
  27268. * **Note:** This method doesn't set the "length" property of curried functions.
  27269. *
  27270. * @static
  27271. * @memberOf _
  27272. * @since 3.0.0
  27273. * @category Function
  27274. * @param {Function} func The function to curry.
  27275. * @param {number} [arity=func.length] The arity of `func`.
  27276. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27277. * @returns {Function} Returns the new curried function.
  27278. * @example
  27279. *
  27280. * var abc = function(a, b, c) {
  27281. * return [a, b, c];
  27282. * };
  27283. *
  27284. * var curried = _.curryRight(abc);
  27285. *
  27286. * curried(3)(2)(1);
  27287. * // => [1, 2, 3]
  27288. *
  27289. * curried(2, 3)(1);
  27290. * // => [1, 2, 3]
  27291. *
  27292. * curried(1, 2, 3);
  27293. * // => [1, 2, 3]
  27294. *
  27295. * // Curried with placeholders.
  27296. * curried(3)(1, _)(2);
  27297. * // => [1, 2, 3]
  27298. */
  27299. function curryRight(func, arity, guard) {
  27300. arity = guard ? undefined : arity;
  27301. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27302. result.placeholder = curryRight.placeholder;
  27303. return result;
  27304. }
  27305. /**
  27306. * Creates a debounced function that delays invoking `func` until after `wait`
  27307. * milliseconds have elapsed since the last time the debounced function was
  27308. * invoked. The debounced function comes with a `cancel` method to cancel
  27309. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27310. * Provide `options` to indicate whether `func` should be invoked on the
  27311. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27312. * with the last arguments provided to the debounced function. Subsequent
  27313. * calls to the debounced function return the result of the last `func`
  27314. * invocation.
  27315. *
  27316. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27317. * invoked on the trailing edge of the timeout only if the debounced function
  27318. * is invoked more than once during the `wait` timeout.
  27319. *
  27320. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27321. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27322. *
  27323. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27324. * for details over the differences between `_.debounce` and `_.throttle`.
  27325. *
  27326. * @static
  27327. * @memberOf _
  27328. * @since 0.1.0
  27329. * @category Function
  27330. * @param {Function} func The function to debounce.
  27331. * @param {number} [wait=0] The number of milliseconds to delay.
  27332. * @param {Object} [options={}] The options object.
  27333. * @param {boolean} [options.leading=false]
  27334. * Specify invoking on the leading edge of the timeout.
  27335. * @param {number} [options.maxWait]
  27336. * The maximum time `func` is allowed to be delayed before it's invoked.
  27337. * @param {boolean} [options.trailing=true]
  27338. * Specify invoking on the trailing edge of the timeout.
  27339. * @returns {Function} Returns the new debounced function.
  27340. * @example
  27341. *
  27342. * // Avoid costly calculations while the window size is in flux.
  27343. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27344. *
  27345. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27346. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27347. * 'leading': true,
  27348. * 'trailing': false
  27349. * }));
  27350. *
  27351. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27352. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27353. * var source = new EventSource('/stream');
  27354. * jQuery(source).on('message', debounced);
  27355. *
  27356. * // Cancel the trailing debounced invocation.
  27357. * jQuery(window).on('popstate', debounced.cancel);
  27358. */
  27359. function debounce(func, wait, options) {
  27360. var lastArgs,
  27361. lastThis,
  27362. maxWait,
  27363. result,
  27364. timerId,
  27365. lastCallTime,
  27366. lastInvokeTime = 0,
  27367. leading = false,
  27368. maxing = false,
  27369. trailing = true;
  27370. if (typeof func != 'function') {
  27371. throw new TypeError(FUNC_ERROR_TEXT);
  27372. }
  27373. wait = toNumber(wait) || 0;
  27374. if (isObject(options)) {
  27375. leading = !!options.leading;
  27376. maxing = 'maxWait' in options;
  27377. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27378. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27379. }
  27380. function invokeFunc(time) {
  27381. var args = lastArgs,
  27382. thisArg = lastThis;
  27383. lastArgs = lastThis = undefined;
  27384. lastInvokeTime = time;
  27385. result = func.apply(thisArg, args);
  27386. return result;
  27387. }
  27388. function leadingEdge(time) {
  27389. // Reset any `maxWait` timer.
  27390. lastInvokeTime = time;
  27391. // Start the timer for the trailing edge.
  27392. timerId = setTimeout(timerExpired, wait);
  27393. // Invoke the leading edge.
  27394. return leading ? invokeFunc(time) : result;
  27395. }
  27396. function remainingWait(time) {
  27397. var timeSinceLastCall = time - lastCallTime,
  27398. timeSinceLastInvoke = time - lastInvokeTime,
  27399. timeWaiting = wait - timeSinceLastCall;
  27400. return maxing
  27401. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27402. : timeWaiting;
  27403. }
  27404. function shouldInvoke(time) {
  27405. var timeSinceLastCall = time - lastCallTime,
  27406. timeSinceLastInvoke = time - lastInvokeTime;
  27407. // Either this is the first call, activity has stopped and we're at the
  27408. // trailing edge, the system time has gone backwards and we're treating
  27409. // it as the trailing edge, or we've hit the `maxWait` limit.
  27410. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27411. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27412. }
  27413. function timerExpired() {
  27414. var time = now();
  27415. if (shouldInvoke(time)) {
  27416. return trailingEdge(time);
  27417. }
  27418. // Restart the timer.
  27419. timerId = setTimeout(timerExpired, remainingWait(time));
  27420. }
  27421. function trailingEdge(time) {
  27422. timerId = undefined;
  27423. // Only invoke if we have `lastArgs` which means `func` has been
  27424. // debounced at least once.
  27425. if (trailing && lastArgs) {
  27426. return invokeFunc(time);
  27427. }
  27428. lastArgs = lastThis = undefined;
  27429. return result;
  27430. }
  27431. function cancel() {
  27432. if (timerId !== undefined) {
  27433. clearTimeout(timerId);
  27434. }
  27435. lastInvokeTime = 0;
  27436. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27437. }
  27438. function flush() {
  27439. return timerId === undefined ? result : trailingEdge(now());
  27440. }
  27441. function debounced() {
  27442. var time = now(),
  27443. isInvoking = shouldInvoke(time);
  27444. lastArgs = arguments;
  27445. lastThis = this;
  27446. lastCallTime = time;
  27447. if (isInvoking) {
  27448. if (timerId === undefined) {
  27449. return leadingEdge(lastCallTime);
  27450. }
  27451. if (maxing) {
  27452. // Handle invocations in a tight loop.
  27453. clearTimeout(timerId);
  27454. timerId = setTimeout(timerExpired, wait);
  27455. return invokeFunc(lastCallTime);
  27456. }
  27457. }
  27458. if (timerId === undefined) {
  27459. timerId = setTimeout(timerExpired, wait);
  27460. }
  27461. return result;
  27462. }
  27463. debounced.cancel = cancel;
  27464. debounced.flush = flush;
  27465. return debounced;
  27466. }
  27467. /**
  27468. * Defers invoking the `func` until the current call stack has cleared. Any
  27469. * additional arguments are provided to `func` when it's invoked.
  27470. *
  27471. * @static
  27472. * @memberOf _
  27473. * @since 0.1.0
  27474. * @category Function
  27475. * @param {Function} func The function to defer.
  27476. * @param {...*} [args] The arguments to invoke `func` with.
  27477. * @returns {number} Returns the timer id.
  27478. * @example
  27479. *
  27480. * _.defer(function(text) {
  27481. * console.log(text);
  27482. * }, 'deferred');
  27483. * // => Logs 'deferred' after one millisecond.
  27484. */
  27485. var defer = baseRest(function(func, args) {
  27486. return baseDelay(func, 1, args);
  27487. });
  27488. /**
  27489. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27490. * provided to `func` when it's invoked.
  27491. *
  27492. * @static
  27493. * @memberOf _
  27494. * @since 0.1.0
  27495. * @category Function
  27496. * @param {Function} func The function to delay.
  27497. * @param {number} wait The number of milliseconds to delay invocation.
  27498. * @param {...*} [args] The arguments to invoke `func` with.
  27499. * @returns {number} Returns the timer id.
  27500. * @example
  27501. *
  27502. * _.delay(function(text) {
  27503. * console.log(text);
  27504. * }, 1000, 'later');
  27505. * // => Logs 'later' after one second.
  27506. */
  27507. var delay = baseRest(function(func, wait, args) {
  27508. return baseDelay(func, toNumber(wait) || 0, args);
  27509. });
  27510. /**
  27511. * Creates a function that invokes `func` with arguments reversed.
  27512. *
  27513. * @static
  27514. * @memberOf _
  27515. * @since 4.0.0
  27516. * @category Function
  27517. * @param {Function} func The function to flip arguments for.
  27518. * @returns {Function} Returns the new flipped function.
  27519. * @example
  27520. *
  27521. * var flipped = _.flip(function() {
  27522. * return _.toArray(arguments);
  27523. * });
  27524. *
  27525. * flipped('a', 'b', 'c', 'd');
  27526. * // => ['d', 'c', 'b', 'a']
  27527. */
  27528. function flip(func) {
  27529. return createWrap(func, WRAP_FLIP_FLAG);
  27530. }
  27531. /**
  27532. * Creates a function that memoizes the result of `func`. If `resolver` is
  27533. * provided, it determines the cache key for storing the result based on the
  27534. * arguments provided to the memoized function. By default, the first argument
  27535. * provided to the memoized function is used as the map cache key. The `func`
  27536. * is invoked with the `this` binding of the memoized function.
  27537. *
  27538. * **Note:** The cache is exposed as the `cache` property on the memoized
  27539. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27540. * constructor with one whose instances implement the
  27541. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27542. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27543. *
  27544. * @static
  27545. * @memberOf _
  27546. * @since 0.1.0
  27547. * @category Function
  27548. * @param {Function} func The function to have its output memoized.
  27549. * @param {Function} [resolver] The function to resolve the cache key.
  27550. * @returns {Function} Returns the new memoized function.
  27551. * @example
  27552. *
  27553. * var object = { 'a': 1, 'b': 2 };
  27554. * var other = { 'c': 3, 'd': 4 };
  27555. *
  27556. * var values = _.memoize(_.values);
  27557. * values(object);
  27558. * // => [1, 2]
  27559. *
  27560. * values(other);
  27561. * // => [3, 4]
  27562. *
  27563. * object.a = 2;
  27564. * values(object);
  27565. * // => [1, 2]
  27566. *
  27567. * // Modify the result cache.
  27568. * values.cache.set(object, ['a', 'b']);
  27569. * values(object);
  27570. * // => ['a', 'b']
  27571. *
  27572. * // Replace `_.memoize.Cache`.
  27573. * _.memoize.Cache = WeakMap;
  27574. */
  27575. function memoize(func, resolver) {
  27576. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27577. throw new TypeError(FUNC_ERROR_TEXT);
  27578. }
  27579. var memoized = function() {
  27580. var args = arguments,
  27581. key = resolver ? resolver.apply(this, args) : args[0],
  27582. cache = memoized.cache;
  27583. if (cache.has(key)) {
  27584. return cache.get(key);
  27585. }
  27586. var result = func.apply(this, args);
  27587. memoized.cache = cache.set(key, result) || cache;
  27588. return result;
  27589. };
  27590. memoized.cache = new (memoize.Cache || MapCache);
  27591. return memoized;
  27592. }
  27593. // Expose `MapCache`.
  27594. memoize.Cache = MapCache;
  27595. /**
  27596. * Creates a function that negates the result of the predicate `func`. The
  27597. * `func` predicate is invoked with the `this` binding and arguments of the
  27598. * created function.
  27599. *
  27600. * @static
  27601. * @memberOf _
  27602. * @since 3.0.0
  27603. * @category Function
  27604. * @param {Function} predicate The predicate to negate.
  27605. * @returns {Function} Returns the new negated function.
  27606. * @example
  27607. *
  27608. * function isEven(n) {
  27609. * return n % 2 == 0;
  27610. * }
  27611. *
  27612. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27613. * // => [1, 3, 5]
  27614. */
  27615. function negate(predicate) {
  27616. if (typeof predicate != 'function') {
  27617. throw new TypeError(FUNC_ERROR_TEXT);
  27618. }
  27619. return function() {
  27620. var args = arguments;
  27621. switch (args.length) {
  27622. case 0: return !predicate.call(this);
  27623. case 1: return !predicate.call(this, args[0]);
  27624. case 2: return !predicate.call(this, args[0], args[1]);
  27625. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27626. }
  27627. return !predicate.apply(this, args);
  27628. };
  27629. }
  27630. /**
  27631. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27632. * to the function return the value of the first invocation. The `func` is
  27633. * invoked with the `this` binding and arguments of the created function.
  27634. *
  27635. * @static
  27636. * @memberOf _
  27637. * @since 0.1.0
  27638. * @category Function
  27639. * @param {Function} func The function to restrict.
  27640. * @returns {Function} Returns the new restricted function.
  27641. * @example
  27642. *
  27643. * var initialize = _.once(createApplication);
  27644. * initialize();
  27645. * initialize();
  27646. * // => `createApplication` is invoked once
  27647. */
  27648. function once(func) {
  27649. return before(2, func);
  27650. }
  27651. /**
  27652. * Creates a function that invokes `func` with its arguments transformed.
  27653. *
  27654. * @static
  27655. * @since 4.0.0
  27656. * @memberOf _
  27657. * @category Function
  27658. * @param {Function} func The function to wrap.
  27659. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27660. * The argument transforms.
  27661. * @returns {Function} Returns the new function.
  27662. * @example
  27663. *
  27664. * function doubled(n) {
  27665. * return n * 2;
  27666. * }
  27667. *
  27668. * function square(n) {
  27669. * return n * n;
  27670. * }
  27671. *
  27672. * var func = _.overArgs(function(x, y) {
  27673. * return [x, y];
  27674. * }, [square, doubled]);
  27675. *
  27676. * func(9, 3);
  27677. * // => [81, 6]
  27678. *
  27679. * func(10, 5);
  27680. * // => [100, 10]
  27681. */
  27682. var overArgs = castRest(function(func, transforms) {
  27683. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27684. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27685. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27686. var funcsLength = transforms.length;
  27687. return baseRest(function(args) {
  27688. var index = -1,
  27689. length = nativeMin(args.length, funcsLength);
  27690. while (++index < length) {
  27691. args[index] = transforms[index].call(this, args[index]);
  27692. }
  27693. return apply(func, this, args);
  27694. });
  27695. });
  27696. /**
  27697. * Creates a function that invokes `func` with `partials` prepended to the
  27698. * arguments it receives. This method is like `_.bind` except it does **not**
  27699. * alter the `this` binding.
  27700. *
  27701. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27702. * builds, may be used as a placeholder for partially applied arguments.
  27703. *
  27704. * **Note:** This method doesn't set the "length" property of partially
  27705. * applied functions.
  27706. *
  27707. * @static
  27708. * @memberOf _
  27709. * @since 0.2.0
  27710. * @category Function
  27711. * @param {Function} func The function to partially apply arguments to.
  27712. * @param {...*} [partials] The arguments to be partially applied.
  27713. * @returns {Function} Returns the new partially applied function.
  27714. * @example
  27715. *
  27716. * function greet(greeting, name) {
  27717. * return greeting + ' ' + name;
  27718. * }
  27719. *
  27720. * var sayHelloTo = _.partial(greet, 'hello');
  27721. * sayHelloTo('fred');
  27722. * // => 'hello fred'
  27723. *
  27724. * // Partially applied with placeholders.
  27725. * var greetFred = _.partial(greet, _, 'fred');
  27726. * greetFred('hi');
  27727. * // => 'hi fred'
  27728. */
  27729. var partial = baseRest(function(func, partials) {
  27730. var holders = replaceHolders(partials, getHolder(partial));
  27731. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27732. });
  27733. /**
  27734. * This method is like `_.partial` except that partially applied arguments
  27735. * are appended to the arguments it receives.
  27736. *
  27737. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27738. * builds, may be used as a placeholder for partially applied arguments.
  27739. *
  27740. * **Note:** This method doesn't set the "length" property of partially
  27741. * applied functions.
  27742. *
  27743. * @static
  27744. * @memberOf _
  27745. * @since 1.0.0
  27746. * @category Function
  27747. * @param {Function} func The function to partially apply arguments to.
  27748. * @param {...*} [partials] The arguments to be partially applied.
  27749. * @returns {Function} Returns the new partially applied function.
  27750. * @example
  27751. *
  27752. * function greet(greeting, name) {
  27753. * return greeting + ' ' + name;
  27754. * }
  27755. *
  27756. * var greetFred = _.partialRight(greet, 'fred');
  27757. * greetFred('hi');
  27758. * // => 'hi fred'
  27759. *
  27760. * // Partially applied with placeholders.
  27761. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27762. * sayHelloTo('fred');
  27763. * // => 'hello fred'
  27764. */
  27765. var partialRight = baseRest(function(func, partials) {
  27766. var holders = replaceHolders(partials, getHolder(partialRight));
  27767. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27768. });
  27769. /**
  27770. * Creates a function that invokes `func` with arguments arranged according
  27771. * to the specified `indexes` where the argument value at the first index is
  27772. * provided as the first argument, the argument value at the second index is
  27773. * provided as the second argument, and so on.
  27774. *
  27775. * @static
  27776. * @memberOf _
  27777. * @since 3.0.0
  27778. * @category Function
  27779. * @param {Function} func The function to rearrange arguments for.
  27780. * @param {...(number|number[])} indexes The arranged argument indexes.
  27781. * @returns {Function} Returns the new function.
  27782. * @example
  27783. *
  27784. * var rearged = _.rearg(function(a, b, c) {
  27785. * return [a, b, c];
  27786. * }, [2, 0, 1]);
  27787. *
  27788. * rearged('b', 'c', 'a')
  27789. * // => ['a', 'b', 'c']
  27790. */
  27791. var rearg = flatRest(function(func, indexes) {
  27792. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27793. });
  27794. /**
  27795. * Creates a function that invokes `func` with the `this` binding of the
  27796. * created function and arguments from `start` and beyond provided as
  27797. * an array.
  27798. *
  27799. * **Note:** This method is based on the
  27800. * [rest parameter](https://mdn.io/rest_parameters).
  27801. *
  27802. * @static
  27803. * @memberOf _
  27804. * @since 4.0.0
  27805. * @category Function
  27806. * @param {Function} func The function to apply a rest parameter to.
  27807. * @param {number} [start=func.length-1] The start position of the rest parameter.
  27808. * @returns {Function} Returns the new function.
  27809. * @example
  27810. *
  27811. * var say = _.rest(function(what, names) {
  27812. * return what + ' ' + _.initial(names).join(', ') +
  27813. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  27814. * });
  27815. *
  27816. * say('hello', 'fred', 'barney', 'pebbles');
  27817. * // => 'hello fred, barney, & pebbles'
  27818. */
  27819. function rest(func, start) {
  27820. if (typeof func != 'function') {
  27821. throw new TypeError(FUNC_ERROR_TEXT);
  27822. }
  27823. start = start === undefined ? start : toInteger(start);
  27824. return baseRest(func, start);
  27825. }
  27826. /**
  27827. * Creates a function that invokes `func` with the `this` binding of the
  27828. * create function and an array of arguments much like
  27829. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  27830. *
  27831. * **Note:** This method is based on the
  27832. * [spread operator](https://mdn.io/spread_operator).
  27833. *
  27834. * @static
  27835. * @memberOf _
  27836. * @since 3.2.0
  27837. * @category Function
  27838. * @param {Function} func The function to spread arguments over.
  27839. * @param {number} [start=0] The start position of the spread.
  27840. * @returns {Function} Returns the new function.
  27841. * @example
  27842. *
  27843. * var say = _.spread(function(who, what) {
  27844. * return who + ' says ' + what;
  27845. * });
  27846. *
  27847. * say(['fred', 'hello']);
  27848. * // => 'fred says hello'
  27849. *
  27850. * var numbers = Promise.all([
  27851. * Promise.resolve(40),
  27852. * Promise.resolve(36)
  27853. * ]);
  27854. *
  27855. * numbers.then(_.spread(function(x, y) {
  27856. * return x + y;
  27857. * }));
  27858. * // => a Promise of 76
  27859. */
  27860. function spread(func, start) {
  27861. if (typeof func != 'function') {
  27862. throw new TypeError(FUNC_ERROR_TEXT);
  27863. }
  27864. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  27865. return baseRest(function(args) {
  27866. var array = args[start],
  27867. otherArgs = castSlice(args, 0, start);
  27868. if (array) {
  27869. arrayPush(otherArgs, array);
  27870. }
  27871. return apply(func, this, otherArgs);
  27872. });
  27873. }
  27874. /**
  27875. * Creates a throttled function that only invokes `func` at most once per
  27876. * every `wait` milliseconds. The throttled function comes with a `cancel`
  27877. * method to cancel delayed `func` invocations and a `flush` method to
  27878. * immediately invoke them. Provide `options` to indicate whether `func`
  27879. * should be invoked on the leading and/or trailing edge of the `wait`
  27880. * timeout. The `func` is invoked with the last arguments provided to the
  27881. * throttled function. Subsequent calls to the throttled function return the
  27882. * result of the last `func` invocation.
  27883. *
  27884. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27885. * invoked on the trailing edge of the timeout only if the throttled function
  27886. * is invoked more than once during the `wait` timeout.
  27887. *
  27888. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27889. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27890. *
  27891. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27892. * for details over the differences between `_.throttle` and `_.debounce`.
  27893. *
  27894. * @static
  27895. * @memberOf _
  27896. * @since 0.1.0
  27897. * @category Function
  27898. * @param {Function} func The function to throttle.
  27899. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  27900. * @param {Object} [options={}] The options object.
  27901. * @param {boolean} [options.leading=true]
  27902. * Specify invoking on the leading edge of the timeout.
  27903. * @param {boolean} [options.trailing=true]
  27904. * Specify invoking on the trailing edge of the timeout.
  27905. * @returns {Function} Returns the new throttled function.
  27906. * @example
  27907. *
  27908. * // Avoid excessively updating the position while scrolling.
  27909. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  27910. *
  27911. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  27912. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  27913. * jQuery(element).on('click', throttled);
  27914. *
  27915. * // Cancel the trailing throttled invocation.
  27916. * jQuery(window).on('popstate', throttled.cancel);
  27917. */
  27918. function throttle(func, wait, options) {
  27919. var leading = true,
  27920. trailing = true;
  27921. if (typeof func != 'function') {
  27922. throw new TypeError(FUNC_ERROR_TEXT);
  27923. }
  27924. if (isObject(options)) {
  27925. leading = 'leading' in options ? !!options.leading : leading;
  27926. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27927. }
  27928. return debounce(func, wait, {
  27929. 'leading': leading,
  27930. 'maxWait': wait,
  27931. 'trailing': trailing
  27932. });
  27933. }
  27934. /**
  27935. * Creates a function that accepts up to one argument, ignoring any
  27936. * additional arguments.
  27937. *
  27938. * @static
  27939. * @memberOf _
  27940. * @since 4.0.0
  27941. * @category Function
  27942. * @param {Function} func The function to cap arguments for.
  27943. * @returns {Function} Returns the new capped function.
  27944. * @example
  27945. *
  27946. * _.map(['6', '8', '10'], _.unary(parseInt));
  27947. * // => [6, 8, 10]
  27948. */
  27949. function unary(func) {
  27950. return ary(func, 1);
  27951. }
  27952. /**
  27953. * Creates a function that provides `value` to `wrapper` as its first
  27954. * argument. Any additional arguments provided to the function are appended
  27955. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  27956. * binding of the created function.
  27957. *
  27958. * @static
  27959. * @memberOf _
  27960. * @since 0.1.0
  27961. * @category Function
  27962. * @param {*} value The value to wrap.
  27963. * @param {Function} [wrapper=identity] The wrapper function.
  27964. * @returns {Function} Returns the new function.
  27965. * @example
  27966. *
  27967. * var p = _.wrap(_.escape, function(func, text) {
  27968. * return '<p>' + func(text) + '</p>';
  27969. * });
  27970. *
  27971. * p('fred, barney, & pebbles');
  27972. * // => '<p>fred, barney, &amp; pebbles</p>'
  27973. */
  27974. function wrap(value, wrapper) {
  27975. return partial(castFunction(wrapper), value);
  27976. }
  27977. /*------------------------------------------------------------------------*/
  27978. /**
  27979. * Casts `value` as an array if it's not one.
  27980. *
  27981. * @static
  27982. * @memberOf _
  27983. * @since 4.4.0
  27984. * @category Lang
  27985. * @param {*} value The value to inspect.
  27986. * @returns {Array} Returns the cast array.
  27987. * @example
  27988. *
  27989. * _.castArray(1);
  27990. * // => [1]
  27991. *
  27992. * _.castArray({ 'a': 1 });
  27993. * // => [{ 'a': 1 }]
  27994. *
  27995. * _.castArray('abc');
  27996. * // => ['abc']
  27997. *
  27998. * _.castArray(null);
  27999. * // => [null]
  28000. *
  28001. * _.castArray(undefined);
  28002. * // => [undefined]
  28003. *
  28004. * _.castArray();
  28005. * // => []
  28006. *
  28007. * var array = [1, 2, 3];
  28008. * console.log(_.castArray(array) === array);
  28009. * // => true
  28010. */
  28011. function castArray() {
  28012. if (!arguments.length) {
  28013. return [];
  28014. }
  28015. var value = arguments[0];
  28016. return isArray(value) ? value : [value];
  28017. }
  28018. /**
  28019. * Creates a shallow clone of `value`.
  28020. *
  28021. * **Note:** This method is loosely based on the
  28022. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28023. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28024. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28025. * arrays. The own enumerable properties of `arguments` objects are cloned
  28026. * as plain objects. An empty object is returned for uncloneable values such
  28027. * as error objects, functions, DOM nodes, and WeakMaps.
  28028. *
  28029. * @static
  28030. * @memberOf _
  28031. * @since 0.1.0
  28032. * @category Lang
  28033. * @param {*} value The value to clone.
  28034. * @returns {*} Returns the cloned value.
  28035. * @see _.cloneDeep
  28036. * @example
  28037. *
  28038. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28039. *
  28040. * var shallow = _.clone(objects);
  28041. * console.log(shallow[0] === objects[0]);
  28042. * // => true
  28043. */
  28044. function clone(value) {
  28045. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28046. }
  28047. /**
  28048. * This method is like `_.clone` except that it accepts `customizer` which
  28049. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28050. * cloning is handled by the method instead. The `customizer` is invoked with
  28051. * up to four arguments; (value [, index|key, object, stack]).
  28052. *
  28053. * @static
  28054. * @memberOf _
  28055. * @since 4.0.0
  28056. * @category Lang
  28057. * @param {*} value The value to clone.
  28058. * @param {Function} [customizer] The function to customize cloning.
  28059. * @returns {*} Returns the cloned value.
  28060. * @see _.cloneDeepWith
  28061. * @example
  28062. *
  28063. * function customizer(value) {
  28064. * if (_.isElement(value)) {
  28065. * return value.cloneNode(false);
  28066. * }
  28067. * }
  28068. *
  28069. * var el = _.cloneWith(document.body, customizer);
  28070. *
  28071. * console.log(el === document.body);
  28072. * // => false
  28073. * console.log(el.nodeName);
  28074. * // => 'BODY'
  28075. * console.log(el.childNodes.length);
  28076. * // => 0
  28077. */
  28078. function cloneWith(value, customizer) {
  28079. customizer = typeof customizer == 'function' ? customizer : undefined;
  28080. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28081. }
  28082. /**
  28083. * This method is like `_.clone` except that it recursively clones `value`.
  28084. *
  28085. * @static
  28086. * @memberOf _
  28087. * @since 1.0.0
  28088. * @category Lang
  28089. * @param {*} value The value to recursively clone.
  28090. * @returns {*} Returns the deep cloned value.
  28091. * @see _.clone
  28092. * @example
  28093. *
  28094. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28095. *
  28096. * var deep = _.cloneDeep(objects);
  28097. * console.log(deep[0] === objects[0]);
  28098. * // => false
  28099. */
  28100. function cloneDeep(value) {
  28101. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28102. }
  28103. /**
  28104. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28105. *
  28106. * @static
  28107. * @memberOf _
  28108. * @since 4.0.0
  28109. * @category Lang
  28110. * @param {*} value The value to recursively clone.
  28111. * @param {Function} [customizer] The function to customize cloning.
  28112. * @returns {*} Returns the deep cloned value.
  28113. * @see _.cloneWith
  28114. * @example
  28115. *
  28116. * function customizer(value) {
  28117. * if (_.isElement(value)) {
  28118. * return value.cloneNode(true);
  28119. * }
  28120. * }
  28121. *
  28122. * var el = _.cloneDeepWith(document.body, customizer);
  28123. *
  28124. * console.log(el === document.body);
  28125. * // => false
  28126. * console.log(el.nodeName);
  28127. * // => 'BODY'
  28128. * console.log(el.childNodes.length);
  28129. * // => 20
  28130. */
  28131. function cloneDeepWith(value, customizer) {
  28132. customizer = typeof customizer == 'function' ? customizer : undefined;
  28133. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28134. }
  28135. /**
  28136. * Checks if `object` conforms to `source` by invoking the predicate
  28137. * properties of `source` with the corresponding property values of `object`.
  28138. *
  28139. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28140. * partially applied.
  28141. *
  28142. * @static
  28143. * @memberOf _
  28144. * @since 4.14.0
  28145. * @category Lang
  28146. * @param {Object} object The object to inspect.
  28147. * @param {Object} source The object of property predicates to conform to.
  28148. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28149. * @example
  28150. *
  28151. * var object = { 'a': 1, 'b': 2 };
  28152. *
  28153. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28154. * // => true
  28155. *
  28156. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28157. * // => false
  28158. */
  28159. function conformsTo(object, source) {
  28160. return source == null || baseConformsTo(object, source, keys(source));
  28161. }
  28162. /**
  28163. * Performs a
  28164. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28165. * comparison between two values to determine if they are equivalent.
  28166. *
  28167. * @static
  28168. * @memberOf _
  28169. * @since 4.0.0
  28170. * @category Lang
  28171. * @param {*} value The value to compare.
  28172. * @param {*} other The other value to compare.
  28173. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28174. * @example
  28175. *
  28176. * var object = { 'a': 1 };
  28177. * var other = { 'a': 1 };
  28178. *
  28179. * _.eq(object, object);
  28180. * // => true
  28181. *
  28182. * _.eq(object, other);
  28183. * // => false
  28184. *
  28185. * _.eq('a', 'a');
  28186. * // => true
  28187. *
  28188. * _.eq('a', Object('a'));
  28189. * // => false
  28190. *
  28191. * _.eq(NaN, NaN);
  28192. * // => true
  28193. */
  28194. function eq(value, other) {
  28195. return value === other || (value !== value && other !== other);
  28196. }
  28197. /**
  28198. * Checks if `value` is greater than `other`.
  28199. *
  28200. * @static
  28201. * @memberOf _
  28202. * @since 3.9.0
  28203. * @category Lang
  28204. * @param {*} value The value to compare.
  28205. * @param {*} other The other value to compare.
  28206. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28207. * else `false`.
  28208. * @see _.lt
  28209. * @example
  28210. *
  28211. * _.gt(3, 1);
  28212. * // => true
  28213. *
  28214. * _.gt(3, 3);
  28215. * // => false
  28216. *
  28217. * _.gt(1, 3);
  28218. * // => false
  28219. */
  28220. var gt = createRelationalOperation(baseGt);
  28221. /**
  28222. * Checks if `value` is greater than or equal to `other`.
  28223. *
  28224. * @static
  28225. * @memberOf _
  28226. * @since 3.9.0
  28227. * @category Lang
  28228. * @param {*} value The value to compare.
  28229. * @param {*} other The other value to compare.
  28230. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28231. * `other`, else `false`.
  28232. * @see _.lte
  28233. * @example
  28234. *
  28235. * _.gte(3, 1);
  28236. * // => true
  28237. *
  28238. * _.gte(3, 3);
  28239. * // => true
  28240. *
  28241. * _.gte(1, 3);
  28242. * // => false
  28243. */
  28244. var gte = createRelationalOperation(function(value, other) {
  28245. return value >= other;
  28246. });
  28247. /**
  28248. * Checks if `value` is likely an `arguments` object.
  28249. *
  28250. * @static
  28251. * @memberOf _
  28252. * @since 0.1.0
  28253. * @category Lang
  28254. * @param {*} value The value to check.
  28255. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28256. * else `false`.
  28257. * @example
  28258. *
  28259. * _.isArguments(function() { return arguments; }());
  28260. * // => true
  28261. *
  28262. * _.isArguments([1, 2, 3]);
  28263. * // => false
  28264. */
  28265. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28266. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28267. !propertyIsEnumerable.call(value, 'callee');
  28268. };
  28269. /**
  28270. * Checks if `value` is classified as an `Array` object.
  28271. *
  28272. * @static
  28273. * @memberOf _
  28274. * @since 0.1.0
  28275. * @category Lang
  28276. * @param {*} value The value to check.
  28277. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28278. * @example
  28279. *
  28280. * _.isArray([1, 2, 3]);
  28281. * // => true
  28282. *
  28283. * _.isArray(document.body.children);
  28284. * // => false
  28285. *
  28286. * _.isArray('abc');
  28287. * // => false
  28288. *
  28289. * _.isArray(_.noop);
  28290. * // => false
  28291. */
  28292. var isArray = Array.isArray;
  28293. /**
  28294. * Checks if `value` is classified as an `ArrayBuffer` object.
  28295. *
  28296. * @static
  28297. * @memberOf _
  28298. * @since 4.3.0
  28299. * @category Lang
  28300. * @param {*} value The value to check.
  28301. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28302. * @example
  28303. *
  28304. * _.isArrayBuffer(new ArrayBuffer(2));
  28305. * // => true
  28306. *
  28307. * _.isArrayBuffer(new Array(2));
  28308. * // => false
  28309. */
  28310. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28311. /**
  28312. * Checks if `value` is array-like. A value is considered array-like if it's
  28313. * not a function and has a `value.length` that's an integer greater than or
  28314. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28315. *
  28316. * @static
  28317. * @memberOf _
  28318. * @since 4.0.0
  28319. * @category Lang
  28320. * @param {*} value The value to check.
  28321. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28322. * @example
  28323. *
  28324. * _.isArrayLike([1, 2, 3]);
  28325. * // => true
  28326. *
  28327. * _.isArrayLike(document.body.children);
  28328. * // => true
  28329. *
  28330. * _.isArrayLike('abc');
  28331. * // => true
  28332. *
  28333. * _.isArrayLike(_.noop);
  28334. * // => false
  28335. */
  28336. function isArrayLike(value) {
  28337. return value != null && isLength(value.length) && !isFunction(value);
  28338. }
  28339. /**
  28340. * This method is like `_.isArrayLike` except that it also checks if `value`
  28341. * is an object.
  28342. *
  28343. * @static
  28344. * @memberOf _
  28345. * @since 4.0.0
  28346. * @category Lang
  28347. * @param {*} value The value to check.
  28348. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28349. * else `false`.
  28350. * @example
  28351. *
  28352. * _.isArrayLikeObject([1, 2, 3]);
  28353. * // => true
  28354. *
  28355. * _.isArrayLikeObject(document.body.children);
  28356. * // => true
  28357. *
  28358. * _.isArrayLikeObject('abc');
  28359. * // => false
  28360. *
  28361. * _.isArrayLikeObject(_.noop);
  28362. * // => false
  28363. */
  28364. function isArrayLikeObject(value) {
  28365. return isObjectLike(value) && isArrayLike(value);
  28366. }
  28367. /**
  28368. * Checks if `value` is classified as a boolean primitive or object.
  28369. *
  28370. * @static
  28371. * @memberOf _
  28372. * @since 0.1.0
  28373. * @category Lang
  28374. * @param {*} value The value to check.
  28375. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28376. * @example
  28377. *
  28378. * _.isBoolean(false);
  28379. * // => true
  28380. *
  28381. * _.isBoolean(null);
  28382. * // => false
  28383. */
  28384. function isBoolean(value) {
  28385. return value === true || value === false ||
  28386. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28387. }
  28388. /**
  28389. * Checks if `value` is a buffer.
  28390. *
  28391. * @static
  28392. * @memberOf _
  28393. * @since 4.3.0
  28394. * @category Lang
  28395. * @param {*} value The value to check.
  28396. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28397. * @example
  28398. *
  28399. * _.isBuffer(new Buffer(2));
  28400. * // => true
  28401. *
  28402. * _.isBuffer(new Uint8Array(2));
  28403. * // => false
  28404. */
  28405. var isBuffer = nativeIsBuffer || stubFalse;
  28406. /**
  28407. * Checks if `value` is classified as a `Date` object.
  28408. *
  28409. * @static
  28410. * @memberOf _
  28411. * @since 0.1.0
  28412. * @category Lang
  28413. * @param {*} value The value to check.
  28414. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28415. * @example
  28416. *
  28417. * _.isDate(new Date);
  28418. * // => true
  28419. *
  28420. * _.isDate('Mon April 23 2012');
  28421. * // => false
  28422. */
  28423. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28424. /**
  28425. * Checks if `value` is likely a DOM element.
  28426. *
  28427. * @static
  28428. * @memberOf _
  28429. * @since 0.1.0
  28430. * @category Lang
  28431. * @param {*} value The value to check.
  28432. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28433. * @example
  28434. *
  28435. * _.isElement(document.body);
  28436. * // => true
  28437. *
  28438. * _.isElement('<body>');
  28439. * // => false
  28440. */
  28441. function isElement(value) {
  28442. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28443. }
  28444. /**
  28445. * Checks if `value` is an empty object, collection, map, or set.
  28446. *
  28447. * Objects are considered empty if they have no own enumerable string keyed
  28448. * properties.
  28449. *
  28450. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28451. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28452. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28453. *
  28454. * @static
  28455. * @memberOf _
  28456. * @since 0.1.0
  28457. * @category Lang
  28458. * @param {*} value The value to check.
  28459. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28460. * @example
  28461. *
  28462. * _.isEmpty(null);
  28463. * // => true
  28464. *
  28465. * _.isEmpty(true);
  28466. * // => true
  28467. *
  28468. * _.isEmpty(1);
  28469. * // => true
  28470. *
  28471. * _.isEmpty([1, 2, 3]);
  28472. * // => false
  28473. *
  28474. * _.isEmpty({ 'a': 1 });
  28475. * // => false
  28476. */
  28477. function isEmpty(value) {
  28478. if (value == null) {
  28479. return true;
  28480. }
  28481. if (isArrayLike(value) &&
  28482. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28483. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28484. return !value.length;
  28485. }
  28486. var tag = getTag(value);
  28487. if (tag == mapTag || tag == setTag) {
  28488. return !value.size;
  28489. }
  28490. if (isPrototype(value)) {
  28491. return !baseKeys(value).length;
  28492. }
  28493. for (var key in value) {
  28494. if (hasOwnProperty.call(value, key)) {
  28495. return false;
  28496. }
  28497. }
  28498. return true;
  28499. }
  28500. /**
  28501. * Performs a deep comparison between two values to determine if they are
  28502. * equivalent.
  28503. *
  28504. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28505. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28506. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28507. * by their own, not inherited, enumerable properties. Functions and DOM
  28508. * nodes are compared by strict equality, i.e. `===`.
  28509. *
  28510. * @static
  28511. * @memberOf _
  28512. * @since 0.1.0
  28513. * @category Lang
  28514. * @param {*} value The value to compare.
  28515. * @param {*} other The other value to compare.
  28516. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28517. * @example
  28518. *
  28519. * var object = { 'a': 1 };
  28520. * var other = { 'a': 1 };
  28521. *
  28522. * _.isEqual(object, other);
  28523. * // => true
  28524. *
  28525. * object === other;
  28526. * // => false
  28527. */
  28528. function isEqual(value, other) {
  28529. return baseIsEqual(value, other);
  28530. }
  28531. /**
  28532. * This method is like `_.isEqual` except that it accepts `customizer` which
  28533. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28534. * are handled by the method instead. The `customizer` is invoked with up to
  28535. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28536. *
  28537. * @static
  28538. * @memberOf _
  28539. * @since 4.0.0
  28540. * @category Lang
  28541. * @param {*} value The value to compare.
  28542. * @param {*} other The other value to compare.
  28543. * @param {Function} [customizer] The function to customize comparisons.
  28544. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28545. * @example
  28546. *
  28547. * function isGreeting(value) {
  28548. * return /^h(?:i|ello)$/.test(value);
  28549. * }
  28550. *
  28551. * function customizer(objValue, othValue) {
  28552. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28553. * return true;
  28554. * }
  28555. * }
  28556. *
  28557. * var array = ['hello', 'goodbye'];
  28558. * var other = ['hi', 'goodbye'];
  28559. *
  28560. * _.isEqualWith(array, other, customizer);
  28561. * // => true
  28562. */
  28563. function isEqualWith(value, other, customizer) {
  28564. customizer = typeof customizer == 'function' ? customizer : undefined;
  28565. var result = customizer ? customizer(value, other) : undefined;
  28566. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28567. }
  28568. /**
  28569. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28570. * `SyntaxError`, `TypeError`, or `URIError` object.
  28571. *
  28572. * @static
  28573. * @memberOf _
  28574. * @since 3.0.0
  28575. * @category Lang
  28576. * @param {*} value The value to check.
  28577. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28578. * @example
  28579. *
  28580. * _.isError(new Error);
  28581. * // => true
  28582. *
  28583. * _.isError(Error);
  28584. * // => false
  28585. */
  28586. function isError(value) {
  28587. if (!isObjectLike(value)) {
  28588. return false;
  28589. }
  28590. var tag = baseGetTag(value);
  28591. return tag == errorTag || tag == domExcTag ||
  28592. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28593. }
  28594. /**
  28595. * Checks if `value` is a finite primitive number.
  28596. *
  28597. * **Note:** This method is based on
  28598. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28599. *
  28600. * @static
  28601. * @memberOf _
  28602. * @since 0.1.0
  28603. * @category Lang
  28604. * @param {*} value The value to check.
  28605. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28606. * @example
  28607. *
  28608. * _.isFinite(3);
  28609. * // => true
  28610. *
  28611. * _.isFinite(Number.MIN_VALUE);
  28612. * // => true
  28613. *
  28614. * _.isFinite(Infinity);
  28615. * // => false
  28616. *
  28617. * _.isFinite('3');
  28618. * // => false
  28619. */
  28620. function isFinite(value) {
  28621. return typeof value == 'number' && nativeIsFinite(value);
  28622. }
  28623. /**
  28624. * Checks if `value` is classified as a `Function` object.
  28625. *
  28626. * @static
  28627. * @memberOf _
  28628. * @since 0.1.0
  28629. * @category Lang
  28630. * @param {*} value The value to check.
  28631. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28632. * @example
  28633. *
  28634. * _.isFunction(_);
  28635. * // => true
  28636. *
  28637. * _.isFunction(/abc/);
  28638. * // => false
  28639. */
  28640. function isFunction(value) {
  28641. if (!isObject(value)) {
  28642. return false;
  28643. }
  28644. // The use of `Object#toString` avoids issues with the `typeof` operator
  28645. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28646. var tag = baseGetTag(value);
  28647. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28648. }
  28649. /**
  28650. * Checks if `value` is an integer.
  28651. *
  28652. * **Note:** This method is based on
  28653. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28654. *
  28655. * @static
  28656. * @memberOf _
  28657. * @since 4.0.0
  28658. * @category Lang
  28659. * @param {*} value The value to check.
  28660. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28661. * @example
  28662. *
  28663. * _.isInteger(3);
  28664. * // => true
  28665. *
  28666. * _.isInteger(Number.MIN_VALUE);
  28667. * // => false
  28668. *
  28669. * _.isInteger(Infinity);
  28670. * // => false
  28671. *
  28672. * _.isInteger('3');
  28673. * // => false
  28674. */
  28675. function isInteger(value) {
  28676. return typeof value == 'number' && value == toInteger(value);
  28677. }
  28678. /**
  28679. * Checks if `value` is a valid array-like length.
  28680. *
  28681. * **Note:** This method is loosely based on
  28682. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28683. *
  28684. * @static
  28685. * @memberOf _
  28686. * @since 4.0.0
  28687. * @category Lang
  28688. * @param {*} value The value to check.
  28689. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28690. * @example
  28691. *
  28692. * _.isLength(3);
  28693. * // => true
  28694. *
  28695. * _.isLength(Number.MIN_VALUE);
  28696. * // => false
  28697. *
  28698. * _.isLength(Infinity);
  28699. * // => false
  28700. *
  28701. * _.isLength('3');
  28702. * // => false
  28703. */
  28704. function isLength(value) {
  28705. return typeof value == 'number' &&
  28706. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28707. }
  28708. /**
  28709. * Checks if `value` is the
  28710. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28711. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28712. *
  28713. * @static
  28714. * @memberOf _
  28715. * @since 0.1.0
  28716. * @category Lang
  28717. * @param {*} value The value to check.
  28718. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28719. * @example
  28720. *
  28721. * _.isObject({});
  28722. * // => true
  28723. *
  28724. * _.isObject([1, 2, 3]);
  28725. * // => true
  28726. *
  28727. * _.isObject(_.noop);
  28728. * // => true
  28729. *
  28730. * _.isObject(null);
  28731. * // => false
  28732. */
  28733. function isObject(value) {
  28734. var type = typeof value;
  28735. return value != null && (type == 'object' || type == 'function');
  28736. }
  28737. /**
  28738. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28739. * and has a `typeof` result of "object".
  28740. *
  28741. * @static
  28742. * @memberOf _
  28743. * @since 4.0.0
  28744. * @category Lang
  28745. * @param {*} value The value to check.
  28746. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28747. * @example
  28748. *
  28749. * _.isObjectLike({});
  28750. * // => true
  28751. *
  28752. * _.isObjectLike([1, 2, 3]);
  28753. * // => true
  28754. *
  28755. * _.isObjectLike(_.noop);
  28756. * // => false
  28757. *
  28758. * _.isObjectLike(null);
  28759. * // => false
  28760. */
  28761. function isObjectLike(value) {
  28762. return value != null && typeof value == 'object';
  28763. }
  28764. /**
  28765. * Checks if `value` is classified as a `Map` object.
  28766. *
  28767. * @static
  28768. * @memberOf _
  28769. * @since 4.3.0
  28770. * @category Lang
  28771. * @param {*} value The value to check.
  28772. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28773. * @example
  28774. *
  28775. * _.isMap(new Map);
  28776. * // => true
  28777. *
  28778. * _.isMap(new WeakMap);
  28779. * // => false
  28780. */
  28781. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28782. /**
  28783. * Performs a partial deep comparison between `object` and `source` to
  28784. * determine if `object` contains equivalent property values.
  28785. *
  28786. * **Note:** This method is equivalent to `_.matches` when `source` is
  28787. * partially applied.
  28788. *
  28789. * Partial comparisons will match empty array and empty object `source`
  28790. * values against any array or object value, respectively. See `_.isEqual`
  28791. * for a list of supported value comparisons.
  28792. *
  28793. * @static
  28794. * @memberOf _
  28795. * @since 3.0.0
  28796. * @category Lang
  28797. * @param {Object} object The object to inspect.
  28798. * @param {Object} source The object of property values to match.
  28799. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28800. * @example
  28801. *
  28802. * var object = { 'a': 1, 'b': 2 };
  28803. *
  28804. * _.isMatch(object, { 'b': 2 });
  28805. * // => true
  28806. *
  28807. * _.isMatch(object, { 'b': 1 });
  28808. * // => false
  28809. */
  28810. function isMatch(object, source) {
  28811. return object === source || baseIsMatch(object, source, getMatchData(source));
  28812. }
  28813. /**
  28814. * This method is like `_.isMatch` except that it accepts `customizer` which
  28815. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28816. * are handled by the method instead. The `customizer` is invoked with five
  28817. * arguments: (objValue, srcValue, index|key, object, source).
  28818. *
  28819. * @static
  28820. * @memberOf _
  28821. * @since 4.0.0
  28822. * @category Lang
  28823. * @param {Object} object The object to inspect.
  28824. * @param {Object} source The object of property values to match.
  28825. * @param {Function} [customizer] The function to customize comparisons.
  28826. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28827. * @example
  28828. *
  28829. * function isGreeting(value) {
  28830. * return /^h(?:i|ello)$/.test(value);
  28831. * }
  28832. *
  28833. * function customizer(objValue, srcValue) {
  28834. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  28835. * return true;
  28836. * }
  28837. * }
  28838. *
  28839. * var object = { 'greeting': 'hello' };
  28840. * var source = { 'greeting': 'hi' };
  28841. *
  28842. * _.isMatchWith(object, source, customizer);
  28843. * // => true
  28844. */
  28845. function isMatchWith(object, source, customizer) {
  28846. customizer = typeof customizer == 'function' ? customizer : undefined;
  28847. return baseIsMatch(object, source, getMatchData(source), customizer);
  28848. }
  28849. /**
  28850. * Checks if `value` is `NaN`.
  28851. *
  28852. * **Note:** This method is based on
  28853. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  28854. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  28855. * `undefined` and other non-number values.
  28856. *
  28857. * @static
  28858. * @memberOf _
  28859. * @since 0.1.0
  28860. * @category Lang
  28861. * @param {*} value The value to check.
  28862. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  28863. * @example
  28864. *
  28865. * _.isNaN(NaN);
  28866. * // => true
  28867. *
  28868. * _.isNaN(new Number(NaN));
  28869. * // => true
  28870. *
  28871. * isNaN(undefined);
  28872. * // => true
  28873. *
  28874. * _.isNaN(undefined);
  28875. * // => false
  28876. */
  28877. function isNaN(value) {
  28878. // An `NaN` primitive is the only value that is not equal to itself.
  28879. // Perform the `toStringTag` check first to avoid errors with some
  28880. // ActiveX objects in IE.
  28881. return isNumber(value) && value != +value;
  28882. }
  28883. /**
  28884. * Checks if `value` is a pristine native function.
  28885. *
  28886. * **Note:** This method can't reliably detect native functions in the presence
  28887. * of the core-js package because core-js circumvents this kind of detection.
  28888. * Despite multiple requests, the core-js maintainer has made it clear: any
  28889. * attempt to fix the detection will be obstructed. As a result, we're left
  28890. * with little choice but to throw an error. Unfortunately, this also affects
  28891. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  28892. * which rely on core-js.
  28893. *
  28894. * @static
  28895. * @memberOf _
  28896. * @since 3.0.0
  28897. * @category Lang
  28898. * @param {*} value The value to check.
  28899. * @returns {boolean} Returns `true` if `value` is a native function,
  28900. * else `false`.
  28901. * @example
  28902. *
  28903. * _.isNative(Array.prototype.push);
  28904. * // => true
  28905. *
  28906. * _.isNative(_);
  28907. * // => false
  28908. */
  28909. function isNative(value) {
  28910. if (isMaskable(value)) {
  28911. throw new Error(CORE_ERROR_TEXT);
  28912. }
  28913. return baseIsNative(value);
  28914. }
  28915. /**
  28916. * Checks if `value` is `null`.
  28917. *
  28918. * @static
  28919. * @memberOf _
  28920. * @since 0.1.0
  28921. * @category Lang
  28922. * @param {*} value The value to check.
  28923. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  28924. * @example
  28925. *
  28926. * _.isNull(null);
  28927. * // => true
  28928. *
  28929. * _.isNull(void 0);
  28930. * // => false
  28931. */
  28932. function isNull(value) {
  28933. return value === null;
  28934. }
  28935. /**
  28936. * Checks if `value` is `null` or `undefined`.
  28937. *
  28938. * @static
  28939. * @memberOf _
  28940. * @since 4.0.0
  28941. * @category Lang
  28942. * @param {*} value The value to check.
  28943. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  28944. * @example
  28945. *
  28946. * _.isNil(null);
  28947. * // => true
  28948. *
  28949. * _.isNil(void 0);
  28950. * // => true
  28951. *
  28952. * _.isNil(NaN);
  28953. * // => false
  28954. */
  28955. function isNil(value) {
  28956. return value == null;
  28957. }
  28958. /**
  28959. * Checks if `value` is classified as a `Number` primitive or object.
  28960. *
  28961. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  28962. * classified as numbers, use the `_.isFinite` method.
  28963. *
  28964. * @static
  28965. * @memberOf _
  28966. * @since 0.1.0
  28967. * @category Lang
  28968. * @param {*} value The value to check.
  28969. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  28970. * @example
  28971. *
  28972. * _.isNumber(3);
  28973. * // => true
  28974. *
  28975. * _.isNumber(Number.MIN_VALUE);
  28976. * // => true
  28977. *
  28978. * _.isNumber(Infinity);
  28979. * // => true
  28980. *
  28981. * _.isNumber('3');
  28982. * // => false
  28983. */
  28984. function isNumber(value) {
  28985. return typeof value == 'number' ||
  28986. (isObjectLike(value) && baseGetTag(value) == numberTag);
  28987. }
  28988. /**
  28989. * Checks if `value` is a plain object, that is, an object created by the
  28990. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  28991. *
  28992. * @static
  28993. * @memberOf _
  28994. * @since 0.8.0
  28995. * @category Lang
  28996. * @param {*} value The value to check.
  28997. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  28998. * @example
  28999. *
  29000. * function Foo() {
  29001. * this.a = 1;
  29002. * }
  29003. *
  29004. * _.isPlainObject(new Foo);
  29005. * // => false
  29006. *
  29007. * _.isPlainObject([1, 2, 3]);
  29008. * // => false
  29009. *
  29010. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29011. * // => true
  29012. *
  29013. * _.isPlainObject(Object.create(null));
  29014. * // => true
  29015. */
  29016. function isPlainObject(value) {
  29017. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29018. return false;
  29019. }
  29020. var proto = getPrototype(value);
  29021. if (proto === null) {
  29022. return true;
  29023. }
  29024. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29025. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29026. funcToString.call(Ctor) == objectCtorString;
  29027. }
  29028. /**
  29029. * Checks if `value` is classified as a `RegExp` object.
  29030. *
  29031. * @static
  29032. * @memberOf _
  29033. * @since 0.1.0
  29034. * @category Lang
  29035. * @param {*} value The value to check.
  29036. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29037. * @example
  29038. *
  29039. * _.isRegExp(/abc/);
  29040. * // => true
  29041. *
  29042. * _.isRegExp('/abc/');
  29043. * // => false
  29044. */
  29045. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29046. /**
  29047. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29048. * double precision number which isn't the result of a rounded unsafe integer.
  29049. *
  29050. * **Note:** This method is based on
  29051. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29052. *
  29053. * @static
  29054. * @memberOf _
  29055. * @since 4.0.0
  29056. * @category Lang
  29057. * @param {*} value The value to check.
  29058. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29059. * @example
  29060. *
  29061. * _.isSafeInteger(3);
  29062. * // => true
  29063. *
  29064. * _.isSafeInteger(Number.MIN_VALUE);
  29065. * // => false
  29066. *
  29067. * _.isSafeInteger(Infinity);
  29068. * // => false
  29069. *
  29070. * _.isSafeInteger('3');
  29071. * // => false
  29072. */
  29073. function isSafeInteger(value) {
  29074. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29075. }
  29076. /**
  29077. * Checks if `value` is classified as a `Set` object.
  29078. *
  29079. * @static
  29080. * @memberOf _
  29081. * @since 4.3.0
  29082. * @category Lang
  29083. * @param {*} value The value to check.
  29084. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29085. * @example
  29086. *
  29087. * _.isSet(new Set);
  29088. * // => true
  29089. *
  29090. * _.isSet(new WeakSet);
  29091. * // => false
  29092. */
  29093. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29094. /**
  29095. * Checks if `value` is classified as a `String` primitive or object.
  29096. *
  29097. * @static
  29098. * @since 0.1.0
  29099. * @memberOf _
  29100. * @category Lang
  29101. * @param {*} value The value to check.
  29102. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29103. * @example
  29104. *
  29105. * _.isString('abc');
  29106. * // => true
  29107. *
  29108. * _.isString(1);
  29109. * // => false
  29110. */
  29111. function isString(value) {
  29112. return typeof value == 'string' ||
  29113. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29114. }
  29115. /**
  29116. * Checks if `value` is classified as a `Symbol` primitive or object.
  29117. *
  29118. * @static
  29119. * @memberOf _
  29120. * @since 4.0.0
  29121. * @category Lang
  29122. * @param {*} value The value to check.
  29123. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29124. * @example
  29125. *
  29126. * _.isSymbol(Symbol.iterator);
  29127. * // => true
  29128. *
  29129. * _.isSymbol('abc');
  29130. * // => false
  29131. */
  29132. function isSymbol(value) {
  29133. return typeof value == 'symbol' ||
  29134. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29135. }
  29136. /**
  29137. * Checks if `value` is classified as a typed array.
  29138. *
  29139. * @static
  29140. * @memberOf _
  29141. * @since 3.0.0
  29142. * @category Lang
  29143. * @param {*} value The value to check.
  29144. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29145. * @example
  29146. *
  29147. * _.isTypedArray(new Uint8Array);
  29148. * // => true
  29149. *
  29150. * _.isTypedArray([]);
  29151. * // => false
  29152. */
  29153. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29154. /**
  29155. * Checks if `value` is `undefined`.
  29156. *
  29157. * @static
  29158. * @since 0.1.0
  29159. * @memberOf _
  29160. * @category Lang
  29161. * @param {*} value The value to check.
  29162. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29163. * @example
  29164. *
  29165. * _.isUndefined(void 0);
  29166. * // => true
  29167. *
  29168. * _.isUndefined(null);
  29169. * // => false
  29170. */
  29171. function isUndefined(value) {
  29172. return value === undefined;
  29173. }
  29174. /**
  29175. * Checks if `value` is classified as a `WeakMap` object.
  29176. *
  29177. * @static
  29178. * @memberOf _
  29179. * @since 4.3.0
  29180. * @category Lang
  29181. * @param {*} value The value to check.
  29182. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29183. * @example
  29184. *
  29185. * _.isWeakMap(new WeakMap);
  29186. * // => true
  29187. *
  29188. * _.isWeakMap(new Map);
  29189. * // => false
  29190. */
  29191. function isWeakMap(value) {
  29192. return isObjectLike(value) && getTag(value) == weakMapTag;
  29193. }
  29194. /**
  29195. * Checks if `value` is classified as a `WeakSet` object.
  29196. *
  29197. * @static
  29198. * @memberOf _
  29199. * @since 4.3.0
  29200. * @category Lang
  29201. * @param {*} value The value to check.
  29202. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29203. * @example
  29204. *
  29205. * _.isWeakSet(new WeakSet);
  29206. * // => true
  29207. *
  29208. * _.isWeakSet(new Set);
  29209. * // => false
  29210. */
  29211. function isWeakSet(value) {
  29212. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29213. }
  29214. /**
  29215. * Checks if `value` is less than `other`.
  29216. *
  29217. * @static
  29218. * @memberOf _
  29219. * @since 3.9.0
  29220. * @category Lang
  29221. * @param {*} value The value to compare.
  29222. * @param {*} other The other value to compare.
  29223. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29224. * else `false`.
  29225. * @see _.gt
  29226. * @example
  29227. *
  29228. * _.lt(1, 3);
  29229. * // => true
  29230. *
  29231. * _.lt(3, 3);
  29232. * // => false
  29233. *
  29234. * _.lt(3, 1);
  29235. * // => false
  29236. */
  29237. var lt = createRelationalOperation(baseLt);
  29238. /**
  29239. * Checks if `value` is less than or equal to `other`.
  29240. *
  29241. * @static
  29242. * @memberOf _
  29243. * @since 3.9.0
  29244. * @category Lang
  29245. * @param {*} value The value to compare.
  29246. * @param {*} other The other value to compare.
  29247. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29248. * `other`, else `false`.
  29249. * @see _.gte
  29250. * @example
  29251. *
  29252. * _.lte(1, 3);
  29253. * // => true
  29254. *
  29255. * _.lte(3, 3);
  29256. * // => true
  29257. *
  29258. * _.lte(3, 1);
  29259. * // => false
  29260. */
  29261. var lte = createRelationalOperation(function(value, other) {
  29262. return value <= other;
  29263. });
  29264. /**
  29265. * Converts `value` to an array.
  29266. *
  29267. * @static
  29268. * @since 0.1.0
  29269. * @memberOf _
  29270. * @category Lang
  29271. * @param {*} value The value to convert.
  29272. * @returns {Array} Returns the converted array.
  29273. * @example
  29274. *
  29275. * _.toArray({ 'a': 1, 'b': 2 });
  29276. * // => [1, 2]
  29277. *
  29278. * _.toArray('abc');
  29279. * // => ['a', 'b', 'c']
  29280. *
  29281. * _.toArray(1);
  29282. * // => []
  29283. *
  29284. * _.toArray(null);
  29285. * // => []
  29286. */
  29287. function toArray(value) {
  29288. if (!value) {
  29289. return [];
  29290. }
  29291. if (isArrayLike(value)) {
  29292. return isString(value) ? stringToArray(value) : copyArray(value);
  29293. }
  29294. if (symIterator && value[symIterator]) {
  29295. return iteratorToArray(value[symIterator]());
  29296. }
  29297. var tag = getTag(value),
  29298. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29299. return func(value);
  29300. }
  29301. /**
  29302. * Converts `value` to a finite number.
  29303. *
  29304. * @static
  29305. * @memberOf _
  29306. * @since 4.12.0
  29307. * @category Lang
  29308. * @param {*} value The value to convert.
  29309. * @returns {number} Returns the converted number.
  29310. * @example
  29311. *
  29312. * _.toFinite(3.2);
  29313. * // => 3.2
  29314. *
  29315. * _.toFinite(Number.MIN_VALUE);
  29316. * // => 5e-324
  29317. *
  29318. * _.toFinite(Infinity);
  29319. * // => 1.7976931348623157e+308
  29320. *
  29321. * _.toFinite('3.2');
  29322. * // => 3.2
  29323. */
  29324. function toFinite(value) {
  29325. if (!value) {
  29326. return value === 0 ? value : 0;
  29327. }
  29328. value = toNumber(value);
  29329. if (value === INFINITY || value === -INFINITY) {
  29330. var sign = (value < 0 ? -1 : 1);
  29331. return sign * MAX_INTEGER;
  29332. }
  29333. return value === value ? value : 0;
  29334. }
  29335. /**
  29336. * Converts `value` to an integer.
  29337. *
  29338. * **Note:** This method is loosely based on
  29339. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29340. *
  29341. * @static
  29342. * @memberOf _
  29343. * @since 4.0.0
  29344. * @category Lang
  29345. * @param {*} value The value to convert.
  29346. * @returns {number} Returns the converted integer.
  29347. * @example
  29348. *
  29349. * _.toInteger(3.2);
  29350. * // => 3
  29351. *
  29352. * _.toInteger(Number.MIN_VALUE);
  29353. * // => 0
  29354. *
  29355. * _.toInteger(Infinity);
  29356. * // => 1.7976931348623157e+308
  29357. *
  29358. * _.toInteger('3.2');
  29359. * // => 3
  29360. */
  29361. function toInteger(value) {
  29362. var result = toFinite(value),
  29363. remainder = result % 1;
  29364. return result === result ? (remainder ? result - remainder : result) : 0;
  29365. }
  29366. /**
  29367. * Converts `value` to an integer suitable for use as the length of an
  29368. * array-like object.
  29369. *
  29370. * **Note:** This method is based on
  29371. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29372. *
  29373. * @static
  29374. * @memberOf _
  29375. * @since 4.0.0
  29376. * @category Lang
  29377. * @param {*} value The value to convert.
  29378. * @returns {number} Returns the converted integer.
  29379. * @example
  29380. *
  29381. * _.toLength(3.2);
  29382. * // => 3
  29383. *
  29384. * _.toLength(Number.MIN_VALUE);
  29385. * // => 0
  29386. *
  29387. * _.toLength(Infinity);
  29388. * // => 4294967295
  29389. *
  29390. * _.toLength('3.2');
  29391. * // => 3
  29392. */
  29393. function toLength(value) {
  29394. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29395. }
  29396. /**
  29397. * Converts `value` to a number.
  29398. *
  29399. * @static
  29400. * @memberOf _
  29401. * @since 4.0.0
  29402. * @category Lang
  29403. * @param {*} value The value to process.
  29404. * @returns {number} Returns the number.
  29405. * @example
  29406. *
  29407. * _.toNumber(3.2);
  29408. * // => 3.2
  29409. *
  29410. * _.toNumber(Number.MIN_VALUE);
  29411. * // => 5e-324
  29412. *
  29413. * _.toNumber(Infinity);
  29414. * // => Infinity
  29415. *
  29416. * _.toNumber('3.2');
  29417. * // => 3.2
  29418. */
  29419. function toNumber(value) {
  29420. if (typeof value == 'number') {
  29421. return value;
  29422. }
  29423. if (isSymbol(value)) {
  29424. return NAN;
  29425. }
  29426. if (isObject(value)) {
  29427. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29428. value = isObject(other) ? (other + '') : other;
  29429. }
  29430. if (typeof value != 'string') {
  29431. return value === 0 ? value : +value;
  29432. }
  29433. value = value.replace(reTrim, '');
  29434. var isBinary = reIsBinary.test(value);
  29435. return (isBinary || reIsOctal.test(value))
  29436. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29437. : (reIsBadHex.test(value) ? NAN : +value);
  29438. }
  29439. /**
  29440. * Converts `value` to a plain object flattening inherited enumerable string
  29441. * keyed properties of `value` to own properties of the plain object.
  29442. *
  29443. * @static
  29444. * @memberOf _
  29445. * @since 3.0.0
  29446. * @category Lang
  29447. * @param {*} value The value to convert.
  29448. * @returns {Object} Returns the converted plain object.
  29449. * @example
  29450. *
  29451. * function Foo() {
  29452. * this.b = 2;
  29453. * }
  29454. *
  29455. * Foo.prototype.c = 3;
  29456. *
  29457. * _.assign({ 'a': 1 }, new Foo);
  29458. * // => { 'a': 1, 'b': 2 }
  29459. *
  29460. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29461. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29462. */
  29463. function toPlainObject(value) {
  29464. return copyObject(value, keysIn(value));
  29465. }
  29466. /**
  29467. * Converts `value` to a safe integer. A safe integer can be compared and
  29468. * represented correctly.
  29469. *
  29470. * @static
  29471. * @memberOf _
  29472. * @since 4.0.0
  29473. * @category Lang
  29474. * @param {*} value The value to convert.
  29475. * @returns {number} Returns the converted integer.
  29476. * @example
  29477. *
  29478. * _.toSafeInteger(3.2);
  29479. * // => 3
  29480. *
  29481. * _.toSafeInteger(Number.MIN_VALUE);
  29482. * // => 0
  29483. *
  29484. * _.toSafeInteger(Infinity);
  29485. * // => 9007199254740991
  29486. *
  29487. * _.toSafeInteger('3.2');
  29488. * // => 3
  29489. */
  29490. function toSafeInteger(value) {
  29491. return value
  29492. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29493. : (value === 0 ? value : 0);
  29494. }
  29495. /**
  29496. * Converts `value` to a string. An empty string is returned for `null`
  29497. * and `undefined` values. The sign of `-0` is preserved.
  29498. *
  29499. * @static
  29500. * @memberOf _
  29501. * @since 4.0.0
  29502. * @category Lang
  29503. * @param {*} value The value to convert.
  29504. * @returns {string} Returns the converted string.
  29505. * @example
  29506. *
  29507. * _.toString(null);
  29508. * // => ''
  29509. *
  29510. * _.toString(-0);
  29511. * // => '-0'
  29512. *
  29513. * _.toString([1, 2, 3]);
  29514. * // => '1,2,3'
  29515. */
  29516. function toString(value) {
  29517. return value == null ? '' : baseToString(value);
  29518. }
  29519. /*------------------------------------------------------------------------*/
  29520. /**
  29521. * Assigns own enumerable string keyed properties of source objects to the
  29522. * destination object. Source objects are applied from left to right.
  29523. * Subsequent sources overwrite property assignments of previous sources.
  29524. *
  29525. * **Note:** This method mutates `object` and is loosely based on
  29526. * [`Object.assign`](https://mdn.io/Object/assign).
  29527. *
  29528. * @static
  29529. * @memberOf _
  29530. * @since 0.10.0
  29531. * @category Object
  29532. * @param {Object} object The destination object.
  29533. * @param {...Object} [sources] The source objects.
  29534. * @returns {Object} Returns `object`.
  29535. * @see _.assignIn
  29536. * @example
  29537. *
  29538. * function Foo() {
  29539. * this.a = 1;
  29540. * }
  29541. *
  29542. * function Bar() {
  29543. * this.c = 3;
  29544. * }
  29545. *
  29546. * Foo.prototype.b = 2;
  29547. * Bar.prototype.d = 4;
  29548. *
  29549. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29550. * // => { 'a': 1, 'c': 3 }
  29551. */
  29552. var assign = createAssigner(function(object, source) {
  29553. if (isPrototype(source) || isArrayLike(source)) {
  29554. copyObject(source, keys(source), object);
  29555. return;
  29556. }
  29557. for (var key in source) {
  29558. if (hasOwnProperty.call(source, key)) {
  29559. assignValue(object, key, source[key]);
  29560. }
  29561. }
  29562. });
  29563. /**
  29564. * This method is like `_.assign` except that it iterates over own and
  29565. * inherited source properties.
  29566. *
  29567. * **Note:** This method mutates `object`.
  29568. *
  29569. * @static
  29570. * @memberOf _
  29571. * @since 4.0.0
  29572. * @alias extend
  29573. * @category Object
  29574. * @param {Object} object The destination object.
  29575. * @param {...Object} [sources] The source objects.
  29576. * @returns {Object} Returns `object`.
  29577. * @see _.assign
  29578. * @example
  29579. *
  29580. * function Foo() {
  29581. * this.a = 1;
  29582. * }
  29583. *
  29584. * function Bar() {
  29585. * this.c = 3;
  29586. * }
  29587. *
  29588. * Foo.prototype.b = 2;
  29589. * Bar.prototype.d = 4;
  29590. *
  29591. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29592. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29593. */
  29594. var assignIn = createAssigner(function(object, source) {
  29595. copyObject(source, keysIn(source), object);
  29596. });
  29597. /**
  29598. * This method is like `_.assignIn` except that it accepts `customizer`
  29599. * which is invoked to produce the assigned values. If `customizer` returns
  29600. * `undefined`, assignment is handled by the method instead. The `customizer`
  29601. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29602. *
  29603. * **Note:** This method mutates `object`.
  29604. *
  29605. * @static
  29606. * @memberOf _
  29607. * @since 4.0.0
  29608. * @alias extendWith
  29609. * @category Object
  29610. * @param {Object} object The destination object.
  29611. * @param {...Object} sources The source objects.
  29612. * @param {Function} [customizer] The function to customize assigned values.
  29613. * @returns {Object} Returns `object`.
  29614. * @see _.assignWith
  29615. * @example
  29616. *
  29617. * function customizer(objValue, srcValue) {
  29618. * return _.isUndefined(objValue) ? srcValue : objValue;
  29619. * }
  29620. *
  29621. * var defaults = _.partialRight(_.assignInWith, customizer);
  29622. *
  29623. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29624. * // => { 'a': 1, 'b': 2 }
  29625. */
  29626. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29627. copyObject(source, keysIn(source), object, customizer);
  29628. });
  29629. /**
  29630. * This method is like `_.assign` except that it accepts `customizer`
  29631. * which is invoked to produce the assigned values. If `customizer` returns
  29632. * `undefined`, assignment is handled by the method instead. The `customizer`
  29633. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29634. *
  29635. * **Note:** This method mutates `object`.
  29636. *
  29637. * @static
  29638. * @memberOf _
  29639. * @since 4.0.0
  29640. * @category Object
  29641. * @param {Object} object The destination object.
  29642. * @param {...Object} sources The source objects.
  29643. * @param {Function} [customizer] The function to customize assigned values.
  29644. * @returns {Object} Returns `object`.
  29645. * @see _.assignInWith
  29646. * @example
  29647. *
  29648. * function customizer(objValue, srcValue) {
  29649. * return _.isUndefined(objValue) ? srcValue : objValue;
  29650. * }
  29651. *
  29652. * var defaults = _.partialRight(_.assignWith, customizer);
  29653. *
  29654. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29655. * // => { 'a': 1, 'b': 2 }
  29656. */
  29657. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29658. copyObject(source, keys(source), object, customizer);
  29659. });
  29660. /**
  29661. * Creates an array of values corresponding to `paths` of `object`.
  29662. *
  29663. * @static
  29664. * @memberOf _
  29665. * @since 1.0.0
  29666. * @category Object
  29667. * @param {Object} object The object to iterate over.
  29668. * @param {...(string|string[])} [paths] The property paths to pick.
  29669. * @returns {Array} Returns the picked values.
  29670. * @example
  29671. *
  29672. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29673. *
  29674. * _.at(object, ['a[0].b.c', 'a[1]']);
  29675. * // => [3, 4]
  29676. */
  29677. var at = flatRest(baseAt);
  29678. /**
  29679. * Creates an object that inherits from the `prototype` object. If a
  29680. * `properties` object is given, its own enumerable string keyed properties
  29681. * are assigned to the created object.
  29682. *
  29683. * @static
  29684. * @memberOf _
  29685. * @since 2.3.0
  29686. * @category Object
  29687. * @param {Object} prototype The object to inherit from.
  29688. * @param {Object} [properties] The properties to assign to the object.
  29689. * @returns {Object} Returns the new object.
  29690. * @example
  29691. *
  29692. * function Shape() {
  29693. * this.x = 0;
  29694. * this.y = 0;
  29695. * }
  29696. *
  29697. * function Circle() {
  29698. * Shape.call(this);
  29699. * }
  29700. *
  29701. * Circle.prototype = _.create(Shape.prototype, {
  29702. * 'constructor': Circle
  29703. * });
  29704. *
  29705. * var circle = new Circle;
  29706. * circle instanceof Circle;
  29707. * // => true
  29708. *
  29709. * circle instanceof Shape;
  29710. * // => true
  29711. */
  29712. function create(prototype, properties) {
  29713. var result = baseCreate(prototype);
  29714. return properties == null ? result : baseAssign(result, properties);
  29715. }
  29716. /**
  29717. * Assigns own and inherited enumerable string keyed properties of source
  29718. * objects to the destination object for all destination properties that
  29719. * resolve to `undefined`. Source objects are applied from left to right.
  29720. * Once a property is set, additional values of the same property are ignored.
  29721. *
  29722. * **Note:** This method mutates `object`.
  29723. *
  29724. * @static
  29725. * @since 0.1.0
  29726. * @memberOf _
  29727. * @category Object
  29728. * @param {Object} object The destination object.
  29729. * @param {...Object} [sources] The source objects.
  29730. * @returns {Object} Returns `object`.
  29731. * @see _.defaultsDeep
  29732. * @example
  29733. *
  29734. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29735. * // => { 'a': 1, 'b': 2 }
  29736. */
  29737. var defaults = baseRest(function(object, sources) {
  29738. object = Object(object);
  29739. var index = -1;
  29740. var length = sources.length;
  29741. var guard = length > 2 ? sources[2] : undefined;
  29742. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29743. length = 1;
  29744. }
  29745. while (++index < length) {
  29746. var source = sources[index];
  29747. var props = keysIn(source);
  29748. var propsIndex = -1;
  29749. var propsLength = props.length;
  29750. while (++propsIndex < propsLength) {
  29751. var key = props[propsIndex];
  29752. var value = object[key];
  29753. if (value === undefined ||
  29754. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29755. object[key] = source[key];
  29756. }
  29757. }
  29758. }
  29759. return object;
  29760. });
  29761. /**
  29762. * This method is like `_.defaults` except that it recursively assigns
  29763. * default properties.
  29764. *
  29765. * **Note:** This method mutates `object`.
  29766. *
  29767. * @static
  29768. * @memberOf _
  29769. * @since 3.10.0
  29770. * @category Object
  29771. * @param {Object} object The destination object.
  29772. * @param {...Object} [sources] The source objects.
  29773. * @returns {Object} Returns `object`.
  29774. * @see _.defaults
  29775. * @example
  29776. *
  29777. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29778. * // => { 'a': { 'b': 2, 'c': 3 } }
  29779. */
  29780. var defaultsDeep = baseRest(function(args) {
  29781. args.push(undefined, customDefaultsMerge);
  29782. return apply(mergeWith, undefined, args);
  29783. });
  29784. /**
  29785. * This method is like `_.find` except that it returns the key of the first
  29786. * element `predicate` returns truthy for instead of the element itself.
  29787. *
  29788. * @static
  29789. * @memberOf _
  29790. * @since 1.1.0
  29791. * @category Object
  29792. * @param {Object} object The object to inspect.
  29793. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29794. * @returns {string|undefined} Returns the key of the matched element,
  29795. * else `undefined`.
  29796. * @example
  29797. *
  29798. * var users = {
  29799. * 'barney': { 'age': 36, 'active': true },
  29800. * 'fred': { 'age': 40, 'active': false },
  29801. * 'pebbles': { 'age': 1, 'active': true }
  29802. * };
  29803. *
  29804. * _.findKey(users, function(o) { return o.age < 40; });
  29805. * // => 'barney' (iteration order is not guaranteed)
  29806. *
  29807. * // The `_.matches` iteratee shorthand.
  29808. * _.findKey(users, { 'age': 1, 'active': true });
  29809. * // => 'pebbles'
  29810. *
  29811. * // The `_.matchesProperty` iteratee shorthand.
  29812. * _.findKey(users, ['active', false]);
  29813. * // => 'fred'
  29814. *
  29815. * // The `_.property` iteratee shorthand.
  29816. * _.findKey(users, 'active');
  29817. * // => 'barney'
  29818. */
  29819. function findKey(object, predicate) {
  29820. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  29821. }
  29822. /**
  29823. * This method is like `_.findKey` except that it iterates over elements of
  29824. * a collection in the opposite order.
  29825. *
  29826. * @static
  29827. * @memberOf _
  29828. * @since 2.0.0
  29829. * @category Object
  29830. * @param {Object} object The object to inspect.
  29831. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29832. * @returns {string|undefined} Returns the key of the matched element,
  29833. * else `undefined`.
  29834. * @example
  29835. *
  29836. * var users = {
  29837. * 'barney': { 'age': 36, 'active': true },
  29838. * 'fred': { 'age': 40, 'active': false },
  29839. * 'pebbles': { 'age': 1, 'active': true }
  29840. * };
  29841. *
  29842. * _.findLastKey(users, function(o) { return o.age < 40; });
  29843. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  29844. *
  29845. * // The `_.matches` iteratee shorthand.
  29846. * _.findLastKey(users, { 'age': 36, 'active': true });
  29847. * // => 'barney'
  29848. *
  29849. * // The `_.matchesProperty` iteratee shorthand.
  29850. * _.findLastKey(users, ['active', false]);
  29851. * // => 'fred'
  29852. *
  29853. * // The `_.property` iteratee shorthand.
  29854. * _.findLastKey(users, 'active');
  29855. * // => 'pebbles'
  29856. */
  29857. function findLastKey(object, predicate) {
  29858. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  29859. }
  29860. /**
  29861. * Iterates over own and inherited enumerable string keyed properties of an
  29862. * object and invokes `iteratee` for each property. The iteratee is invoked
  29863. * with three arguments: (value, key, object). Iteratee functions may exit
  29864. * iteration early by explicitly returning `false`.
  29865. *
  29866. * @static
  29867. * @memberOf _
  29868. * @since 0.3.0
  29869. * @category Object
  29870. * @param {Object} object The object to iterate over.
  29871. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29872. * @returns {Object} Returns `object`.
  29873. * @see _.forInRight
  29874. * @example
  29875. *
  29876. * function Foo() {
  29877. * this.a = 1;
  29878. * this.b = 2;
  29879. * }
  29880. *
  29881. * Foo.prototype.c = 3;
  29882. *
  29883. * _.forIn(new Foo, function(value, key) {
  29884. * console.log(key);
  29885. * });
  29886. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  29887. */
  29888. function forIn(object, iteratee) {
  29889. return object == null
  29890. ? object
  29891. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  29892. }
  29893. /**
  29894. * This method is like `_.forIn` except that it iterates over properties of
  29895. * `object` in the opposite order.
  29896. *
  29897. * @static
  29898. * @memberOf _
  29899. * @since 2.0.0
  29900. * @category Object
  29901. * @param {Object} object The object to iterate over.
  29902. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29903. * @returns {Object} Returns `object`.
  29904. * @see _.forIn
  29905. * @example
  29906. *
  29907. * function Foo() {
  29908. * this.a = 1;
  29909. * this.b = 2;
  29910. * }
  29911. *
  29912. * Foo.prototype.c = 3;
  29913. *
  29914. * _.forInRight(new Foo, function(value, key) {
  29915. * console.log(key);
  29916. * });
  29917. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  29918. */
  29919. function forInRight(object, iteratee) {
  29920. return object == null
  29921. ? object
  29922. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  29923. }
  29924. /**
  29925. * Iterates over own enumerable string keyed properties of an object and
  29926. * invokes `iteratee` for each property. The iteratee is invoked with three
  29927. * arguments: (value, key, object). Iteratee functions may exit iteration
  29928. * early by explicitly returning `false`.
  29929. *
  29930. * @static
  29931. * @memberOf _
  29932. * @since 0.3.0
  29933. * @category Object
  29934. * @param {Object} object The object to iterate over.
  29935. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29936. * @returns {Object} Returns `object`.
  29937. * @see _.forOwnRight
  29938. * @example
  29939. *
  29940. * function Foo() {
  29941. * this.a = 1;
  29942. * this.b = 2;
  29943. * }
  29944. *
  29945. * Foo.prototype.c = 3;
  29946. *
  29947. * _.forOwn(new Foo, function(value, key) {
  29948. * console.log(key);
  29949. * });
  29950. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  29951. */
  29952. function forOwn(object, iteratee) {
  29953. return object && baseForOwn(object, getIteratee(iteratee, 3));
  29954. }
  29955. /**
  29956. * This method is like `_.forOwn` except that it iterates over properties of
  29957. * `object` in the opposite order.
  29958. *
  29959. * @static
  29960. * @memberOf _
  29961. * @since 2.0.0
  29962. * @category Object
  29963. * @param {Object} object The object to iterate over.
  29964. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29965. * @returns {Object} Returns `object`.
  29966. * @see _.forOwn
  29967. * @example
  29968. *
  29969. * function Foo() {
  29970. * this.a = 1;
  29971. * this.b = 2;
  29972. * }
  29973. *
  29974. * Foo.prototype.c = 3;
  29975. *
  29976. * _.forOwnRight(new Foo, function(value, key) {
  29977. * console.log(key);
  29978. * });
  29979. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  29980. */
  29981. function forOwnRight(object, iteratee) {
  29982. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  29983. }
  29984. /**
  29985. * Creates an array of function property names from own enumerable properties
  29986. * of `object`.
  29987. *
  29988. * @static
  29989. * @since 0.1.0
  29990. * @memberOf _
  29991. * @category Object
  29992. * @param {Object} object The object to inspect.
  29993. * @returns {Array} Returns the function names.
  29994. * @see _.functionsIn
  29995. * @example
  29996. *
  29997. * function Foo() {
  29998. * this.a = _.constant('a');
  29999. * this.b = _.constant('b');
  30000. * }
  30001. *
  30002. * Foo.prototype.c = _.constant('c');
  30003. *
  30004. * _.functions(new Foo);
  30005. * // => ['a', 'b']
  30006. */
  30007. function functions(object) {
  30008. return object == null ? [] : baseFunctions(object, keys(object));
  30009. }
  30010. /**
  30011. * Creates an array of function property names from own and inherited
  30012. * enumerable properties of `object`.
  30013. *
  30014. * @static
  30015. * @memberOf _
  30016. * @since 4.0.0
  30017. * @category Object
  30018. * @param {Object} object The object to inspect.
  30019. * @returns {Array} Returns the function names.
  30020. * @see _.functions
  30021. * @example
  30022. *
  30023. * function Foo() {
  30024. * this.a = _.constant('a');
  30025. * this.b = _.constant('b');
  30026. * }
  30027. *
  30028. * Foo.prototype.c = _.constant('c');
  30029. *
  30030. * _.functionsIn(new Foo);
  30031. * // => ['a', 'b', 'c']
  30032. */
  30033. function functionsIn(object) {
  30034. return object == null ? [] : baseFunctions(object, keysIn(object));
  30035. }
  30036. /**
  30037. * Gets the value at `path` of `object`. If the resolved value is
  30038. * `undefined`, the `defaultValue` is returned in its place.
  30039. *
  30040. * @static
  30041. * @memberOf _
  30042. * @since 3.7.0
  30043. * @category Object
  30044. * @param {Object} object The object to query.
  30045. * @param {Array|string} path The path of the property to get.
  30046. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30047. * @returns {*} Returns the resolved value.
  30048. * @example
  30049. *
  30050. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30051. *
  30052. * _.get(object, 'a[0].b.c');
  30053. * // => 3
  30054. *
  30055. * _.get(object, ['a', '0', 'b', 'c']);
  30056. * // => 3
  30057. *
  30058. * _.get(object, 'a.b.c', 'default');
  30059. * // => 'default'
  30060. */
  30061. function get(object, path, defaultValue) {
  30062. var result = object == null ? undefined : baseGet(object, path);
  30063. return result === undefined ? defaultValue : result;
  30064. }
  30065. /**
  30066. * Checks if `path` is a direct property of `object`.
  30067. *
  30068. * @static
  30069. * @since 0.1.0
  30070. * @memberOf _
  30071. * @category Object
  30072. * @param {Object} object The object to query.
  30073. * @param {Array|string} path The path to check.
  30074. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30075. * @example
  30076. *
  30077. * var object = { 'a': { 'b': 2 } };
  30078. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30079. *
  30080. * _.has(object, 'a');
  30081. * // => true
  30082. *
  30083. * _.has(object, 'a.b');
  30084. * // => true
  30085. *
  30086. * _.has(object, ['a', 'b']);
  30087. * // => true
  30088. *
  30089. * _.has(other, 'a');
  30090. * // => false
  30091. */
  30092. function has(object, path) {
  30093. return object != null && hasPath(object, path, baseHas);
  30094. }
  30095. /**
  30096. * Checks if `path` is a direct or inherited property of `object`.
  30097. *
  30098. * @static
  30099. * @memberOf _
  30100. * @since 4.0.0
  30101. * @category Object
  30102. * @param {Object} object The object to query.
  30103. * @param {Array|string} path The path to check.
  30104. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30105. * @example
  30106. *
  30107. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30108. *
  30109. * _.hasIn(object, 'a');
  30110. * // => true
  30111. *
  30112. * _.hasIn(object, 'a.b');
  30113. * // => true
  30114. *
  30115. * _.hasIn(object, ['a', 'b']);
  30116. * // => true
  30117. *
  30118. * _.hasIn(object, 'b');
  30119. * // => false
  30120. */
  30121. function hasIn(object, path) {
  30122. return object != null && hasPath(object, path, baseHasIn);
  30123. }
  30124. /**
  30125. * Creates an object composed of the inverted keys and values of `object`.
  30126. * If `object` contains duplicate values, subsequent values overwrite
  30127. * property assignments of previous values.
  30128. *
  30129. * @static
  30130. * @memberOf _
  30131. * @since 0.7.0
  30132. * @category Object
  30133. * @param {Object} object The object to invert.
  30134. * @returns {Object} Returns the new inverted object.
  30135. * @example
  30136. *
  30137. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30138. *
  30139. * _.invert(object);
  30140. * // => { '1': 'c', '2': 'b' }
  30141. */
  30142. var invert = createInverter(function(result, value, key) {
  30143. if (value != null &&
  30144. typeof value.toString != 'function') {
  30145. value = nativeObjectToString.call(value);
  30146. }
  30147. result[value] = key;
  30148. }, constant(identity));
  30149. /**
  30150. * This method is like `_.invert` except that the inverted object is generated
  30151. * from the results of running each element of `object` thru `iteratee`. The
  30152. * corresponding inverted value of each inverted key is an array of keys
  30153. * responsible for generating the inverted value. The iteratee is invoked
  30154. * with one argument: (value).
  30155. *
  30156. * @static
  30157. * @memberOf _
  30158. * @since 4.1.0
  30159. * @category Object
  30160. * @param {Object} object The object to invert.
  30161. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30162. * @returns {Object} Returns the new inverted object.
  30163. * @example
  30164. *
  30165. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30166. *
  30167. * _.invertBy(object);
  30168. * // => { '1': ['a', 'c'], '2': ['b'] }
  30169. *
  30170. * _.invertBy(object, function(value) {
  30171. * return 'group' + value;
  30172. * });
  30173. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30174. */
  30175. var invertBy = createInverter(function(result, value, key) {
  30176. if (value != null &&
  30177. typeof value.toString != 'function') {
  30178. value = nativeObjectToString.call(value);
  30179. }
  30180. if (hasOwnProperty.call(result, value)) {
  30181. result[value].push(key);
  30182. } else {
  30183. result[value] = [key];
  30184. }
  30185. }, getIteratee);
  30186. /**
  30187. * Invokes the method at `path` of `object`.
  30188. *
  30189. * @static
  30190. * @memberOf _
  30191. * @since 4.0.0
  30192. * @category Object
  30193. * @param {Object} object The object to query.
  30194. * @param {Array|string} path The path of the method to invoke.
  30195. * @param {...*} [args] The arguments to invoke the method with.
  30196. * @returns {*} Returns the result of the invoked method.
  30197. * @example
  30198. *
  30199. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30200. *
  30201. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30202. * // => [2, 3]
  30203. */
  30204. var invoke = baseRest(baseInvoke);
  30205. /**
  30206. * Creates an array of the own enumerable property names of `object`.
  30207. *
  30208. * **Note:** Non-object values are coerced to objects. See the
  30209. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30210. * for more details.
  30211. *
  30212. * @static
  30213. * @since 0.1.0
  30214. * @memberOf _
  30215. * @category Object
  30216. * @param {Object} object The object to query.
  30217. * @returns {Array} Returns the array of property names.
  30218. * @example
  30219. *
  30220. * function Foo() {
  30221. * this.a = 1;
  30222. * this.b = 2;
  30223. * }
  30224. *
  30225. * Foo.prototype.c = 3;
  30226. *
  30227. * _.keys(new Foo);
  30228. * // => ['a', 'b'] (iteration order is not guaranteed)
  30229. *
  30230. * _.keys('hi');
  30231. * // => ['0', '1']
  30232. */
  30233. function keys(object) {
  30234. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30235. }
  30236. /**
  30237. * Creates an array of the own and inherited enumerable property names of `object`.
  30238. *
  30239. * **Note:** Non-object values are coerced to objects.
  30240. *
  30241. * @static
  30242. * @memberOf _
  30243. * @since 3.0.0
  30244. * @category Object
  30245. * @param {Object} object The object to query.
  30246. * @returns {Array} Returns the array of property names.
  30247. * @example
  30248. *
  30249. * function Foo() {
  30250. * this.a = 1;
  30251. * this.b = 2;
  30252. * }
  30253. *
  30254. * Foo.prototype.c = 3;
  30255. *
  30256. * _.keysIn(new Foo);
  30257. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30258. */
  30259. function keysIn(object) {
  30260. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30261. }
  30262. /**
  30263. * The opposite of `_.mapValues`; this method creates an object with the
  30264. * same values as `object` and keys generated by running each own enumerable
  30265. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30266. * with three arguments: (value, key, object).
  30267. *
  30268. * @static
  30269. * @memberOf _
  30270. * @since 3.8.0
  30271. * @category Object
  30272. * @param {Object} object The object to iterate over.
  30273. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30274. * @returns {Object} Returns the new mapped object.
  30275. * @see _.mapValues
  30276. * @example
  30277. *
  30278. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30279. * return key + value;
  30280. * });
  30281. * // => { 'a1': 1, 'b2': 2 }
  30282. */
  30283. function mapKeys(object, iteratee) {
  30284. var result = {};
  30285. iteratee = getIteratee(iteratee, 3);
  30286. baseForOwn(object, function(value, key, object) {
  30287. baseAssignValue(result, iteratee(value, key, object), value);
  30288. });
  30289. return result;
  30290. }
  30291. /**
  30292. * Creates an object with the same keys as `object` and values generated
  30293. * by running each own enumerable string keyed property of `object` thru
  30294. * `iteratee`. The iteratee is invoked with three arguments:
  30295. * (value, key, object).
  30296. *
  30297. * @static
  30298. * @memberOf _
  30299. * @since 2.4.0
  30300. * @category Object
  30301. * @param {Object} object The object to iterate over.
  30302. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30303. * @returns {Object} Returns the new mapped object.
  30304. * @see _.mapKeys
  30305. * @example
  30306. *
  30307. * var users = {
  30308. * 'fred': { 'user': 'fred', 'age': 40 },
  30309. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30310. * };
  30311. *
  30312. * _.mapValues(users, function(o) { return o.age; });
  30313. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30314. *
  30315. * // The `_.property` iteratee shorthand.
  30316. * _.mapValues(users, 'age');
  30317. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30318. */
  30319. function mapValues(object, iteratee) {
  30320. var result = {};
  30321. iteratee = getIteratee(iteratee, 3);
  30322. baseForOwn(object, function(value, key, object) {
  30323. baseAssignValue(result, key, iteratee(value, key, object));
  30324. });
  30325. return result;
  30326. }
  30327. /**
  30328. * This method is like `_.assign` except that it recursively merges own and
  30329. * inherited enumerable string keyed properties of source objects into the
  30330. * destination object. Source properties that resolve to `undefined` are
  30331. * skipped if a destination value exists. Array and plain object properties
  30332. * are merged recursively. Other objects and value types are overridden by
  30333. * assignment. Source objects are applied from left to right. Subsequent
  30334. * sources overwrite property assignments of previous sources.
  30335. *
  30336. * **Note:** This method mutates `object`.
  30337. *
  30338. * @static
  30339. * @memberOf _
  30340. * @since 0.5.0
  30341. * @category Object
  30342. * @param {Object} object The destination object.
  30343. * @param {...Object} [sources] The source objects.
  30344. * @returns {Object} Returns `object`.
  30345. * @example
  30346. *
  30347. * var object = {
  30348. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30349. * };
  30350. *
  30351. * var other = {
  30352. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30353. * };
  30354. *
  30355. * _.merge(object, other);
  30356. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30357. */
  30358. var merge = createAssigner(function(object, source, srcIndex) {
  30359. baseMerge(object, source, srcIndex);
  30360. });
  30361. /**
  30362. * This method is like `_.merge` except that it accepts `customizer` which
  30363. * is invoked to produce the merged values of the destination and source
  30364. * properties. If `customizer` returns `undefined`, merging is handled by the
  30365. * method instead. The `customizer` is invoked with six arguments:
  30366. * (objValue, srcValue, key, object, source, stack).
  30367. *
  30368. * **Note:** This method mutates `object`.
  30369. *
  30370. * @static
  30371. * @memberOf _
  30372. * @since 4.0.0
  30373. * @category Object
  30374. * @param {Object} object The destination object.
  30375. * @param {...Object} sources The source objects.
  30376. * @param {Function} customizer The function to customize assigned values.
  30377. * @returns {Object} Returns `object`.
  30378. * @example
  30379. *
  30380. * function customizer(objValue, srcValue) {
  30381. * if (_.isArray(objValue)) {
  30382. * return objValue.concat(srcValue);
  30383. * }
  30384. * }
  30385. *
  30386. * var object = { 'a': [1], 'b': [2] };
  30387. * var other = { 'a': [3], 'b': [4] };
  30388. *
  30389. * _.mergeWith(object, other, customizer);
  30390. * // => { 'a': [1, 3], 'b': [2, 4] }
  30391. */
  30392. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30393. baseMerge(object, source, srcIndex, customizer);
  30394. });
  30395. /**
  30396. * The opposite of `_.pick`; this method creates an object composed of the
  30397. * own and inherited enumerable property paths of `object` that are not omitted.
  30398. *
  30399. * **Note:** This method is considerably slower than `_.pick`.
  30400. *
  30401. * @static
  30402. * @since 0.1.0
  30403. * @memberOf _
  30404. * @category Object
  30405. * @param {Object} object The source object.
  30406. * @param {...(string|string[])} [paths] The property paths to omit.
  30407. * @returns {Object} Returns the new object.
  30408. * @example
  30409. *
  30410. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30411. *
  30412. * _.omit(object, ['a', 'c']);
  30413. * // => { 'b': '2' }
  30414. */
  30415. var omit = flatRest(function(object, paths) {
  30416. var result = {};
  30417. if (object == null) {
  30418. return result;
  30419. }
  30420. var isDeep = false;
  30421. paths = arrayMap(paths, function(path) {
  30422. path = castPath(path, object);
  30423. isDeep || (isDeep = path.length > 1);
  30424. return path;
  30425. });
  30426. copyObject(object, getAllKeysIn(object), result);
  30427. if (isDeep) {
  30428. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30429. }
  30430. var length = paths.length;
  30431. while (length--) {
  30432. baseUnset(result, paths[length]);
  30433. }
  30434. return result;
  30435. });
  30436. /**
  30437. * The opposite of `_.pickBy`; this method creates an object composed of
  30438. * the own and inherited enumerable string keyed properties of `object` that
  30439. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30440. * arguments: (value, key).
  30441. *
  30442. * @static
  30443. * @memberOf _
  30444. * @since 4.0.0
  30445. * @category Object
  30446. * @param {Object} object The source object.
  30447. * @param {Function} [predicate=_.identity] The function invoked per property.
  30448. * @returns {Object} Returns the new object.
  30449. * @example
  30450. *
  30451. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30452. *
  30453. * _.omitBy(object, _.isNumber);
  30454. * // => { 'b': '2' }
  30455. */
  30456. function omitBy(object, predicate) {
  30457. return pickBy(object, negate(getIteratee(predicate)));
  30458. }
  30459. /**
  30460. * Creates an object composed of the picked `object` properties.
  30461. *
  30462. * @static
  30463. * @since 0.1.0
  30464. * @memberOf _
  30465. * @category Object
  30466. * @param {Object} object The source object.
  30467. * @param {...(string|string[])} [paths] The property paths to pick.
  30468. * @returns {Object} Returns the new object.
  30469. * @example
  30470. *
  30471. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30472. *
  30473. * _.pick(object, ['a', 'c']);
  30474. * // => { 'a': 1, 'c': 3 }
  30475. */
  30476. var pick = flatRest(function(object, paths) {
  30477. return object == null ? {} : basePick(object, paths);
  30478. });
  30479. /**
  30480. * Creates an object composed of the `object` properties `predicate` returns
  30481. * truthy for. The predicate is invoked with two arguments: (value, key).
  30482. *
  30483. * @static
  30484. * @memberOf _
  30485. * @since 4.0.0
  30486. * @category Object
  30487. * @param {Object} object The source object.
  30488. * @param {Function} [predicate=_.identity] The function invoked per property.
  30489. * @returns {Object} Returns the new object.
  30490. * @example
  30491. *
  30492. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30493. *
  30494. * _.pickBy(object, _.isNumber);
  30495. * // => { 'a': 1, 'c': 3 }
  30496. */
  30497. function pickBy(object, predicate) {
  30498. if (object == null) {
  30499. return {};
  30500. }
  30501. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30502. return [prop];
  30503. });
  30504. predicate = getIteratee(predicate);
  30505. return basePickBy(object, props, function(value, path) {
  30506. return predicate(value, path[0]);
  30507. });
  30508. }
  30509. /**
  30510. * This method is like `_.get` except that if the resolved value is a
  30511. * function it's invoked with the `this` binding of its parent object and
  30512. * its result is returned.
  30513. *
  30514. * @static
  30515. * @since 0.1.0
  30516. * @memberOf _
  30517. * @category Object
  30518. * @param {Object} object The object to query.
  30519. * @param {Array|string} path The path of the property to resolve.
  30520. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30521. * @returns {*} Returns the resolved value.
  30522. * @example
  30523. *
  30524. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30525. *
  30526. * _.result(object, 'a[0].b.c1');
  30527. * // => 3
  30528. *
  30529. * _.result(object, 'a[0].b.c2');
  30530. * // => 4
  30531. *
  30532. * _.result(object, 'a[0].b.c3', 'default');
  30533. * // => 'default'
  30534. *
  30535. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30536. * // => 'default'
  30537. */
  30538. function result(object, path, defaultValue) {
  30539. path = castPath(path, object);
  30540. var index = -1,
  30541. length = path.length;
  30542. // Ensure the loop is entered when path is empty.
  30543. if (!length) {
  30544. length = 1;
  30545. object = undefined;
  30546. }
  30547. while (++index < length) {
  30548. var value = object == null ? undefined : object[toKey(path[index])];
  30549. if (value === undefined) {
  30550. index = length;
  30551. value = defaultValue;
  30552. }
  30553. object = isFunction(value) ? value.call(object) : value;
  30554. }
  30555. return object;
  30556. }
  30557. /**
  30558. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30559. * it's created. Arrays are created for missing index properties while objects
  30560. * are created for all other missing properties. Use `_.setWith` to customize
  30561. * `path` creation.
  30562. *
  30563. * **Note:** This method mutates `object`.
  30564. *
  30565. * @static
  30566. * @memberOf _
  30567. * @since 3.7.0
  30568. * @category Object
  30569. * @param {Object} object The object to modify.
  30570. * @param {Array|string} path The path of the property to set.
  30571. * @param {*} value The value to set.
  30572. * @returns {Object} Returns `object`.
  30573. * @example
  30574. *
  30575. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30576. *
  30577. * _.set(object, 'a[0].b.c', 4);
  30578. * console.log(object.a[0].b.c);
  30579. * // => 4
  30580. *
  30581. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30582. * console.log(object.x[0].y.z);
  30583. * // => 5
  30584. */
  30585. function set(object, path, value) {
  30586. return object == null ? object : baseSet(object, path, value);
  30587. }
  30588. /**
  30589. * This method is like `_.set` except that it accepts `customizer` which is
  30590. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30591. * path creation is handled by the method instead. The `customizer` is invoked
  30592. * with three arguments: (nsValue, key, nsObject).
  30593. *
  30594. * **Note:** This method mutates `object`.
  30595. *
  30596. * @static
  30597. * @memberOf _
  30598. * @since 4.0.0
  30599. * @category Object
  30600. * @param {Object} object The object to modify.
  30601. * @param {Array|string} path The path of the property to set.
  30602. * @param {*} value The value to set.
  30603. * @param {Function} [customizer] The function to customize assigned values.
  30604. * @returns {Object} Returns `object`.
  30605. * @example
  30606. *
  30607. * var object = {};
  30608. *
  30609. * _.setWith(object, '[0][1]', 'a', Object);
  30610. * // => { '0': { '1': 'a' } }
  30611. */
  30612. function setWith(object, path, value, customizer) {
  30613. customizer = typeof customizer == 'function' ? customizer : undefined;
  30614. return object == null ? object : baseSet(object, path, value, customizer);
  30615. }
  30616. /**
  30617. * Creates an array of own enumerable string keyed-value pairs for `object`
  30618. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30619. * entries are returned.
  30620. *
  30621. * @static
  30622. * @memberOf _
  30623. * @since 4.0.0
  30624. * @alias entries
  30625. * @category Object
  30626. * @param {Object} object The object to query.
  30627. * @returns {Array} Returns the key-value pairs.
  30628. * @example
  30629. *
  30630. * function Foo() {
  30631. * this.a = 1;
  30632. * this.b = 2;
  30633. * }
  30634. *
  30635. * Foo.prototype.c = 3;
  30636. *
  30637. * _.toPairs(new Foo);
  30638. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30639. */
  30640. var toPairs = createToPairs(keys);
  30641. /**
  30642. * Creates an array of own and inherited enumerable string keyed-value pairs
  30643. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30644. * or set, its entries are returned.
  30645. *
  30646. * @static
  30647. * @memberOf _
  30648. * @since 4.0.0
  30649. * @alias entriesIn
  30650. * @category Object
  30651. * @param {Object} object The object to query.
  30652. * @returns {Array} Returns the key-value pairs.
  30653. * @example
  30654. *
  30655. * function Foo() {
  30656. * this.a = 1;
  30657. * this.b = 2;
  30658. * }
  30659. *
  30660. * Foo.prototype.c = 3;
  30661. *
  30662. * _.toPairsIn(new Foo);
  30663. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30664. */
  30665. var toPairsIn = createToPairs(keysIn);
  30666. /**
  30667. * An alternative to `_.reduce`; this method transforms `object` to a new
  30668. * `accumulator` object which is the result of running each of its own
  30669. * enumerable string keyed properties thru `iteratee`, with each invocation
  30670. * potentially mutating the `accumulator` object. If `accumulator` is not
  30671. * provided, a new object with the same `[[Prototype]]` will be used. The
  30672. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30673. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30674. *
  30675. * @static
  30676. * @memberOf _
  30677. * @since 1.3.0
  30678. * @category Object
  30679. * @param {Object} object The object to iterate over.
  30680. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30681. * @param {*} [accumulator] The custom accumulator value.
  30682. * @returns {*} Returns the accumulated value.
  30683. * @example
  30684. *
  30685. * _.transform([2, 3, 4], function(result, n) {
  30686. * result.push(n *= n);
  30687. * return n % 2 == 0;
  30688. * }, []);
  30689. * // => [4, 9]
  30690. *
  30691. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30692. * (result[value] || (result[value] = [])).push(key);
  30693. * }, {});
  30694. * // => { '1': ['a', 'c'], '2': ['b'] }
  30695. */
  30696. function transform(object, iteratee, accumulator) {
  30697. var isArr = isArray(object),
  30698. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30699. iteratee = getIteratee(iteratee, 4);
  30700. if (accumulator == null) {
  30701. var Ctor = object && object.constructor;
  30702. if (isArrLike) {
  30703. accumulator = isArr ? new Ctor : [];
  30704. }
  30705. else if (isObject(object)) {
  30706. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30707. }
  30708. else {
  30709. accumulator = {};
  30710. }
  30711. }
  30712. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30713. return iteratee(accumulator, value, index, object);
  30714. });
  30715. return accumulator;
  30716. }
  30717. /**
  30718. * Removes the property at `path` of `object`.
  30719. *
  30720. * **Note:** This method mutates `object`.
  30721. *
  30722. * @static
  30723. * @memberOf _
  30724. * @since 4.0.0
  30725. * @category Object
  30726. * @param {Object} object The object to modify.
  30727. * @param {Array|string} path The path of the property to unset.
  30728. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30729. * @example
  30730. *
  30731. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30732. * _.unset(object, 'a[0].b.c');
  30733. * // => true
  30734. *
  30735. * console.log(object);
  30736. * // => { 'a': [{ 'b': {} }] };
  30737. *
  30738. * _.unset(object, ['a', '0', 'b', 'c']);
  30739. * // => true
  30740. *
  30741. * console.log(object);
  30742. * // => { 'a': [{ 'b': {} }] };
  30743. */
  30744. function unset(object, path) {
  30745. return object == null ? true : baseUnset(object, path);
  30746. }
  30747. /**
  30748. * This method is like `_.set` except that accepts `updater` to produce the
  30749. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30750. * is invoked with one argument: (value).
  30751. *
  30752. * **Note:** This method mutates `object`.
  30753. *
  30754. * @static
  30755. * @memberOf _
  30756. * @since 4.6.0
  30757. * @category Object
  30758. * @param {Object} object The object to modify.
  30759. * @param {Array|string} path The path of the property to set.
  30760. * @param {Function} updater The function to produce the updated value.
  30761. * @returns {Object} Returns `object`.
  30762. * @example
  30763. *
  30764. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30765. *
  30766. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30767. * console.log(object.a[0].b.c);
  30768. * // => 9
  30769. *
  30770. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30771. * console.log(object.x[0].y.z);
  30772. * // => 0
  30773. */
  30774. function update(object, path, updater) {
  30775. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30776. }
  30777. /**
  30778. * This method is like `_.update` except that it accepts `customizer` which is
  30779. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30780. * path creation is handled by the method instead. The `customizer` is invoked
  30781. * with three arguments: (nsValue, key, nsObject).
  30782. *
  30783. * **Note:** This method mutates `object`.
  30784. *
  30785. * @static
  30786. * @memberOf _
  30787. * @since 4.6.0
  30788. * @category Object
  30789. * @param {Object} object The object to modify.
  30790. * @param {Array|string} path The path of the property to set.
  30791. * @param {Function} updater The function to produce the updated value.
  30792. * @param {Function} [customizer] The function to customize assigned values.
  30793. * @returns {Object} Returns `object`.
  30794. * @example
  30795. *
  30796. * var object = {};
  30797. *
  30798. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30799. * // => { '0': { '1': 'a' } }
  30800. */
  30801. function updateWith(object, path, updater, customizer) {
  30802. customizer = typeof customizer == 'function' ? customizer : undefined;
  30803. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  30804. }
  30805. /**
  30806. * Creates an array of the own enumerable string keyed property values of `object`.
  30807. *
  30808. * **Note:** Non-object values are coerced to objects.
  30809. *
  30810. * @static
  30811. * @since 0.1.0
  30812. * @memberOf _
  30813. * @category Object
  30814. * @param {Object} object The object to query.
  30815. * @returns {Array} Returns the array of property values.
  30816. * @example
  30817. *
  30818. * function Foo() {
  30819. * this.a = 1;
  30820. * this.b = 2;
  30821. * }
  30822. *
  30823. * Foo.prototype.c = 3;
  30824. *
  30825. * _.values(new Foo);
  30826. * // => [1, 2] (iteration order is not guaranteed)
  30827. *
  30828. * _.values('hi');
  30829. * // => ['h', 'i']
  30830. */
  30831. function values(object) {
  30832. return object == null ? [] : baseValues(object, keys(object));
  30833. }
  30834. /**
  30835. * Creates an array of the own and inherited enumerable string keyed property
  30836. * values of `object`.
  30837. *
  30838. * **Note:** Non-object values are coerced to objects.
  30839. *
  30840. * @static
  30841. * @memberOf _
  30842. * @since 3.0.0
  30843. * @category Object
  30844. * @param {Object} object The object to query.
  30845. * @returns {Array} Returns the array of property values.
  30846. * @example
  30847. *
  30848. * function Foo() {
  30849. * this.a = 1;
  30850. * this.b = 2;
  30851. * }
  30852. *
  30853. * Foo.prototype.c = 3;
  30854. *
  30855. * _.valuesIn(new Foo);
  30856. * // => [1, 2, 3] (iteration order is not guaranteed)
  30857. */
  30858. function valuesIn(object) {
  30859. return object == null ? [] : baseValues(object, keysIn(object));
  30860. }
  30861. /*------------------------------------------------------------------------*/
  30862. /**
  30863. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  30864. *
  30865. * @static
  30866. * @memberOf _
  30867. * @since 4.0.0
  30868. * @category Number
  30869. * @param {number} number The number to clamp.
  30870. * @param {number} [lower] The lower bound.
  30871. * @param {number} upper The upper bound.
  30872. * @returns {number} Returns the clamped number.
  30873. * @example
  30874. *
  30875. * _.clamp(-10, -5, 5);
  30876. * // => -5
  30877. *
  30878. * _.clamp(10, -5, 5);
  30879. * // => 5
  30880. */
  30881. function clamp(number, lower, upper) {
  30882. if (upper === undefined) {
  30883. upper = lower;
  30884. lower = undefined;
  30885. }
  30886. if (upper !== undefined) {
  30887. upper = toNumber(upper);
  30888. upper = upper === upper ? upper : 0;
  30889. }
  30890. if (lower !== undefined) {
  30891. lower = toNumber(lower);
  30892. lower = lower === lower ? lower : 0;
  30893. }
  30894. return baseClamp(toNumber(number), lower, upper);
  30895. }
  30896. /**
  30897. * Checks if `n` is between `start` and up to, but not including, `end`. If
  30898. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  30899. * If `start` is greater than `end` the params are swapped to support
  30900. * negative ranges.
  30901. *
  30902. * @static
  30903. * @memberOf _
  30904. * @since 3.3.0
  30905. * @category Number
  30906. * @param {number} number The number to check.
  30907. * @param {number} [start=0] The start of the range.
  30908. * @param {number} end The end of the range.
  30909. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  30910. * @see _.range, _.rangeRight
  30911. * @example
  30912. *
  30913. * _.inRange(3, 2, 4);
  30914. * // => true
  30915. *
  30916. * _.inRange(4, 8);
  30917. * // => true
  30918. *
  30919. * _.inRange(4, 2);
  30920. * // => false
  30921. *
  30922. * _.inRange(2, 2);
  30923. * // => false
  30924. *
  30925. * _.inRange(1.2, 2);
  30926. * // => true
  30927. *
  30928. * _.inRange(5.2, 4);
  30929. * // => false
  30930. *
  30931. * _.inRange(-3, -2, -6);
  30932. * // => true
  30933. */
  30934. function inRange(number, start, end) {
  30935. start = toFinite(start);
  30936. if (end === undefined) {
  30937. end = start;
  30938. start = 0;
  30939. } else {
  30940. end = toFinite(end);
  30941. }
  30942. number = toNumber(number);
  30943. return baseInRange(number, start, end);
  30944. }
  30945. /**
  30946. * Produces a random number between the inclusive `lower` and `upper` bounds.
  30947. * If only one argument is provided a number between `0` and the given number
  30948. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  30949. * floats, a floating-point number is returned instead of an integer.
  30950. *
  30951. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  30952. * floating-point values which can produce unexpected results.
  30953. *
  30954. * @static
  30955. * @memberOf _
  30956. * @since 0.7.0
  30957. * @category Number
  30958. * @param {number} [lower=0] The lower bound.
  30959. * @param {number} [upper=1] The upper bound.
  30960. * @param {boolean} [floating] Specify returning a floating-point number.
  30961. * @returns {number} Returns the random number.
  30962. * @example
  30963. *
  30964. * _.random(0, 5);
  30965. * // => an integer between 0 and 5
  30966. *
  30967. * _.random(5);
  30968. * // => also an integer between 0 and 5
  30969. *
  30970. * _.random(5, true);
  30971. * // => a floating-point number between 0 and 5
  30972. *
  30973. * _.random(1.2, 5.2);
  30974. * // => a floating-point number between 1.2 and 5.2
  30975. */
  30976. function random(lower, upper, floating) {
  30977. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  30978. upper = floating = undefined;
  30979. }
  30980. if (floating === undefined) {
  30981. if (typeof upper == 'boolean') {
  30982. floating = upper;
  30983. upper = undefined;
  30984. }
  30985. else if (typeof lower == 'boolean') {
  30986. floating = lower;
  30987. lower = undefined;
  30988. }
  30989. }
  30990. if (lower === undefined && upper === undefined) {
  30991. lower = 0;
  30992. upper = 1;
  30993. }
  30994. else {
  30995. lower = toFinite(lower);
  30996. if (upper === undefined) {
  30997. upper = lower;
  30998. lower = 0;
  30999. } else {
  31000. upper = toFinite(upper);
  31001. }
  31002. }
  31003. if (lower > upper) {
  31004. var temp = lower;
  31005. lower = upper;
  31006. upper = temp;
  31007. }
  31008. if (floating || lower % 1 || upper % 1) {
  31009. var rand = nativeRandom();
  31010. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31011. }
  31012. return baseRandom(lower, upper);
  31013. }
  31014. /*------------------------------------------------------------------------*/
  31015. /**
  31016. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31017. *
  31018. * @static
  31019. * @memberOf _
  31020. * @since 3.0.0
  31021. * @category String
  31022. * @param {string} [string=''] The string to convert.
  31023. * @returns {string} Returns the camel cased string.
  31024. * @example
  31025. *
  31026. * _.camelCase('Foo Bar');
  31027. * // => 'fooBar'
  31028. *
  31029. * _.camelCase('--foo-bar--');
  31030. * // => 'fooBar'
  31031. *
  31032. * _.camelCase('__FOO_BAR__');
  31033. * // => 'fooBar'
  31034. */
  31035. var camelCase = createCompounder(function(result, word, index) {
  31036. word = word.toLowerCase();
  31037. return result + (index ? capitalize(word) : word);
  31038. });
  31039. /**
  31040. * Converts the first character of `string` to upper case and the remaining
  31041. * to lower case.
  31042. *
  31043. * @static
  31044. * @memberOf _
  31045. * @since 3.0.0
  31046. * @category String
  31047. * @param {string} [string=''] The string to capitalize.
  31048. * @returns {string} Returns the capitalized string.
  31049. * @example
  31050. *
  31051. * _.capitalize('FRED');
  31052. * // => 'Fred'
  31053. */
  31054. function capitalize(string) {
  31055. return upperFirst(toString(string).toLowerCase());
  31056. }
  31057. /**
  31058. * Deburrs `string` by converting
  31059. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31060. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31061. * letters to basic Latin letters and removing
  31062. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31063. *
  31064. * @static
  31065. * @memberOf _
  31066. * @since 3.0.0
  31067. * @category String
  31068. * @param {string} [string=''] The string to deburr.
  31069. * @returns {string} Returns the deburred string.
  31070. * @example
  31071. *
  31072. * _.deburr('déjà vu');
  31073. * // => 'deja vu'
  31074. */
  31075. function deburr(string) {
  31076. string = toString(string);
  31077. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31078. }
  31079. /**
  31080. * Checks if `string` ends with the given target string.
  31081. *
  31082. * @static
  31083. * @memberOf _
  31084. * @since 3.0.0
  31085. * @category String
  31086. * @param {string} [string=''] The string to inspect.
  31087. * @param {string} [target] The string to search for.
  31088. * @param {number} [position=string.length] The position to search up to.
  31089. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31090. * else `false`.
  31091. * @example
  31092. *
  31093. * _.endsWith('abc', 'c');
  31094. * // => true
  31095. *
  31096. * _.endsWith('abc', 'b');
  31097. * // => false
  31098. *
  31099. * _.endsWith('abc', 'b', 2);
  31100. * // => true
  31101. */
  31102. function endsWith(string, target, position) {
  31103. string = toString(string);
  31104. target = baseToString(target);
  31105. var length = string.length;
  31106. position = position === undefined
  31107. ? length
  31108. : baseClamp(toInteger(position), 0, length);
  31109. var end = position;
  31110. position -= target.length;
  31111. return position >= 0 && string.slice(position, end) == target;
  31112. }
  31113. /**
  31114. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31115. * corresponding HTML entities.
  31116. *
  31117. * **Note:** No other characters are escaped. To escape additional
  31118. * characters use a third-party library like [_he_](https://mths.be/he).
  31119. *
  31120. * Though the ">" character is escaped for symmetry, characters like
  31121. * ">" and "/" don't need escaping in HTML and have no special meaning
  31122. * unless they're part of a tag or unquoted attribute value. See
  31123. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31124. * (under "semi-related fun fact") for more details.
  31125. *
  31126. * When working with HTML you should always
  31127. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31128. * XSS vectors.
  31129. *
  31130. * @static
  31131. * @since 0.1.0
  31132. * @memberOf _
  31133. * @category String
  31134. * @param {string} [string=''] The string to escape.
  31135. * @returns {string} Returns the escaped string.
  31136. * @example
  31137. *
  31138. * _.escape('fred, barney, & pebbles');
  31139. * // => 'fred, barney, &amp; pebbles'
  31140. */
  31141. function escape(string) {
  31142. string = toString(string);
  31143. return (string && reHasUnescapedHtml.test(string))
  31144. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31145. : string;
  31146. }
  31147. /**
  31148. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31149. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31150. *
  31151. * @static
  31152. * @memberOf _
  31153. * @since 3.0.0
  31154. * @category String
  31155. * @param {string} [string=''] The string to escape.
  31156. * @returns {string} Returns the escaped string.
  31157. * @example
  31158. *
  31159. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31160. * // => '\[lodash\]\(https://lodash\.com/\)'
  31161. */
  31162. function escapeRegExp(string) {
  31163. string = toString(string);
  31164. return (string && reHasRegExpChar.test(string))
  31165. ? string.replace(reRegExpChar, '\\$&')
  31166. : string;
  31167. }
  31168. /**
  31169. * Converts `string` to
  31170. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31171. *
  31172. * @static
  31173. * @memberOf _
  31174. * @since 3.0.0
  31175. * @category String
  31176. * @param {string} [string=''] The string to convert.
  31177. * @returns {string} Returns the kebab cased string.
  31178. * @example
  31179. *
  31180. * _.kebabCase('Foo Bar');
  31181. * // => 'foo-bar'
  31182. *
  31183. * _.kebabCase('fooBar');
  31184. * // => 'foo-bar'
  31185. *
  31186. * _.kebabCase('__FOO_BAR__');
  31187. * // => 'foo-bar'
  31188. */
  31189. var kebabCase = createCompounder(function(result, word, index) {
  31190. return result + (index ? '-' : '') + word.toLowerCase();
  31191. });
  31192. /**
  31193. * Converts `string`, as space separated words, to lower case.
  31194. *
  31195. * @static
  31196. * @memberOf _
  31197. * @since 4.0.0
  31198. * @category String
  31199. * @param {string} [string=''] The string to convert.
  31200. * @returns {string} Returns the lower cased string.
  31201. * @example
  31202. *
  31203. * _.lowerCase('--Foo-Bar--');
  31204. * // => 'foo bar'
  31205. *
  31206. * _.lowerCase('fooBar');
  31207. * // => 'foo bar'
  31208. *
  31209. * _.lowerCase('__FOO_BAR__');
  31210. * // => 'foo bar'
  31211. */
  31212. var lowerCase = createCompounder(function(result, word, index) {
  31213. return result + (index ? ' ' : '') + word.toLowerCase();
  31214. });
  31215. /**
  31216. * Converts the first character of `string` to lower case.
  31217. *
  31218. * @static
  31219. * @memberOf _
  31220. * @since 4.0.0
  31221. * @category String
  31222. * @param {string} [string=''] The string to convert.
  31223. * @returns {string} Returns the converted string.
  31224. * @example
  31225. *
  31226. * _.lowerFirst('Fred');
  31227. * // => 'fred'
  31228. *
  31229. * _.lowerFirst('FRED');
  31230. * // => 'fRED'
  31231. */
  31232. var lowerFirst = createCaseFirst('toLowerCase');
  31233. /**
  31234. * Pads `string` on the left and right sides if it's shorter than `length`.
  31235. * Padding characters are truncated if they can't be evenly divided by `length`.
  31236. *
  31237. * @static
  31238. * @memberOf _
  31239. * @since 3.0.0
  31240. * @category String
  31241. * @param {string} [string=''] The string to pad.
  31242. * @param {number} [length=0] The padding length.
  31243. * @param {string} [chars=' '] The string used as padding.
  31244. * @returns {string} Returns the padded string.
  31245. * @example
  31246. *
  31247. * _.pad('abc', 8);
  31248. * // => ' abc '
  31249. *
  31250. * _.pad('abc', 8, '_-');
  31251. * // => '_-abc_-_'
  31252. *
  31253. * _.pad('abc', 3);
  31254. * // => 'abc'
  31255. */
  31256. function pad(string, length, chars) {
  31257. string = toString(string);
  31258. length = toInteger(length);
  31259. var strLength = length ? stringSize(string) : 0;
  31260. if (!length || strLength >= length) {
  31261. return string;
  31262. }
  31263. var mid = (length - strLength) / 2;
  31264. return (
  31265. createPadding(nativeFloor(mid), chars) +
  31266. string +
  31267. createPadding(nativeCeil(mid), chars)
  31268. );
  31269. }
  31270. /**
  31271. * Pads `string` on the right side if it's shorter than `length`. Padding
  31272. * characters are truncated if they exceed `length`.
  31273. *
  31274. * @static
  31275. * @memberOf _
  31276. * @since 4.0.0
  31277. * @category String
  31278. * @param {string} [string=''] The string to pad.
  31279. * @param {number} [length=0] The padding length.
  31280. * @param {string} [chars=' '] The string used as padding.
  31281. * @returns {string} Returns the padded string.
  31282. * @example
  31283. *
  31284. * _.padEnd('abc', 6);
  31285. * // => 'abc '
  31286. *
  31287. * _.padEnd('abc', 6, '_-');
  31288. * // => 'abc_-_'
  31289. *
  31290. * _.padEnd('abc', 3);
  31291. * // => 'abc'
  31292. */
  31293. function padEnd(string, length, chars) {
  31294. string = toString(string);
  31295. length = toInteger(length);
  31296. var strLength = length ? stringSize(string) : 0;
  31297. return (length && strLength < length)
  31298. ? (string + createPadding(length - strLength, chars))
  31299. : string;
  31300. }
  31301. /**
  31302. * Pads `string` on the left side if it's shorter than `length`. Padding
  31303. * characters are truncated if they exceed `length`.
  31304. *
  31305. * @static
  31306. * @memberOf _
  31307. * @since 4.0.0
  31308. * @category String
  31309. * @param {string} [string=''] The string to pad.
  31310. * @param {number} [length=0] The padding length.
  31311. * @param {string} [chars=' '] The string used as padding.
  31312. * @returns {string} Returns the padded string.
  31313. * @example
  31314. *
  31315. * _.padStart('abc', 6);
  31316. * // => ' abc'
  31317. *
  31318. * _.padStart('abc', 6, '_-');
  31319. * // => '_-_abc'
  31320. *
  31321. * _.padStart('abc', 3);
  31322. * // => 'abc'
  31323. */
  31324. function padStart(string, length, chars) {
  31325. string = toString(string);
  31326. length = toInteger(length);
  31327. var strLength = length ? stringSize(string) : 0;
  31328. return (length && strLength < length)
  31329. ? (createPadding(length - strLength, chars) + string)
  31330. : string;
  31331. }
  31332. /**
  31333. * Converts `string` to an integer of the specified radix. If `radix` is
  31334. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31335. * hexadecimal, in which case a `radix` of `16` is used.
  31336. *
  31337. * **Note:** This method aligns with the
  31338. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31339. *
  31340. * @static
  31341. * @memberOf _
  31342. * @since 1.1.0
  31343. * @category String
  31344. * @param {string} string The string to convert.
  31345. * @param {number} [radix=10] The radix to interpret `value` by.
  31346. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31347. * @returns {number} Returns the converted integer.
  31348. * @example
  31349. *
  31350. * _.parseInt('08');
  31351. * // => 8
  31352. *
  31353. * _.map(['6', '08', '10'], _.parseInt);
  31354. * // => [6, 8, 10]
  31355. */
  31356. function parseInt(string, radix, guard) {
  31357. if (guard || radix == null) {
  31358. radix = 0;
  31359. } else if (radix) {
  31360. radix = +radix;
  31361. }
  31362. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31363. }
  31364. /**
  31365. * Repeats the given string `n` times.
  31366. *
  31367. * @static
  31368. * @memberOf _
  31369. * @since 3.0.0
  31370. * @category String
  31371. * @param {string} [string=''] The string to repeat.
  31372. * @param {number} [n=1] The number of times to repeat the string.
  31373. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31374. * @returns {string} Returns the repeated string.
  31375. * @example
  31376. *
  31377. * _.repeat('*', 3);
  31378. * // => '***'
  31379. *
  31380. * _.repeat('abc', 2);
  31381. * // => 'abcabc'
  31382. *
  31383. * _.repeat('abc', 0);
  31384. * // => ''
  31385. */
  31386. function repeat(string, n, guard) {
  31387. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31388. n = 1;
  31389. } else {
  31390. n = toInteger(n);
  31391. }
  31392. return baseRepeat(toString(string), n);
  31393. }
  31394. /**
  31395. * Replaces matches for `pattern` in `string` with `replacement`.
  31396. *
  31397. * **Note:** This method is based on
  31398. * [`String#replace`](https://mdn.io/String/replace).
  31399. *
  31400. * @static
  31401. * @memberOf _
  31402. * @since 4.0.0
  31403. * @category String
  31404. * @param {string} [string=''] The string to modify.
  31405. * @param {RegExp|string} pattern The pattern to replace.
  31406. * @param {Function|string} replacement The match replacement.
  31407. * @returns {string} Returns the modified string.
  31408. * @example
  31409. *
  31410. * _.replace('Hi Fred', 'Fred', 'Barney');
  31411. * // => 'Hi Barney'
  31412. */
  31413. function replace() {
  31414. var args = arguments,
  31415. string = toString(args[0]);
  31416. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31417. }
  31418. /**
  31419. * Converts `string` to
  31420. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31421. *
  31422. * @static
  31423. * @memberOf _
  31424. * @since 3.0.0
  31425. * @category String
  31426. * @param {string} [string=''] The string to convert.
  31427. * @returns {string} Returns the snake cased string.
  31428. * @example
  31429. *
  31430. * _.snakeCase('Foo Bar');
  31431. * // => 'foo_bar'
  31432. *
  31433. * _.snakeCase('fooBar');
  31434. * // => 'foo_bar'
  31435. *
  31436. * _.snakeCase('--FOO-BAR--');
  31437. * // => 'foo_bar'
  31438. */
  31439. var snakeCase = createCompounder(function(result, word, index) {
  31440. return result + (index ? '_' : '') + word.toLowerCase();
  31441. });
  31442. /**
  31443. * Splits `string` by `separator`.
  31444. *
  31445. * **Note:** This method is based on
  31446. * [`String#split`](https://mdn.io/String/split).
  31447. *
  31448. * @static
  31449. * @memberOf _
  31450. * @since 4.0.0
  31451. * @category String
  31452. * @param {string} [string=''] The string to split.
  31453. * @param {RegExp|string} separator The separator pattern to split by.
  31454. * @param {number} [limit] The length to truncate results to.
  31455. * @returns {Array} Returns the string segments.
  31456. * @example
  31457. *
  31458. * _.split('a-b-c', '-', 2);
  31459. * // => ['a', 'b']
  31460. */
  31461. function split(string, separator, limit) {
  31462. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31463. separator = limit = undefined;
  31464. }
  31465. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31466. if (!limit) {
  31467. return [];
  31468. }
  31469. string = toString(string);
  31470. if (string && (
  31471. typeof separator == 'string' ||
  31472. (separator != null && !isRegExp(separator))
  31473. )) {
  31474. separator = baseToString(separator);
  31475. if (!separator && hasUnicode(string)) {
  31476. return castSlice(stringToArray(string), 0, limit);
  31477. }
  31478. }
  31479. return string.split(separator, limit);
  31480. }
  31481. /**
  31482. * Converts `string` to
  31483. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31484. *
  31485. * @static
  31486. * @memberOf _
  31487. * @since 3.1.0
  31488. * @category String
  31489. * @param {string} [string=''] The string to convert.
  31490. * @returns {string} Returns the start cased string.
  31491. * @example
  31492. *
  31493. * _.startCase('--foo-bar--');
  31494. * // => 'Foo Bar'
  31495. *
  31496. * _.startCase('fooBar');
  31497. * // => 'Foo Bar'
  31498. *
  31499. * _.startCase('__FOO_BAR__');
  31500. * // => 'FOO BAR'
  31501. */
  31502. var startCase = createCompounder(function(result, word, index) {
  31503. return result + (index ? ' ' : '') + upperFirst(word);
  31504. });
  31505. /**
  31506. * Checks if `string` starts with the given target string.
  31507. *
  31508. * @static
  31509. * @memberOf _
  31510. * @since 3.0.0
  31511. * @category String
  31512. * @param {string} [string=''] The string to inspect.
  31513. * @param {string} [target] The string to search for.
  31514. * @param {number} [position=0] The position to search from.
  31515. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31516. * else `false`.
  31517. * @example
  31518. *
  31519. * _.startsWith('abc', 'a');
  31520. * // => true
  31521. *
  31522. * _.startsWith('abc', 'b');
  31523. * // => false
  31524. *
  31525. * _.startsWith('abc', 'b', 1);
  31526. * // => true
  31527. */
  31528. function startsWith(string, target, position) {
  31529. string = toString(string);
  31530. position = position == null
  31531. ? 0
  31532. : baseClamp(toInteger(position), 0, string.length);
  31533. target = baseToString(target);
  31534. return string.slice(position, position + target.length) == target;
  31535. }
  31536. /**
  31537. * Creates a compiled template function that can interpolate data properties
  31538. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31539. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31540. * properties may be accessed as free variables in the template. If a setting
  31541. * object is given, it takes precedence over `_.templateSettings` values.
  31542. *
  31543. * **Note:** In the development build `_.template` utilizes
  31544. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31545. * for easier debugging.
  31546. *
  31547. * For more information on precompiling templates see
  31548. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31549. *
  31550. * For more information on Chrome extension sandboxes see
  31551. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31552. *
  31553. * @static
  31554. * @since 0.1.0
  31555. * @memberOf _
  31556. * @category String
  31557. * @param {string} [string=''] The template string.
  31558. * @param {Object} [options={}] The options object.
  31559. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31560. * The HTML "escape" delimiter.
  31561. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31562. * The "evaluate" delimiter.
  31563. * @param {Object} [options.imports=_.templateSettings.imports]
  31564. * An object to import into the template as free variables.
  31565. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31566. * The "interpolate" delimiter.
  31567. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31568. * The sourceURL of the compiled template.
  31569. * @param {string} [options.variable='obj']
  31570. * The data object variable name.
  31571. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31572. * @returns {Function} Returns the compiled template function.
  31573. * @example
  31574. *
  31575. * // Use the "interpolate" delimiter to create a compiled template.
  31576. * var compiled = _.template('hello <%= user %>!');
  31577. * compiled({ 'user': 'fred' });
  31578. * // => 'hello fred!'
  31579. *
  31580. * // Use the HTML "escape" delimiter to escape data property values.
  31581. * var compiled = _.template('<b><%- value %></b>');
  31582. * compiled({ 'value': '<script>' });
  31583. * // => '<b>&lt;script&gt;</b>'
  31584. *
  31585. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31586. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31587. * compiled({ 'users': ['fred', 'barney'] });
  31588. * // => '<li>fred</li><li>barney</li>'
  31589. *
  31590. * // Use the internal `print` function in "evaluate" delimiters.
  31591. * var compiled = _.template('<% print("hello " + user); %>!');
  31592. * compiled({ 'user': 'barney' });
  31593. * // => 'hello barney!'
  31594. *
  31595. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31596. * // Disable support by replacing the "interpolate" delimiter.
  31597. * var compiled = _.template('hello ${ user }!');
  31598. * compiled({ 'user': 'pebbles' });
  31599. * // => 'hello pebbles!'
  31600. *
  31601. * // Use backslashes to treat delimiters as plain text.
  31602. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31603. * compiled({ 'value': 'ignored' });
  31604. * // => '<%- value %>'
  31605. *
  31606. * // Use the `imports` option to import `jQuery` as `jq`.
  31607. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31608. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31609. * compiled({ 'users': ['fred', 'barney'] });
  31610. * // => '<li>fred</li><li>barney</li>'
  31611. *
  31612. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31613. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31614. * compiled(data);
  31615. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31616. *
  31617. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31618. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31619. * compiled.source;
  31620. * // => function(data) {
  31621. * // var __t, __p = '';
  31622. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31623. * // return __p;
  31624. * // }
  31625. *
  31626. * // Use custom template delimiters.
  31627. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31628. * var compiled = _.template('hello {{ user }}!');
  31629. * compiled({ 'user': 'mustache' });
  31630. * // => 'hello mustache!'
  31631. *
  31632. * // Use the `source` property to inline compiled templates for meaningful
  31633. * // line numbers in error messages and stack traces.
  31634. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31635. * var JST = {\
  31636. * "main": ' + _.template(mainText).source + '\
  31637. * };\
  31638. * ');
  31639. */
  31640. function template(string, options, guard) {
  31641. // Based on John Resig's `tmpl` implementation
  31642. // (http://ejohn.org/blog/javascript-micro-templating/)
  31643. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31644. var settings = lodash.templateSettings;
  31645. if (guard && isIterateeCall(string, options, guard)) {
  31646. options = undefined;
  31647. }
  31648. string = toString(string);
  31649. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31650. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31651. importsKeys = keys(imports),
  31652. importsValues = baseValues(imports, importsKeys);
  31653. var isEscaping,
  31654. isEvaluating,
  31655. index = 0,
  31656. interpolate = options.interpolate || reNoMatch,
  31657. source = "__p += '";
  31658. // Compile the regexp to match each delimiter.
  31659. var reDelimiters = RegExp(
  31660. (options.escape || reNoMatch).source + '|' +
  31661. interpolate.source + '|' +
  31662. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31663. (options.evaluate || reNoMatch).source + '|$'
  31664. , 'g');
  31665. // Use a sourceURL for easier debugging.
  31666. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31667. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31668. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31669. var sourceURL = '//# sourceURL=' +
  31670. (hasOwnProperty.call(options, 'sourceURL')
  31671. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31672. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31673. ) + '\n';
  31674. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31675. interpolateValue || (interpolateValue = esTemplateValue);
  31676. // Escape characters that can't be included in string literals.
  31677. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31678. // Replace delimiters with snippets.
  31679. if (escapeValue) {
  31680. isEscaping = true;
  31681. source += "' +\n__e(" + escapeValue + ") +\n'";
  31682. }
  31683. if (evaluateValue) {
  31684. isEvaluating = true;
  31685. source += "';\n" + evaluateValue + ";\n__p += '";
  31686. }
  31687. if (interpolateValue) {
  31688. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31689. }
  31690. index = offset + match.length;
  31691. // The JS engine embedded in Adobe products needs `match` returned in
  31692. // order to produce the correct `offset` value.
  31693. return match;
  31694. });
  31695. source += "';\n";
  31696. // If `variable` is not specified wrap a with-statement around the generated
  31697. // code to add the data object to the top of the scope chain.
  31698. // Like with sourceURL, we take care to not check the option's prototype,
  31699. // as this configuration is a code injection vector.
  31700. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31701. if (!variable) {
  31702. source = 'with (obj) {\n' + source + '\n}\n';
  31703. }
  31704. // Cleanup code by stripping empty strings.
  31705. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31706. .replace(reEmptyStringMiddle, '$1')
  31707. .replace(reEmptyStringTrailing, '$1;');
  31708. // Frame code as the function body.
  31709. source = 'function(' + (variable || 'obj') + ') {\n' +
  31710. (variable
  31711. ? ''
  31712. : 'obj || (obj = {});\n'
  31713. ) +
  31714. "var __t, __p = ''" +
  31715. (isEscaping
  31716. ? ', __e = _.escape'
  31717. : ''
  31718. ) +
  31719. (isEvaluating
  31720. ? ', __j = Array.prototype.join;\n' +
  31721. "function print() { __p += __j.call(arguments, '') }\n"
  31722. : ';\n'
  31723. ) +
  31724. source +
  31725. 'return __p\n}';
  31726. var result = attempt(function() {
  31727. return Function(importsKeys, sourceURL + 'return ' + source)
  31728. .apply(undefined, importsValues);
  31729. });
  31730. // Provide the compiled function's source by its `toString` method or
  31731. // the `source` property as a convenience for inlining compiled templates.
  31732. result.source = source;
  31733. if (isError(result)) {
  31734. throw result;
  31735. }
  31736. return result;
  31737. }
  31738. /**
  31739. * Converts `string`, as a whole, to lower case just like
  31740. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31741. *
  31742. * @static
  31743. * @memberOf _
  31744. * @since 4.0.0
  31745. * @category String
  31746. * @param {string} [string=''] The string to convert.
  31747. * @returns {string} Returns the lower cased string.
  31748. * @example
  31749. *
  31750. * _.toLower('--Foo-Bar--');
  31751. * // => '--foo-bar--'
  31752. *
  31753. * _.toLower('fooBar');
  31754. * // => 'foobar'
  31755. *
  31756. * _.toLower('__FOO_BAR__');
  31757. * // => '__foo_bar__'
  31758. */
  31759. function toLower(value) {
  31760. return toString(value).toLowerCase();
  31761. }
  31762. /**
  31763. * Converts `string`, as a whole, to upper case just like
  31764. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31765. *
  31766. * @static
  31767. * @memberOf _
  31768. * @since 4.0.0
  31769. * @category String
  31770. * @param {string} [string=''] The string to convert.
  31771. * @returns {string} Returns the upper cased string.
  31772. * @example
  31773. *
  31774. * _.toUpper('--foo-bar--');
  31775. * // => '--FOO-BAR--'
  31776. *
  31777. * _.toUpper('fooBar');
  31778. * // => 'FOOBAR'
  31779. *
  31780. * _.toUpper('__foo_bar__');
  31781. * // => '__FOO_BAR__'
  31782. */
  31783. function toUpper(value) {
  31784. return toString(value).toUpperCase();
  31785. }
  31786. /**
  31787. * Removes leading and trailing whitespace or specified characters from `string`.
  31788. *
  31789. * @static
  31790. * @memberOf _
  31791. * @since 3.0.0
  31792. * @category String
  31793. * @param {string} [string=''] The string to trim.
  31794. * @param {string} [chars=whitespace] The characters to trim.
  31795. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31796. * @returns {string} Returns the trimmed string.
  31797. * @example
  31798. *
  31799. * _.trim(' abc ');
  31800. * // => 'abc'
  31801. *
  31802. * _.trim('-_-abc-_-', '_-');
  31803. * // => 'abc'
  31804. *
  31805. * _.map([' foo ', ' bar '], _.trim);
  31806. * // => ['foo', 'bar']
  31807. */
  31808. function trim(string, chars, guard) {
  31809. string = toString(string);
  31810. if (string && (guard || chars === undefined)) {
  31811. return string.replace(reTrim, '');
  31812. }
  31813. if (!string || !(chars = baseToString(chars))) {
  31814. return string;
  31815. }
  31816. var strSymbols = stringToArray(string),
  31817. chrSymbols = stringToArray(chars),
  31818. start = charsStartIndex(strSymbols, chrSymbols),
  31819. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  31820. return castSlice(strSymbols, start, end).join('');
  31821. }
  31822. /**
  31823. * Removes trailing whitespace or specified characters from `string`.
  31824. *
  31825. * @static
  31826. * @memberOf _
  31827. * @since 4.0.0
  31828. * @category String
  31829. * @param {string} [string=''] The string to trim.
  31830. * @param {string} [chars=whitespace] The characters to trim.
  31831. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31832. * @returns {string} Returns the trimmed string.
  31833. * @example
  31834. *
  31835. * _.trimEnd(' abc ');
  31836. * // => ' abc'
  31837. *
  31838. * _.trimEnd('-_-abc-_-', '_-');
  31839. * // => '-_-abc'
  31840. */
  31841. function trimEnd(string, chars, guard) {
  31842. string = toString(string);
  31843. if (string && (guard || chars === undefined)) {
  31844. return string.replace(reTrimEnd, '');
  31845. }
  31846. if (!string || !(chars = baseToString(chars))) {
  31847. return string;
  31848. }
  31849. var strSymbols = stringToArray(string),
  31850. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  31851. return castSlice(strSymbols, 0, end).join('');
  31852. }
  31853. /**
  31854. * Removes leading whitespace or specified characters from `string`.
  31855. *
  31856. * @static
  31857. * @memberOf _
  31858. * @since 4.0.0
  31859. * @category String
  31860. * @param {string} [string=''] The string to trim.
  31861. * @param {string} [chars=whitespace] The characters to trim.
  31862. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31863. * @returns {string} Returns the trimmed string.
  31864. * @example
  31865. *
  31866. * _.trimStart(' abc ');
  31867. * // => 'abc '
  31868. *
  31869. * _.trimStart('-_-abc-_-', '_-');
  31870. * // => 'abc-_-'
  31871. */
  31872. function trimStart(string, chars, guard) {
  31873. string = toString(string);
  31874. if (string && (guard || chars === undefined)) {
  31875. return string.replace(reTrimStart, '');
  31876. }
  31877. if (!string || !(chars = baseToString(chars))) {
  31878. return string;
  31879. }
  31880. var strSymbols = stringToArray(string),
  31881. start = charsStartIndex(strSymbols, stringToArray(chars));
  31882. return castSlice(strSymbols, start).join('');
  31883. }
  31884. /**
  31885. * Truncates `string` if it's longer than the given maximum string length.
  31886. * The last characters of the truncated string are replaced with the omission
  31887. * string which defaults to "...".
  31888. *
  31889. * @static
  31890. * @memberOf _
  31891. * @since 4.0.0
  31892. * @category String
  31893. * @param {string} [string=''] The string to truncate.
  31894. * @param {Object} [options={}] The options object.
  31895. * @param {number} [options.length=30] The maximum string length.
  31896. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  31897. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  31898. * @returns {string} Returns the truncated string.
  31899. * @example
  31900. *
  31901. * _.truncate('hi-diddly-ho there, neighborino');
  31902. * // => 'hi-diddly-ho there, neighbo...'
  31903. *
  31904. * _.truncate('hi-diddly-ho there, neighborino', {
  31905. * 'length': 24,
  31906. * 'separator': ' '
  31907. * });
  31908. * // => 'hi-diddly-ho there,...'
  31909. *
  31910. * _.truncate('hi-diddly-ho there, neighborino', {
  31911. * 'length': 24,
  31912. * 'separator': /,? +/
  31913. * });
  31914. * // => 'hi-diddly-ho there...'
  31915. *
  31916. * _.truncate('hi-diddly-ho there, neighborino', {
  31917. * 'omission': ' [...]'
  31918. * });
  31919. * // => 'hi-diddly-ho there, neig [...]'
  31920. */
  31921. function truncate(string, options) {
  31922. var length = DEFAULT_TRUNC_LENGTH,
  31923. omission = DEFAULT_TRUNC_OMISSION;
  31924. if (isObject(options)) {
  31925. var separator = 'separator' in options ? options.separator : separator;
  31926. length = 'length' in options ? toInteger(options.length) : length;
  31927. omission = 'omission' in options ? baseToString(options.omission) : omission;
  31928. }
  31929. string = toString(string);
  31930. var strLength = string.length;
  31931. if (hasUnicode(string)) {
  31932. var strSymbols = stringToArray(string);
  31933. strLength = strSymbols.length;
  31934. }
  31935. if (length >= strLength) {
  31936. return string;
  31937. }
  31938. var end = length - stringSize(omission);
  31939. if (end < 1) {
  31940. return omission;
  31941. }
  31942. var result = strSymbols
  31943. ? castSlice(strSymbols, 0, end).join('')
  31944. : string.slice(0, end);
  31945. if (separator === undefined) {
  31946. return result + omission;
  31947. }
  31948. if (strSymbols) {
  31949. end += (result.length - end);
  31950. }
  31951. if (isRegExp(separator)) {
  31952. if (string.slice(end).search(separator)) {
  31953. var match,
  31954. substring = result;
  31955. if (!separator.global) {
  31956. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  31957. }
  31958. separator.lastIndex = 0;
  31959. while ((match = separator.exec(substring))) {
  31960. var newEnd = match.index;
  31961. }
  31962. result = result.slice(0, newEnd === undefined ? end : newEnd);
  31963. }
  31964. } else if (string.indexOf(baseToString(separator), end) != end) {
  31965. var index = result.lastIndexOf(separator);
  31966. if (index > -1) {
  31967. result = result.slice(0, index);
  31968. }
  31969. }
  31970. return result + omission;
  31971. }
  31972. /**
  31973. * The inverse of `_.escape`; this method converts the HTML entities
  31974. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  31975. * their corresponding characters.
  31976. *
  31977. * **Note:** No other HTML entities are unescaped. To unescape additional
  31978. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  31979. *
  31980. * @static
  31981. * @memberOf _
  31982. * @since 0.6.0
  31983. * @category String
  31984. * @param {string} [string=''] The string to unescape.
  31985. * @returns {string} Returns the unescaped string.
  31986. * @example
  31987. *
  31988. * _.unescape('fred, barney, &amp; pebbles');
  31989. * // => 'fred, barney, & pebbles'
  31990. */
  31991. function unescape(string) {
  31992. string = toString(string);
  31993. return (string && reHasEscapedHtml.test(string))
  31994. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  31995. : string;
  31996. }
  31997. /**
  31998. * Converts `string`, as space separated words, to upper case.
  31999. *
  32000. * @static
  32001. * @memberOf _
  32002. * @since 4.0.0
  32003. * @category String
  32004. * @param {string} [string=''] The string to convert.
  32005. * @returns {string} Returns the upper cased string.
  32006. * @example
  32007. *
  32008. * _.upperCase('--foo-bar');
  32009. * // => 'FOO BAR'
  32010. *
  32011. * _.upperCase('fooBar');
  32012. * // => 'FOO BAR'
  32013. *
  32014. * _.upperCase('__foo_bar__');
  32015. * // => 'FOO BAR'
  32016. */
  32017. var upperCase = createCompounder(function(result, word, index) {
  32018. return result + (index ? ' ' : '') + word.toUpperCase();
  32019. });
  32020. /**
  32021. * Converts the first character of `string` to upper case.
  32022. *
  32023. * @static
  32024. * @memberOf _
  32025. * @since 4.0.0
  32026. * @category String
  32027. * @param {string} [string=''] The string to convert.
  32028. * @returns {string} Returns the converted string.
  32029. * @example
  32030. *
  32031. * _.upperFirst('fred');
  32032. * // => 'Fred'
  32033. *
  32034. * _.upperFirst('FRED');
  32035. * // => 'FRED'
  32036. */
  32037. var upperFirst = createCaseFirst('toUpperCase');
  32038. /**
  32039. * Splits `string` into an array of its words.
  32040. *
  32041. * @static
  32042. * @memberOf _
  32043. * @since 3.0.0
  32044. * @category String
  32045. * @param {string} [string=''] The string to inspect.
  32046. * @param {RegExp|string} [pattern] The pattern to match words.
  32047. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32048. * @returns {Array} Returns the words of `string`.
  32049. * @example
  32050. *
  32051. * _.words('fred, barney, & pebbles');
  32052. * // => ['fred', 'barney', 'pebbles']
  32053. *
  32054. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32055. * // => ['fred', 'barney', '&', 'pebbles']
  32056. */
  32057. function words(string, pattern, guard) {
  32058. string = toString(string);
  32059. pattern = guard ? undefined : pattern;
  32060. if (pattern === undefined) {
  32061. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32062. }
  32063. return string.match(pattern) || [];
  32064. }
  32065. /*------------------------------------------------------------------------*/
  32066. /**
  32067. * Attempts to invoke `func`, returning either the result or the caught error
  32068. * object. Any additional arguments are provided to `func` when it's invoked.
  32069. *
  32070. * @static
  32071. * @memberOf _
  32072. * @since 3.0.0
  32073. * @category Util
  32074. * @param {Function} func The function to attempt.
  32075. * @param {...*} [args] The arguments to invoke `func` with.
  32076. * @returns {*} Returns the `func` result or error object.
  32077. * @example
  32078. *
  32079. * // Avoid throwing errors for invalid selectors.
  32080. * var elements = _.attempt(function(selector) {
  32081. * return document.querySelectorAll(selector);
  32082. * }, '>_>');
  32083. *
  32084. * if (_.isError(elements)) {
  32085. * elements = [];
  32086. * }
  32087. */
  32088. var attempt = baseRest(function(func, args) {
  32089. try {
  32090. return apply(func, undefined, args);
  32091. } catch (e) {
  32092. return isError(e) ? e : new Error(e);
  32093. }
  32094. });
  32095. /**
  32096. * Binds methods of an object to the object itself, overwriting the existing
  32097. * method.
  32098. *
  32099. * **Note:** This method doesn't set the "length" property of bound functions.
  32100. *
  32101. * @static
  32102. * @since 0.1.0
  32103. * @memberOf _
  32104. * @category Util
  32105. * @param {Object} object The object to bind and assign the bound methods to.
  32106. * @param {...(string|string[])} methodNames The object method names to bind.
  32107. * @returns {Object} Returns `object`.
  32108. * @example
  32109. *
  32110. * var view = {
  32111. * 'label': 'docs',
  32112. * 'click': function() {
  32113. * console.log('clicked ' + this.label);
  32114. * }
  32115. * };
  32116. *
  32117. * _.bindAll(view, ['click']);
  32118. * jQuery(element).on('click', view.click);
  32119. * // => Logs 'clicked docs' when clicked.
  32120. */
  32121. var bindAll = flatRest(function(object, methodNames) {
  32122. arrayEach(methodNames, function(key) {
  32123. key = toKey(key);
  32124. baseAssignValue(object, key, bind(object[key], object));
  32125. });
  32126. return object;
  32127. });
  32128. /**
  32129. * Creates a function that iterates over `pairs` and invokes the corresponding
  32130. * function of the first predicate to return truthy. The predicate-function
  32131. * pairs are invoked with the `this` binding and arguments of the created
  32132. * function.
  32133. *
  32134. * @static
  32135. * @memberOf _
  32136. * @since 4.0.0
  32137. * @category Util
  32138. * @param {Array} pairs The predicate-function pairs.
  32139. * @returns {Function} Returns the new composite function.
  32140. * @example
  32141. *
  32142. * var func = _.cond([
  32143. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32144. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32145. * [_.stubTrue, _.constant('no match')]
  32146. * ]);
  32147. *
  32148. * func({ 'a': 1, 'b': 2 });
  32149. * // => 'matches A'
  32150. *
  32151. * func({ 'a': 0, 'b': 1 });
  32152. * // => 'matches B'
  32153. *
  32154. * func({ 'a': '1', 'b': '2' });
  32155. * // => 'no match'
  32156. */
  32157. function cond(pairs) {
  32158. var length = pairs == null ? 0 : pairs.length,
  32159. toIteratee = getIteratee();
  32160. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32161. if (typeof pair[1] != 'function') {
  32162. throw new TypeError(FUNC_ERROR_TEXT);
  32163. }
  32164. return [toIteratee(pair[0]), pair[1]];
  32165. });
  32166. return baseRest(function(args) {
  32167. var index = -1;
  32168. while (++index < length) {
  32169. var pair = pairs[index];
  32170. if (apply(pair[0], this, args)) {
  32171. return apply(pair[1], this, args);
  32172. }
  32173. }
  32174. });
  32175. }
  32176. /**
  32177. * Creates a function that invokes the predicate properties of `source` with
  32178. * the corresponding property values of a given object, returning `true` if
  32179. * all predicates return truthy, else `false`.
  32180. *
  32181. * **Note:** The created function is equivalent to `_.conformsTo` with
  32182. * `source` partially applied.
  32183. *
  32184. * @static
  32185. * @memberOf _
  32186. * @since 4.0.0
  32187. * @category Util
  32188. * @param {Object} source The object of property predicates to conform to.
  32189. * @returns {Function} Returns the new spec function.
  32190. * @example
  32191. *
  32192. * var objects = [
  32193. * { 'a': 2, 'b': 1 },
  32194. * { 'a': 1, 'b': 2 }
  32195. * ];
  32196. *
  32197. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32198. * // => [{ 'a': 1, 'b': 2 }]
  32199. */
  32200. function conforms(source) {
  32201. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32202. }
  32203. /**
  32204. * Creates a function that returns `value`.
  32205. *
  32206. * @static
  32207. * @memberOf _
  32208. * @since 2.4.0
  32209. * @category Util
  32210. * @param {*} value The value to return from the new function.
  32211. * @returns {Function} Returns the new constant function.
  32212. * @example
  32213. *
  32214. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32215. *
  32216. * console.log(objects);
  32217. * // => [{ 'a': 1 }, { 'a': 1 }]
  32218. *
  32219. * console.log(objects[0] === objects[1]);
  32220. * // => true
  32221. */
  32222. function constant(value) {
  32223. return function() {
  32224. return value;
  32225. };
  32226. }
  32227. /**
  32228. * Checks `value` to determine whether a default value should be returned in
  32229. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32230. * or `undefined`.
  32231. *
  32232. * @static
  32233. * @memberOf _
  32234. * @since 4.14.0
  32235. * @category Util
  32236. * @param {*} value The value to check.
  32237. * @param {*} defaultValue The default value.
  32238. * @returns {*} Returns the resolved value.
  32239. * @example
  32240. *
  32241. * _.defaultTo(1, 10);
  32242. * // => 1
  32243. *
  32244. * _.defaultTo(undefined, 10);
  32245. * // => 10
  32246. */
  32247. function defaultTo(value, defaultValue) {
  32248. return (value == null || value !== value) ? defaultValue : value;
  32249. }
  32250. /**
  32251. * Creates a function that returns the result of invoking the given functions
  32252. * with the `this` binding of the created function, where each successive
  32253. * invocation is supplied the return value of the previous.
  32254. *
  32255. * @static
  32256. * @memberOf _
  32257. * @since 3.0.0
  32258. * @category Util
  32259. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32260. * @returns {Function} Returns the new composite function.
  32261. * @see _.flowRight
  32262. * @example
  32263. *
  32264. * function square(n) {
  32265. * return n * n;
  32266. * }
  32267. *
  32268. * var addSquare = _.flow([_.add, square]);
  32269. * addSquare(1, 2);
  32270. * // => 9
  32271. */
  32272. var flow = createFlow();
  32273. /**
  32274. * This method is like `_.flow` except that it creates a function that
  32275. * invokes the given functions from right to left.
  32276. *
  32277. * @static
  32278. * @since 3.0.0
  32279. * @memberOf _
  32280. * @category Util
  32281. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32282. * @returns {Function} Returns the new composite function.
  32283. * @see _.flow
  32284. * @example
  32285. *
  32286. * function square(n) {
  32287. * return n * n;
  32288. * }
  32289. *
  32290. * var addSquare = _.flowRight([square, _.add]);
  32291. * addSquare(1, 2);
  32292. * // => 9
  32293. */
  32294. var flowRight = createFlow(true);
  32295. /**
  32296. * This method returns the first argument it receives.
  32297. *
  32298. * @static
  32299. * @since 0.1.0
  32300. * @memberOf _
  32301. * @category Util
  32302. * @param {*} value Any value.
  32303. * @returns {*} Returns `value`.
  32304. * @example
  32305. *
  32306. * var object = { 'a': 1 };
  32307. *
  32308. * console.log(_.identity(object) === object);
  32309. * // => true
  32310. */
  32311. function identity(value) {
  32312. return value;
  32313. }
  32314. /**
  32315. * Creates a function that invokes `func` with the arguments of the created
  32316. * function. If `func` is a property name, the created function returns the
  32317. * property value for a given element. If `func` is an array or object, the
  32318. * created function returns `true` for elements that contain the equivalent
  32319. * source properties, otherwise it returns `false`.
  32320. *
  32321. * @static
  32322. * @since 4.0.0
  32323. * @memberOf _
  32324. * @category Util
  32325. * @param {*} [func=_.identity] The value to convert to a callback.
  32326. * @returns {Function} Returns the callback.
  32327. * @example
  32328. *
  32329. * var users = [
  32330. * { 'user': 'barney', 'age': 36, 'active': true },
  32331. * { 'user': 'fred', 'age': 40, 'active': false }
  32332. * ];
  32333. *
  32334. * // The `_.matches` iteratee shorthand.
  32335. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32336. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32337. *
  32338. * // The `_.matchesProperty` iteratee shorthand.
  32339. * _.filter(users, _.iteratee(['user', 'fred']));
  32340. * // => [{ 'user': 'fred', 'age': 40 }]
  32341. *
  32342. * // The `_.property` iteratee shorthand.
  32343. * _.map(users, _.iteratee('user'));
  32344. * // => ['barney', 'fred']
  32345. *
  32346. * // Create custom iteratee shorthands.
  32347. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32348. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32349. * return func.test(string);
  32350. * };
  32351. * });
  32352. *
  32353. * _.filter(['abc', 'def'], /ef/);
  32354. * // => ['def']
  32355. */
  32356. function iteratee(func) {
  32357. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32358. }
  32359. /**
  32360. * Creates a function that performs a partial deep comparison between a given
  32361. * object and `source`, returning `true` if the given object has equivalent
  32362. * property values, else `false`.
  32363. *
  32364. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32365. * partially applied.
  32366. *
  32367. * Partial comparisons will match empty array and empty object `source`
  32368. * values against any array or object value, respectively. See `_.isEqual`
  32369. * for a list of supported value comparisons.
  32370. *
  32371. * @static
  32372. * @memberOf _
  32373. * @since 3.0.0
  32374. * @category Util
  32375. * @param {Object} source The object of property values to match.
  32376. * @returns {Function} Returns the new spec function.
  32377. * @example
  32378. *
  32379. * var objects = [
  32380. * { 'a': 1, 'b': 2, 'c': 3 },
  32381. * { 'a': 4, 'b': 5, 'c': 6 }
  32382. * ];
  32383. *
  32384. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32385. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32386. */
  32387. function matches(source) {
  32388. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32389. }
  32390. /**
  32391. * Creates a function that performs a partial deep comparison between the
  32392. * value at `path` of a given object to `srcValue`, returning `true` if the
  32393. * object value is equivalent, else `false`.
  32394. *
  32395. * **Note:** Partial comparisons will match empty array and empty object
  32396. * `srcValue` values against any array or object value, respectively. See
  32397. * `_.isEqual` for a list of supported value comparisons.
  32398. *
  32399. * @static
  32400. * @memberOf _
  32401. * @since 3.2.0
  32402. * @category Util
  32403. * @param {Array|string} path The path of the property to get.
  32404. * @param {*} srcValue The value to match.
  32405. * @returns {Function} Returns the new spec function.
  32406. * @example
  32407. *
  32408. * var objects = [
  32409. * { 'a': 1, 'b': 2, 'c': 3 },
  32410. * { 'a': 4, 'b': 5, 'c': 6 }
  32411. * ];
  32412. *
  32413. * _.find(objects, _.matchesProperty('a', 4));
  32414. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32415. */
  32416. function matchesProperty(path, srcValue) {
  32417. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32418. }
  32419. /**
  32420. * Creates a function that invokes the method at `path` of a given object.
  32421. * Any additional arguments are provided to the invoked method.
  32422. *
  32423. * @static
  32424. * @memberOf _
  32425. * @since 3.7.0
  32426. * @category Util
  32427. * @param {Array|string} path The path of the method to invoke.
  32428. * @param {...*} [args] The arguments to invoke the method with.
  32429. * @returns {Function} Returns the new invoker function.
  32430. * @example
  32431. *
  32432. * var objects = [
  32433. * { 'a': { 'b': _.constant(2) } },
  32434. * { 'a': { 'b': _.constant(1) } }
  32435. * ];
  32436. *
  32437. * _.map(objects, _.method('a.b'));
  32438. * // => [2, 1]
  32439. *
  32440. * _.map(objects, _.method(['a', 'b']));
  32441. * // => [2, 1]
  32442. */
  32443. var method = baseRest(function(path, args) {
  32444. return function(object) {
  32445. return baseInvoke(object, path, args);
  32446. };
  32447. });
  32448. /**
  32449. * The opposite of `_.method`; this method creates a function that invokes
  32450. * the method at a given path of `object`. Any additional arguments are
  32451. * provided to the invoked method.
  32452. *
  32453. * @static
  32454. * @memberOf _
  32455. * @since 3.7.0
  32456. * @category Util
  32457. * @param {Object} object The object to query.
  32458. * @param {...*} [args] The arguments to invoke the method with.
  32459. * @returns {Function} Returns the new invoker function.
  32460. * @example
  32461. *
  32462. * var array = _.times(3, _.constant),
  32463. * object = { 'a': array, 'b': array, 'c': array };
  32464. *
  32465. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32466. * // => [2, 0]
  32467. *
  32468. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32469. * // => [2, 0]
  32470. */
  32471. var methodOf = baseRest(function(object, args) {
  32472. return function(path) {
  32473. return baseInvoke(object, path, args);
  32474. };
  32475. });
  32476. /**
  32477. * Adds all own enumerable string keyed function properties of a source
  32478. * object to the destination object. If `object` is a function, then methods
  32479. * are added to its prototype as well.
  32480. *
  32481. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32482. * avoid conflicts caused by modifying the original.
  32483. *
  32484. * @static
  32485. * @since 0.1.0
  32486. * @memberOf _
  32487. * @category Util
  32488. * @param {Function|Object} [object=lodash] The destination object.
  32489. * @param {Object} source The object of functions to add.
  32490. * @param {Object} [options={}] The options object.
  32491. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32492. * @returns {Function|Object} Returns `object`.
  32493. * @example
  32494. *
  32495. * function vowels(string) {
  32496. * return _.filter(string, function(v) {
  32497. * return /[aeiou]/i.test(v);
  32498. * });
  32499. * }
  32500. *
  32501. * _.mixin({ 'vowels': vowels });
  32502. * _.vowels('fred');
  32503. * // => ['e']
  32504. *
  32505. * _('fred').vowels().value();
  32506. * // => ['e']
  32507. *
  32508. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32509. * _('fred').vowels();
  32510. * // => ['e']
  32511. */
  32512. function mixin(object, source, options) {
  32513. var props = keys(source),
  32514. methodNames = baseFunctions(source, props);
  32515. if (options == null &&
  32516. !(isObject(source) && (methodNames.length || !props.length))) {
  32517. options = source;
  32518. source = object;
  32519. object = this;
  32520. methodNames = baseFunctions(source, keys(source));
  32521. }
  32522. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32523. isFunc = isFunction(object);
  32524. arrayEach(methodNames, function(methodName) {
  32525. var func = source[methodName];
  32526. object[methodName] = func;
  32527. if (isFunc) {
  32528. object.prototype[methodName] = function() {
  32529. var chainAll = this.__chain__;
  32530. if (chain || chainAll) {
  32531. var result = object(this.__wrapped__),
  32532. actions = result.__actions__ = copyArray(this.__actions__);
  32533. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32534. result.__chain__ = chainAll;
  32535. return result;
  32536. }
  32537. return func.apply(object, arrayPush([this.value()], arguments));
  32538. };
  32539. }
  32540. });
  32541. return object;
  32542. }
  32543. /**
  32544. * Reverts the `_` variable to its previous value and returns a reference to
  32545. * the `lodash` function.
  32546. *
  32547. * @static
  32548. * @since 0.1.0
  32549. * @memberOf _
  32550. * @category Util
  32551. * @returns {Function} Returns the `lodash` function.
  32552. * @example
  32553. *
  32554. * var lodash = _.noConflict();
  32555. */
  32556. function noConflict() {
  32557. if (root._ === this) {
  32558. root._ = oldDash;
  32559. }
  32560. return this;
  32561. }
  32562. /**
  32563. * This method returns `undefined`.
  32564. *
  32565. * @static
  32566. * @memberOf _
  32567. * @since 2.3.0
  32568. * @category Util
  32569. * @example
  32570. *
  32571. * _.times(2, _.noop);
  32572. * // => [undefined, undefined]
  32573. */
  32574. function noop() {
  32575. // No operation performed.
  32576. }
  32577. /**
  32578. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32579. * the nth argument from the end is returned.
  32580. *
  32581. * @static
  32582. * @memberOf _
  32583. * @since 4.0.0
  32584. * @category Util
  32585. * @param {number} [n=0] The index of the argument to return.
  32586. * @returns {Function} Returns the new pass-thru function.
  32587. * @example
  32588. *
  32589. * var func = _.nthArg(1);
  32590. * func('a', 'b', 'c', 'd');
  32591. * // => 'b'
  32592. *
  32593. * var func = _.nthArg(-2);
  32594. * func('a', 'b', 'c', 'd');
  32595. * // => 'c'
  32596. */
  32597. function nthArg(n) {
  32598. n = toInteger(n);
  32599. return baseRest(function(args) {
  32600. return baseNth(args, n);
  32601. });
  32602. }
  32603. /**
  32604. * Creates a function that invokes `iteratees` with the arguments it receives
  32605. * and returns their results.
  32606. *
  32607. * @static
  32608. * @memberOf _
  32609. * @since 4.0.0
  32610. * @category Util
  32611. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32612. * The iteratees to invoke.
  32613. * @returns {Function} Returns the new function.
  32614. * @example
  32615. *
  32616. * var func = _.over([Math.max, Math.min]);
  32617. *
  32618. * func(1, 2, 3, 4);
  32619. * // => [4, 1]
  32620. */
  32621. var over = createOver(arrayMap);
  32622. /**
  32623. * Creates a function that checks if **all** of the `predicates` return
  32624. * truthy when invoked with the arguments it receives.
  32625. *
  32626. * @static
  32627. * @memberOf _
  32628. * @since 4.0.0
  32629. * @category Util
  32630. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32631. * The predicates to check.
  32632. * @returns {Function} Returns the new function.
  32633. * @example
  32634. *
  32635. * var func = _.overEvery([Boolean, isFinite]);
  32636. *
  32637. * func('1');
  32638. * // => true
  32639. *
  32640. * func(null);
  32641. * // => false
  32642. *
  32643. * func(NaN);
  32644. * // => false
  32645. */
  32646. var overEvery = createOver(arrayEvery);
  32647. /**
  32648. * Creates a function that checks if **any** of the `predicates` return
  32649. * truthy when invoked with the arguments it receives.
  32650. *
  32651. * @static
  32652. * @memberOf _
  32653. * @since 4.0.0
  32654. * @category Util
  32655. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32656. * The predicates to check.
  32657. * @returns {Function} Returns the new function.
  32658. * @example
  32659. *
  32660. * var func = _.overSome([Boolean, isFinite]);
  32661. *
  32662. * func('1');
  32663. * // => true
  32664. *
  32665. * func(null);
  32666. * // => true
  32667. *
  32668. * func(NaN);
  32669. * // => false
  32670. */
  32671. var overSome = createOver(arraySome);
  32672. /**
  32673. * Creates a function that returns the value at `path` of a given object.
  32674. *
  32675. * @static
  32676. * @memberOf _
  32677. * @since 2.4.0
  32678. * @category Util
  32679. * @param {Array|string} path The path of the property to get.
  32680. * @returns {Function} Returns the new accessor function.
  32681. * @example
  32682. *
  32683. * var objects = [
  32684. * { 'a': { 'b': 2 } },
  32685. * { 'a': { 'b': 1 } }
  32686. * ];
  32687. *
  32688. * _.map(objects, _.property('a.b'));
  32689. * // => [2, 1]
  32690. *
  32691. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32692. * // => [1, 2]
  32693. */
  32694. function property(path) {
  32695. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32696. }
  32697. /**
  32698. * The opposite of `_.property`; this method creates a function that returns
  32699. * the value at a given path of `object`.
  32700. *
  32701. * @static
  32702. * @memberOf _
  32703. * @since 3.0.0
  32704. * @category Util
  32705. * @param {Object} object The object to query.
  32706. * @returns {Function} Returns the new accessor function.
  32707. * @example
  32708. *
  32709. * var array = [0, 1, 2],
  32710. * object = { 'a': array, 'b': array, 'c': array };
  32711. *
  32712. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32713. * // => [2, 0]
  32714. *
  32715. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32716. * // => [2, 0]
  32717. */
  32718. function propertyOf(object) {
  32719. return function(path) {
  32720. return object == null ? undefined : baseGet(object, path);
  32721. };
  32722. }
  32723. /**
  32724. * Creates an array of numbers (positive and/or negative) progressing from
  32725. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32726. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32727. * it's set to `start` with `start` then set to `0`.
  32728. *
  32729. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32730. * floating-point values which can produce unexpected results.
  32731. *
  32732. * @static
  32733. * @since 0.1.0
  32734. * @memberOf _
  32735. * @category Util
  32736. * @param {number} [start=0] The start of the range.
  32737. * @param {number} end The end of the range.
  32738. * @param {number} [step=1] The value to increment or decrement by.
  32739. * @returns {Array} Returns the range of numbers.
  32740. * @see _.inRange, _.rangeRight
  32741. * @example
  32742. *
  32743. * _.range(4);
  32744. * // => [0, 1, 2, 3]
  32745. *
  32746. * _.range(-4);
  32747. * // => [0, -1, -2, -3]
  32748. *
  32749. * _.range(1, 5);
  32750. * // => [1, 2, 3, 4]
  32751. *
  32752. * _.range(0, 20, 5);
  32753. * // => [0, 5, 10, 15]
  32754. *
  32755. * _.range(0, -4, -1);
  32756. * // => [0, -1, -2, -3]
  32757. *
  32758. * _.range(1, 4, 0);
  32759. * // => [1, 1, 1]
  32760. *
  32761. * _.range(0);
  32762. * // => []
  32763. */
  32764. var range = createRange();
  32765. /**
  32766. * This method is like `_.range` except that it populates values in
  32767. * descending order.
  32768. *
  32769. * @static
  32770. * @memberOf _
  32771. * @since 4.0.0
  32772. * @category Util
  32773. * @param {number} [start=0] The start of the range.
  32774. * @param {number} end The end of the range.
  32775. * @param {number} [step=1] The value to increment or decrement by.
  32776. * @returns {Array} Returns the range of numbers.
  32777. * @see _.inRange, _.range
  32778. * @example
  32779. *
  32780. * _.rangeRight(4);
  32781. * // => [3, 2, 1, 0]
  32782. *
  32783. * _.rangeRight(-4);
  32784. * // => [-3, -2, -1, 0]
  32785. *
  32786. * _.rangeRight(1, 5);
  32787. * // => [4, 3, 2, 1]
  32788. *
  32789. * _.rangeRight(0, 20, 5);
  32790. * // => [15, 10, 5, 0]
  32791. *
  32792. * _.rangeRight(0, -4, -1);
  32793. * // => [-3, -2, -1, 0]
  32794. *
  32795. * _.rangeRight(1, 4, 0);
  32796. * // => [1, 1, 1]
  32797. *
  32798. * _.rangeRight(0);
  32799. * // => []
  32800. */
  32801. var rangeRight = createRange(true);
  32802. /**
  32803. * This method returns a new empty array.
  32804. *
  32805. * @static
  32806. * @memberOf _
  32807. * @since 4.13.0
  32808. * @category Util
  32809. * @returns {Array} Returns the new empty array.
  32810. * @example
  32811. *
  32812. * var arrays = _.times(2, _.stubArray);
  32813. *
  32814. * console.log(arrays);
  32815. * // => [[], []]
  32816. *
  32817. * console.log(arrays[0] === arrays[1]);
  32818. * // => false
  32819. */
  32820. function stubArray() {
  32821. return [];
  32822. }
  32823. /**
  32824. * This method returns `false`.
  32825. *
  32826. * @static
  32827. * @memberOf _
  32828. * @since 4.13.0
  32829. * @category Util
  32830. * @returns {boolean} Returns `false`.
  32831. * @example
  32832. *
  32833. * _.times(2, _.stubFalse);
  32834. * // => [false, false]
  32835. */
  32836. function stubFalse() {
  32837. return false;
  32838. }
  32839. /**
  32840. * This method returns a new empty object.
  32841. *
  32842. * @static
  32843. * @memberOf _
  32844. * @since 4.13.0
  32845. * @category Util
  32846. * @returns {Object} Returns the new empty object.
  32847. * @example
  32848. *
  32849. * var objects = _.times(2, _.stubObject);
  32850. *
  32851. * console.log(objects);
  32852. * // => [{}, {}]
  32853. *
  32854. * console.log(objects[0] === objects[1]);
  32855. * // => false
  32856. */
  32857. function stubObject() {
  32858. return {};
  32859. }
  32860. /**
  32861. * This method returns an empty string.
  32862. *
  32863. * @static
  32864. * @memberOf _
  32865. * @since 4.13.0
  32866. * @category Util
  32867. * @returns {string} Returns the empty string.
  32868. * @example
  32869. *
  32870. * _.times(2, _.stubString);
  32871. * // => ['', '']
  32872. */
  32873. function stubString() {
  32874. return '';
  32875. }
  32876. /**
  32877. * This method returns `true`.
  32878. *
  32879. * @static
  32880. * @memberOf _
  32881. * @since 4.13.0
  32882. * @category Util
  32883. * @returns {boolean} Returns `true`.
  32884. * @example
  32885. *
  32886. * _.times(2, _.stubTrue);
  32887. * // => [true, true]
  32888. */
  32889. function stubTrue() {
  32890. return true;
  32891. }
  32892. /**
  32893. * Invokes the iteratee `n` times, returning an array of the results of
  32894. * each invocation. The iteratee is invoked with one argument; (index).
  32895. *
  32896. * @static
  32897. * @since 0.1.0
  32898. * @memberOf _
  32899. * @category Util
  32900. * @param {number} n The number of times to invoke `iteratee`.
  32901. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32902. * @returns {Array} Returns the array of results.
  32903. * @example
  32904. *
  32905. * _.times(3, String);
  32906. * // => ['0', '1', '2']
  32907. *
  32908. * _.times(4, _.constant(0));
  32909. * // => [0, 0, 0, 0]
  32910. */
  32911. function times(n, iteratee) {
  32912. n = toInteger(n);
  32913. if (n < 1 || n > MAX_SAFE_INTEGER) {
  32914. return [];
  32915. }
  32916. var index = MAX_ARRAY_LENGTH,
  32917. length = nativeMin(n, MAX_ARRAY_LENGTH);
  32918. iteratee = getIteratee(iteratee);
  32919. n -= MAX_ARRAY_LENGTH;
  32920. var result = baseTimes(length, iteratee);
  32921. while (++index < n) {
  32922. iteratee(index);
  32923. }
  32924. return result;
  32925. }
  32926. /**
  32927. * Converts `value` to a property path array.
  32928. *
  32929. * @static
  32930. * @memberOf _
  32931. * @since 4.0.0
  32932. * @category Util
  32933. * @param {*} value The value to convert.
  32934. * @returns {Array} Returns the new property path array.
  32935. * @example
  32936. *
  32937. * _.toPath('a.b.c');
  32938. * // => ['a', 'b', 'c']
  32939. *
  32940. * _.toPath('a[0].b.c');
  32941. * // => ['a', '0', 'b', 'c']
  32942. */
  32943. function toPath(value) {
  32944. if (isArray(value)) {
  32945. return arrayMap(value, toKey);
  32946. }
  32947. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  32948. }
  32949. /**
  32950. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  32951. *
  32952. * @static
  32953. * @since 0.1.0
  32954. * @memberOf _
  32955. * @category Util
  32956. * @param {string} [prefix=''] The value to prefix the ID with.
  32957. * @returns {string} Returns the unique ID.
  32958. * @example
  32959. *
  32960. * _.uniqueId('contact_');
  32961. * // => 'contact_104'
  32962. *
  32963. * _.uniqueId();
  32964. * // => '105'
  32965. */
  32966. function uniqueId(prefix) {
  32967. var id = ++idCounter;
  32968. return toString(prefix) + id;
  32969. }
  32970. /*------------------------------------------------------------------------*/
  32971. /**
  32972. * Adds two numbers.
  32973. *
  32974. * @static
  32975. * @memberOf _
  32976. * @since 3.4.0
  32977. * @category Math
  32978. * @param {number} augend The first number in an addition.
  32979. * @param {number} addend The second number in an addition.
  32980. * @returns {number} Returns the total.
  32981. * @example
  32982. *
  32983. * _.add(6, 4);
  32984. * // => 10
  32985. */
  32986. var add = createMathOperation(function(augend, addend) {
  32987. return augend + addend;
  32988. }, 0);
  32989. /**
  32990. * Computes `number` rounded up to `precision`.
  32991. *
  32992. * @static
  32993. * @memberOf _
  32994. * @since 3.10.0
  32995. * @category Math
  32996. * @param {number} number The number to round up.
  32997. * @param {number} [precision=0] The precision to round up to.
  32998. * @returns {number} Returns the rounded up number.
  32999. * @example
  33000. *
  33001. * _.ceil(4.006);
  33002. * // => 5
  33003. *
  33004. * _.ceil(6.004, 2);
  33005. * // => 6.01
  33006. *
  33007. * _.ceil(6040, -2);
  33008. * // => 6100
  33009. */
  33010. var ceil = createRound('ceil');
  33011. /**
  33012. * Divide two numbers.
  33013. *
  33014. * @static
  33015. * @memberOf _
  33016. * @since 4.7.0
  33017. * @category Math
  33018. * @param {number} dividend The first number in a division.
  33019. * @param {number} divisor The second number in a division.
  33020. * @returns {number} Returns the quotient.
  33021. * @example
  33022. *
  33023. * _.divide(6, 4);
  33024. * // => 1.5
  33025. */
  33026. var divide = createMathOperation(function(dividend, divisor) {
  33027. return dividend / divisor;
  33028. }, 1);
  33029. /**
  33030. * Computes `number` rounded down to `precision`.
  33031. *
  33032. * @static
  33033. * @memberOf _
  33034. * @since 3.10.0
  33035. * @category Math
  33036. * @param {number} number The number to round down.
  33037. * @param {number} [precision=0] The precision to round down to.
  33038. * @returns {number} Returns the rounded down number.
  33039. * @example
  33040. *
  33041. * _.floor(4.006);
  33042. * // => 4
  33043. *
  33044. * _.floor(0.046, 2);
  33045. * // => 0.04
  33046. *
  33047. * _.floor(4060, -2);
  33048. * // => 4000
  33049. */
  33050. var floor = createRound('floor');
  33051. /**
  33052. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33053. * `undefined` is returned.
  33054. *
  33055. * @static
  33056. * @since 0.1.0
  33057. * @memberOf _
  33058. * @category Math
  33059. * @param {Array} array The array to iterate over.
  33060. * @returns {*} Returns the maximum value.
  33061. * @example
  33062. *
  33063. * _.max([4, 2, 8, 6]);
  33064. * // => 8
  33065. *
  33066. * _.max([]);
  33067. * // => undefined
  33068. */
  33069. function max(array) {
  33070. return (array && array.length)
  33071. ? baseExtremum(array, identity, baseGt)
  33072. : undefined;
  33073. }
  33074. /**
  33075. * This method is like `_.max` except that it accepts `iteratee` which is
  33076. * invoked for each element in `array` to generate the criterion by which
  33077. * the value is ranked. The iteratee is invoked with one argument: (value).
  33078. *
  33079. * @static
  33080. * @memberOf _
  33081. * @since 4.0.0
  33082. * @category Math
  33083. * @param {Array} array The array to iterate over.
  33084. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33085. * @returns {*} Returns the maximum value.
  33086. * @example
  33087. *
  33088. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33089. *
  33090. * _.maxBy(objects, function(o) { return o.n; });
  33091. * // => { 'n': 2 }
  33092. *
  33093. * // The `_.property` iteratee shorthand.
  33094. * _.maxBy(objects, 'n');
  33095. * // => { 'n': 2 }
  33096. */
  33097. function maxBy(array, iteratee) {
  33098. return (array && array.length)
  33099. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33100. : undefined;
  33101. }
  33102. /**
  33103. * Computes the mean of the values in `array`.
  33104. *
  33105. * @static
  33106. * @memberOf _
  33107. * @since 4.0.0
  33108. * @category Math
  33109. * @param {Array} array The array to iterate over.
  33110. * @returns {number} Returns the mean.
  33111. * @example
  33112. *
  33113. * _.mean([4, 2, 8, 6]);
  33114. * // => 5
  33115. */
  33116. function mean(array) {
  33117. return baseMean(array, identity);
  33118. }
  33119. /**
  33120. * This method is like `_.mean` except that it accepts `iteratee` which is
  33121. * invoked for each element in `array` to generate the value to be averaged.
  33122. * The iteratee is invoked with one argument: (value).
  33123. *
  33124. * @static
  33125. * @memberOf _
  33126. * @since 4.7.0
  33127. * @category Math
  33128. * @param {Array} array The array to iterate over.
  33129. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33130. * @returns {number} Returns the mean.
  33131. * @example
  33132. *
  33133. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33134. *
  33135. * _.meanBy(objects, function(o) { return o.n; });
  33136. * // => 5
  33137. *
  33138. * // The `_.property` iteratee shorthand.
  33139. * _.meanBy(objects, 'n');
  33140. * // => 5
  33141. */
  33142. function meanBy(array, iteratee) {
  33143. return baseMean(array, getIteratee(iteratee, 2));
  33144. }
  33145. /**
  33146. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33147. * `undefined` is returned.
  33148. *
  33149. * @static
  33150. * @since 0.1.0
  33151. * @memberOf _
  33152. * @category Math
  33153. * @param {Array} array The array to iterate over.
  33154. * @returns {*} Returns the minimum value.
  33155. * @example
  33156. *
  33157. * _.min([4, 2, 8, 6]);
  33158. * // => 2
  33159. *
  33160. * _.min([]);
  33161. * // => undefined
  33162. */
  33163. function min(array) {
  33164. return (array && array.length)
  33165. ? baseExtremum(array, identity, baseLt)
  33166. : undefined;
  33167. }
  33168. /**
  33169. * This method is like `_.min` except that it accepts `iteratee` which is
  33170. * invoked for each element in `array` to generate the criterion by which
  33171. * the value is ranked. The iteratee is invoked with one argument: (value).
  33172. *
  33173. * @static
  33174. * @memberOf _
  33175. * @since 4.0.0
  33176. * @category Math
  33177. * @param {Array} array The array to iterate over.
  33178. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33179. * @returns {*} Returns the minimum value.
  33180. * @example
  33181. *
  33182. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33183. *
  33184. * _.minBy(objects, function(o) { return o.n; });
  33185. * // => { 'n': 1 }
  33186. *
  33187. * // The `_.property` iteratee shorthand.
  33188. * _.minBy(objects, 'n');
  33189. * // => { 'n': 1 }
  33190. */
  33191. function minBy(array, iteratee) {
  33192. return (array && array.length)
  33193. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33194. : undefined;
  33195. }
  33196. /**
  33197. * Multiply two numbers.
  33198. *
  33199. * @static
  33200. * @memberOf _
  33201. * @since 4.7.0
  33202. * @category Math
  33203. * @param {number} multiplier The first number in a multiplication.
  33204. * @param {number} multiplicand The second number in a multiplication.
  33205. * @returns {number} Returns the product.
  33206. * @example
  33207. *
  33208. * _.multiply(6, 4);
  33209. * // => 24
  33210. */
  33211. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33212. return multiplier * multiplicand;
  33213. }, 1);
  33214. /**
  33215. * Computes `number` rounded to `precision`.
  33216. *
  33217. * @static
  33218. * @memberOf _
  33219. * @since 3.10.0
  33220. * @category Math
  33221. * @param {number} number The number to round.
  33222. * @param {number} [precision=0] The precision to round to.
  33223. * @returns {number} Returns the rounded number.
  33224. * @example
  33225. *
  33226. * _.round(4.006);
  33227. * // => 4
  33228. *
  33229. * _.round(4.006, 2);
  33230. * // => 4.01
  33231. *
  33232. * _.round(4060, -2);
  33233. * // => 4100
  33234. */
  33235. var round = createRound('round');
  33236. /**
  33237. * Subtract two numbers.
  33238. *
  33239. * @static
  33240. * @memberOf _
  33241. * @since 4.0.0
  33242. * @category Math
  33243. * @param {number} minuend The first number in a subtraction.
  33244. * @param {number} subtrahend The second number in a subtraction.
  33245. * @returns {number} Returns the difference.
  33246. * @example
  33247. *
  33248. * _.subtract(6, 4);
  33249. * // => 2
  33250. */
  33251. var subtract = createMathOperation(function(minuend, subtrahend) {
  33252. return minuend - subtrahend;
  33253. }, 0);
  33254. /**
  33255. * Computes the sum of the values in `array`.
  33256. *
  33257. * @static
  33258. * @memberOf _
  33259. * @since 3.4.0
  33260. * @category Math
  33261. * @param {Array} array The array to iterate over.
  33262. * @returns {number} Returns the sum.
  33263. * @example
  33264. *
  33265. * _.sum([4, 2, 8, 6]);
  33266. * // => 20
  33267. */
  33268. function sum(array) {
  33269. return (array && array.length)
  33270. ? baseSum(array, identity)
  33271. : 0;
  33272. }
  33273. /**
  33274. * This method is like `_.sum` except that it accepts `iteratee` which is
  33275. * invoked for each element in `array` to generate the value to be summed.
  33276. * The iteratee is invoked with one argument: (value).
  33277. *
  33278. * @static
  33279. * @memberOf _
  33280. * @since 4.0.0
  33281. * @category Math
  33282. * @param {Array} array The array to iterate over.
  33283. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33284. * @returns {number} Returns the sum.
  33285. * @example
  33286. *
  33287. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33288. *
  33289. * _.sumBy(objects, function(o) { return o.n; });
  33290. * // => 20
  33291. *
  33292. * // The `_.property` iteratee shorthand.
  33293. * _.sumBy(objects, 'n');
  33294. * // => 20
  33295. */
  33296. function sumBy(array, iteratee) {
  33297. return (array && array.length)
  33298. ? baseSum(array, getIteratee(iteratee, 2))
  33299. : 0;
  33300. }
  33301. /*------------------------------------------------------------------------*/
  33302. // Add methods that return wrapped values in chain sequences.
  33303. lodash.after = after;
  33304. lodash.ary = ary;
  33305. lodash.assign = assign;
  33306. lodash.assignIn = assignIn;
  33307. lodash.assignInWith = assignInWith;
  33308. lodash.assignWith = assignWith;
  33309. lodash.at = at;
  33310. lodash.before = before;
  33311. lodash.bind = bind;
  33312. lodash.bindAll = bindAll;
  33313. lodash.bindKey = bindKey;
  33314. lodash.castArray = castArray;
  33315. lodash.chain = chain;
  33316. lodash.chunk = chunk;
  33317. lodash.compact = compact;
  33318. lodash.concat = concat;
  33319. lodash.cond = cond;
  33320. lodash.conforms = conforms;
  33321. lodash.constant = constant;
  33322. lodash.countBy = countBy;
  33323. lodash.create = create;
  33324. lodash.curry = curry;
  33325. lodash.curryRight = curryRight;
  33326. lodash.debounce = debounce;
  33327. lodash.defaults = defaults;
  33328. lodash.defaultsDeep = defaultsDeep;
  33329. lodash.defer = defer;
  33330. lodash.delay = delay;
  33331. lodash.difference = difference;
  33332. lodash.differenceBy = differenceBy;
  33333. lodash.differenceWith = differenceWith;
  33334. lodash.drop = drop;
  33335. lodash.dropRight = dropRight;
  33336. lodash.dropRightWhile = dropRightWhile;
  33337. lodash.dropWhile = dropWhile;
  33338. lodash.fill = fill;
  33339. lodash.filter = filter;
  33340. lodash.flatMap = flatMap;
  33341. lodash.flatMapDeep = flatMapDeep;
  33342. lodash.flatMapDepth = flatMapDepth;
  33343. lodash.flatten = flatten;
  33344. lodash.flattenDeep = flattenDeep;
  33345. lodash.flattenDepth = flattenDepth;
  33346. lodash.flip = flip;
  33347. lodash.flow = flow;
  33348. lodash.flowRight = flowRight;
  33349. lodash.fromPairs = fromPairs;
  33350. lodash.functions = functions;
  33351. lodash.functionsIn = functionsIn;
  33352. lodash.groupBy = groupBy;
  33353. lodash.initial = initial;
  33354. lodash.intersection = intersection;
  33355. lodash.intersectionBy = intersectionBy;
  33356. lodash.intersectionWith = intersectionWith;
  33357. lodash.invert = invert;
  33358. lodash.invertBy = invertBy;
  33359. lodash.invokeMap = invokeMap;
  33360. lodash.iteratee = iteratee;
  33361. lodash.keyBy = keyBy;
  33362. lodash.keys = keys;
  33363. lodash.keysIn = keysIn;
  33364. lodash.map = map;
  33365. lodash.mapKeys = mapKeys;
  33366. lodash.mapValues = mapValues;
  33367. lodash.matches = matches;
  33368. lodash.matchesProperty = matchesProperty;
  33369. lodash.memoize = memoize;
  33370. lodash.merge = merge;
  33371. lodash.mergeWith = mergeWith;
  33372. lodash.method = method;
  33373. lodash.methodOf = methodOf;
  33374. lodash.mixin = mixin;
  33375. lodash.negate = negate;
  33376. lodash.nthArg = nthArg;
  33377. lodash.omit = omit;
  33378. lodash.omitBy = omitBy;
  33379. lodash.once = once;
  33380. lodash.orderBy = orderBy;
  33381. lodash.over = over;
  33382. lodash.overArgs = overArgs;
  33383. lodash.overEvery = overEvery;
  33384. lodash.overSome = overSome;
  33385. lodash.partial = partial;
  33386. lodash.partialRight = partialRight;
  33387. lodash.partition = partition;
  33388. lodash.pick = pick;
  33389. lodash.pickBy = pickBy;
  33390. lodash.property = property;
  33391. lodash.propertyOf = propertyOf;
  33392. lodash.pull = pull;
  33393. lodash.pullAll = pullAll;
  33394. lodash.pullAllBy = pullAllBy;
  33395. lodash.pullAllWith = pullAllWith;
  33396. lodash.pullAt = pullAt;
  33397. lodash.range = range;
  33398. lodash.rangeRight = rangeRight;
  33399. lodash.rearg = rearg;
  33400. lodash.reject = reject;
  33401. lodash.remove = remove;
  33402. lodash.rest = rest;
  33403. lodash.reverse = reverse;
  33404. lodash.sampleSize = sampleSize;
  33405. lodash.set = set;
  33406. lodash.setWith = setWith;
  33407. lodash.shuffle = shuffle;
  33408. lodash.slice = slice;
  33409. lodash.sortBy = sortBy;
  33410. lodash.sortedUniq = sortedUniq;
  33411. lodash.sortedUniqBy = sortedUniqBy;
  33412. lodash.split = split;
  33413. lodash.spread = spread;
  33414. lodash.tail = tail;
  33415. lodash.take = take;
  33416. lodash.takeRight = takeRight;
  33417. lodash.takeRightWhile = takeRightWhile;
  33418. lodash.takeWhile = takeWhile;
  33419. lodash.tap = tap;
  33420. lodash.throttle = throttle;
  33421. lodash.thru = thru;
  33422. lodash.toArray = toArray;
  33423. lodash.toPairs = toPairs;
  33424. lodash.toPairsIn = toPairsIn;
  33425. lodash.toPath = toPath;
  33426. lodash.toPlainObject = toPlainObject;
  33427. lodash.transform = transform;
  33428. lodash.unary = unary;
  33429. lodash.union = union;
  33430. lodash.unionBy = unionBy;
  33431. lodash.unionWith = unionWith;
  33432. lodash.uniq = uniq;
  33433. lodash.uniqBy = uniqBy;
  33434. lodash.uniqWith = uniqWith;
  33435. lodash.unset = unset;
  33436. lodash.unzip = unzip;
  33437. lodash.unzipWith = unzipWith;
  33438. lodash.update = update;
  33439. lodash.updateWith = updateWith;
  33440. lodash.values = values;
  33441. lodash.valuesIn = valuesIn;
  33442. lodash.without = without;
  33443. lodash.words = words;
  33444. lodash.wrap = wrap;
  33445. lodash.xor = xor;
  33446. lodash.xorBy = xorBy;
  33447. lodash.xorWith = xorWith;
  33448. lodash.zip = zip;
  33449. lodash.zipObject = zipObject;
  33450. lodash.zipObjectDeep = zipObjectDeep;
  33451. lodash.zipWith = zipWith;
  33452. // Add aliases.
  33453. lodash.entries = toPairs;
  33454. lodash.entriesIn = toPairsIn;
  33455. lodash.extend = assignIn;
  33456. lodash.extendWith = assignInWith;
  33457. // Add methods to `lodash.prototype`.
  33458. mixin(lodash, lodash);
  33459. /*------------------------------------------------------------------------*/
  33460. // Add methods that return unwrapped values in chain sequences.
  33461. lodash.add = add;
  33462. lodash.attempt = attempt;
  33463. lodash.camelCase = camelCase;
  33464. lodash.capitalize = capitalize;
  33465. lodash.ceil = ceil;
  33466. lodash.clamp = clamp;
  33467. lodash.clone = clone;
  33468. lodash.cloneDeep = cloneDeep;
  33469. lodash.cloneDeepWith = cloneDeepWith;
  33470. lodash.cloneWith = cloneWith;
  33471. lodash.conformsTo = conformsTo;
  33472. lodash.deburr = deburr;
  33473. lodash.defaultTo = defaultTo;
  33474. lodash.divide = divide;
  33475. lodash.endsWith = endsWith;
  33476. lodash.eq = eq;
  33477. lodash.escape = escape;
  33478. lodash.escapeRegExp = escapeRegExp;
  33479. lodash.every = every;
  33480. lodash.find = find;
  33481. lodash.findIndex = findIndex;
  33482. lodash.findKey = findKey;
  33483. lodash.findLast = findLast;
  33484. lodash.findLastIndex = findLastIndex;
  33485. lodash.findLastKey = findLastKey;
  33486. lodash.floor = floor;
  33487. lodash.forEach = forEach;
  33488. lodash.forEachRight = forEachRight;
  33489. lodash.forIn = forIn;
  33490. lodash.forInRight = forInRight;
  33491. lodash.forOwn = forOwn;
  33492. lodash.forOwnRight = forOwnRight;
  33493. lodash.get = get;
  33494. lodash.gt = gt;
  33495. lodash.gte = gte;
  33496. lodash.has = has;
  33497. lodash.hasIn = hasIn;
  33498. lodash.head = head;
  33499. lodash.identity = identity;
  33500. lodash.includes = includes;
  33501. lodash.indexOf = indexOf;
  33502. lodash.inRange = inRange;
  33503. lodash.invoke = invoke;
  33504. lodash.isArguments = isArguments;
  33505. lodash.isArray = isArray;
  33506. lodash.isArrayBuffer = isArrayBuffer;
  33507. lodash.isArrayLike = isArrayLike;
  33508. lodash.isArrayLikeObject = isArrayLikeObject;
  33509. lodash.isBoolean = isBoolean;
  33510. lodash.isBuffer = isBuffer;
  33511. lodash.isDate = isDate;
  33512. lodash.isElement = isElement;
  33513. lodash.isEmpty = isEmpty;
  33514. lodash.isEqual = isEqual;
  33515. lodash.isEqualWith = isEqualWith;
  33516. lodash.isError = isError;
  33517. lodash.isFinite = isFinite;
  33518. lodash.isFunction = isFunction;
  33519. lodash.isInteger = isInteger;
  33520. lodash.isLength = isLength;
  33521. lodash.isMap = isMap;
  33522. lodash.isMatch = isMatch;
  33523. lodash.isMatchWith = isMatchWith;
  33524. lodash.isNaN = isNaN;
  33525. lodash.isNative = isNative;
  33526. lodash.isNil = isNil;
  33527. lodash.isNull = isNull;
  33528. lodash.isNumber = isNumber;
  33529. lodash.isObject = isObject;
  33530. lodash.isObjectLike = isObjectLike;
  33531. lodash.isPlainObject = isPlainObject;
  33532. lodash.isRegExp = isRegExp;
  33533. lodash.isSafeInteger = isSafeInteger;
  33534. lodash.isSet = isSet;
  33535. lodash.isString = isString;
  33536. lodash.isSymbol = isSymbol;
  33537. lodash.isTypedArray = isTypedArray;
  33538. lodash.isUndefined = isUndefined;
  33539. lodash.isWeakMap = isWeakMap;
  33540. lodash.isWeakSet = isWeakSet;
  33541. lodash.join = join;
  33542. lodash.kebabCase = kebabCase;
  33543. lodash.last = last;
  33544. lodash.lastIndexOf = lastIndexOf;
  33545. lodash.lowerCase = lowerCase;
  33546. lodash.lowerFirst = lowerFirst;
  33547. lodash.lt = lt;
  33548. lodash.lte = lte;
  33549. lodash.max = max;
  33550. lodash.maxBy = maxBy;
  33551. lodash.mean = mean;
  33552. lodash.meanBy = meanBy;
  33553. lodash.min = min;
  33554. lodash.minBy = minBy;
  33555. lodash.stubArray = stubArray;
  33556. lodash.stubFalse = stubFalse;
  33557. lodash.stubObject = stubObject;
  33558. lodash.stubString = stubString;
  33559. lodash.stubTrue = stubTrue;
  33560. lodash.multiply = multiply;
  33561. lodash.nth = nth;
  33562. lodash.noConflict = noConflict;
  33563. lodash.noop = noop;
  33564. lodash.now = now;
  33565. lodash.pad = pad;
  33566. lodash.padEnd = padEnd;
  33567. lodash.padStart = padStart;
  33568. lodash.parseInt = parseInt;
  33569. lodash.random = random;
  33570. lodash.reduce = reduce;
  33571. lodash.reduceRight = reduceRight;
  33572. lodash.repeat = repeat;
  33573. lodash.replace = replace;
  33574. lodash.result = result;
  33575. lodash.round = round;
  33576. lodash.runInContext = runInContext;
  33577. lodash.sample = sample;
  33578. lodash.size = size;
  33579. lodash.snakeCase = snakeCase;
  33580. lodash.some = some;
  33581. lodash.sortedIndex = sortedIndex;
  33582. lodash.sortedIndexBy = sortedIndexBy;
  33583. lodash.sortedIndexOf = sortedIndexOf;
  33584. lodash.sortedLastIndex = sortedLastIndex;
  33585. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33586. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33587. lodash.startCase = startCase;
  33588. lodash.startsWith = startsWith;
  33589. lodash.subtract = subtract;
  33590. lodash.sum = sum;
  33591. lodash.sumBy = sumBy;
  33592. lodash.template = template;
  33593. lodash.times = times;
  33594. lodash.toFinite = toFinite;
  33595. lodash.toInteger = toInteger;
  33596. lodash.toLength = toLength;
  33597. lodash.toLower = toLower;
  33598. lodash.toNumber = toNumber;
  33599. lodash.toSafeInteger = toSafeInteger;
  33600. lodash.toString = toString;
  33601. lodash.toUpper = toUpper;
  33602. lodash.trim = trim;
  33603. lodash.trimEnd = trimEnd;
  33604. lodash.trimStart = trimStart;
  33605. lodash.truncate = truncate;
  33606. lodash.unescape = unescape;
  33607. lodash.uniqueId = uniqueId;
  33608. lodash.upperCase = upperCase;
  33609. lodash.upperFirst = upperFirst;
  33610. // Add aliases.
  33611. lodash.each = forEach;
  33612. lodash.eachRight = forEachRight;
  33613. lodash.first = head;
  33614. mixin(lodash, (function() {
  33615. var source = {};
  33616. baseForOwn(lodash, function(func, methodName) {
  33617. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33618. source[methodName] = func;
  33619. }
  33620. });
  33621. return source;
  33622. }()), { 'chain': false });
  33623. /*------------------------------------------------------------------------*/
  33624. /**
  33625. * The semantic version number.
  33626. *
  33627. * @static
  33628. * @memberOf _
  33629. * @type {string}
  33630. */
  33631. lodash.VERSION = VERSION;
  33632. // Assign default placeholders.
  33633. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33634. lodash[methodName].placeholder = lodash;
  33635. });
  33636. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33637. arrayEach(['drop', 'take'], function(methodName, index) {
  33638. LazyWrapper.prototype[methodName] = function(n) {
  33639. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33640. var result = (this.__filtered__ && !index)
  33641. ? new LazyWrapper(this)
  33642. : this.clone();
  33643. if (result.__filtered__) {
  33644. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33645. } else {
  33646. result.__views__.push({
  33647. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33648. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33649. });
  33650. }
  33651. return result;
  33652. };
  33653. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33654. return this.reverse()[methodName](n).reverse();
  33655. };
  33656. });
  33657. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33658. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33659. var type = index + 1,
  33660. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33661. LazyWrapper.prototype[methodName] = function(iteratee) {
  33662. var result = this.clone();
  33663. result.__iteratees__.push({
  33664. 'iteratee': getIteratee(iteratee, 3),
  33665. 'type': type
  33666. });
  33667. result.__filtered__ = result.__filtered__ || isFilter;
  33668. return result;
  33669. };
  33670. });
  33671. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33672. arrayEach(['head', 'last'], function(methodName, index) {
  33673. var takeName = 'take' + (index ? 'Right' : '');
  33674. LazyWrapper.prototype[methodName] = function() {
  33675. return this[takeName](1).value()[0];
  33676. };
  33677. });
  33678. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33679. arrayEach(['initial', 'tail'], function(methodName, index) {
  33680. var dropName = 'drop' + (index ? '' : 'Right');
  33681. LazyWrapper.prototype[methodName] = function() {
  33682. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33683. };
  33684. });
  33685. LazyWrapper.prototype.compact = function() {
  33686. return this.filter(identity);
  33687. };
  33688. LazyWrapper.prototype.find = function(predicate) {
  33689. return this.filter(predicate).head();
  33690. };
  33691. LazyWrapper.prototype.findLast = function(predicate) {
  33692. return this.reverse().find(predicate);
  33693. };
  33694. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33695. if (typeof path == 'function') {
  33696. return new LazyWrapper(this);
  33697. }
  33698. return this.map(function(value) {
  33699. return baseInvoke(value, path, args);
  33700. });
  33701. });
  33702. LazyWrapper.prototype.reject = function(predicate) {
  33703. return this.filter(negate(getIteratee(predicate)));
  33704. };
  33705. LazyWrapper.prototype.slice = function(start, end) {
  33706. start = toInteger(start);
  33707. var result = this;
  33708. if (result.__filtered__ && (start > 0 || end < 0)) {
  33709. return new LazyWrapper(result);
  33710. }
  33711. if (start < 0) {
  33712. result = result.takeRight(-start);
  33713. } else if (start) {
  33714. result = result.drop(start);
  33715. }
  33716. if (end !== undefined) {
  33717. end = toInteger(end);
  33718. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33719. }
  33720. return result;
  33721. };
  33722. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33723. return this.reverse().takeWhile(predicate).reverse();
  33724. };
  33725. LazyWrapper.prototype.toArray = function() {
  33726. return this.take(MAX_ARRAY_LENGTH);
  33727. };
  33728. // Add `LazyWrapper` methods to `lodash.prototype`.
  33729. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33730. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33731. isTaker = /^(?:head|last)$/.test(methodName),
  33732. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33733. retUnwrapped = isTaker || /^find/.test(methodName);
  33734. if (!lodashFunc) {
  33735. return;
  33736. }
  33737. lodash.prototype[methodName] = function() {
  33738. var value = this.__wrapped__,
  33739. args = isTaker ? [1] : arguments,
  33740. isLazy = value instanceof LazyWrapper,
  33741. iteratee = args[0],
  33742. useLazy = isLazy || isArray(value);
  33743. var interceptor = function(value) {
  33744. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33745. return (isTaker && chainAll) ? result[0] : result;
  33746. };
  33747. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33748. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33749. isLazy = useLazy = false;
  33750. }
  33751. var chainAll = this.__chain__,
  33752. isHybrid = !!this.__actions__.length,
  33753. isUnwrapped = retUnwrapped && !chainAll,
  33754. onlyLazy = isLazy && !isHybrid;
  33755. if (!retUnwrapped && useLazy) {
  33756. value = onlyLazy ? value : new LazyWrapper(this);
  33757. var result = func.apply(value, args);
  33758. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33759. return new LodashWrapper(result, chainAll);
  33760. }
  33761. if (isUnwrapped && onlyLazy) {
  33762. return func.apply(this, args);
  33763. }
  33764. result = this.thru(interceptor);
  33765. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33766. };
  33767. });
  33768. // Add `Array` methods to `lodash.prototype`.
  33769. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33770. var func = arrayProto[methodName],
  33771. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33772. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33773. lodash.prototype[methodName] = function() {
  33774. var args = arguments;
  33775. if (retUnwrapped && !this.__chain__) {
  33776. var value = this.value();
  33777. return func.apply(isArray(value) ? value : [], args);
  33778. }
  33779. return this[chainName](function(value) {
  33780. return func.apply(isArray(value) ? value : [], args);
  33781. });
  33782. };
  33783. });
  33784. // Map minified method names to their real names.
  33785. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33786. var lodashFunc = lodash[methodName];
  33787. if (lodashFunc) {
  33788. var key = lodashFunc.name + '';
  33789. if (!hasOwnProperty.call(realNames, key)) {
  33790. realNames[key] = [];
  33791. }
  33792. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33793. }
  33794. });
  33795. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33796. 'name': 'wrapper',
  33797. 'func': undefined
  33798. }];
  33799. // Add methods to `LazyWrapper`.
  33800. LazyWrapper.prototype.clone = lazyClone;
  33801. LazyWrapper.prototype.reverse = lazyReverse;
  33802. LazyWrapper.prototype.value = lazyValue;
  33803. // Add chain sequence methods to the `lodash` wrapper.
  33804. lodash.prototype.at = wrapperAt;
  33805. lodash.prototype.chain = wrapperChain;
  33806. lodash.prototype.commit = wrapperCommit;
  33807. lodash.prototype.next = wrapperNext;
  33808. lodash.prototype.plant = wrapperPlant;
  33809. lodash.prototype.reverse = wrapperReverse;
  33810. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  33811. // Add lazy aliases.
  33812. lodash.prototype.first = lodash.prototype.head;
  33813. if (symIterator) {
  33814. lodash.prototype[symIterator] = wrapperToIterator;
  33815. }
  33816. return lodash;
  33817. });
  33818. /*--------------------------------------------------------------------------*/
  33819. // Export lodash.
  33820. var _ = runInContext();
  33821. // Some AMD build optimizers, like r.js, check for condition patterns like:
  33822. if (true) {
  33823. // Expose Lodash on the global object to prevent errors when Lodash is
  33824. // loaded by a script tag in the presence of an AMD loader.
  33825. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  33826. // Use `_.noConflict` to remove Lodash from the global object.
  33827. root._ = _;
  33828. // Define as an anonymous module so, through path mapping, it can be
  33829. // referenced as the "underscore" module.
  33830. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  33831. return _;
  33832. }).call(exports, __webpack_require__, exports, module),
  33833. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33834. }
  33835. // Check for `exports` after `define` in case a build optimizer adds it.
  33836. else {}
  33837. }.call(this));
  33838. /* 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)))
  33839. /***/ }),
  33840. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  33841. /*!***************************************************!*\
  33842. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  33843. \***************************************************/
  33844. /*! exports provided: default */
  33845. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  33846. "use strict";
  33847. __webpack_require__.r(__webpack_exports__);
  33848. /* WEBPACK VAR INJECTION */(function(global) {/**!
  33849. * @fileOverview Kickass library to create and place poppers near their reference elements.
  33850. * @version 1.16.1
  33851. * @license
  33852. * Copyright (c) 2016 Federico Zivolo and contributors
  33853. *
  33854. * Permission is hereby granted, free of charge, to any person obtaining a copy
  33855. * of this software and associated documentation files (the "Software"), to deal
  33856. * in the Software without restriction, including without limitation the rights
  33857. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  33858. * copies of the Software, and to permit persons to whom the Software is
  33859. * furnished to do so, subject to the following conditions:
  33860. *
  33861. * The above copyright notice and this permission notice shall be included in all
  33862. * copies or substantial portions of the Software.
  33863. *
  33864. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  33865. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33866. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  33867. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  33868. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33869. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  33870. * SOFTWARE.
  33871. */
  33872. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  33873. var timeoutDuration = function () {
  33874. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  33875. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  33876. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  33877. return 1;
  33878. }
  33879. }
  33880. return 0;
  33881. }();
  33882. function microtaskDebounce(fn) {
  33883. var called = false;
  33884. return function () {
  33885. if (called) {
  33886. return;
  33887. }
  33888. called = true;
  33889. window.Promise.resolve().then(function () {
  33890. called = false;
  33891. fn();
  33892. });
  33893. };
  33894. }
  33895. function taskDebounce(fn) {
  33896. var scheduled = false;
  33897. return function () {
  33898. if (!scheduled) {
  33899. scheduled = true;
  33900. setTimeout(function () {
  33901. scheduled = false;
  33902. fn();
  33903. }, timeoutDuration);
  33904. }
  33905. };
  33906. }
  33907. var supportsMicroTasks = isBrowser && window.Promise;
  33908. /**
  33909. * Create a debounced version of a method, that's asynchronously deferred
  33910. * but called in the minimum time possible.
  33911. *
  33912. * @method
  33913. * @memberof Popper.Utils
  33914. * @argument {Function} fn
  33915. * @returns {Function}
  33916. */
  33917. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  33918. /**
  33919. * Check if the given variable is a function
  33920. * @method
  33921. * @memberof Popper.Utils
  33922. * @argument {Any} functionToCheck - variable to check
  33923. * @returns {Boolean} answer to: is a function?
  33924. */
  33925. function isFunction(functionToCheck) {
  33926. var getType = {};
  33927. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  33928. }
  33929. /**
  33930. * Get CSS computed property of the given element
  33931. * @method
  33932. * @memberof Popper.Utils
  33933. * @argument {Eement} element
  33934. * @argument {String} property
  33935. */
  33936. function getStyleComputedProperty(element, property) {
  33937. if (element.nodeType !== 1) {
  33938. return [];
  33939. }
  33940. // NOTE: 1 DOM access here
  33941. var window = element.ownerDocument.defaultView;
  33942. var css = window.getComputedStyle(element, null);
  33943. return property ? css[property] : css;
  33944. }
  33945. /**
  33946. * Returns the parentNode or the host of the element
  33947. * @method
  33948. * @memberof Popper.Utils
  33949. * @argument {Element} element
  33950. * @returns {Element} parent
  33951. */
  33952. function getParentNode(element) {
  33953. if (element.nodeName === 'HTML') {
  33954. return element;
  33955. }
  33956. return element.parentNode || element.host;
  33957. }
  33958. /**
  33959. * Returns the scrolling parent of the given element
  33960. * @method
  33961. * @memberof Popper.Utils
  33962. * @argument {Element} element
  33963. * @returns {Element} scroll parent
  33964. */
  33965. function getScrollParent(element) {
  33966. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  33967. if (!element) {
  33968. return document.body;
  33969. }
  33970. switch (element.nodeName) {
  33971. case 'HTML':
  33972. case 'BODY':
  33973. return element.ownerDocument.body;
  33974. case '#document':
  33975. return element.body;
  33976. }
  33977. // Firefox want us to check `-x` and `-y` variations as well
  33978. var _getStyleComputedProp = getStyleComputedProperty(element),
  33979. overflow = _getStyleComputedProp.overflow,
  33980. overflowX = _getStyleComputedProp.overflowX,
  33981. overflowY = _getStyleComputedProp.overflowY;
  33982. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  33983. return element;
  33984. }
  33985. return getScrollParent(getParentNode(element));
  33986. }
  33987. /**
  33988. * Returns the reference node of the reference object, or the reference object itself.
  33989. * @method
  33990. * @memberof Popper.Utils
  33991. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  33992. * @returns {Element} parent
  33993. */
  33994. function getReferenceNode(reference) {
  33995. return reference && reference.referenceNode ? reference.referenceNode : reference;
  33996. }
  33997. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  33998. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  33999. /**
  34000. * Determines if the browser is Internet Explorer
  34001. * @method
  34002. * @memberof Popper.Utils
  34003. * @param {Number} version to check
  34004. * @returns {Boolean} isIE
  34005. */
  34006. function isIE(version) {
  34007. if (version === 11) {
  34008. return isIE11;
  34009. }
  34010. if (version === 10) {
  34011. return isIE10;
  34012. }
  34013. return isIE11 || isIE10;
  34014. }
  34015. /**
  34016. * Returns the offset parent of the given element
  34017. * @method
  34018. * @memberof Popper.Utils
  34019. * @argument {Element} element
  34020. * @returns {Element} offset parent
  34021. */
  34022. function getOffsetParent(element) {
  34023. if (!element) {
  34024. return document.documentElement;
  34025. }
  34026. var noOffsetParent = isIE(10) ? document.body : null;
  34027. // NOTE: 1 DOM access here
  34028. var offsetParent = element.offsetParent || null;
  34029. // Skip hidden elements which don't have an offsetParent
  34030. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34031. offsetParent = (element = element.nextElementSibling).offsetParent;
  34032. }
  34033. var nodeName = offsetParent && offsetParent.nodeName;
  34034. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34035. return element ? element.ownerDocument.documentElement : document.documentElement;
  34036. }
  34037. // .offsetParent will return the closest TH, TD or TABLE in case
  34038. // no offsetParent is present, I hate this job...
  34039. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34040. return getOffsetParent(offsetParent);
  34041. }
  34042. return offsetParent;
  34043. }
  34044. function isOffsetContainer(element) {
  34045. var nodeName = element.nodeName;
  34046. if (nodeName === 'BODY') {
  34047. return false;
  34048. }
  34049. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34050. }
  34051. /**
  34052. * Finds the root node (document, shadowDOM root) of the given element
  34053. * @method
  34054. * @memberof Popper.Utils
  34055. * @argument {Element} node
  34056. * @returns {Element} root node
  34057. */
  34058. function getRoot(node) {
  34059. if (node.parentNode !== null) {
  34060. return getRoot(node.parentNode);
  34061. }
  34062. return node;
  34063. }
  34064. /**
  34065. * Finds the offset parent common to the two provided nodes
  34066. * @method
  34067. * @memberof Popper.Utils
  34068. * @argument {Element} element1
  34069. * @argument {Element} element2
  34070. * @returns {Element} common offset parent
  34071. */
  34072. function findCommonOffsetParent(element1, element2) {
  34073. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34074. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34075. return document.documentElement;
  34076. }
  34077. // Here we make sure to give as "start" the element that comes first in the DOM
  34078. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34079. var start = order ? element1 : element2;
  34080. var end = order ? element2 : element1;
  34081. // Get common ancestor container
  34082. var range = document.createRange();
  34083. range.setStart(start, 0);
  34084. range.setEnd(end, 0);
  34085. var commonAncestorContainer = range.commonAncestorContainer;
  34086. // Both nodes are inside #document
  34087. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34088. if (isOffsetContainer(commonAncestorContainer)) {
  34089. return commonAncestorContainer;
  34090. }
  34091. return getOffsetParent(commonAncestorContainer);
  34092. }
  34093. // one of the nodes is inside shadowDOM, find which one
  34094. var element1root = getRoot(element1);
  34095. if (element1root.host) {
  34096. return findCommonOffsetParent(element1root.host, element2);
  34097. } else {
  34098. return findCommonOffsetParent(element1, getRoot(element2).host);
  34099. }
  34100. }
  34101. /**
  34102. * Gets the scroll value of the given element in the given side (top and left)
  34103. * @method
  34104. * @memberof Popper.Utils
  34105. * @argument {Element} element
  34106. * @argument {String} side `top` or `left`
  34107. * @returns {number} amount of scrolled pixels
  34108. */
  34109. function getScroll(element) {
  34110. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34111. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34112. var nodeName = element.nodeName;
  34113. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34114. var html = element.ownerDocument.documentElement;
  34115. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34116. return scrollingElement[upperSide];
  34117. }
  34118. return element[upperSide];
  34119. }
  34120. /*
  34121. * Sum or subtract the element scroll values (left and top) from a given rect object
  34122. * @method
  34123. * @memberof Popper.Utils
  34124. * @param {Object} rect - Rect object you want to change
  34125. * @param {HTMLElement} element - The element from the function reads the scroll values
  34126. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34127. * @return {Object} rect - The modifier rect object
  34128. */
  34129. function includeScroll(rect, element) {
  34130. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34131. var scrollTop = getScroll(element, 'top');
  34132. var scrollLeft = getScroll(element, 'left');
  34133. var modifier = subtract ? -1 : 1;
  34134. rect.top += scrollTop * modifier;
  34135. rect.bottom += scrollTop * modifier;
  34136. rect.left += scrollLeft * modifier;
  34137. rect.right += scrollLeft * modifier;
  34138. return rect;
  34139. }
  34140. /*
  34141. * Helper to detect borders of a given element
  34142. * @method
  34143. * @memberof Popper.Utils
  34144. * @param {CSSStyleDeclaration} styles
  34145. * Result of `getStyleComputedProperty` on the given element
  34146. * @param {String} axis - `x` or `y`
  34147. * @return {number} borders - The borders size of the given axis
  34148. */
  34149. function getBordersSize(styles, axis) {
  34150. var sideA = axis === 'x' ? 'Left' : 'Top';
  34151. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34152. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34153. }
  34154. function getSize(axis, body, html, computedStyle) {
  34155. 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);
  34156. }
  34157. function getWindowSizes(document) {
  34158. var body = document.body;
  34159. var html = document.documentElement;
  34160. var computedStyle = isIE(10) && getComputedStyle(html);
  34161. return {
  34162. height: getSize('Height', body, html, computedStyle),
  34163. width: getSize('Width', body, html, computedStyle)
  34164. };
  34165. }
  34166. var classCallCheck = function (instance, Constructor) {
  34167. if (!(instance instanceof Constructor)) {
  34168. throw new TypeError("Cannot call a class as a function");
  34169. }
  34170. };
  34171. var createClass = function () {
  34172. function defineProperties(target, props) {
  34173. for (var i = 0; i < props.length; i++) {
  34174. var descriptor = props[i];
  34175. descriptor.enumerable = descriptor.enumerable || false;
  34176. descriptor.configurable = true;
  34177. if ("value" in descriptor) descriptor.writable = true;
  34178. Object.defineProperty(target, descriptor.key, descriptor);
  34179. }
  34180. }
  34181. return function (Constructor, protoProps, staticProps) {
  34182. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34183. if (staticProps) defineProperties(Constructor, staticProps);
  34184. return Constructor;
  34185. };
  34186. }();
  34187. var defineProperty = function (obj, key, value) {
  34188. if (key in obj) {
  34189. Object.defineProperty(obj, key, {
  34190. value: value,
  34191. enumerable: true,
  34192. configurable: true,
  34193. writable: true
  34194. });
  34195. } else {
  34196. obj[key] = value;
  34197. }
  34198. return obj;
  34199. };
  34200. var _extends = Object.assign || function (target) {
  34201. for (var i = 1; i < arguments.length; i++) {
  34202. var source = arguments[i];
  34203. for (var key in source) {
  34204. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34205. target[key] = source[key];
  34206. }
  34207. }
  34208. }
  34209. return target;
  34210. };
  34211. /**
  34212. * Given element offsets, generate an output similar to getBoundingClientRect
  34213. * @method
  34214. * @memberof Popper.Utils
  34215. * @argument {Object} offsets
  34216. * @returns {Object} ClientRect like output
  34217. */
  34218. function getClientRect(offsets) {
  34219. return _extends({}, offsets, {
  34220. right: offsets.left + offsets.width,
  34221. bottom: offsets.top + offsets.height
  34222. });
  34223. }
  34224. /**
  34225. * Get bounding client rect of given element
  34226. * @method
  34227. * @memberof Popper.Utils
  34228. * @param {HTMLElement} element
  34229. * @return {Object} client rect
  34230. */
  34231. function getBoundingClientRect(element) {
  34232. var rect = {};
  34233. // IE10 10 FIX: Please, don't ask, the element isn't
  34234. // considered in DOM in some circumstances...
  34235. // This isn't reproducible in IE10 compatibility mode of IE11
  34236. try {
  34237. if (isIE(10)) {
  34238. rect = element.getBoundingClientRect();
  34239. var scrollTop = getScroll(element, 'top');
  34240. var scrollLeft = getScroll(element, 'left');
  34241. rect.top += scrollTop;
  34242. rect.left += scrollLeft;
  34243. rect.bottom += scrollTop;
  34244. rect.right += scrollLeft;
  34245. } else {
  34246. rect = element.getBoundingClientRect();
  34247. }
  34248. } catch (e) {}
  34249. var result = {
  34250. left: rect.left,
  34251. top: rect.top,
  34252. width: rect.right - rect.left,
  34253. height: rect.bottom - rect.top
  34254. };
  34255. // subtract scrollbar size from sizes
  34256. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34257. var width = sizes.width || element.clientWidth || result.width;
  34258. var height = sizes.height || element.clientHeight || result.height;
  34259. var horizScrollbar = element.offsetWidth - width;
  34260. var vertScrollbar = element.offsetHeight - height;
  34261. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34262. // we make this check conditional for performance reasons
  34263. if (horizScrollbar || vertScrollbar) {
  34264. var styles = getStyleComputedProperty(element);
  34265. horizScrollbar -= getBordersSize(styles, 'x');
  34266. vertScrollbar -= getBordersSize(styles, 'y');
  34267. result.width -= horizScrollbar;
  34268. result.height -= vertScrollbar;
  34269. }
  34270. return getClientRect(result);
  34271. }
  34272. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34273. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34274. var isIE10 = isIE(10);
  34275. var isHTML = parent.nodeName === 'HTML';
  34276. var childrenRect = getBoundingClientRect(children);
  34277. var parentRect = getBoundingClientRect(parent);
  34278. var scrollParent = getScrollParent(children);
  34279. var styles = getStyleComputedProperty(parent);
  34280. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34281. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34282. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34283. if (fixedPosition && isHTML) {
  34284. parentRect.top = Math.max(parentRect.top, 0);
  34285. parentRect.left = Math.max(parentRect.left, 0);
  34286. }
  34287. var offsets = getClientRect({
  34288. top: childrenRect.top - parentRect.top - borderTopWidth,
  34289. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34290. width: childrenRect.width,
  34291. height: childrenRect.height
  34292. });
  34293. offsets.marginTop = 0;
  34294. offsets.marginLeft = 0;
  34295. // Subtract margins of documentElement in case it's being used as parent
  34296. // we do this only on HTML because it's the only element that behaves
  34297. // differently when margins are applied to it. The margins are included in
  34298. // the box of the documentElement, in the other cases not.
  34299. if (!isIE10 && isHTML) {
  34300. var marginTop = parseFloat(styles.marginTop);
  34301. var marginLeft = parseFloat(styles.marginLeft);
  34302. offsets.top -= borderTopWidth - marginTop;
  34303. offsets.bottom -= borderTopWidth - marginTop;
  34304. offsets.left -= borderLeftWidth - marginLeft;
  34305. offsets.right -= borderLeftWidth - marginLeft;
  34306. // Attach marginTop and marginLeft because in some circumstances we may need them
  34307. offsets.marginTop = marginTop;
  34308. offsets.marginLeft = marginLeft;
  34309. }
  34310. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34311. offsets = includeScroll(offsets, parent);
  34312. }
  34313. return offsets;
  34314. }
  34315. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34316. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34317. var html = element.ownerDocument.documentElement;
  34318. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34319. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34320. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34321. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34322. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34323. var offset = {
  34324. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34325. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34326. width: width,
  34327. height: height
  34328. };
  34329. return getClientRect(offset);
  34330. }
  34331. /**
  34332. * Check if the given element is fixed or is inside a fixed parent
  34333. * @method
  34334. * @memberof Popper.Utils
  34335. * @argument {Element} element
  34336. * @argument {Element} customContainer
  34337. * @returns {Boolean} answer to "isFixed?"
  34338. */
  34339. function isFixed(element) {
  34340. var nodeName = element.nodeName;
  34341. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34342. return false;
  34343. }
  34344. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34345. return true;
  34346. }
  34347. var parentNode = getParentNode(element);
  34348. if (!parentNode) {
  34349. return false;
  34350. }
  34351. return isFixed(parentNode);
  34352. }
  34353. /**
  34354. * Finds the first parent of an element that has a transformed property defined
  34355. * @method
  34356. * @memberof Popper.Utils
  34357. * @argument {Element} element
  34358. * @returns {Element} first transformed parent or documentElement
  34359. */
  34360. function getFixedPositionOffsetParent(element) {
  34361. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34362. if (!element || !element.parentElement || isIE()) {
  34363. return document.documentElement;
  34364. }
  34365. var el = element.parentElement;
  34366. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34367. el = el.parentElement;
  34368. }
  34369. return el || document.documentElement;
  34370. }
  34371. /**
  34372. * Computed the boundaries limits and return them
  34373. * @method
  34374. * @memberof Popper.Utils
  34375. * @param {HTMLElement} popper
  34376. * @param {HTMLElement} reference
  34377. * @param {number} padding
  34378. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34379. * @param {Boolean} fixedPosition - Is in fixed position mode
  34380. * @returns {Object} Coordinates of the boundaries
  34381. */
  34382. function getBoundaries(popper, reference, padding, boundariesElement) {
  34383. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34384. // NOTE: 1 DOM access here
  34385. var boundaries = { top: 0, left: 0 };
  34386. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34387. // Handle viewport case
  34388. if (boundariesElement === 'viewport') {
  34389. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34390. } else {
  34391. // Handle other cases based on DOM element used as boundaries
  34392. var boundariesNode = void 0;
  34393. if (boundariesElement === 'scrollParent') {
  34394. boundariesNode = getScrollParent(getParentNode(reference));
  34395. if (boundariesNode.nodeName === 'BODY') {
  34396. boundariesNode = popper.ownerDocument.documentElement;
  34397. }
  34398. } else if (boundariesElement === 'window') {
  34399. boundariesNode = popper.ownerDocument.documentElement;
  34400. } else {
  34401. boundariesNode = boundariesElement;
  34402. }
  34403. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34404. // In case of HTML, we need a different computation
  34405. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34406. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34407. height = _getWindowSizes.height,
  34408. width = _getWindowSizes.width;
  34409. boundaries.top += offsets.top - offsets.marginTop;
  34410. boundaries.bottom = height + offsets.top;
  34411. boundaries.left += offsets.left - offsets.marginLeft;
  34412. boundaries.right = width + offsets.left;
  34413. } else {
  34414. // for all the other DOM elements, this one is good
  34415. boundaries = offsets;
  34416. }
  34417. }
  34418. // Add paddings
  34419. padding = padding || 0;
  34420. var isPaddingNumber = typeof padding === 'number';
  34421. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34422. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34423. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34424. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34425. return boundaries;
  34426. }
  34427. function getArea(_ref) {
  34428. var width = _ref.width,
  34429. height = _ref.height;
  34430. return width * height;
  34431. }
  34432. /**
  34433. * Utility used to transform the `auto` placement to the placement with more
  34434. * available space.
  34435. * @method
  34436. * @memberof Popper.Utils
  34437. * @argument {Object} data - The data object generated by update method
  34438. * @argument {Object} options - Modifiers configuration and options
  34439. * @returns {Object} The data object, properly modified
  34440. */
  34441. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34442. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34443. if (placement.indexOf('auto') === -1) {
  34444. return placement;
  34445. }
  34446. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34447. var rects = {
  34448. top: {
  34449. width: boundaries.width,
  34450. height: refRect.top - boundaries.top
  34451. },
  34452. right: {
  34453. width: boundaries.right - refRect.right,
  34454. height: boundaries.height
  34455. },
  34456. bottom: {
  34457. width: boundaries.width,
  34458. height: boundaries.bottom - refRect.bottom
  34459. },
  34460. left: {
  34461. width: refRect.left - boundaries.left,
  34462. height: boundaries.height
  34463. }
  34464. };
  34465. var sortedAreas = Object.keys(rects).map(function (key) {
  34466. return _extends({
  34467. key: key
  34468. }, rects[key], {
  34469. area: getArea(rects[key])
  34470. });
  34471. }).sort(function (a, b) {
  34472. return b.area - a.area;
  34473. });
  34474. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34475. var width = _ref2.width,
  34476. height = _ref2.height;
  34477. return width >= popper.clientWidth && height >= popper.clientHeight;
  34478. });
  34479. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34480. var variation = placement.split('-')[1];
  34481. return computedPlacement + (variation ? '-' + variation : '');
  34482. }
  34483. /**
  34484. * Get offsets to the reference element
  34485. * @method
  34486. * @memberof Popper.Utils
  34487. * @param {Object} state
  34488. * @param {Element} popper - the popper element
  34489. * @param {Element} reference - the reference element (the popper will be relative to this)
  34490. * @param {Element} fixedPosition - is in fixed position mode
  34491. * @returns {Object} An object containing the offsets which will be applied to the popper
  34492. */
  34493. function getReferenceOffsets(state, popper, reference) {
  34494. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34495. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34496. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34497. }
  34498. /**
  34499. * Get the outer sizes of the given element (offset size + margins)
  34500. * @method
  34501. * @memberof Popper.Utils
  34502. * @argument {Element} element
  34503. * @returns {Object} object containing width and height properties
  34504. */
  34505. function getOuterSizes(element) {
  34506. var window = element.ownerDocument.defaultView;
  34507. var styles = window.getComputedStyle(element);
  34508. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34509. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34510. var result = {
  34511. width: element.offsetWidth + y,
  34512. height: element.offsetHeight + x
  34513. };
  34514. return result;
  34515. }
  34516. /**
  34517. * Get the opposite placement of the given one
  34518. * @method
  34519. * @memberof Popper.Utils
  34520. * @argument {String} placement
  34521. * @returns {String} flipped placement
  34522. */
  34523. function getOppositePlacement(placement) {
  34524. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34525. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34526. return hash[matched];
  34527. });
  34528. }
  34529. /**
  34530. * Get offsets to the popper
  34531. * @method
  34532. * @memberof Popper.Utils
  34533. * @param {Object} position - CSS position the Popper will get applied
  34534. * @param {HTMLElement} popper - the popper element
  34535. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34536. * @param {String} placement - one of the valid placement options
  34537. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34538. */
  34539. function getPopperOffsets(popper, referenceOffsets, placement) {
  34540. placement = placement.split('-')[0];
  34541. // Get popper node sizes
  34542. var popperRect = getOuterSizes(popper);
  34543. // Add position, width and height to our offsets object
  34544. var popperOffsets = {
  34545. width: popperRect.width,
  34546. height: popperRect.height
  34547. };
  34548. // depending by the popper placement we have to compute its offsets slightly differently
  34549. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34550. var mainSide = isHoriz ? 'top' : 'left';
  34551. var secondarySide = isHoriz ? 'left' : 'top';
  34552. var measurement = isHoriz ? 'height' : 'width';
  34553. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34554. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34555. if (placement === secondarySide) {
  34556. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34557. } else {
  34558. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34559. }
  34560. return popperOffsets;
  34561. }
  34562. /**
  34563. * Mimics the `find` method of Array
  34564. * @method
  34565. * @memberof Popper.Utils
  34566. * @argument {Array} arr
  34567. * @argument prop
  34568. * @argument value
  34569. * @returns index or -1
  34570. */
  34571. function find(arr, check) {
  34572. // use native find if supported
  34573. if (Array.prototype.find) {
  34574. return arr.find(check);
  34575. }
  34576. // use `filter` to obtain the same behavior of `find`
  34577. return arr.filter(check)[0];
  34578. }
  34579. /**
  34580. * Return the index of the matching object
  34581. * @method
  34582. * @memberof Popper.Utils
  34583. * @argument {Array} arr
  34584. * @argument prop
  34585. * @argument value
  34586. * @returns index or -1
  34587. */
  34588. function findIndex(arr, prop, value) {
  34589. // use native findIndex if supported
  34590. if (Array.prototype.findIndex) {
  34591. return arr.findIndex(function (cur) {
  34592. return cur[prop] === value;
  34593. });
  34594. }
  34595. // use `find` + `indexOf` if `findIndex` isn't supported
  34596. var match = find(arr, function (obj) {
  34597. return obj[prop] === value;
  34598. });
  34599. return arr.indexOf(match);
  34600. }
  34601. /**
  34602. * Loop trough the list of modifiers and run them in order,
  34603. * each of them will then edit the data object.
  34604. * @method
  34605. * @memberof Popper.Utils
  34606. * @param {dataObject} data
  34607. * @param {Array} modifiers
  34608. * @param {String} ends - Optional modifier name used as stopper
  34609. * @returns {dataObject}
  34610. */
  34611. function runModifiers(modifiers, data, ends) {
  34612. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34613. modifiersToRun.forEach(function (modifier) {
  34614. if (modifier['function']) {
  34615. // eslint-disable-line dot-notation
  34616. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34617. }
  34618. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34619. if (modifier.enabled && isFunction(fn)) {
  34620. // Add properties to offsets to make them a complete clientRect object
  34621. // we do this before each modifier to make sure the previous one doesn't
  34622. // mess with these values
  34623. data.offsets.popper = getClientRect(data.offsets.popper);
  34624. data.offsets.reference = getClientRect(data.offsets.reference);
  34625. data = fn(data, modifier);
  34626. }
  34627. });
  34628. return data;
  34629. }
  34630. /**
  34631. * Updates the position of the popper, computing the new offsets and applying
  34632. * the new style.<br />
  34633. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34634. * @method
  34635. * @memberof Popper
  34636. */
  34637. function update() {
  34638. // if popper is destroyed, don't perform any further update
  34639. if (this.state.isDestroyed) {
  34640. return;
  34641. }
  34642. var data = {
  34643. instance: this,
  34644. styles: {},
  34645. arrowStyles: {},
  34646. attributes: {},
  34647. flipped: false,
  34648. offsets: {}
  34649. };
  34650. // compute reference element offsets
  34651. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34652. // compute auto placement, store placement inside the data object,
  34653. // modifiers will be able to edit `placement` if needed
  34654. // and refer to originalPlacement to know the original value
  34655. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34656. // store the computed placement inside `originalPlacement`
  34657. data.originalPlacement = data.placement;
  34658. data.positionFixed = this.options.positionFixed;
  34659. // compute the popper offsets
  34660. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34661. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34662. // run the modifiers
  34663. data = runModifiers(this.modifiers, data);
  34664. // the first `update` will call `onCreate` callback
  34665. // the other ones will call `onUpdate` callback
  34666. if (!this.state.isCreated) {
  34667. this.state.isCreated = true;
  34668. this.options.onCreate(data);
  34669. } else {
  34670. this.options.onUpdate(data);
  34671. }
  34672. }
  34673. /**
  34674. * Helper used to know if the given modifier is enabled.
  34675. * @method
  34676. * @memberof Popper.Utils
  34677. * @returns {Boolean}
  34678. */
  34679. function isModifierEnabled(modifiers, modifierName) {
  34680. return modifiers.some(function (_ref) {
  34681. var name = _ref.name,
  34682. enabled = _ref.enabled;
  34683. return enabled && name === modifierName;
  34684. });
  34685. }
  34686. /**
  34687. * Get the prefixed supported property name
  34688. * @method
  34689. * @memberof Popper.Utils
  34690. * @argument {String} property (camelCase)
  34691. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34692. */
  34693. function getSupportedPropertyName(property) {
  34694. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34695. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34696. for (var i = 0; i < prefixes.length; i++) {
  34697. var prefix = prefixes[i];
  34698. var toCheck = prefix ? '' + prefix + upperProp : property;
  34699. if (typeof document.body.style[toCheck] !== 'undefined') {
  34700. return toCheck;
  34701. }
  34702. }
  34703. return null;
  34704. }
  34705. /**
  34706. * Destroys the popper.
  34707. * @method
  34708. * @memberof Popper
  34709. */
  34710. function destroy() {
  34711. this.state.isDestroyed = true;
  34712. // touch DOM only if `applyStyle` modifier is enabled
  34713. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34714. this.popper.removeAttribute('x-placement');
  34715. this.popper.style.position = '';
  34716. this.popper.style.top = '';
  34717. this.popper.style.left = '';
  34718. this.popper.style.right = '';
  34719. this.popper.style.bottom = '';
  34720. this.popper.style.willChange = '';
  34721. this.popper.style[getSupportedPropertyName('transform')] = '';
  34722. }
  34723. this.disableEventListeners();
  34724. // remove the popper if user explicitly asked for the deletion on destroy
  34725. // do not use `remove` because IE11 doesn't support it
  34726. if (this.options.removeOnDestroy) {
  34727. this.popper.parentNode.removeChild(this.popper);
  34728. }
  34729. return this;
  34730. }
  34731. /**
  34732. * Get the window associated with the element
  34733. * @argument {Element} element
  34734. * @returns {Window}
  34735. */
  34736. function getWindow(element) {
  34737. var ownerDocument = element.ownerDocument;
  34738. return ownerDocument ? ownerDocument.defaultView : window;
  34739. }
  34740. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34741. var isBody = scrollParent.nodeName === 'BODY';
  34742. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34743. target.addEventListener(event, callback, { passive: true });
  34744. if (!isBody) {
  34745. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34746. }
  34747. scrollParents.push(target);
  34748. }
  34749. /**
  34750. * Setup needed event listeners used to update the popper position
  34751. * @method
  34752. * @memberof Popper.Utils
  34753. * @private
  34754. */
  34755. function setupEventListeners(reference, options, state, updateBound) {
  34756. // Resize event listener on window
  34757. state.updateBound = updateBound;
  34758. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34759. // Scroll event listener on scroll parents
  34760. var scrollElement = getScrollParent(reference);
  34761. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34762. state.scrollElement = scrollElement;
  34763. state.eventsEnabled = true;
  34764. return state;
  34765. }
  34766. /**
  34767. * It will add resize/scroll events and start recalculating
  34768. * position of the popper element when they are triggered.
  34769. * @method
  34770. * @memberof Popper
  34771. */
  34772. function enableEventListeners() {
  34773. if (!this.state.eventsEnabled) {
  34774. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34775. }
  34776. }
  34777. /**
  34778. * Remove event listeners used to update the popper position
  34779. * @method
  34780. * @memberof Popper.Utils
  34781. * @private
  34782. */
  34783. function removeEventListeners(reference, state) {
  34784. // Remove resize event listener on window
  34785. getWindow(reference).removeEventListener('resize', state.updateBound);
  34786. // Remove scroll event listener on scroll parents
  34787. state.scrollParents.forEach(function (target) {
  34788. target.removeEventListener('scroll', state.updateBound);
  34789. });
  34790. // Reset state
  34791. state.updateBound = null;
  34792. state.scrollParents = [];
  34793. state.scrollElement = null;
  34794. state.eventsEnabled = false;
  34795. return state;
  34796. }
  34797. /**
  34798. * It will remove resize/scroll events and won't recalculate popper position
  34799. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34800. * unless you call `update` method manually.
  34801. * @method
  34802. * @memberof Popper
  34803. */
  34804. function disableEventListeners() {
  34805. if (this.state.eventsEnabled) {
  34806. cancelAnimationFrame(this.scheduleUpdate);
  34807. this.state = removeEventListeners(this.reference, this.state);
  34808. }
  34809. }
  34810. /**
  34811. * Tells if a given input is a number
  34812. * @method
  34813. * @memberof Popper.Utils
  34814. * @param {*} input to check
  34815. * @return {Boolean}
  34816. */
  34817. function isNumeric(n) {
  34818. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  34819. }
  34820. /**
  34821. * Set the style to the given popper
  34822. * @method
  34823. * @memberof Popper.Utils
  34824. * @argument {Element} element - Element to apply the style to
  34825. * @argument {Object} styles
  34826. * Object with a list of properties and values which will be applied to the element
  34827. */
  34828. function setStyles(element, styles) {
  34829. Object.keys(styles).forEach(function (prop) {
  34830. var unit = '';
  34831. // add unit if the value is numeric and is one of the following
  34832. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  34833. unit = 'px';
  34834. }
  34835. element.style[prop] = styles[prop] + unit;
  34836. });
  34837. }
  34838. /**
  34839. * Set the attributes to the given popper
  34840. * @method
  34841. * @memberof Popper.Utils
  34842. * @argument {Element} element - Element to apply the attributes to
  34843. * @argument {Object} styles
  34844. * Object with a list of properties and values which will be applied to the element
  34845. */
  34846. function setAttributes(element, attributes) {
  34847. Object.keys(attributes).forEach(function (prop) {
  34848. var value = attributes[prop];
  34849. if (value !== false) {
  34850. element.setAttribute(prop, attributes[prop]);
  34851. } else {
  34852. element.removeAttribute(prop);
  34853. }
  34854. });
  34855. }
  34856. /**
  34857. * @function
  34858. * @memberof Modifiers
  34859. * @argument {Object} data - The data object generated by `update` method
  34860. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  34861. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  34862. * @argument {Object} options - Modifiers configuration and options
  34863. * @returns {Object} The same data object
  34864. */
  34865. function applyStyle(data) {
  34866. // any property present in `data.styles` will be applied to the popper,
  34867. // in this way we can make the 3rd party modifiers add custom styles to it
  34868. // Be aware, modifiers could override the properties defined in the previous
  34869. // lines of this modifier!
  34870. setStyles(data.instance.popper, data.styles);
  34871. // any property present in `data.attributes` will be applied to the popper,
  34872. // they will be set as HTML attributes of the element
  34873. setAttributes(data.instance.popper, data.attributes);
  34874. // if arrowElement is defined and arrowStyles has some properties
  34875. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  34876. setStyles(data.arrowElement, data.arrowStyles);
  34877. }
  34878. return data;
  34879. }
  34880. /**
  34881. * Set the x-placement attribute before everything else because it could be used
  34882. * to add margins to the popper margins needs to be calculated to get the
  34883. * correct popper offsets.
  34884. * @method
  34885. * @memberof Popper.modifiers
  34886. * @param {HTMLElement} reference - The reference element used to position the popper
  34887. * @param {HTMLElement} popper - The HTML element used as popper
  34888. * @param {Object} options - Popper.js options
  34889. */
  34890. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  34891. // compute reference element offsets
  34892. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  34893. // compute auto placement, store placement inside the data object,
  34894. // modifiers will be able to edit `placement` if needed
  34895. // and refer to originalPlacement to know the original value
  34896. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  34897. popper.setAttribute('x-placement', placement);
  34898. // Apply `position` to popper before anything else because
  34899. // without the position applied we can't guarantee correct computations
  34900. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  34901. return options;
  34902. }
  34903. /**
  34904. * @function
  34905. * @memberof Popper.Utils
  34906. * @argument {Object} data - The data object generated by `update` method
  34907. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  34908. * @returns {Object} The popper's position offsets rounded
  34909. *
  34910. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  34911. * good as it can be within reason.
  34912. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  34913. *
  34914. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  34915. * as well on High DPI screens).
  34916. *
  34917. * Firefox prefers no rounding for positioning and does not have blurriness on
  34918. * high DPI screens.
  34919. *
  34920. * Only horizontal placement and left/right values need to be considered.
  34921. */
  34922. function getRoundedOffsets(data, shouldRound) {
  34923. var _data$offsets = data.offsets,
  34924. popper = _data$offsets.popper,
  34925. reference = _data$offsets.reference;
  34926. var round = Math.round,
  34927. floor = Math.floor;
  34928. var noRound = function noRound(v) {
  34929. return v;
  34930. };
  34931. var referenceWidth = round(reference.width);
  34932. var popperWidth = round(popper.width);
  34933. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  34934. var isVariation = data.placement.indexOf('-') !== -1;
  34935. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  34936. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  34937. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  34938. var verticalToInteger = !shouldRound ? noRound : round;
  34939. return {
  34940. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  34941. top: verticalToInteger(popper.top),
  34942. bottom: verticalToInteger(popper.bottom),
  34943. right: horizontalToInteger(popper.right)
  34944. };
  34945. }
  34946. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  34947. /**
  34948. * @function
  34949. * @memberof Modifiers
  34950. * @argument {Object} data - The data object generated by `update` method
  34951. * @argument {Object} options - Modifiers configuration and options
  34952. * @returns {Object} The data object, properly modified
  34953. */
  34954. function computeStyle(data, options) {
  34955. var x = options.x,
  34956. y = options.y;
  34957. var popper = data.offsets.popper;
  34958. // Remove this legacy support in Popper.js v2
  34959. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  34960. return modifier.name === 'applyStyle';
  34961. }).gpuAcceleration;
  34962. if (legacyGpuAccelerationOption !== undefined) {
  34963. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  34964. }
  34965. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  34966. var offsetParent = getOffsetParent(data.instance.popper);
  34967. var offsetParentRect = getBoundingClientRect(offsetParent);
  34968. // Styles
  34969. var styles = {
  34970. position: popper.position
  34971. };
  34972. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  34973. var sideA = x === 'bottom' ? 'top' : 'bottom';
  34974. var sideB = y === 'right' ? 'left' : 'right';
  34975. // if gpuAcceleration is set to `true` and transform is supported,
  34976. // we use `translate3d` to apply the position to the popper we
  34977. // automatically use the supported prefixed version if needed
  34978. var prefixedProperty = getSupportedPropertyName('transform');
  34979. // now, let's make a step back and look at this code closely (wtf?)
  34980. // If the content of the popper grows once it's been positioned, it
  34981. // may happen that the popper gets misplaced because of the new content
  34982. // overflowing its reference element
  34983. // To avoid this problem, we provide two options (x and y), which allow
  34984. // the consumer to define the offset origin.
  34985. // If we position a popper on top of a reference element, we can set
  34986. // `x` to `top` to make the popper grow towards its top instead of
  34987. // its bottom.
  34988. var left = void 0,
  34989. top = void 0;
  34990. if (sideA === 'bottom') {
  34991. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  34992. // and not the bottom of the html element
  34993. if (offsetParent.nodeName === 'HTML') {
  34994. top = -offsetParent.clientHeight + offsets.bottom;
  34995. } else {
  34996. top = -offsetParentRect.height + offsets.bottom;
  34997. }
  34998. } else {
  34999. top = offsets.top;
  35000. }
  35001. if (sideB === 'right') {
  35002. if (offsetParent.nodeName === 'HTML') {
  35003. left = -offsetParent.clientWidth + offsets.right;
  35004. } else {
  35005. left = -offsetParentRect.width + offsets.right;
  35006. }
  35007. } else {
  35008. left = offsets.left;
  35009. }
  35010. if (gpuAcceleration && prefixedProperty) {
  35011. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35012. styles[sideA] = 0;
  35013. styles[sideB] = 0;
  35014. styles.willChange = 'transform';
  35015. } else {
  35016. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35017. var invertTop = sideA === 'bottom' ? -1 : 1;
  35018. var invertLeft = sideB === 'right' ? -1 : 1;
  35019. styles[sideA] = top * invertTop;
  35020. styles[sideB] = left * invertLeft;
  35021. styles.willChange = sideA + ', ' + sideB;
  35022. }
  35023. // Attributes
  35024. var attributes = {
  35025. 'x-placement': data.placement
  35026. };
  35027. // Update `data` attributes, styles and arrowStyles
  35028. data.attributes = _extends({}, attributes, data.attributes);
  35029. data.styles = _extends({}, styles, data.styles);
  35030. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35031. return data;
  35032. }
  35033. /**
  35034. * Helper used to know if the given modifier depends from another one.<br />
  35035. * It checks if the needed modifier is listed and enabled.
  35036. * @method
  35037. * @memberof Popper.Utils
  35038. * @param {Array} modifiers - list of modifiers
  35039. * @param {String} requestingName - name of requesting modifier
  35040. * @param {String} requestedName - name of requested modifier
  35041. * @returns {Boolean}
  35042. */
  35043. function isModifierRequired(modifiers, requestingName, requestedName) {
  35044. var requesting = find(modifiers, function (_ref) {
  35045. var name = _ref.name;
  35046. return name === requestingName;
  35047. });
  35048. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35049. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35050. });
  35051. if (!isRequired) {
  35052. var _requesting = '`' + requestingName + '`';
  35053. var requested = '`' + requestedName + '`';
  35054. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35055. }
  35056. return isRequired;
  35057. }
  35058. /**
  35059. * @function
  35060. * @memberof Modifiers
  35061. * @argument {Object} data - The data object generated by update method
  35062. * @argument {Object} options - Modifiers configuration and options
  35063. * @returns {Object} The data object, properly modified
  35064. */
  35065. function arrow(data, options) {
  35066. var _data$offsets$arrow;
  35067. // arrow depends on keepTogether in order to work
  35068. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35069. return data;
  35070. }
  35071. var arrowElement = options.element;
  35072. // if arrowElement is a string, suppose it's a CSS selector
  35073. if (typeof arrowElement === 'string') {
  35074. arrowElement = data.instance.popper.querySelector(arrowElement);
  35075. // if arrowElement is not found, don't run the modifier
  35076. if (!arrowElement) {
  35077. return data;
  35078. }
  35079. } else {
  35080. // if the arrowElement isn't a query selector we must check that the
  35081. // provided DOM node is child of its popper node
  35082. if (!data.instance.popper.contains(arrowElement)) {
  35083. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35084. return data;
  35085. }
  35086. }
  35087. var placement = data.placement.split('-')[0];
  35088. var _data$offsets = data.offsets,
  35089. popper = _data$offsets.popper,
  35090. reference = _data$offsets.reference;
  35091. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35092. var len = isVertical ? 'height' : 'width';
  35093. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35094. var side = sideCapitalized.toLowerCase();
  35095. var altSide = isVertical ? 'left' : 'top';
  35096. var opSide = isVertical ? 'bottom' : 'right';
  35097. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35098. //
  35099. // extends keepTogether behavior making sure the popper and its
  35100. // reference have enough pixels in conjunction
  35101. //
  35102. // top/left side
  35103. if (reference[opSide] - arrowElementSize < popper[side]) {
  35104. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35105. }
  35106. // bottom/right side
  35107. if (reference[side] + arrowElementSize > popper[opSide]) {
  35108. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35109. }
  35110. data.offsets.popper = getClientRect(data.offsets.popper);
  35111. // compute center of the popper
  35112. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35113. // Compute the sideValue using the updated popper offsets
  35114. // take popper margin in account because we don't have this info available
  35115. var css = getStyleComputedProperty(data.instance.popper);
  35116. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35117. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35118. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35119. // prevent arrowElement from being placed not contiguously to its popper
  35120. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35121. data.arrowElement = arrowElement;
  35122. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35123. return data;
  35124. }
  35125. /**
  35126. * Get the opposite placement variation of the given one
  35127. * @method
  35128. * @memberof Popper.Utils
  35129. * @argument {String} placement variation
  35130. * @returns {String} flipped placement variation
  35131. */
  35132. function getOppositeVariation(variation) {
  35133. if (variation === 'end') {
  35134. return 'start';
  35135. } else if (variation === 'start') {
  35136. return 'end';
  35137. }
  35138. return variation;
  35139. }
  35140. /**
  35141. * List of accepted placements to use as values of the `placement` option.<br />
  35142. * Valid placements are:
  35143. * - `auto`
  35144. * - `top`
  35145. * - `right`
  35146. * - `bottom`
  35147. * - `left`
  35148. *
  35149. * Each placement can have a variation from this list:
  35150. * - `-start`
  35151. * - `-end`
  35152. *
  35153. * Variations are interpreted easily if you think of them as the left to right
  35154. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35155. * is right.<br />
  35156. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35157. *
  35158. * Some valid examples are:
  35159. * - `top-end` (on top of reference, right aligned)
  35160. * - `right-start` (on right of reference, top aligned)
  35161. * - `bottom` (on bottom, centered)
  35162. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35163. *
  35164. * @static
  35165. * @type {Array}
  35166. * @enum {String}
  35167. * @readonly
  35168. * @method placements
  35169. * @memberof Popper
  35170. */
  35171. 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'];
  35172. // Get rid of `auto` `auto-start` and `auto-end`
  35173. var validPlacements = placements.slice(3);
  35174. /**
  35175. * Given an initial placement, returns all the subsequent placements
  35176. * clockwise (or counter-clockwise).
  35177. *
  35178. * @method
  35179. * @memberof Popper.Utils
  35180. * @argument {String} placement - A valid placement (it accepts variations)
  35181. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35182. * @returns {Array} placements including their variations
  35183. */
  35184. function clockwise(placement) {
  35185. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35186. var index = validPlacements.indexOf(placement);
  35187. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35188. return counter ? arr.reverse() : arr;
  35189. }
  35190. var BEHAVIORS = {
  35191. FLIP: 'flip',
  35192. CLOCKWISE: 'clockwise',
  35193. COUNTERCLOCKWISE: 'counterclockwise'
  35194. };
  35195. /**
  35196. * @function
  35197. * @memberof Modifiers
  35198. * @argument {Object} data - The data object generated by update method
  35199. * @argument {Object} options - Modifiers configuration and options
  35200. * @returns {Object} The data object, properly modified
  35201. */
  35202. function flip(data, options) {
  35203. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35204. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35205. return data;
  35206. }
  35207. if (data.flipped && data.placement === data.originalPlacement) {
  35208. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35209. return data;
  35210. }
  35211. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35212. var placement = data.placement.split('-')[0];
  35213. var placementOpposite = getOppositePlacement(placement);
  35214. var variation = data.placement.split('-')[1] || '';
  35215. var flipOrder = [];
  35216. switch (options.behavior) {
  35217. case BEHAVIORS.FLIP:
  35218. flipOrder = [placement, placementOpposite];
  35219. break;
  35220. case BEHAVIORS.CLOCKWISE:
  35221. flipOrder = clockwise(placement);
  35222. break;
  35223. case BEHAVIORS.COUNTERCLOCKWISE:
  35224. flipOrder = clockwise(placement, true);
  35225. break;
  35226. default:
  35227. flipOrder = options.behavior;
  35228. }
  35229. flipOrder.forEach(function (step, index) {
  35230. if (placement !== step || flipOrder.length === index + 1) {
  35231. return data;
  35232. }
  35233. placement = data.placement.split('-')[0];
  35234. placementOpposite = getOppositePlacement(placement);
  35235. var popperOffsets = data.offsets.popper;
  35236. var refOffsets = data.offsets.reference;
  35237. // using floor because the reference offsets may contain decimals we are not going to consider here
  35238. var floor = Math.floor;
  35239. 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);
  35240. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35241. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35242. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35243. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35244. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35245. // flip the variation if required
  35246. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35247. // flips variation if reference element overflows boundaries
  35248. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35249. // flips variation if popper content overflows boundaries
  35250. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35251. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35252. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35253. // this boolean to detect any flip loop
  35254. data.flipped = true;
  35255. if (overlapsRef || overflowsBoundaries) {
  35256. placement = flipOrder[index + 1];
  35257. }
  35258. if (flippedVariation) {
  35259. variation = getOppositeVariation(variation);
  35260. }
  35261. data.placement = placement + (variation ? '-' + variation : '');
  35262. // this object contains `position`, we want to preserve it along with
  35263. // any additional property we may add in the future
  35264. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35265. data = runModifiers(data.instance.modifiers, data, 'flip');
  35266. }
  35267. });
  35268. return data;
  35269. }
  35270. /**
  35271. * @function
  35272. * @memberof Modifiers
  35273. * @argument {Object} data - The data object generated by update method
  35274. * @argument {Object} options - Modifiers configuration and options
  35275. * @returns {Object} The data object, properly modified
  35276. */
  35277. function keepTogether(data) {
  35278. var _data$offsets = data.offsets,
  35279. popper = _data$offsets.popper,
  35280. reference = _data$offsets.reference;
  35281. var placement = data.placement.split('-')[0];
  35282. var floor = Math.floor;
  35283. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35284. var side = isVertical ? 'right' : 'bottom';
  35285. var opSide = isVertical ? 'left' : 'top';
  35286. var measurement = isVertical ? 'width' : 'height';
  35287. if (popper[side] < floor(reference[opSide])) {
  35288. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35289. }
  35290. if (popper[opSide] > floor(reference[side])) {
  35291. data.offsets.popper[opSide] = floor(reference[side]);
  35292. }
  35293. return data;
  35294. }
  35295. /**
  35296. * Converts a string containing value + unit into a px value number
  35297. * @function
  35298. * @memberof {modifiers~offset}
  35299. * @private
  35300. * @argument {String} str - Value + unit string
  35301. * @argument {String} measurement - `height` or `width`
  35302. * @argument {Object} popperOffsets
  35303. * @argument {Object} referenceOffsets
  35304. * @returns {Number|String}
  35305. * Value in pixels, or original string if no values were extracted
  35306. */
  35307. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35308. // separate value from unit
  35309. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35310. var value = +split[1];
  35311. var unit = split[2];
  35312. // If it's not a number it's an operator, I guess
  35313. if (!value) {
  35314. return str;
  35315. }
  35316. if (unit.indexOf('%') === 0) {
  35317. var element = void 0;
  35318. switch (unit) {
  35319. case '%p':
  35320. element = popperOffsets;
  35321. break;
  35322. case '%':
  35323. case '%r':
  35324. default:
  35325. element = referenceOffsets;
  35326. }
  35327. var rect = getClientRect(element);
  35328. return rect[measurement] / 100 * value;
  35329. } else if (unit === 'vh' || unit === 'vw') {
  35330. // if is a vh or vw, we calculate the size based on the viewport
  35331. var size = void 0;
  35332. if (unit === 'vh') {
  35333. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35334. } else {
  35335. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35336. }
  35337. return size / 100 * value;
  35338. } else {
  35339. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35340. // if is an implicit unit, it's px, and we return just the value
  35341. return value;
  35342. }
  35343. }
  35344. /**
  35345. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35346. * @function
  35347. * @memberof {modifiers~offset}
  35348. * @private
  35349. * @argument {String} offset
  35350. * @argument {Object} popperOffsets
  35351. * @argument {Object} referenceOffsets
  35352. * @argument {String} basePlacement
  35353. * @returns {Array} a two cells array with x and y offsets in numbers
  35354. */
  35355. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35356. var offsets = [0, 0];
  35357. // Use height if placement is left or right and index is 0 otherwise use width
  35358. // in this way the first offset will use an axis and the second one
  35359. // will use the other one
  35360. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35361. // Split the offset string to obtain a list of values and operands
  35362. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35363. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35364. return frag.trim();
  35365. });
  35366. // Detect if the offset string contains a pair of values or a single one
  35367. // they could be separated by comma or space
  35368. var divider = fragments.indexOf(find(fragments, function (frag) {
  35369. return frag.search(/,|\s/) !== -1;
  35370. }));
  35371. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35372. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35373. }
  35374. // If divider is found, we divide the list of values and operands to divide
  35375. // them by ofset X and Y.
  35376. var splitRegex = /\s*,\s*|\s+/;
  35377. 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];
  35378. // Convert the values with units to absolute pixels to allow our computations
  35379. ops = ops.map(function (op, index) {
  35380. // Most of the units rely on the orientation of the popper
  35381. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35382. var mergeWithPrevious = false;
  35383. return op
  35384. // This aggregates any `+` or `-` sign that aren't considered operators
  35385. // e.g.: 10 + +5 => [10, +, +5]
  35386. .reduce(function (a, b) {
  35387. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35388. a[a.length - 1] = b;
  35389. mergeWithPrevious = true;
  35390. return a;
  35391. } else if (mergeWithPrevious) {
  35392. a[a.length - 1] += b;
  35393. mergeWithPrevious = false;
  35394. return a;
  35395. } else {
  35396. return a.concat(b);
  35397. }
  35398. }, [])
  35399. // Here we convert the string values into number values (in px)
  35400. .map(function (str) {
  35401. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35402. });
  35403. });
  35404. // Loop trough the offsets arrays and execute the operations
  35405. ops.forEach(function (op, index) {
  35406. op.forEach(function (frag, index2) {
  35407. if (isNumeric(frag)) {
  35408. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35409. }
  35410. });
  35411. });
  35412. return offsets;
  35413. }
  35414. /**
  35415. * @function
  35416. * @memberof Modifiers
  35417. * @argument {Object} data - The data object generated by update method
  35418. * @argument {Object} options - Modifiers configuration and options
  35419. * @argument {Number|String} options.offset=0
  35420. * The offset value as described in the modifier description
  35421. * @returns {Object} The data object, properly modified
  35422. */
  35423. function offset(data, _ref) {
  35424. var offset = _ref.offset;
  35425. var placement = data.placement,
  35426. _data$offsets = data.offsets,
  35427. popper = _data$offsets.popper,
  35428. reference = _data$offsets.reference;
  35429. var basePlacement = placement.split('-')[0];
  35430. var offsets = void 0;
  35431. if (isNumeric(+offset)) {
  35432. offsets = [+offset, 0];
  35433. } else {
  35434. offsets = parseOffset(offset, popper, reference, basePlacement);
  35435. }
  35436. if (basePlacement === 'left') {
  35437. popper.top += offsets[0];
  35438. popper.left -= offsets[1];
  35439. } else if (basePlacement === 'right') {
  35440. popper.top += offsets[0];
  35441. popper.left += offsets[1];
  35442. } else if (basePlacement === 'top') {
  35443. popper.left += offsets[0];
  35444. popper.top -= offsets[1];
  35445. } else if (basePlacement === 'bottom') {
  35446. popper.left += offsets[0];
  35447. popper.top += offsets[1];
  35448. }
  35449. data.popper = popper;
  35450. return data;
  35451. }
  35452. /**
  35453. * @function
  35454. * @memberof Modifiers
  35455. * @argument {Object} data - The data object generated by `update` method
  35456. * @argument {Object} options - Modifiers configuration and options
  35457. * @returns {Object} The data object, properly modified
  35458. */
  35459. function preventOverflow(data, options) {
  35460. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35461. // If offsetParent is the reference element, we really want to
  35462. // go one step up and use the next offsetParent as reference to
  35463. // avoid to make this modifier completely useless and look like broken
  35464. if (data.instance.reference === boundariesElement) {
  35465. boundariesElement = getOffsetParent(boundariesElement);
  35466. }
  35467. // NOTE: DOM access here
  35468. // resets the popper's position so that the document size can be calculated excluding
  35469. // the size of the popper element itself
  35470. var transformProp = getSupportedPropertyName('transform');
  35471. var popperStyles = data.instance.popper.style; // assignment to help minification
  35472. var top = popperStyles.top,
  35473. left = popperStyles.left,
  35474. transform = popperStyles[transformProp];
  35475. popperStyles.top = '';
  35476. popperStyles.left = '';
  35477. popperStyles[transformProp] = '';
  35478. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35479. // NOTE: DOM access here
  35480. // restores the original style properties after the offsets have been computed
  35481. popperStyles.top = top;
  35482. popperStyles.left = left;
  35483. popperStyles[transformProp] = transform;
  35484. options.boundaries = boundaries;
  35485. var order = options.priority;
  35486. var popper = data.offsets.popper;
  35487. var check = {
  35488. primary: function primary(placement) {
  35489. var value = popper[placement];
  35490. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35491. value = Math.max(popper[placement], boundaries[placement]);
  35492. }
  35493. return defineProperty({}, placement, value);
  35494. },
  35495. secondary: function secondary(placement) {
  35496. var mainSide = placement === 'right' ? 'left' : 'top';
  35497. var value = popper[mainSide];
  35498. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35499. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35500. }
  35501. return defineProperty({}, mainSide, value);
  35502. }
  35503. };
  35504. order.forEach(function (placement) {
  35505. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35506. popper = _extends({}, popper, check[side](placement));
  35507. });
  35508. data.offsets.popper = popper;
  35509. return data;
  35510. }
  35511. /**
  35512. * @function
  35513. * @memberof Modifiers
  35514. * @argument {Object} data - The data object generated by `update` method
  35515. * @argument {Object} options - Modifiers configuration and options
  35516. * @returns {Object} The data object, properly modified
  35517. */
  35518. function shift(data) {
  35519. var placement = data.placement;
  35520. var basePlacement = placement.split('-')[0];
  35521. var shiftvariation = placement.split('-')[1];
  35522. // if shift shiftvariation is specified, run the modifier
  35523. if (shiftvariation) {
  35524. var _data$offsets = data.offsets,
  35525. reference = _data$offsets.reference,
  35526. popper = _data$offsets.popper;
  35527. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35528. var side = isVertical ? 'left' : 'top';
  35529. var measurement = isVertical ? 'width' : 'height';
  35530. var shiftOffsets = {
  35531. start: defineProperty({}, side, reference[side]),
  35532. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35533. };
  35534. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35535. }
  35536. return data;
  35537. }
  35538. /**
  35539. * @function
  35540. * @memberof Modifiers
  35541. * @argument {Object} data - The data object generated by update method
  35542. * @argument {Object} options - Modifiers configuration and options
  35543. * @returns {Object} The data object, properly modified
  35544. */
  35545. function hide(data) {
  35546. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35547. return data;
  35548. }
  35549. var refRect = data.offsets.reference;
  35550. var bound = find(data.instance.modifiers, function (modifier) {
  35551. return modifier.name === 'preventOverflow';
  35552. }).boundaries;
  35553. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35554. // Avoid unnecessary DOM access if visibility hasn't changed
  35555. if (data.hide === true) {
  35556. return data;
  35557. }
  35558. data.hide = true;
  35559. data.attributes['x-out-of-boundaries'] = '';
  35560. } else {
  35561. // Avoid unnecessary DOM access if visibility hasn't changed
  35562. if (data.hide === false) {
  35563. return data;
  35564. }
  35565. data.hide = false;
  35566. data.attributes['x-out-of-boundaries'] = false;
  35567. }
  35568. return data;
  35569. }
  35570. /**
  35571. * @function
  35572. * @memberof Modifiers
  35573. * @argument {Object} data - The data object generated by `update` method
  35574. * @argument {Object} options - Modifiers configuration and options
  35575. * @returns {Object} The data object, properly modified
  35576. */
  35577. function inner(data) {
  35578. var placement = data.placement;
  35579. var basePlacement = placement.split('-')[0];
  35580. var _data$offsets = data.offsets,
  35581. popper = _data$offsets.popper,
  35582. reference = _data$offsets.reference;
  35583. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35584. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35585. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35586. data.placement = getOppositePlacement(placement);
  35587. data.offsets.popper = getClientRect(popper);
  35588. return data;
  35589. }
  35590. /**
  35591. * Modifier function, each modifier can have a function of this type assigned
  35592. * to its `fn` property.<br />
  35593. * These functions will be called on each update, this means that you must
  35594. * make sure they are performant enough to avoid performance bottlenecks.
  35595. *
  35596. * @function ModifierFn
  35597. * @argument {dataObject} data - The data object generated by `update` method
  35598. * @argument {Object} options - Modifiers configuration and options
  35599. * @returns {dataObject} The data object, properly modified
  35600. */
  35601. /**
  35602. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35603. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35604. * needed by the library.
  35605. *
  35606. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35607. * All the other properties are configurations that could be tweaked.
  35608. * @namespace modifiers
  35609. */
  35610. var modifiers = {
  35611. /**
  35612. * Modifier used to shift the popper on the start or end of its reference
  35613. * element.<br />
  35614. * It will read the variation of the `placement` property.<br />
  35615. * It can be one either `-end` or `-start`.
  35616. * @memberof modifiers
  35617. * @inner
  35618. */
  35619. shift: {
  35620. /** @prop {number} order=100 - Index used to define the order of execution */
  35621. order: 100,
  35622. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35623. enabled: true,
  35624. /** @prop {ModifierFn} */
  35625. fn: shift
  35626. },
  35627. /**
  35628. * The `offset` modifier can shift your popper on both its axis.
  35629. *
  35630. * It accepts the following units:
  35631. * - `px` or unit-less, interpreted as pixels
  35632. * - `%` or `%r`, percentage relative to the length of the reference element
  35633. * - `%p`, percentage relative to the length of the popper element
  35634. * - `vw`, CSS viewport width unit
  35635. * - `vh`, CSS viewport height unit
  35636. *
  35637. * For length is intended the main axis relative to the placement of the popper.<br />
  35638. * This means that if the placement is `top` or `bottom`, the length will be the
  35639. * `width`. In case of `left` or `right`, it will be the `height`.
  35640. *
  35641. * You can provide a single value (as `Number` or `String`), or a pair of values
  35642. * as `String` divided by a comma or one (or more) white spaces.<br />
  35643. * The latter is a deprecated method because it leads to confusion and will be
  35644. * removed in v2.<br />
  35645. * Additionally, it accepts additions and subtractions between different units.
  35646. * Note that multiplications and divisions aren't supported.
  35647. *
  35648. * Valid examples are:
  35649. * ```
  35650. * 10
  35651. * '10%'
  35652. * '10, 10'
  35653. * '10%, 10'
  35654. * '10 + 10%'
  35655. * '10 - 5vh + 3%'
  35656. * '-10px + 5vh, 5px - 6%'
  35657. * ```
  35658. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35659. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35660. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35661. *
  35662. * @memberof modifiers
  35663. * @inner
  35664. */
  35665. offset: {
  35666. /** @prop {number} order=200 - Index used to define the order of execution */
  35667. order: 200,
  35668. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35669. enabled: true,
  35670. /** @prop {ModifierFn} */
  35671. fn: offset,
  35672. /** @prop {Number|String} offset=0
  35673. * The offset value as described in the modifier description
  35674. */
  35675. offset: 0
  35676. },
  35677. /**
  35678. * Modifier used to prevent the popper from being positioned outside the boundary.
  35679. *
  35680. * A scenario exists where the reference itself is not within the boundaries.<br />
  35681. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35682. * In this case we need to decide whether the popper should either:
  35683. *
  35684. * - detach from the reference and remain "trapped" in the boundaries, or
  35685. * - if it should ignore the boundary and "escape with its reference"
  35686. *
  35687. * When `escapeWithReference` is set to`true` and reference is completely
  35688. * outside its boundaries, the popper will overflow (or completely leave)
  35689. * the boundaries in order to remain attached to the edge of the reference.
  35690. *
  35691. * @memberof modifiers
  35692. * @inner
  35693. */
  35694. preventOverflow: {
  35695. /** @prop {number} order=300 - Index used to define the order of execution */
  35696. order: 300,
  35697. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35698. enabled: true,
  35699. /** @prop {ModifierFn} */
  35700. fn: preventOverflow,
  35701. /**
  35702. * @prop {Array} [priority=['left','right','top','bottom']]
  35703. * Popper will try to prevent overflow following these priorities by default,
  35704. * then, it could overflow on the left and on top of the `boundariesElement`
  35705. */
  35706. priority: ['left', 'right', 'top', 'bottom'],
  35707. /**
  35708. * @prop {number} padding=5
  35709. * Amount of pixel used to define a minimum distance between the boundaries
  35710. * and the popper. This makes sure the popper always has a little padding
  35711. * between the edges of its container
  35712. */
  35713. padding: 5,
  35714. /**
  35715. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35716. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35717. * `viewport` or any DOM element.
  35718. */
  35719. boundariesElement: 'scrollParent'
  35720. },
  35721. /**
  35722. * Modifier used to make sure the reference and its popper stay near each other
  35723. * without leaving any gap between the two. Especially useful when the arrow is
  35724. * enabled and you want to ensure that it points to its reference element.
  35725. * It cares only about the first axis. You can still have poppers with margin
  35726. * between the popper and its reference element.
  35727. * @memberof modifiers
  35728. * @inner
  35729. */
  35730. keepTogether: {
  35731. /** @prop {number} order=400 - Index used to define the order of execution */
  35732. order: 400,
  35733. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35734. enabled: true,
  35735. /** @prop {ModifierFn} */
  35736. fn: keepTogether
  35737. },
  35738. /**
  35739. * This modifier is used to move the `arrowElement` of the popper to make
  35740. * sure it is positioned between the reference element and its popper element.
  35741. * It will read the outer size of the `arrowElement` node to detect how many
  35742. * pixels of conjunction are needed.
  35743. *
  35744. * It has no effect if no `arrowElement` is provided.
  35745. * @memberof modifiers
  35746. * @inner
  35747. */
  35748. arrow: {
  35749. /** @prop {number} order=500 - Index used to define the order of execution */
  35750. order: 500,
  35751. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35752. enabled: true,
  35753. /** @prop {ModifierFn} */
  35754. fn: arrow,
  35755. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35756. element: '[x-arrow]'
  35757. },
  35758. /**
  35759. * Modifier used to flip the popper's placement when it starts to overlap its
  35760. * reference element.
  35761. *
  35762. * Requires the `preventOverflow` modifier before it in order to work.
  35763. *
  35764. * **NOTE:** this modifier will interrupt the current update cycle and will
  35765. * restart it if it detects the need to flip the placement.
  35766. * @memberof modifiers
  35767. * @inner
  35768. */
  35769. flip: {
  35770. /** @prop {number} order=600 - Index used to define the order of execution */
  35771. order: 600,
  35772. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35773. enabled: true,
  35774. /** @prop {ModifierFn} */
  35775. fn: flip,
  35776. /**
  35777. * @prop {String|Array} behavior='flip'
  35778. * The behavior used to change the popper's placement. It can be one of
  35779. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35780. * placements (with optional variations)
  35781. */
  35782. behavior: 'flip',
  35783. /**
  35784. * @prop {number} padding=5
  35785. * The popper will flip if it hits the edges of the `boundariesElement`
  35786. */
  35787. padding: 5,
  35788. /**
  35789. * @prop {String|HTMLElement} boundariesElement='viewport'
  35790. * The element which will define the boundaries of the popper position.
  35791. * The popper will never be placed outside of the defined boundaries
  35792. * (except if `keepTogether` is enabled)
  35793. */
  35794. boundariesElement: 'viewport',
  35795. /**
  35796. * @prop {Boolean} flipVariations=false
  35797. * The popper will switch placement variation between `-start` and `-end` when
  35798. * the reference element overlaps its boundaries.
  35799. *
  35800. * The original placement should have a set variation.
  35801. */
  35802. flipVariations: false,
  35803. /**
  35804. * @prop {Boolean} flipVariationsByContent=false
  35805. * The popper will switch placement variation between `-start` and `-end` when
  35806. * the popper element overlaps its reference boundaries.
  35807. *
  35808. * The original placement should have a set variation.
  35809. */
  35810. flipVariationsByContent: false
  35811. },
  35812. /**
  35813. * Modifier used to make the popper flow toward the inner of the reference element.
  35814. * By default, when this modifier is disabled, the popper will be placed outside
  35815. * the reference element.
  35816. * @memberof modifiers
  35817. * @inner
  35818. */
  35819. inner: {
  35820. /** @prop {number} order=700 - Index used to define the order of execution */
  35821. order: 700,
  35822. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  35823. enabled: false,
  35824. /** @prop {ModifierFn} */
  35825. fn: inner
  35826. },
  35827. /**
  35828. * Modifier used to hide the popper when its reference element is outside of the
  35829. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  35830. * be used to hide with a CSS selector the popper when its reference is
  35831. * out of boundaries.
  35832. *
  35833. * Requires the `preventOverflow` modifier before it in order to work.
  35834. * @memberof modifiers
  35835. * @inner
  35836. */
  35837. hide: {
  35838. /** @prop {number} order=800 - Index used to define the order of execution */
  35839. order: 800,
  35840. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35841. enabled: true,
  35842. /** @prop {ModifierFn} */
  35843. fn: hide
  35844. },
  35845. /**
  35846. * Computes the style that will be applied to the popper element to gets
  35847. * properly positioned.
  35848. *
  35849. * Note that this modifier will not touch the DOM, it just prepares the styles
  35850. * so that `applyStyle` modifier can apply it. This separation is useful
  35851. * in case you need to replace `applyStyle` with a custom implementation.
  35852. *
  35853. * This modifier has `850` as `order` value to maintain backward compatibility
  35854. * with previous versions of Popper.js. Expect the modifiers ordering method
  35855. * to change in future major versions of the library.
  35856. *
  35857. * @memberof modifiers
  35858. * @inner
  35859. */
  35860. computeStyle: {
  35861. /** @prop {number} order=850 - Index used to define the order of execution */
  35862. order: 850,
  35863. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35864. enabled: true,
  35865. /** @prop {ModifierFn} */
  35866. fn: computeStyle,
  35867. /**
  35868. * @prop {Boolean} gpuAcceleration=true
  35869. * If true, it uses the CSS 3D transformation to position the popper.
  35870. * Otherwise, it will use the `top` and `left` properties
  35871. */
  35872. gpuAcceleration: true,
  35873. /**
  35874. * @prop {string} [x='bottom']
  35875. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  35876. * Change this if your popper should grow in a direction different from `bottom`
  35877. */
  35878. x: 'bottom',
  35879. /**
  35880. * @prop {string} [x='left']
  35881. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  35882. * Change this if your popper should grow in a direction different from `right`
  35883. */
  35884. y: 'right'
  35885. },
  35886. /**
  35887. * Applies the computed styles to the popper element.
  35888. *
  35889. * All the DOM manipulations are limited to this modifier. This is useful in case
  35890. * you want to integrate Popper.js inside a framework or view library and you
  35891. * want to delegate all the DOM manipulations to it.
  35892. *
  35893. * Note that if you disable this modifier, you must make sure the popper element
  35894. * has its position set to `absolute` before Popper.js can do its work!
  35895. *
  35896. * Just disable this modifier and define your own to achieve the desired effect.
  35897. *
  35898. * @memberof modifiers
  35899. * @inner
  35900. */
  35901. applyStyle: {
  35902. /** @prop {number} order=900 - Index used to define the order of execution */
  35903. order: 900,
  35904. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35905. enabled: true,
  35906. /** @prop {ModifierFn} */
  35907. fn: applyStyle,
  35908. /** @prop {Function} */
  35909. onLoad: applyStyleOnLoad,
  35910. /**
  35911. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  35912. * @prop {Boolean} gpuAcceleration=true
  35913. * If true, it uses the CSS 3D transformation to position the popper.
  35914. * Otherwise, it will use the `top` and `left` properties
  35915. */
  35916. gpuAcceleration: undefined
  35917. }
  35918. };
  35919. /**
  35920. * The `dataObject` is an object containing all the information used by Popper.js.
  35921. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  35922. * @name dataObject
  35923. * @property {Object} data.instance The Popper.js instance
  35924. * @property {String} data.placement Placement applied to popper
  35925. * @property {String} data.originalPlacement Placement originally defined on init
  35926. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  35927. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  35928. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  35929. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  35930. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  35931. * @property {Object} data.boundaries Offsets of the popper boundaries
  35932. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  35933. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  35934. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  35935. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  35936. */
  35937. /**
  35938. * Default options provided to Popper.js constructor.<br />
  35939. * These can be overridden using the `options` argument of Popper.js.<br />
  35940. * To override an option, simply pass an object with the same
  35941. * structure of the `options` object, as the 3rd argument. For example:
  35942. * ```
  35943. * new Popper(ref, pop, {
  35944. * modifiers: {
  35945. * preventOverflow: { enabled: false }
  35946. * }
  35947. * })
  35948. * ```
  35949. * @type {Object}
  35950. * @static
  35951. * @memberof Popper
  35952. */
  35953. var Defaults = {
  35954. /**
  35955. * Popper's placement.
  35956. * @prop {Popper.placements} placement='bottom'
  35957. */
  35958. placement: 'bottom',
  35959. /**
  35960. * Set this to true if you want popper to position it self in 'fixed' mode
  35961. * @prop {Boolean} positionFixed=false
  35962. */
  35963. positionFixed: false,
  35964. /**
  35965. * Whether events (resize, scroll) are initially enabled.
  35966. * @prop {Boolean} eventsEnabled=true
  35967. */
  35968. eventsEnabled: true,
  35969. /**
  35970. * Set to true if you want to automatically remove the popper when
  35971. * you call the `destroy` method.
  35972. * @prop {Boolean} removeOnDestroy=false
  35973. */
  35974. removeOnDestroy: false,
  35975. /**
  35976. * Callback called when the popper is created.<br />
  35977. * By default, it is set to no-op.<br />
  35978. * Access Popper.js instance with `data.instance`.
  35979. * @prop {onCreate}
  35980. */
  35981. onCreate: function onCreate() {},
  35982. /**
  35983. * Callback called when the popper is updated. This callback is not called
  35984. * on the initialization/creation of the popper, but only on subsequent
  35985. * updates.<br />
  35986. * By default, it is set to no-op.<br />
  35987. * Access Popper.js instance with `data.instance`.
  35988. * @prop {onUpdate}
  35989. */
  35990. onUpdate: function onUpdate() {},
  35991. /**
  35992. * List of modifiers used to modify the offsets before they are applied to the popper.
  35993. * They provide most of the functionalities of Popper.js.
  35994. * @prop {modifiers}
  35995. */
  35996. modifiers: modifiers
  35997. };
  35998. /**
  35999. * @callback onCreate
  36000. * @param {dataObject} data
  36001. */
  36002. /**
  36003. * @callback onUpdate
  36004. * @param {dataObject} data
  36005. */
  36006. // Utils
  36007. // Methods
  36008. var Popper = function () {
  36009. /**
  36010. * Creates a new Popper.js instance.
  36011. * @class Popper
  36012. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36013. * @param {Element} popper - The HTML / XML element used as the popper
  36014. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36015. * @return {Object} instance - The generated Popper.js instance
  36016. */
  36017. function Popper(reference, popper) {
  36018. var _this = this;
  36019. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36020. classCallCheck(this, Popper);
  36021. this.scheduleUpdate = function () {
  36022. return requestAnimationFrame(_this.update);
  36023. };
  36024. // make update() debounced, so that it only runs at most once-per-tick
  36025. this.update = debounce(this.update.bind(this));
  36026. // with {} we create a new object with the options inside it
  36027. this.options = _extends({}, Popper.Defaults, options);
  36028. // init state
  36029. this.state = {
  36030. isDestroyed: false,
  36031. isCreated: false,
  36032. scrollParents: []
  36033. };
  36034. // get reference and popper elements (allow jQuery wrappers)
  36035. this.reference = reference && reference.jquery ? reference[0] : reference;
  36036. this.popper = popper && popper.jquery ? popper[0] : popper;
  36037. // Deep merge modifiers options
  36038. this.options.modifiers = {};
  36039. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36040. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36041. });
  36042. // Refactoring modifiers' list (Object => Array)
  36043. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36044. return _extends({
  36045. name: name
  36046. }, _this.options.modifiers[name]);
  36047. })
  36048. // sort the modifiers by order
  36049. .sort(function (a, b) {
  36050. return a.order - b.order;
  36051. });
  36052. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36053. // such code is executed in the same order of its modifier
  36054. // they could add new properties to their options configuration
  36055. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36056. this.modifiers.forEach(function (modifierOptions) {
  36057. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36058. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36059. }
  36060. });
  36061. // fire the first update to position the popper in the right place
  36062. this.update();
  36063. var eventsEnabled = this.options.eventsEnabled;
  36064. if (eventsEnabled) {
  36065. // setup event listeners, they will take care of update the position in specific situations
  36066. this.enableEventListeners();
  36067. }
  36068. this.state.eventsEnabled = eventsEnabled;
  36069. }
  36070. // We can't use class properties because they don't get listed in the
  36071. // class prototype and break stuff like Sinon stubs
  36072. createClass(Popper, [{
  36073. key: 'update',
  36074. value: function update$$1() {
  36075. return update.call(this);
  36076. }
  36077. }, {
  36078. key: 'destroy',
  36079. value: function destroy$$1() {
  36080. return destroy.call(this);
  36081. }
  36082. }, {
  36083. key: 'enableEventListeners',
  36084. value: function enableEventListeners$$1() {
  36085. return enableEventListeners.call(this);
  36086. }
  36087. }, {
  36088. key: 'disableEventListeners',
  36089. value: function disableEventListeners$$1() {
  36090. return disableEventListeners.call(this);
  36091. }
  36092. /**
  36093. * Schedules an update. It will run on the next UI update available.
  36094. * @method scheduleUpdate
  36095. * @memberof Popper
  36096. */
  36097. /**
  36098. * Collection of utilities useful when writing custom modifiers.
  36099. * Starting from version 1.7, this method is available only if you
  36100. * include `popper-utils.js` before `popper.js`.
  36101. *
  36102. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36103. * and will be removed in v2! Use the PopperUtils module directly instead.
  36104. * Due to the high instability of the methods contained in Utils, we can't
  36105. * guarantee them to follow semver. Use them at your own risk!
  36106. * @static
  36107. * @private
  36108. * @type {Object}
  36109. * @deprecated since version 1.8
  36110. * @member Utils
  36111. * @memberof Popper
  36112. */
  36113. }]);
  36114. return Popper;
  36115. }();
  36116. /**
  36117. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36118. * and lets you use it as replacement of a real DOM node.<br />
  36119. * You can use this method to position a popper relatively to a set of coordinates
  36120. * in case you don't have a DOM node to use as reference.
  36121. *
  36122. * ```
  36123. * new Popper(referenceObject, popperNode);
  36124. * ```
  36125. *
  36126. * NB: This feature isn't supported in Internet Explorer 10.
  36127. * @name referenceObject
  36128. * @property {Function} data.getBoundingClientRect
  36129. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36130. * @property {number} data.clientWidth
  36131. * An ES6 getter that will return the width of the virtual reference element.
  36132. * @property {number} data.clientHeight
  36133. * An ES6 getter that will return the height of the virtual reference element.
  36134. */
  36135. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36136. Popper.placements = placements;
  36137. Popper.Defaults = Defaults;
  36138. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36139. //# sourceMappingURL=popper.js.map
  36140. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36141. /***/ }),
  36142. /***/ "./node_modules/process/browser.js":
  36143. /*!*****************************************!*\
  36144. !*** ./node_modules/process/browser.js ***!
  36145. \*****************************************/
  36146. /*! no static exports found */
  36147. /***/ (function(module, exports) {
  36148. // shim for using process in browser
  36149. var process = module.exports = {};
  36150. // cached from whatever global is present so that test runners that stub it
  36151. // don't break things. But we need to wrap it in a try catch in case it is
  36152. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36153. // function because try/catches deoptimize in certain engines.
  36154. var cachedSetTimeout;
  36155. var cachedClearTimeout;
  36156. function defaultSetTimout() {
  36157. throw new Error('setTimeout has not been defined');
  36158. }
  36159. function defaultClearTimeout () {
  36160. throw new Error('clearTimeout has not been defined');
  36161. }
  36162. (function () {
  36163. try {
  36164. if (typeof setTimeout === 'function') {
  36165. cachedSetTimeout = setTimeout;
  36166. } else {
  36167. cachedSetTimeout = defaultSetTimout;
  36168. }
  36169. } catch (e) {
  36170. cachedSetTimeout = defaultSetTimout;
  36171. }
  36172. try {
  36173. if (typeof clearTimeout === 'function') {
  36174. cachedClearTimeout = clearTimeout;
  36175. } else {
  36176. cachedClearTimeout = defaultClearTimeout;
  36177. }
  36178. } catch (e) {
  36179. cachedClearTimeout = defaultClearTimeout;
  36180. }
  36181. } ())
  36182. function runTimeout(fun) {
  36183. if (cachedSetTimeout === setTimeout) {
  36184. //normal enviroments in sane situations
  36185. return setTimeout(fun, 0);
  36186. }
  36187. // if setTimeout wasn't available but was latter defined
  36188. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36189. cachedSetTimeout = setTimeout;
  36190. return setTimeout(fun, 0);
  36191. }
  36192. try {
  36193. // when when somebody has screwed with setTimeout but no I.E. maddness
  36194. return cachedSetTimeout(fun, 0);
  36195. } catch(e){
  36196. try {
  36197. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36198. return cachedSetTimeout.call(null, fun, 0);
  36199. } catch(e){
  36200. // 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
  36201. return cachedSetTimeout.call(this, fun, 0);
  36202. }
  36203. }
  36204. }
  36205. function runClearTimeout(marker) {
  36206. if (cachedClearTimeout === clearTimeout) {
  36207. //normal enviroments in sane situations
  36208. return clearTimeout(marker);
  36209. }
  36210. // if clearTimeout wasn't available but was latter defined
  36211. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36212. cachedClearTimeout = clearTimeout;
  36213. return clearTimeout(marker);
  36214. }
  36215. try {
  36216. // when when somebody has screwed with setTimeout but no I.E. maddness
  36217. return cachedClearTimeout(marker);
  36218. } catch (e){
  36219. try {
  36220. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36221. return cachedClearTimeout.call(null, marker);
  36222. } catch (e){
  36223. // 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.
  36224. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36225. return cachedClearTimeout.call(this, marker);
  36226. }
  36227. }
  36228. }
  36229. var queue = [];
  36230. var draining = false;
  36231. var currentQueue;
  36232. var queueIndex = -1;
  36233. function cleanUpNextTick() {
  36234. if (!draining || !currentQueue) {
  36235. return;
  36236. }
  36237. draining = false;
  36238. if (currentQueue.length) {
  36239. queue = currentQueue.concat(queue);
  36240. } else {
  36241. queueIndex = -1;
  36242. }
  36243. if (queue.length) {
  36244. drainQueue();
  36245. }
  36246. }
  36247. function drainQueue() {
  36248. if (draining) {
  36249. return;
  36250. }
  36251. var timeout = runTimeout(cleanUpNextTick);
  36252. draining = true;
  36253. var len = queue.length;
  36254. while(len) {
  36255. currentQueue = queue;
  36256. queue = [];
  36257. while (++queueIndex < len) {
  36258. if (currentQueue) {
  36259. currentQueue[queueIndex].run();
  36260. }
  36261. }
  36262. queueIndex = -1;
  36263. len = queue.length;
  36264. }
  36265. currentQueue = null;
  36266. draining = false;
  36267. runClearTimeout(timeout);
  36268. }
  36269. process.nextTick = function (fun) {
  36270. var args = new Array(arguments.length - 1);
  36271. if (arguments.length > 1) {
  36272. for (var i = 1; i < arguments.length; i++) {
  36273. args[i - 1] = arguments[i];
  36274. }
  36275. }
  36276. queue.push(new Item(fun, args));
  36277. if (queue.length === 1 && !draining) {
  36278. runTimeout(drainQueue);
  36279. }
  36280. };
  36281. // v8 likes predictible objects
  36282. function Item(fun, array) {
  36283. this.fun = fun;
  36284. this.array = array;
  36285. }
  36286. Item.prototype.run = function () {
  36287. this.fun.apply(null, this.array);
  36288. };
  36289. process.title = 'browser';
  36290. process.browser = true;
  36291. process.env = {};
  36292. process.argv = [];
  36293. process.version = ''; // empty string to avoid regexp issues
  36294. process.versions = {};
  36295. function noop() {}
  36296. process.on = noop;
  36297. process.addListener = noop;
  36298. process.once = noop;
  36299. process.off = noop;
  36300. process.removeListener = noop;
  36301. process.removeAllListeners = noop;
  36302. process.emit = noop;
  36303. process.prependListener = noop;
  36304. process.prependOnceListener = noop;
  36305. process.listeners = function (name) { return [] }
  36306. process.binding = function (name) {
  36307. throw new Error('process.binding is not supported');
  36308. };
  36309. process.cwd = function () { return '/' };
  36310. process.chdir = function (dir) {
  36311. throw new Error('process.chdir is not supported');
  36312. };
  36313. process.umask = function() { return 0; };
  36314. /***/ }),
  36315. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36316. /*!***************************************************!*\
  36317. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36318. \***************************************************/
  36319. /*! no static exports found */
  36320. /***/ (function(module, exports, __webpack_require__) {
  36321. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36322. * Pusher JavaScript Library v5.0.3
  36323. * https://pusher.com/
  36324. *
  36325. * Copyright 2017, Pusher
  36326. * Released under the MIT licence.
  36327. */
  36328. (function webpackUniversalModuleDefinition(root, factory) {
  36329. if(true)
  36330. module.exports = factory();
  36331. else {}
  36332. })(window, function() {
  36333. return /******/ (function(modules) { // webpackBootstrap
  36334. /******/ // The module cache
  36335. /******/ var installedModules = {};
  36336. /******/
  36337. /******/ // The require function
  36338. /******/ function __webpack_require__(moduleId) {
  36339. /******/
  36340. /******/ // Check if module is in cache
  36341. /******/ if(installedModules[moduleId]) {
  36342. /******/ return installedModules[moduleId].exports;
  36343. /******/ }
  36344. /******/ // Create a new module (and put it into the cache)
  36345. /******/ var module = installedModules[moduleId] = {
  36346. /******/ i: moduleId,
  36347. /******/ l: false,
  36348. /******/ exports: {}
  36349. /******/ };
  36350. /******/
  36351. /******/ // Execute the module function
  36352. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36353. /******/
  36354. /******/ // Flag the module as loaded
  36355. /******/ module.l = true;
  36356. /******/
  36357. /******/ // Return the exports of the module
  36358. /******/ return module.exports;
  36359. /******/ }
  36360. /******/
  36361. /******/
  36362. /******/ // expose the modules object (__webpack_modules__)
  36363. /******/ __webpack_require__.m = modules;
  36364. /******/
  36365. /******/ // expose the module cache
  36366. /******/ __webpack_require__.c = installedModules;
  36367. /******/
  36368. /******/ // define getter function for harmony exports
  36369. /******/ __webpack_require__.d = function(exports, name, getter) {
  36370. /******/ if(!__webpack_require__.o(exports, name)) {
  36371. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36372. /******/ }
  36373. /******/ };
  36374. /******/
  36375. /******/ // define __esModule on exports
  36376. /******/ __webpack_require__.r = function(exports) {
  36377. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36378. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36379. /******/ }
  36380. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36381. /******/ };
  36382. /******/
  36383. /******/ // create a fake namespace object
  36384. /******/ // mode & 1: value is a module id, require it
  36385. /******/ // mode & 2: merge all properties of value into the ns
  36386. /******/ // mode & 4: return value when already ns object
  36387. /******/ // mode & 8|1: behave like require
  36388. /******/ __webpack_require__.t = function(value, mode) {
  36389. /******/ if(mode & 1) value = __webpack_require__(value);
  36390. /******/ if(mode & 8) return value;
  36391. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36392. /******/ var ns = Object.create(null);
  36393. /******/ __webpack_require__.r(ns);
  36394. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36395. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36396. /******/ return ns;
  36397. /******/ };
  36398. /******/
  36399. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36400. /******/ __webpack_require__.n = function(module) {
  36401. /******/ var getter = module && module.__esModule ?
  36402. /******/ function getDefault() { return module['default']; } :
  36403. /******/ function getModuleExports() { return module; };
  36404. /******/ __webpack_require__.d(getter, 'a', getter);
  36405. /******/ return getter;
  36406. /******/ };
  36407. /******/
  36408. /******/ // Object.prototype.hasOwnProperty.call
  36409. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36410. /******/
  36411. /******/ // __webpack_public_path__
  36412. /******/ __webpack_require__.p = "";
  36413. /******/
  36414. /******/
  36415. /******/ // Load entry module and return exports
  36416. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36417. /******/ })
  36418. /************************************************************************/
  36419. /******/ ([
  36420. /* 0 */
  36421. /***/ (function(module, exports, __webpack_require__) {
  36422. (function(nacl) {
  36423. 'use strict';
  36424. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36425. // Public domain.
  36426. //
  36427. // Implementation derived from TweetNaCl version 20140427.
  36428. // See for details: http://tweetnacl.cr.yp.to/
  36429. var gf = function(init) {
  36430. var i, r = new Float64Array(16);
  36431. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36432. return r;
  36433. };
  36434. // Pluggable, initialized in high-level API below.
  36435. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36436. var _0 = new Uint8Array(16);
  36437. var _9 = new Uint8Array(32); _9[0] = 9;
  36438. var gf0 = gf(),
  36439. gf1 = gf([1]),
  36440. _121665 = gf([0xdb41, 1]),
  36441. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36442. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36443. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36444. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36445. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36446. function ts64(x, i, h, l) {
  36447. x[i] = (h >> 24) & 0xff;
  36448. x[i+1] = (h >> 16) & 0xff;
  36449. x[i+2] = (h >> 8) & 0xff;
  36450. x[i+3] = h & 0xff;
  36451. x[i+4] = (l >> 24) & 0xff;
  36452. x[i+5] = (l >> 16) & 0xff;
  36453. x[i+6] = (l >> 8) & 0xff;
  36454. x[i+7] = l & 0xff;
  36455. }
  36456. function vn(x, xi, y, yi, n) {
  36457. var i,d = 0;
  36458. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36459. return (1 & ((d - 1) >>> 8)) - 1;
  36460. }
  36461. function crypto_verify_16(x, xi, y, yi) {
  36462. return vn(x,xi,y,yi,16);
  36463. }
  36464. function crypto_verify_32(x, xi, y, yi) {
  36465. return vn(x,xi,y,yi,32);
  36466. }
  36467. function core_salsa20(o, p, k, c) {
  36468. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36469. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36470. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36471. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36472. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36473. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36474. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36475. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36476. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36477. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36478. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36479. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36480. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36481. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36482. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36483. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36484. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36485. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36486. x15 = j15, u;
  36487. for (var i = 0; i < 20; i += 2) {
  36488. u = x0 + x12 | 0;
  36489. x4 ^= u<<7 | u>>>(32-7);
  36490. u = x4 + x0 | 0;
  36491. x8 ^= u<<9 | u>>>(32-9);
  36492. u = x8 + x4 | 0;
  36493. x12 ^= u<<13 | u>>>(32-13);
  36494. u = x12 + x8 | 0;
  36495. x0 ^= u<<18 | u>>>(32-18);
  36496. u = x5 + x1 | 0;
  36497. x9 ^= u<<7 | u>>>(32-7);
  36498. u = x9 + x5 | 0;
  36499. x13 ^= u<<9 | u>>>(32-9);
  36500. u = x13 + x9 | 0;
  36501. x1 ^= u<<13 | u>>>(32-13);
  36502. u = x1 + x13 | 0;
  36503. x5 ^= u<<18 | u>>>(32-18);
  36504. u = x10 + x6 | 0;
  36505. x14 ^= u<<7 | u>>>(32-7);
  36506. u = x14 + x10 | 0;
  36507. x2 ^= u<<9 | u>>>(32-9);
  36508. u = x2 + x14 | 0;
  36509. x6 ^= u<<13 | u>>>(32-13);
  36510. u = x6 + x2 | 0;
  36511. x10 ^= u<<18 | u>>>(32-18);
  36512. u = x15 + x11 | 0;
  36513. x3 ^= u<<7 | u>>>(32-7);
  36514. u = x3 + x15 | 0;
  36515. x7 ^= u<<9 | u>>>(32-9);
  36516. u = x7 + x3 | 0;
  36517. x11 ^= u<<13 | u>>>(32-13);
  36518. u = x11 + x7 | 0;
  36519. x15 ^= u<<18 | u>>>(32-18);
  36520. u = x0 + x3 | 0;
  36521. x1 ^= u<<7 | u>>>(32-7);
  36522. u = x1 + x0 | 0;
  36523. x2 ^= u<<9 | u>>>(32-9);
  36524. u = x2 + x1 | 0;
  36525. x3 ^= u<<13 | u>>>(32-13);
  36526. u = x3 + x2 | 0;
  36527. x0 ^= u<<18 | u>>>(32-18);
  36528. u = x5 + x4 | 0;
  36529. x6 ^= u<<7 | u>>>(32-7);
  36530. u = x6 + x5 | 0;
  36531. x7 ^= u<<9 | u>>>(32-9);
  36532. u = x7 + x6 | 0;
  36533. x4 ^= u<<13 | u>>>(32-13);
  36534. u = x4 + x7 | 0;
  36535. x5 ^= u<<18 | u>>>(32-18);
  36536. u = x10 + x9 | 0;
  36537. x11 ^= u<<7 | u>>>(32-7);
  36538. u = x11 + x10 | 0;
  36539. x8 ^= u<<9 | u>>>(32-9);
  36540. u = x8 + x11 | 0;
  36541. x9 ^= u<<13 | u>>>(32-13);
  36542. u = x9 + x8 | 0;
  36543. x10 ^= u<<18 | u>>>(32-18);
  36544. u = x15 + x14 | 0;
  36545. x12 ^= u<<7 | u>>>(32-7);
  36546. u = x12 + x15 | 0;
  36547. x13 ^= u<<9 | u>>>(32-9);
  36548. u = x13 + x12 | 0;
  36549. x14 ^= u<<13 | u>>>(32-13);
  36550. u = x14 + x13 | 0;
  36551. x15 ^= u<<18 | u>>>(32-18);
  36552. }
  36553. x0 = x0 + j0 | 0;
  36554. x1 = x1 + j1 | 0;
  36555. x2 = x2 + j2 | 0;
  36556. x3 = x3 + j3 | 0;
  36557. x4 = x4 + j4 | 0;
  36558. x5 = x5 + j5 | 0;
  36559. x6 = x6 + j6 | 0;
  36560. x7 = x7 + j7 | 0;
  36561. x8 = x8 + j8 | 0;
  36562. x9 = x9 + j9 | 0;
  36563. x10 = x10 + j10 | 0;
  36564. x11 = x11 + j11 | 0;
  36565. x12 = x12 + j12 | 0;
  36566. x13 = x13 + j13 | 0;
  36567. x14 = x14 + j14 | 0;
  36568. x15 = x15 + j15 | 0;
  36569. o[ 0] = x0 >>> 0 & 0xff;
  36570. o[ 1] = x0 >>> 8 & 0xff;
  36571. o[ 2] = x0 >>> 16 & 0xff;
  36572. o[ 3] = x0 >>> 24 & 0xff;
  36573. o[ 4] = x1 >>> 0 & 0xff;
  36574. o[ 5] = x1 >>> 8 & 0xff;
  36575. o[ 6] = x1 >>> 16 & 0xff;
  36576. o[ 7] = x1 >>> 24 & 0xff;
  36577. o[ 8] = x2 >>> 0 & 0xff;
  36578. o[ 9] = x2 >>> 8 & 0xff;
  36579. o[10] = x2 >>> 16 & 0xff;
  36580. o[11] = x2 >>> 24 & 0xff;
  36581. o[12] = x3 >>> 0 & 0xff;
  36582. o[13] = x3 >>> 8 & 0xff;
  36583. o[14] = x3 >>> 16 & 0xff;
  36584. o[15] = x3 >>> 24 & 0xff;
  36585. o[16] = x4 >>> 0 & 0xff;
  36586. o[17] = x4 >>> 8 & 0xff;
  36587. o[18] = x4 >>> 16 & 0xff;
  36588. o[19] = x4 >>> 24 & 0xff;
  36589. o[20] = x5 >>> 0 & 0xff;
  36590. o[21] = x5 >>> 8 & 0xff;
  36591. o[22] = x5 >>> 16 & 0xff;
  36592. o[23] = x5 >>> 24 & 0xff;
  36593. o[24] = x6 >>> 0 & 0xff;
  36594. o[25] = x6 >>> 8 & 0xff;
  36595. o[26] = x6 >>> 16 & 0xff;
  36596. o[27] = x6 >>> 24 & 0xff;
  36597. o[28] = x7 >>> 0 & 0xff;
  36598. o[29] = x7 >>> 8 & 0xff;
  36599. o[30] = x7 >>> 16 & 0xff;
  36600. o[31] = x7 >>> 24 & 0xff;
  36601. o[32] = x8 >>> 0 & 0xff;
  36602. o[33] = x8 >>> 8 & 0xff;
  36603. o[34] = x8 >>> 16 & 0xff;
  36604. o[35] = x8 >>> 24 & 0xff;
  36605. o[36] = x9 >>> 0 & 0xff;
  36606. o[37] = x9 >>> 8 & 0xff;
  36607. o[38] = x9 >>> 16 & 0xff;
  36608. o[39] = x9 >>> 24 & 0xff;
  36609. o[40] = x10 >>> 0 & 0xff;
  36610. o[41] = x10 >>> 8 & 0xff;
  36611. o[42] = x10 >>> 16 & 0xff;
  36612. o[43] = x10 >>> 24 & 0xff;
  36613. o[44] = x11 >>> 0 & 0xff;
  36614. o[45] = x11 >>> 8 & 0xff;
  36615. o[46] = x11 >>> 16 & 0xff;
  36616. o[47] = x11 >>> 24 & 0xff;
  36617. o[48] = x12 >>> 0 & 0xff;
  36618. o[49] = x12 >>> 8 & 0xff;
  36619. o[50] = x12 >>> 16 & 0xff;
  36620. o[51] = x12 >>> 24 & 0xff;
  36621. o[52] = x13 >>> 0 & 0xff;
  36622. o[53] = x13 >>> 8 & 0xff;
  36623. o[54] = x13 >>> 16 & 0xff;
  36624. o[55] = x13 >>> 24 & 0xff;
  36625. o[56] = x14 >>> 0 & 0xff;
  36626. o[57] = x14 >>> 8 & 0xff;
  36627. o[58] = x14 >>> 16 & 0xff;
  36628. o[59] = x14 >>> 24 & 0xff;
  36629. o[60] = x15 >>> 0 & 0xff;
  36630. o[61] = x15 >>> 8 & 0xff;
  36631. o[62] = x15 >>> 16 & 0xff;
  36632. o[63] = x15 >>> 24 & 0xff;
  36633. }
  36634. function core_hsalsa20(o,p,k,c) {
  36635. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36636. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36637. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36638. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36639. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36640. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36641. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36642. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36643. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36644. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36645. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36646. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36647. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36648. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36649. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36650. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36651. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36652. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36653. x15 = j15, u;
  36654. for (var i = 0; i < 20; i += 2) {
  36655. u = x0 + x12 | 0;
  36656. x4 ^= u<<7 | u>>>(32-7);
  36657. u = x4 + x0 | 0;
  36658. x8 ^= u<<9 | u>>>(32-9);
  36659. u = x8 + x4 | 0;
  36660. x12 ^= u<<13 | u>>>(32-13);
  36661. u = x12 + x8 | 0;
  36662. x0 ^= u<<18 | u>>>(32-18);
  36663. u = x5 + x1 | 0;
  36664. x9 ^= u<<7 | u>>>(32-7);
  36665. u = x9 + x5 | 0;
  36666. x13 ^= u<<9 | u>>>(32-9);
  36667. u = x13 + x9 | 0;
  36668. x1 ^= u<<13 | u>>>(32-13);
  36669. u = x1 + x13 | 0;
  36670. x5 ^= u<<18 | u>>>(32-18);
  36671. u = x10 + x6 | 0;
  36672. x14 ^= u<<7 | u>>>(32-7);
  36673. u = x14 + x10 | 0;
  36674. x2 ^= u<<9 | u>>>(32-9);
  36675. u = x2 + x14 | 0;
  36676. x6 ^= u<<13 | u>>>(32-13);
  36677. u = x6 + x2 | 0;
  36678. x10 ^= u<<18 | u>>>(32-18);
  36679. u = x15 + x11 | 0;
  36680. x3 ^= u<<7 | u>>>(32-7);
  36681. u = x3 + x15 | 0;
  36682. x7 ^= u<<9 | u>>>(32-9);
  36683. u = x7 + x3 | 0;
  36684. x11 ^= u<<13 | u>>>(32-13);
  36685. u = x11 + x7 | 0;
  36686. x15 ^= u<<18 | u>>>(32-18);
  36687. u = x0 + x3 | 0;
  36688. x1 ^= u<<7 | u>>>(32-7);
  36689. u = x1 + x0 | 0;
  36690. x2 ^= u<<9 | u>>>(32-9);
  36691. u = x2 + x1 | 0;
  36692. x3 ^= u<<13 | u>>>(32-13);
  36693. u = x3 + x2 | 0;
  36694. x0 ^= u<<18 | u>>>(32-18);
  36695. u = x5 + x4 | 0;
  36696. x6 ^= u<<7 | u>>>(32-7);
  36697. u = x6 + x5 | 0;
  36698. x7 ^= u<<9 | u>>>(32-9);
  36699. u = x7 + x6 | 0;
  36700. x4 ^= u<<13 | u>>>(32-13);
  36701. u = x4 + x7 | 0;
  36702. x5 ^= u<<18 | u>>>(32-18);
  36703. u = x10 + x9 | 0;
  36704. x11 ^= u<<7 | u>>>(32-7);
  36705. u = x11 + x10 | 0;
  36706. x8 ^= u<<9 | u>>>(32-9);
  36707. u = x8 + x11 | 0;
  36708. x9 ^= u<<13 | u>>>(32-13);
  36709. u = x9 + x8 | 0;
  36710. x10 ^= u<<18 | u>>>(32-18);
  36711. u = x15 + x14 | 0;
  36712. x12 ^= u<<7 | u>>>(32-7);
  36713. u = x12 + x15 | 0;
  36714. x13 ^= u<<9 | u>>>(32-9);
  36715. u = x13 + x12 | 0;
  36716. x14 ^= u<<13 | u>>>(32-13);
  36717. u = x14 + x13 | 0;
  36718. x15 ^= u<<18 | u>>>(32-18);
  36719. }
  36720. o[ 0] = x0 >>> 0 & 0xff;
  36721. o[ 1] = x0 >>> 8 & 0xff;
  36722. o[ 2] = x0 >>> 16 & 0xff;
  36723. o[ 3] = x0 >>> 24 & 0xff;
  36724. o[ 4] = x5 >>> 0 & 0xff;
  36725. o[ 5] = x5 >>> 8 & 0xff;
  36726. o[ 6] = x5 >>> 16 & 0xff;
  36727. o[ 7] = x5 >>> 24 & 0xff;
  36728. o[ 8] = x10 >>> 0 & 0xff;
  36729. o[ 9] = x10 >>> 8 & 0xff;
  36730. o[10] = x10 >>> 16 & 0xff;
  36731. o[11] = x10 >>> 24 & 0xff;
  36732. o[12] = x15 >>> 0 & 0xff;
  36733. o[13] = x15 >>> 8 & 0xff;
  36734. o[14] = x15 >>> 16 & 0xff;
  36735. o[15] = x15 >>> 24 & 0xff;
  36736. o[16] = x6 >>> 0 & 0xff;
  36737. o[17] = x6 >>> 8 & 0xff;
  36738. o[18] = x6 >>> 16 & 0xff;
  36739. o[19] = x6 >>> 24 & 0xff;
  36740. o[20] = x7 >>> 0 & 0xff;
  36741. o[21] = x7 >>> 8 & 0xff;
  36742. o[22] = x7 >>> 16 & 0xff;
  36743. o[23] = x7 >>> 24 & 0xff;
  36744. o[24] = x8 >>> 0 & 0xff;
  36745. o[25] = x8 >>> 8 & 0xff;
  36746. o[26] = x8 >>> 16 & 0xff;
  36747. o[27] = x8 >>> 24 & 0xff;
  36748. o[28] = x9 >>> 0 & 0xff;
  36749. o[29] = x9 >>> 8 & 0xff;
  36750. o[30] = x9 >>> 16 & 0xff;
  36751. o[31] = x9 >>> 24 & 0xff;
  36752. }
  36753. function crypto_core_salsa20(out,inp,k,c) {
  36754. core_salsa20(out,inp,k,c);
  36755. }
  36756. function crypto_core_hsalsa20(out,inp,k,c) {
  36757. core_hsalsa20(out,inp,k,c);
  36758. }
  36759. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36760. // "expand 32-byte k"
  36761. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36762. var z = new Uint8Array(16), x = new Uint8Array(64);
  36763. var u, i;
  36764. for (i = 0; i < 16; i++) z[i] = 0;
  36765. for (i = 0; i < 8; i++) z[i] = n[i];
  36766. while (b >= 64) {
  36767. crypto_core_salsa20(x,z,k,sigma);
  36768. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36769. u = 1;
  36770. for (i = 8; i < 16; i++) {
  36771. u = u + (z[i] & 0xff) | 0;
  36772. z[i] = u & 0xff;
  36773. u >>>= 8;
  36774. }
  36775. b -= 64;
  36776. cpos += 64;
  36777. mpos += 64;
  36778. }
  36779. if (b > 0) {
  36780. crypto_core_salsa20(x,z,k,sigma);
  36781. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36782. }
  36783. return 0;
  36784. }
  36785. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36786. var z = new Uint8Array(16), x = new Uint8Array(64);
  36787. var u, i;
  36788. for (i = 0; i < 16; i++) z[i] = 0;
  36789. for (i = 0; i < 8; i++) z[i] = n[i];
  36790. while (b >= 64) {
  36791. crypto_core_salsa20(x,z,k,sigma);
  36792. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36793. u = 1;
  36794. for (i = 8; i < 16; i++) {
  36795. u = u + (z[i] & 0xff) | 0;
  36796. z[i] = u & 0xff;
  36797. u >>>= 8;
  36798. }
  36799. b -= 64;
  36800. cpos += 64;
  36801. }
  36802. if (b > 0) {
  36803. crypto_core_salsa20(x,z,k,sigma);
  36804. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  36805. }
  36806. return 0;
  36807. }
  36808. function crypto_stream(c,cpos,d,n,k) {
  36809. var s = new Uint8Array(32);
  36810. crypto_core_hsalsa20(s,n,k,sigma);
  36811. var sn = new Uint8Array(8);
  36812. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36813. return crypto_stream_salsa20(c,cpos,d,sn,s);
  36814. }
  36815. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  36816. var s = new Uint8Array(32);
  36817. crypto_core_hsalsa20(s,n,k,sigma);
  36818. var sn = new Uint8Array(8);
  36819. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36820. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  36821. }
  36822. /*
  36823. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  36824. * https://github.com/floodyberry/poly1305-donna
  36825. */
  36826. var poly1305 = function(key) {
  36827. this.buffer = new Uint8Array(16);
  36828. this.r = new Uint16Array(10);
  36829. this.h = new Uint16Array(10);
  36830. this.pad = new Uint16Array(8);
  36831. this.leftover = 0;
  36832. this.fin = 0;
  36833. var t0, t1, t2, t3, t4, t5, t6, t7;
  36834. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  36835. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36836. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  36837. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36838. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  36839. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  36840. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36841. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  36842. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36843. this.r[9] = ((t7 >>> 5)) & 0x007f;
  36844. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  36845. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  36846. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  36847. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  36848. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  36849. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  36850. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  36851. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  36852. };
  36853. poly1305.prototype.blocks = function(m, mpos, bytes) {
  36854. var hibit = this.fin ? 0 : (1 << 11);
  36855. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  36856. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  36857. var h0 = this.h[0],
  36858. h1 = this.h[1],
  36859. h2 = this.h[2],
  36860. h3 = this.h[3],
  36861. h4 = this.h[4],
  36862. h5 = this.h[5],
  36863. h6 = this.h[6],
  36864. h7 = this.h[7],
  36865. h8 = this.h[8],
  36866. h9 = this.h[9];
  36867. var r0 = this.r[0],
  36868. r1 = this.r[1],
  36869. r2 = this.r[2],
  36870. r3 = this.r[3],
  36871. r4 = this.r[4],
  36872. r5 = this.r[5],
  36873. r6 = this.r[6],
  36874. r7 = this.r[7],
  36875. r8 = this.r[8],
  36876. r9 = this.r[9];
  36877. while (bytes >= 16) {
  36878. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  36879. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36880. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  36881. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36882. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  36883. h5 += ((t4 >>> 1)) & 0x1fff;
  36884. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36885. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  36886. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36887. h9 += ((t7 >>> 5)) | hibit;
  36888. c = 0;
  36889. d0 = c;
  36890. d0 += h0 * r0;
  36891. d0 += h1 * (5 * r9);
  36892. d0 += h2 * (5 * r8);
  36893. d0 += h3 * (5 * r7);
  36894. d0 += h4 * (5 * r6);
  36895. c = (d0 >>> 13); d0 &= 0x1fff;
  36896. d0 += h5 * (5 * r5);
  36897. d0 += h6 * (5 * r4);
  36898. d0 += h7 * (5 * r3);
  36899. d0 += h8 * (5 * r2);
  36900. d0 += h9 * (5 * r1);
  36901. c += (d0 >>> 13); d0 &= 0x1fff;
  36902. d1 = c;
  36903. d1 += h0 * r1;
  36904. d1 += h1 * r0;
  36905. d1 += h2 * (5 * r9);
  36906. d1 += h3 * (5 * r8);
  36907. d1 += h4 * (5 * r7);
  36908. c = (d1 >>> 13); d1 &= 0x1fff;
  36909. d1 += h5 * (5 * r6);
  36910. d1 += h6 * (5 * r5);
  36911. d1 += h7 * (5 * r4);
  36912. d1 += h8 * (5 * r3);
  36913. d1 += h9 * (5 * r2);
  36914. c += (d1 >>> 13); d1 &= 0x1fff;
  36915. d2 = c;
  36916. d2 += h0 * r2;
  36917. d2 += h1 * r1;
  36918. d2 += h2 * r0;
  36919. d2 += h3 * (5 * r9);
  36920. d2 += h4 * (5 * r8);
  36921. c = (d2 >>> 13); d2 &= 0x1fff;
  36922. d2 += h5 * (5 * r7);
  36923. d2 += h6 * (5 * r6);
  36924. d2 += h7 * (5 * r5);
  36925. d2 += h8 * (5 * r4);
  36926. d2 += h9 * (5 * r3);
  36927. c += (d2 >>> 13); d2 &= 0x1fff;
  36928. d3 = c;
  36929. d3 += h0 * r3;
  36930. d3 += h1 * r2;
  36931. d3 += h2 * r1;
  36932. d3 += h3 * r0;
  36933. d3 += h4 * (5 * r9);
  36934. c = (d3 >>> 13); d3 &= 0x1fff;
  36935. d3 += h5 * (5 * r8);
  36936. d3 += h6 * (5 * r7);
  36937. d3 += h7 * (5 * r6);
  36938. d3 += h8 * (5 * r5);
  36939. d3 += h9 * (5 * r4);
  36940. c += (d3 >>> 13); d3 &= 0x1fff;
  36941. d4 = c;
  36942. d4 += h0 * r4;
  36943. d4 += h1 * r3;
  36944. d4 += h2 * r2;
  36945. d4 += h3 * r1;
  36946. d4 += h4 * r0;
  36947. c = (d4 >>> 13); d4 &= 0x1fff;
  36948. d4 += h5 * (5 * r9);
  36949. d4 += h6 * (5 * r8);
  36950. d4 += h7 * (5 * r7);
  36951. d4 += h8 * (5 * r6);
  36952. d4 += h9 * (5 * r5);
  36953. c += (d4 >>> 13); d4 &= 0x1fff;
  36954. d5 = c;
  36955. d5 += h0 * r5;
  36956. d5 += h1 * r4;
  36957. d5 += h2 * r3;
  36958. d5 += h3 * r2;
  36959. d5 += h4 * r1;
  36960. c = (d5 >>> 13); d5 &= 0x1fff;
  36961. d5 += h5 * r0;
  36962. d5 += h6 * (5 * r9);
  36963. d5 += h7 * (5 * r8);
  36964. d5 += h8 * (5 * r7);
  36965. d5 += h9 * (5 * r6);
  36966. c += (d5 >>> 13); d5 &= 0x1fff;
  36967. d6 = c;
  36968. d6 += h0 * r6;
  36969. d6 += h1 * r5;
  36970. d6 += h2 * r4;
  36971. d6 += h3 * r3;
  36972. d6 += h4 * r2;
  36973. c = (d6 >>> 13); d6 &= 0x1fff;
  36974. d6 += h5 * r1;
  36975. d6 += h6 * r0;
  36976. d6 += h7 * (5 * r9);
  36977. d6 += h8 * (5 * r8);
  36978. d6 += h9 * (5 * r7);
  36979. c += (d6 >>> 13); d6 &= 0x1fff;
  36980. d7 = c;
  36981. d7 += h0 * r7;
  36982. d7 += h1 * r6;
  36983. d7 += h2 * r5;
  36984. d7 += h3 * r4;
  36985. d7 += h4 * r3;
  36986. c = (d7 >>> 13); d7 &= 0x1fff;
  36987. d7 += h5 * r2;
  36988. d7 += h6 * r1;
  36989. d7 += h7 * r0;
  36990. d7 += h8 * (5 * r9);
  36991. d7 += h9 * (5 * r8);
  36992. c += (d7 >>> 13); d7 &= 0x1fff;
  36993. d8 = c;
  36994. d8 += h0 * r8;
  36995. d8 += h1 * r7;
  36996. d8 += h2 * r6;
  36997. d8 += h3 * r5;
  36998. d8 += h4 * r4;
  36999. c = (d8 >>> 13); d8 &= 0x1fff;
  37000. d8 += h5 * r3;
  37001. d8 += h6 * r2;
  37002. d8 += h7 * r1;
  37003. d8 += h8 * r0;
  37004. d8 += h9 * (5 * r9);
  37005. c += (d8 >>> 13); d8 &= 0x1fff;
  37006. d9 = c;
  37007. d9 += h0 * r9;
  37008. d9 += h1 * r8;
  37009. d9 += h2 * r7;
  37010. d9 += h3 * r6;
  37011. d9 += h4 * r5;
  37012. c = (d9 >>> 13); d9 &= 0x1fff;
  37013. d9 += h5 * r4;
  37014. d9 += h6 * r3;
  37015. d9 += h7 * r2;
  37016. d9 += h8 * r1;
  37017. d9 += h9 * r0;
  37018. c += (d9 >>> 13); d9 &= 0x1fff;
  37019. c = (((c << 2) + c)) | 0;
  37020. c = (c + d0) | 0;
  37021. d0 = c & 0x1fff;
  37022. c = (c >>> 13);
  37023. d1 += c;
  37024. h0 = d0;
  37025. h1 = d1;
  37026. h2 = d2;
  37027. h3 = d3;
  37028. h4 = d4;
  37029. h5 = d5;
  37030. h6 = d6;
  37031. h7 = d7;
  37032. h8 = d8;
  37033. h9 = d9;
  37034. mpos += 16;
  37035. bytes -= 16;
  37036. }
  37037. this.h[0] = h0;
  37038. this.h[1] = h1;
  37039. this.h[2] = h2;
  37040. this.h[3] = h3;
  37041. this.h[4] = h4;
  37042. this.h[5] = h5;
  37043. this.h[6] = h6;
  37044. this.h[7] = h7;
  37045. this.h[8] = h8;
  37046. this.h[9] = h9;
  37047. };
  37048. poly1305.prototype.finish = function(mac, macpos) {
  37049. var g = new Uint16Array(10);
  37050. var c, mask, f, i;
  37051. if (this.leftover) {
  37052. i = this.leftover;
  37053. this.buffer[i++] = 1;
  37054. for (; i < 16; i++) this.buffer[i] = 0;
  37055. this.fin = 1;
  37056. this.blocks(this.buffer, 0, 16);
  37057. }
  37058. c = this.h[1] >>> 13;
  37059. this.h[1] &= 0x1fff;
  37060. for (i = 2; i < 10; i++) {
  37061. this.h[i] += c;
  37062. c = this.h[i] >>> 13;
  37063. this.h[i] &= 0x1fff;
  37064. }
  37065. this.h[0] += (c * 5);
  37066. c = this.h[0] >>> 13;
  37067. this.h[0] &= 0x1fff;
  37068. this.h[1] += c;
  37069. c = this.h[1] >>> 13;
  37070. this.h[1] &= 0x1fff;
  37071. this.h[2] += c;
  37072. g[0] = this.h[0] + 5;
  37073. c = g[0] >>> 13;
  37074. g[0] &= 0x1fff;
  37075. for (i = 1; i < 10; i++) {
  37076. g[i] = this.h[i] + c;
  37077. c = g[i] >>> 13;
  37078. g[i] &= 0x1fff;
  37079. }
  37080. g[9] -= (1 << 13);
  37081. mask = (c ^ 1) - 1;
  37082. for (i = 0; i < 10; i++) g[i] &= mask;
  37083. mask = ~mask;
  37084. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37085. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37086. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37087. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37088. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37089. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37090. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37091. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37092. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37093. f = this.h[0] + this.pad[0];
  37094. this.h[0] = f & 0xffff;
  37095. for (i = 1; i < 8; i++) {
  37096. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37097. this.h[i] = f & 0xffff;
  37098. }
  37099. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37100. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37101. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37102. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37103. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37104. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37105. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37106. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37107. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37108. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37109. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37110. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37111. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37112. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37113. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37114. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37115. };
  37116. poly1305.prototype.update = function(m, mpos, bytes) {
  37117. var i, want;
  37118. if (this.leftover) {
  37119. want = (16 - this.leftover);
  37120. if (want > bytes)
  37121. want = bytes;
  37122. for (i = 0; i < want; i++)
  37123. this.buffer[this.leftover + i] = m[mpos+i];
  37124. bytes -= want;
  37125. mpos += want;
  37126. this.leftover += want;
  37127. if (this.leftover < 16)
  37128. return;
  37129. this.blocks(this.buffer, 0, 16);
  37130. this.leftover = 0;
  37131. }
  37132. if (bytes >= 16) {
  37133. want = bytes - (bytes % 16);
  37134. this.blocks(m, mpos, want);
  37135. mpos += want;
  37136. bytes -= want;
  37137. }
  37138. if (bytes) {
  37139. for (i = 0; i < bytes; i++)
  37140. this.buffer[this.leftover + i] = m[mpos+i];
  37141. this.leftover += bytes;
  37142. }
  37143. };
  37144. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37145. var s = new poly1305(k);
  37146. s.update(m, mpos, n);
  37147. s.finish(out, outpos);
  37148. return 0;
  37149. }
  37150. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37151. var x = new Uint8Array(16);
  37152. crypto_onetimeauth(x,0,m,mpos,n,k);
  37153. return crypto_verify_16(h,hpos,x,0);
  37154. }
  37155. function crypto_secretbox(c,m,d,n,k) {
  37156. var i;
  37157. if (d < 32) return -1;
  37158. crypto_stream_xor(c,0,m,0,d,n,k);
  37159. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37160. for (i = 0; i < 16; i++) c[i] = 0;
  37161. return 0;
  37162. }
  37163. function crypto_secretbox_open(m,c,d,n,k) {
  37164. var i;
  37165. var x = new Uint8Array(32);
  37166. if (d < 32) return -1;
  37167. crypto_stream(x,0,32,n,k);
  37168. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37169. crypto_stream_xor(m,0,c,0,d,n,k);
  37170. for (i = 0; i < 32; i++) m[i] = 0;
  37171. return 0;
  37172. }
  37173. function set25519(r, a) {
  37174. var i;
  37175. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37176. }
  37177. function car25519(o) {
  37178. var i, v, c = 1;
  37179. for (i = 0; i < 16; i++) {
  37180. v = o[i] + c + 65535;
  37181. c = Math.floor(v / 65536);
  37182. o[i] = v - c * 65536;
  37183. }
  37184. o[0] += c-1 + 37 * (c-1);
  37185. }
  37186. function sel25519(p, q, b) {
  37187. var t, c = ~(b-1);
  37188. for (var i = 0; i < 16; i++) {
  37189. t = c & (p[i] ^ q[i]);
  37190. p[i] ^= t;
  37191. q[i] ^= t;
  37192. }
  37193. }
  37194. function pack25519(o, n) {
  37195. var i, j, b;
  37196. var m = gf(), t = gf();
  37197. for (i = 0; i < 16; i++) t[i] = n[i];
  37198. car25519(t);
  37199. car25519(t);
  37200. car25519(t);
  37201. for (j = 0; j < 2; j++) {
  37202. m[0] = t[0] - 0xffed;
  37203. for (i = 1; i < 15; i++) {
  37204. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37205. m[i-1] &= 0xffff;
  37206. }
  37207. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37208. b = (m[15]>>16) & 1;
  37209. m[14] &= 0xffff;
  37210. sel25519(t, m, 1-b);
  37211. }
  37212. for (i = 0; i < 16; i++) {
  37213. o[2*i] = t[i] & 0xff;
  37214. o[2*i+1] = t[i]>>8;
  37215. }
  37216. }
  37217. function neq25519(a, b) {
  37218. var c = new Uint8Array(32), d = new Uint8Array(32);
  37219. pack25519(c, a);
  37220. pack25519(d, b);
  37221. return crypto_verify_32(c, 0, d, 0);
  37222. }
  37223. function par25519(a) {
  37224. var d = new Uint8Array(32);
  37225. pack25519(d, a);
  37226. return d[0] & 1;
  37227. }
  37228. function unpack25519(o, n) {
  37229. var i;
  37230. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37231. o[15] &= 0x7fff;
  37232. }
  37233. function A(o, a, b) {
  37234. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37235. }
  37236. function Z(o, a, b) {
  37237. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37238. }
  37239. function M(o, a, b) {
  37240. var v, c,
  37241. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37242. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37243. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37244. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37245. b0 = b[0],
  37246. b1 = b[1],
  37247. b2 = b[2],
  37248. b3 = b[3],
  37249. b4 = b[4],
  37250. b5 = b[5],
  37251. b6 = b[6],
  37252. b7 = b[7],
  37253. b8 = b[8],
  37254. b9 = b[9],
  37255. b10 = b[10],
  37256. b11 = b[11],
  37257. b12 = b[12],
  37258. b13 = b[13],
  37259. b14 = b[14],
  37260. b15 = b[15];
  37261. v = a[0];
  37262. t0 += v * b0;
  37263. t1 += v * b1;
  37264. t2 += v * b2;
  37265. t3 += v * b3;
  37266. t4 += v * b4;
  37267. t5 += v * b5;
  37268. t6 += v * b6;
  37269. t7 += v * b7;
  37270. t8 += v * b8;
  37271. t9 += v * b9;
  37272. t10 += v * b10;
  37273. t11 += v * b11;
  37274. t12 += v * b12;
  37275. t13 += v * b13;
  37276. t14 += v * b14;
  37277. t15 += v * b15;
  37278. v = a[1];
  37279. t1 += v * b0;
  37280. t2 += v * b1;
  37281. t3 += v * b2;
  37282. t4 += v * b3;
  37283. t5 += v * b4;
  37284. t6 += v * b5;
  37285. t7 += v * b6;
  37286. t8 += v * b7;
  37287. t9 += v * b8;
  37288. t10 += v * b9;
  37289. t11 += v * b10;
  37290. t12 += v * b11;
  37291. t13 += v * b12;
  37292. t14 += v * b13;
  37293. t15 += v * b14;
  37294. t16 += v * b15;
  37295. v = a[2];
  37296. t2 += v * b0;
  37297. t3 += v * b1;
  37298. t4 += v * b2;
  37299. t5 += v * b3;
  37300. t6 += v * b4;
  37301. t7 += v * b5;
  37302. t8 += v * b6;
  37303. t9 += v * b7;
  37304. t10 += v * b8;
  37305. t11 += v * b9;
  37306. t12 += v * b10;
  37307. t13 += v * b11;
  37308. t14 += v * b12;
  37309. t15 += v * b13;
  37310. t16 += v * b14;
  37311. t17 += v * b15;
  37312. v = a[3];
  37313. t3 += v * b0;
  37314. t4 += v * b1;
  37315. t5 += v * b2;
  37316. t6 += v * b3;
  37317. t7 += v * b4;
  37318. t8 += v * b5;
  37319. t9 += v * b6;
  37320. t10 += v * b7;
  37321. t11 += v * b8;
  37322. t12 += v * b9;
  37323. t13 += v * b10;
  37324. t14 += v * b11;
  37325. t15 += v * b12;
  37326. t16 += v * b13;
  37327. t17 += v * b14;
  37328. t18 += v * b15;
  37329. v = a[4];
  37330. t4 += v * b0;
  37331. t5 += v * b1;
  37332. t6 += v * b2;
  37333. t7 += v * b3;
  37334. t8 += v * b4;
  37335. t9 += v * b5;
  37336. t10 += v * b6;
  37337. t11 += v * b7;
  37338. t12 += v * b8;
  37339. t13 += v * b9;
  37340. t14 += v * b10;
  37341. t15 += v * b11;
  37342. t16 += v * b12;
  37343. t17 += v * b13;
  37344. t18 += v * b14;
  37345. t19 += v * b15;
  37346. v = a[5];
  37347. t5 += v * b0;
  37348. t6 += v * b1;
  37349. t7 += v * b2;
  37350. t8 += v * b3;
  37351. t9 += v * b4;
  37352. t10 += v * b5;
  37353. t11 += v * b6;
  37354. t12 += v * b7;
  37355. t13 += v * b8;
  37356. t14 += v * b9;
  37357. t15 += v * b10;
  37358. t16 += v * b11;
  37359. t17 += v * b12;
  37360. t18 += v * b13;
  37361. t19 += v * b14;
  37362. t20 += v * b15;
  37363. v = a[6];
  37364. t6 += v * b0;
  37365. t7 += v * b1;
  37366. t8 += v * b2;
  37367. t9 += v * b3;
  37368. t10 += v * b4;
  37369. t11 += v * b5;
  37370. t12 += v * b6;
  37371. t13 += v * b7;
  37372. t14 += v * b8;
  37373. t15 += v * b9;
  37374. t16 += v * b10;
  37375. t17 += v * b11;
  37376. t18 += v * b12;
  37377. t19 += v * b13;
  37378. t20 += v * b14;
  37379. t21 += v * b15;
  37380. v = a[7];
  37381. t7 += v * b0;
  37382. t8 += v * b1;
  37383. t9 += v * b2;
  37384. t10 += v * b3;
  37385. t11 += v * b4;
  37386. t12 += v * b5;
  37387. t13 += v * b6;
  37388. t14 += v * b7;
  37389. t15 += v * b8;
  37390. t16 += v * b9;
  37391. t17 += v * b10;
  37392. t18 += v * b11;
  37393. t19 += v * b12;
  37394. t20 += v * b13;
  37395. t21 += v * b14;
  37396. t22 += v * b15;
  37397. v = a[8];
  37398. t8 += v * b0;
  37399. t9 += v * b1;
  37400. t10 += v * b2;
  37401. t11 += v * b3;
  37402. t12 += v * b4;
  37403. t13 += v * b5;
  37404. t14 += v * b6;
  37405. t15 += v * b7;
  37406. t16 += v * b8;
  37407. t17 += v * b9;
  37408. t18 += v * b10;
  37409. t19 += v * b11;
  37410. t20 += v * b12;
  37411. t21 += v * b13;
  37412. t22 += v * b14;
  37413. t23 += v * b15;
  37414. v = a[9];
  37415. t9 += v * b0;
  37416. t10 += v * b1;
  37417. t11 += v * b2;
  37418. t12 += v * b3;
  37419. t13 += v * b4;
  37420. t14 += v * b5;
  37421. t15 += v * b6;
  37422. t16 += v * b7;
  37423. t17 += v * b8;
  37424. t18 += v * b9;
  37425. t19 += v * b10;
  37426. t20 += v * b11;
  37427. t21 += v * b12;
  37428. t22 += v * b13;
  37429. t23 += v * b14;
  37430. t24 += v * b15;
  37431. v = a[10];
  37432. t10 += v * b0;
  37433. t11 += v * b1;
  37434. t12 += v * b2;
  37435. t13 += v * b3;
  37436. t14 += v * b4;
  37437. t15 += v * b5;
  37438. t16 += v * b6;
  37439. t17 += v * b7;
  37440. t18 += v * b8;
  37441. t19 += v * b9;
  37442. t20 += v * b10;
  37443. t21 += v * b11;
  37444. t22 += v * b12;
  37445. t23 += v * b13;
  37446. t24 += v * b14;
  37447. t25 += v * b15;
  37448. v = a[11];
  37449. t11 += v * b0;
  37450. t12 += v * b1;
  37451. t13 += v * b2;
  37452. t14 += v * b3;
  37453. t15 += v * b4;
  37454. t16 += v * b5;
  37455. t17 += v * b6;
  37456. t18 += v * b7;
  37457. t19 += v * b8;
  37458. t20 += v * b9;
  37459. t21 += v * b10;
  37460. t22 += v * b11;
  37461. t23 += v * b12;
  37462. t24 += v * b13;
  37463. t25 += v * b14;
  37464. t26 += v * b15;
  37465. v = a[12];
  37466. t12 += v * b0;
  37467. t13 += v * b1;
  37468. t14 += v * b2;
  37469. t15 += v * b3;
  37470. t16 += v * b4;
  37471. t17 += v * b5;
  37472. t18 += v * b6;
  37473. t19 += v * b7;
  37474. t20 += v * b8;
  37475. t21 += v * b9;
  37476. t22 += v * b10;
  37477. t23 += v * b11;
  37478. t24 += v * b12;
  37479. t25 += v * b13;
  37480. t26 += v * b14;
  37481. t27 += v * b15;
  37482. v = a[13];
  37483. t13 += v * b0;
  37484. t14 += v * b1;
  37485. t15 += v * b2;
  37486. t16 += v * b3;
  37487. t17 += v * b4;
  37488. t18 += v * b5;
  37489. t19 += v * b6;
  37490. t20 += v * b7;
  37491. t21 += v * b8;
  37492. t22 += v * b9;
  37493. t23 += v * b10;
  37494. t24 += v * b11;
  37495. t25 += v * b12;
  37496. t26 += v * b13;
  37497. t27 += v * b14;
  37498. t28 += v * b15;
  37499. v = a[14];
  37500. t14 += v * b0;
  37501. t15 += v * b1;
  37502. t16 += v * b2;
  37503. t17 += v * b3;
  37504. t18 += v * b4;
  37505. t19 += v * b5;
  37506. t20 += v * b6;
  37507. t21 += v * b7;
  37508. t22 += v * b8;
  37509. t23 += v * b9;
  37510. t24 += v * b10;
  37511. t25 += v * b11;
  37512. t26 += v * b12;
  37513. t27 += v * b13;
  37514. t28 += v * b14;
  37515. t29 += v * b15;
  37516. v = a[15];
  37517. t15 += v * b0;
  37518. t16 += v * b1;
  37519. t17 += v * b2;
  37520. t18 += v * b3;
  37521. t19 += v * b4;
  37522. t20 += v * b5;
  37523. t21 += v * b6;
  37524. t22 += v * b7;
  37525. t23 += v * b8;
  37526. t24 += v * b9;
  37527. t25 += v * b10;
  37528. t26 += v * b11;
  37529. t27 += v * b12;
  37530. t28 += v * b13;
  37531. t29 += v * b14;
  37532. t30 += v * b15;
  37533. t0 += 38 * t16;
  37534. t1 += 38 * t17;
  37535. t2 += 38 * t18;
  37536. t3 += 38 * t19;
  37537. t4 += 38 * t20;
  37538. t5 += 38 * t21;
  37539. t6 += 38 * t22;
  37540. t7 += 38 * t23;
  37541. t8 += 38 * t24;
  37542. t9 += 38 * t25;
  37543. t10 += 38 * t26;
  37544. t11 += 38 * t27;
  37545. t12 += 38 * t28;
  37546. t13 += 38 * t29;
  37547. t14 += 38 * t30;
  37548. // t15 left as is
  37549. // first car
  37550. c = 1;
  37551. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37552. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37553. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37554. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37555. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37556. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37557. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37558. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37559. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37560. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37561. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37562. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37563. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37564. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37565. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37566. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37567. t0 += c-1 + 37 * (c-1);
  37568. // second car
  37569. c = 1;
  37570. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37571. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37572. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37573. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37574. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37575. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37576. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37577. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37578. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37579. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37580. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37581. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37582. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37583. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37584. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37585. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37586. t0 += c-1 + 37 * (c-1);
  37587. o[ 0] = t0;
  37588. o[ 1] = t1;
  37589. o[ 2] = t2;
  37590. o[ 3] = t3;
  37591. o[ 4] = t4;
  37592. o[ 5] = t5;
  37593. o[ 6] = t6;
  37594. o[ 7] = t7;
  37595. o[ 8] = t8;
  37596. o[ 9] = t9;
  37597. o[10] = t10;
  37598. o[11] = t11;
  37599. o[12] = t12;
  37600. o[13] = t13;
  37601. o[14] = t14;
  37602. o[15] = t15;
  37603. }
  37604. function S(o, a) {
  37605. M(o, a, a);
  37606. }
  37607. function inv25519(o, i) {
  37608. var c = gf();
  37609. var a;
  37610. for (a = 0; a < 16; a++) c[a] = i[a];
  37611. for (a = 253; a >= 0; a--) {
  37612. S(c, c);
  37613. if(a !== 2 && a !== 4) M(c, c, i);
  37614. }
  37615. for (a = 0; a < 16; a++) o[a] = c[a];
  37616. }
  37617. function pow2523(o, i) {
  37618. var c = gf();
  37619. var a;
  37620. for (a = 0; a < 16; a++) c[a] = i[a];
  37621. for (a = 250; a >= 0; a--) {
  37622. S(c, c);
  37623. if(a !== 1) M(c, c, i);
  37624. }
  37625. for (a = 0; a < 16; a++) o[a] = c[a];
  37626. }
  37627. function crypto_scalarmult(q, n, p) {
  37628. var z = new Uint8Array(32);
  37629. var x = new Float64Array(80), r, i;
  37630. var a = gf(), b = gf(), c = gf(),
  37631. d = gf(), e = gf(), f = gf();
  37632. for (i = 0; i < 31; i++) z[i] = n[i];
  37633. z[31]=(n[31]&127)|64;
  37634. z[0]&=248;
  37635. unpack25519(x,p);
  37636. for (i = 0; i < 16; i++) {
  37637. b[i]=x[i];
  37638. d[i]=a[i]=c[i]=0;
  37639. }
  37640. a[0]=d[0]=1;
  37641. for (i=254; i>=0; --i) {
  37642. r=(z[i>>>3]>>>(i&7))&1;
  37643. sel25519(a,b,r);
  37644. sel25519(c,d,r);
  37645. A(e,a,c);
  37646. Z(a,a,c);
  37647. A(c,b,d);
  37648. Z(b,b,d);
  37649. S(d,e);
  37650. S(f,a);
  37651. M(a,c,a);
  37652. M(c,b,e);
  37653. A(e,a,c);
  37654. Z(a,a,c);
  37655. S(b,a);
  37656. Z(c,d,f);
  37657. M(a,c,_121665);
  37658. A(a,a,d);
  37659. M(c,c,a);
  37660. M(a,d,f);
  37661. M(d,b,x);
  37662. S(b,e);
  37663. sel25519(a,b,r);
  37664. sel25519(c,d,r);
  37665. }
  37666. for (i = 0; i < 16; i++) {
  37667. x[i+16]=a[i];
  37668. x[i+32]=c[i];
  37669. x[i+48]=b[i];
  37670. x[i+64]=d[i];
  37671. }
  37672. var x32 = x.subarray(32);
  37673. var x16 = x.subarray(16);
  37674. inv25519(x32,x32);
  37675. M(x16,x16,x32);
  37676. pack25519(q,x16);
  37677. return 0;
  37678. }
  37679. function crypto_scalarmult_base(q, n) {
  37680. return crypto_scalarmult(q, n, _9);
  37681. }
  37682. function crypto_box_keypair(y, x) {
  37683. randombytes(x, 32);
  37684. return crypto_scalarmult_base(y, x);
  37685. }
  37686. function crypto_box_beforenm(k, y, x) {
  37687. var s = new Uint8Array(32);
  37688. crypto_scalarmult(s, x, y);
  37689. return crypto_core_hsalsa20(k, _0, s, sigma);
  37690. }
  37691. var crypto_box_afternm = crypto_secretbox;
  37692. var crypto_box_open_afternm = crypto_secretbox_open;
  37693. function crypto_box(c, m, d, n, y, x) {
  37694. var k = new Uint8Array(32);
  37695. crypto_box_beforenm(k, y, x);
  37696. return crypto_box_afternm(c, m, d, n, k);
  37697. }
  37698. function crypto_box_open(m, c, d, n, y, x) {
  37699. var k = new Uint8Array(32);
  37700. crypto_box_beforenm(k, y, x);
  37701. return crypto_box_open_afternm(m, c, d, n, k);
  37702. }
  37703. var K = [
  37704. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37705. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37706. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37707. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37708. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37709. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37710. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37711. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37712. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37713. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37714. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37715. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37716. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37717. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37718. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37719. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37720. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37721. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37722. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37723. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37724. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37725. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37726. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37727. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37728. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37729. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37730. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37731. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37732. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37733. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37734. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37735. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37736. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37737. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37738. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37739. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37740. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37741. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37742. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37743. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37744. ];
  37745. function crypto_hashblocks_hl(hh, hl, m, n) {
  37746. var wh = new Int32Array(16), wl = new Int32Array(16),
  37747. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37748. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37749. th, tl, i, j, h, l, a, b, c, d;
  37750. var ah0 = hh[0],
  37751. ah1 = hh[1],
  37752. ah2 = hh[2],
  37753. ah3 = hh[3],
  37754. ah4 = hh[4],
  37755. ah5 = hh[5],
  37756. ah6 = hh[6],
  37757. ah7 = hh[7],
  37758. al0 = hl[0],
  37759. al1 = hl[1],
  37760. al2 = hl[2],
  37761. al3 = hl[3],
  37762. al4 = hl[4],
  37763. al5 = hl[5],
  37764. al6 = hl[6],
  37765. al7 = hl[7];
  37766. var pos = 0;
  37767. while (n >= 128) {
  37768. for (i = 0; i < 16; i++) {
  37769. j = 8 * i + pos;
  37770. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37771. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37772. }
  37773. for (i = 0; i < 80; i++) {
  37774. bh0 = ah0;
  37775. bh1 = ah1;
  37776. bh2 = ah2;
  37777. bh3 = ah3;
  37778. bh4 = ah4;
  37779. bh5 = ah5;
  37780. bh6 = ah6;
  37781. bh7 = ah7;
  37782. bl0 = al0;
  37783. bl1 = al1;
  37784. bl2 = al2;
  37785. bl3 = al3;
  37786. bl4 = al4;
  37787. bl5 = al5;
  37788. bl6 = al6;
  37789. bl7 = al7;
  37790. // add
  37791. h = ah7;
  37792. l = al7;
  37793. a = l & 0xffff; b = l >>> 16;
  37794. c = h & 0xffff; d = h >>> 16;
  37795. // Sigma1
  37796. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37797. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37798. a += l & 0xffff; b += l >>> 16;
  37799. c += h & 0xffff; d += h >>> 16;
  37800. // Ch
  37801. h = (ah4 & ah5) ^ (~ah4 & ah6);
  37802. l = (al4 & al5) ^ (~al4 & al6);
  37803. a += l & 0xffff; b += l >>> 16;
  37804. c += h & 0xffff; d += h >>> 16;
  37805. // K
  37806. h = K[i*2];
  37807. l = K[i*2+1];
  37808. a += l & 0xffff; b += l >>> 16;
  37809. c += h & 0xffff; d += h >>> 16;
  37810. // w
  37811. h = wh[i%16];
  37812. l = wl[i%16];
  37813. a += l & 0xffff; b += l >>> 16;
  37814. c += h & 0xffff; d += h >>> 16;
  37815. b += a >>> 16;
  37816. c += b >>> 16;
  37817. d += c >>> 16;
  37818. th = c & 0xffff | d << 16;
  37819. tl = a & 0xffff | b << 16;
  37820. // add
  37821. h = th;
  37822. l = tl;
  37823. a = l & 0xffff; b = l >>> 16;
  37824. c = h & 0xffff; d = h >>> 16;
  37825. // Sigma0
  37826. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  37827. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  37828. a += l & 0xffff; b += l >>> 16;
  37829. c += h & 0xffff; d += h >>> 16;
  37830. // Maj
  37831. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  37832. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  37833. a += l & 0xffff; b += l >>> 16;
  37834. c += h & 0xffff; d += h >>> 16;
  37835. b += a >>> 16;
  37836. c += b >>> 16;
  37837. d += c >>> 16;
  37838. bh7 = (c & 0xffff) | (d << 16);
  37839. bl7 = (a & 0xffff) | (b << 16);
  37840. // add
  37841. h = bh3;
  37842. l = bl3;
  37843. a = l & 0xffff; b = l >>> 16;
  37844. c = h & 0xffff; d = h >>> 16;
  37845. h = th;
  37846. l = tl;
  37847. a += l & 0xffff; b += l >>> 16;
  37848. c += h & 0xffff; d += h >>> 16;
  37849. b += a >>> 16;
  37850. c += b >>> 16;
  37851. d += c >>> 16;
  37852. bh3 = (c & 0xffff) | (d << 16);
  37853. bl3 = (a & 0xffff) | (b << 16);
  37854. ah1 = bh0;
  37855. ah2 = bh1;
  37856. ah3 = bh2;
  37857. ah4 = bh3;
  37858. ah5 = bh4;
  37859. ah6 = bh5;
  37860. ah7 = bh6;
  37861. ah0 = bh7;
  37862. al1 = bl0;
  37863. al2 = bl1;
  37864. al3 = bl2;
  37865. al4 = bl3;
  37866. al5 = bl4;
  37867. al6 = bl5;
  37868. al7 = bl6;
  37869. al0 = bl7;
  37870. if (i%16 === 15) {
  37871. for (j = 0; j < 16; j++) {
  37872. // add
  37873. h = wh[j];
  37874. l = wl[j];
  37875. a = l & 0xffff; b = l >>> 16;
  37876. c = h & 0xffff; d = h >>> 16;
  37877. h = wh[(j+9)%16];
  37878. l = wl[(j+9)%16];
  37879. a += l & 0xffff; b += l >>> 16;
  37880. c += h & 0xffff; d += h >>> 16;
  37881. // sigma0
  37882. th = wh[(j+1)%16];
  37883. tl = wl[(j+1)%16];
  37884. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  37885. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  37886. a += l & 0xffff; b += l >>> 16;
  37887. c += h & 0xffff; d += h >>> 16;
  37888. // sigma1
  37889. th = wh[(j+14)%16];
  37890. tl = wl[(j+14)%16];
  37891. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  37892. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  37893. a += l & 0xffff; b += l >>> 16;
  37894. c += h & 0xffff; d += h >>> 16;
  37895. b += a >>> 16;
  37896. c += b >>> 16;
  37897. d += c >>> 16;
  37898. wh[j] = (c & 0xffff) | (d << 16);
  37899. wl[j] = (a & 0xffff) | (b << 16);
  37900. }
  37901. }
  37902. }
  37903. // add
  37904. h = ah0;
  37905. l = al0;
  37906. a = l & 0xffff; b = l >>> 16;
  37907. c = h & 0xffff; d = h >>> 16;
  37908. h = hh[0];
  37909. l = hl[0];
  37910. a += l & 0xffff; b += l >>> 16;
  37911. c += h & 0xffff; d += h >>> 16;
  37912. b += a >>> 16;
  37913. c += b >>> 16;
  37914. d += c >>> 16;
  37915. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  37916. hl[0] = al0 = (a & 0xffff) | (b << 16);
  37917. h = ah1;
  37918. l = al1;
  37919. a = l & 0xffff; b = l >>> 16;
  37920. c = h & 0xffff; d = h >>> 16;
  37921. h = hh[1];
  37922. l = hl[1];
  37923. a += l & 0xffff; b += l >>> 16;
  37924. c += h & 0xffff; d += h >>> 16;
  37925. b += a >>> 16;
  37926. c += b >>> 16;
  37927. d += c >>> 16;
  37928. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  37929. hl[1] = al1 = (a & 0xffff) | (b << 16);
  37930. h = ah2;
  37931. l = al2;
  37932. a = l & 0xffff; b = l >>> 16;
  37933. c = h & 0xffff; d = h >>> 16;
  37934. h = hh[2];
  37935. l = hl[2];
  37936. a += l & 0xffff; b += l >>> 16;
  37937. c += h & 0xffff; d += h >>> 16;
  37938. b += a >>> 16;
  37939. c += b >>> 16;
  37940. d += c >>> 16;
  37941. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  37942. hl[2] = al2 = (a & 0xffff) | (b << 16);
  37943. h = ah3;
  37944. l = al3;
  37945. a = l & 0xffff; b = l >>> 16;
  37946. c = h & 0xffff; d = h >>> 16;
  37947. h = hh[3];
  37948. l = hl[3];
  37949. a += l & 0xffff; b += l >>> 16;
  37950. c += h & 0xffff; d += h >>> 16;
  37951. b += a >>> 16;
  37952. c += b >>> 16;
  37953. d += c >>> 16;
  37954. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  37955. hl[3] = al3 = (a & 0xffff) | (b << 16);
  37956. h = ah4;
  37957. l = al4;
  37958. a = l & 0xffff; b = l >>> 16;
  37959. c = h & 0xffff; d = h >>> 16;
  37960. h = hh[4];
  37961. l = hl[4];
  37962. a += l & 0xffff; b += l >>> 16;
  37963. c += h & 0xffff; d += h >>> 16;
  37964. b += a >>> 16;
  37965. c += b >>> 16;
  37966. d += c >>> 16;
  37967. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  37968. hl[4] = al4 = (a & 0xffff) | (b << 16);
  37969. h = ah5;
  37970. l = al5;
  37971. a = l & 0xffff; b = l >>> 16;
  37972. c = h & 0xffff; d = h >>> 16;
  37973. h = hh[5];
  37974. l = hl[5];
  37975. a += l & 0xffff; b += l >>> 16;
  37976. c += h & 0xffff; d += h >>> 16;
  37977. b += a >>> 16;
  37978. c += b >>> 16;
  37979. d += c >>> 16;
  37980. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  37981. hl[5] = al5 = (a & 0xffff) | (b << 16);
  37982. h = ah6;
  37983. l = al6;
  37984. a = l & 0xffff; b = l >>> 16;
  37985. c = h & 0xffff; d = h >>> 16;
  37986. h = hh[6];
  37987. l = hl[6];
  37988. a += l & 0xffff; b += l >>> 16;
  37989. c += h & 0xffff; d += h >>> 16;
  37990. b += a >>> 16;
  37991. c += b >>> 16;
  37992. d += c >>> 16;
  37993. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  37994. hl[6] = al6 = (a & 0xffff) | (b << 16);
  37995. h = ah7;
  37996. l = al7;
  37997. a = l & 0xffff; b = l >>> 16;
  37998. c = h & 0xffff; d = h >>> 16;
  37999. h = hh[7];
  38000. l = hl[7];
  38001. a += l & 0xffff; b += l >>> 16;
  38002. c += h & 0xffff; d += h >>> 16;
  38003. b += a >>> 16;
  38004. c += b >>> 16;
  38005. d += c >>> 16;
  38006. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38007. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38008. pos += 128;
  38009. n -= 128;
  38010. }
  38011. return n;
  38012. }
  38013. function crypto_hash(out, m, n) {
  38014. var hh = new Int32Array(8),
  38015. hl = new Int32Array(8),
  38016. x = new Uint8Array(256),
  38017. i, b = n;
  38018. hh[0] = 0x6a09e667;
  38019. hh[1] = 0xbb67ae85;
  38020. hh[2] = 0x3c6ef372;
  38021. hh[3] = 0xa54ff53a;
  38022. hh[4] = 0x510e527f;
  38023. hh[5] = 0x9b05688c;
  38024. hh[6] = 0x1f83d9ab;
  38025. hh[7] = 0x5be0cd19;
  38026. hl[0] = 0xf3bcc908;
  38027. hl[1] = 0x84caa73b;
  38028. hl[2] = 0xfe94f82b;
  38029. hl[3] = 0x5f1d36f1;
  38030. hl[4] = 0xade682d1;
  38031. hl[5] = 0x2b3e6c1f;
  38032. hl[6] = 0xfb41bd6b;
  38033. hl[7] = 0x137e2179;
  38034. crypto_hashblocks_hl(hh, hl, m, n);
  38035. n %= 128;
  38036. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38037. x[n] = 128;
  38038. n = 256-128*(n<112?1:0);
  38039. x[n-9] = 0;
  38040. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38041. crypto_hashblocks_hl(hh, hl, x, n);
  38042. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38043. return 0;
  38044. }
  38045. function add(p, q) {
  38046. var a = gf(), b = gf(), c = gf(),
  38047. d = gf(), e = gf(), f = gf(),
  38048. g = gf(), h = gf(), t = gf();
  38049. Z(a, p[1], p[0]);
  38050. Z(t, q[1], q[0]);
  38051. M(a, a, t);
  38052. A(b, p[0], p[1]);
  38053. A(t, q[0], q[1]);
  38054. M(b, b, t);
  38055. M(c, p[3], q[3]);
  38056. M(c, c, D2);
  38057. M(d, p[2], q[2]);
  38058. A(d, d, d);
  38059. Z(e, b, a);
  38060. Z(f, d, c);
  38061. A(g, d, c);
  38062. A(h, b, a);
  38063. M(p[0], e, f);
  38064. M(p[1], h, g);
  38065. M(p[2], g, f);
  38066. M(p[3], e, h);
  38067. }
  38068. function cswap(p, q, b) {
  38069. var i;
  38070. for (i = 0; i < 4; i++) {
  38071. sel25519(p[i], q[i], b);
  38072. }
  38073. }
  38074. function pack(r, p) {
  38075. var tx = gf(), ty = gf(), zi = gf();
  38076. inv25519(zi, p[2]);
  38077. M(tx, p[0], zi);
  38078. M(ty, p[1], zi);
  38079. pack25519(r, ty);
  38080. r[31] ^= par25519(tx) << 7;
  38081. }
  38082. function scalarmult(p, q, s) {
  38083. var b, i;
  38084. set25519(p[0], gf0);
  38085. set25519(p[1], gf1);
  38086. set25519(p[2], gf1);
  38087. set25519(p[3], gf0);
  38088. for (i = 255; i >= 0; --i) {
  38089. b = (s[(i/8)|0] >> (i&7)) & 1;
  38090. cswap(p, q, b);
  38091. add(q, p);
  38092. add(p, p);
  38093. cswap(p, q, b);
  38094. }
  38095. }
  38096. function scalarbase(p, s) {
  38097. var q = [gf(), gf(), gf(), gf()];
  38098. set25519(q[0], X);
  38099. set25519(q[1], Y);
  38100. set25519(q[2], gf1);
  38101. M(q[3], X, Y);
  38102. scalarmult(p, q, s);
  38103. }
  38104. function crypto_sign_keypair(pk, sk, seeded) {
  38105. var d = new Uint8Array(64);
  38106. var p = [gf(), gf(), gf(), gf()];
  38107. var i;
  38108. if (!seeded) randombytes(sk, 32);
  38109. crypto_hash(d, sk, 32);
  38110. d[0] &= 248;
  38111. d[31] &= 127;
  38112. d[31] |= 64;
  38113. scalarbase(p, d);
  38114. pack(pk, p);
  38115. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38116. return 0;
  38117. }
  38118. var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);
  38119. function modL(r, x) {
  38120. var carry, i, j, k;
  38121. for (i = 63; i >= 32; --i) {
  38122. carry = 0;
  38123. for (j = i - 32, k = i - 12; j < k; ++j) {
  38124. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38125. carry = (x[j] + 128) >> 8;
  38126. x[j] -= carry * 256;
  38127. }
  38128. x[j] += carry;
  38129. x[i] = 0;
  38130. }
  38131. carry = 0;
  38132. for (j = 0; j < 32; j++) {
  38133. x[j] += carry - (x[31] >> 4) * L[j];
  38134. carry = x[j] >> 8;
  38135. x[j] &= 255;
  38136. }
  38137. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38138. for (i = 0; i < 32; i++) {
  38139. x[i+1] += x[i] >> 8;
  38140. r[i] = x[i] & 255;
  38141. }
  38142. }
  38143. function reduce(r) {
  38144. var x = new Float64Array(64), i;
  38145. for (i = 0; i < 64; i++) x[i] = r[i];
  38146. for (i = 0; i < 64; i++) r[i] = 0;
  38147. modL(r, x);
  38148. }
  38149. // Note: difference from C - smlen returned, not passed as argument.
  38150. function crypto_sign(sm, m, n, sk) {
  38151. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38152. var i, j, x = new Float64Array(64);
  38153. var p = [gf(), gf(), gf(), gf()];
  38154. crypto_hash(d, sk, 32);
  38155. d[0] &= 248;
  38156. d[31] &= 127;
  38157. d[31] |= 64;
  38158. var smlen = n + 64;
  38159. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38160. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38161. crypto_hash(r, sm.subarray(32), n+32);
  38162. reduce(r);
  38163. scalarbase(p, r);
  38164. pack(sm, p);
  38165. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38166. crypto_hash(h, sm, n + 64);
  38167. reduce(h);
  38168. for (i = 0; i < 64; i++) x[i] = 0;
  38169. for (i = 0; i < 32; i++) x[i] = r[i];
  38170. for (i = 0; i < 32; i++) {
  38171. for (j = 0; j < 32; j++) {
  38172. x[i+j] += h[i] * d[j];
  38173. }
  38174. }
  38175. modL(sm.subarray(32), x);
  38176. return smlen;
  38177. }
  38178. function unpackneg(r, p) {
  38179. var t = gf(), chk = gf(), num = gf(),
  38180. den = gf(), den2 = gf(), den4 = gf(),
  38181. den6 = gf();
  38182. set25519(r[2], gf1);
  38183. unpack25519(r[1], p);
  38184. S(num, r[1]);
  38185. M(den, num, D);
  38186. Z(num, num, r[2]);
  38187. A(den, r[2], den);
  38188. S(den2, den);
  38189. S(den4, den2);
  38190. M(den6, den4, den2);
  38191. M(t, den6, num);
  38192. M(t, t, den);
  38193. pow2523(t, t);
  38194. M(t, t, num);
  38195. M(t, t, den);
  38196. M(t, t, den);
  38197. M(r[0], t, den);
  38198. S(chk, r[0]);
  38199. M(chk, chk, den);
  38200. if (neq25519(chk, num)) M(r[0], r[0], I);
  38201. S(chk, r[0]);
  38202. M(chk, chk, den);
  38203. if (neq25519(chk, num)) return -1;
  38204. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38205. M(r[3], r[0], r[1]);
  38206. return 0;
  38207. }
  38208. function crypto_sign_open(m, sm, n, pk) {
  38209. var i, mlen;
  38210. var t = new Uint8Array(32), h = new Uint8Array(64);
  38211. var p = [gf(), gf(), gf(), gf()],
  38212. q = [gf(), gf(), gf(), gf()];
  38213. mlen = -1;
  38214. if (n < 64) return -1;
  38215. if (unpackneg(q, pk)) return -1;
  38216. for (i = 0; i < n; i++) m[i] = sm[i];
  38217. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38218. crypto_hash(h, m, n);
  38219. reduce(h);
  38220. scalarmult(p, q, h);
  38221. scalarbase(q, sm.subarray(32));
  38222. add(p, q);
  38223. pack(t, p);
  38224. n -= 64;
  38225. if (crypto_verify_32(sm, 0, t, 0)) {
  38226. for (i = 0; i < n; i++) m[i] = 0;
  38227. return -1;
  38228. }
  38229. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38230. mlen = n;
  38231. return mlen;
  38232. }
  38233. var crypto_secretbox_KEYBYTES = 32,
  38234. crypto_secretbox_NONCEBYTES = 24,
  38235. crypto_secretbox_ZEROBYTES = 32,
  38236. crypto_secretbox_BOXZEROBYTES = 16,
  38237. crypto_scalarmult_BYTES = 32,
  38238. crypto_scalarmult_SCALARBYTES = 32,
  38239. crypto_box_PUBLICKEYBYTES = 32,
  38240. crypto_box_SECRETKEYBYTES = 32,
  38241. crypto_box_BEFORENMBYTES = 32,
  38242. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38243. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38244. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38245. crypto_sign_BYTES = 64,
  38246. crypto_sign_PUBLICKEYBYTES = 32,
  38247. crypto_sign_SECRETKEYBYTES = 64,
  38248. crypto_sign_SEEDBYTES = 32,
  38249. crypto_hash_BYTES = 64;
  38250. nacl.lowlevel = {
  38251. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38252. crypto_stream_xor: crypto_stream_xor,
  38253. crypto_stream: crypto_stream,
  38254. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38255. crypto_stream_salsa20: crypto_stream_salsa20,
  38256. crypto_onetimeauth: crypto_onetimeauth,
  38257. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38258. crypto_verify_16: crypto_verify_16,
  38259. crypto_verify_32: crypto_verify_32,
  38260. crypto_secretbox: crypto_secretbox,
  38261. crypto_secretbox_open: crypto_secretbox_open,
  38262. crypto_scalarmult: crypto_scalarmult,
  38263. crypto_scalarmult_base: crypto_scalarmult_base,
  38264. crypto_box_beforenm: crypto_box_beforenm,
  38265. crypto_box_afternm: crypto_box_afternm,
  38266. crypto_box: crypto_box,
  38267. crypto_box_open: crypto_box_open,
  38268. crypto_box_keypair: crypto_box_keypair,
  38269. crypto_hash: crypto_hash,
  38270. crypto_sign: crypto_sign,
  38271. crypto_sign_keypair: crypto_sign_keypair,
  38272. crypto_sign_open: crypto_sign_open,
  38273. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38274. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38275. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38276. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38277. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38278. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38279. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38280. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38281. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38282. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38283. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38284. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38285. crypto_sign_BYTES: crypto_sign_BYTES,
  38286. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38287. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38288. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38289. crypto_hash_BYTES: crypto_hash_BYTES
  38290. };
  38291. /* High-level API */
  38292. function checkLengths(k, n) {
  38293. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38294. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38295. }
  38296. function checkBoxLengths(pk, sk) {
  38297. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38298. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38299. }
  38300. function checkArrayTypes() {
  38301. for (var i = 0; i < arguments.length; i++) {
  38302. if (!(arguments[i] instanceof Uint8Array))
  38303. throw new TypeError('unexpected type, use Uint8Array');
  38304. }
  38305. }
  38306. function cleanup(arr) {
  38307. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38308. }
  38309. nacl.randomBytes = function(n) {
  38310. var b = new Uint8Array(n);
  38311. randombytes(b, n);
  38312. return b;
  38313. };
  38314. nacl.secretbox = function(msg, nonce, key) {
  38315. checkArrayTypes(msg, nonce, key);
  38316. checkLengths(key, nonce);
  38317. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38318. var c = new Uint8Array(m.length);
  38319. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38320. crypto_secretbox(c, m, m.length, nonce, key);
  38321. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38322. };
  38323. nacl.secretbox.open = function(box, nonce, key) {
  38324. checkArrayTypes(box, nonce, key);
  38325. checkLengths(key, nonce);
  38326. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38327. var m = new Uint8Array(c.length);
  38328. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38329. if (c.length < 32) return null;
  38330. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38331. return m.subarray(crypto_secretbox_ZEROBYTES);
  38332. };
  38333. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38334. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38335. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38336. nacl.scalarMult = function(n, p) {
  38337. checkArrayTypes(n, p);
  38338. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38339. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38340. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38341. crypto_scalarmult(q, n, p);
  38342. return q;
  38343. };
  38344. nacl.scalarMult.base = function(n) {
  38345. checkArrayTypes(n);
  38346. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38347. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38348. crypto_scalarmult_base(q, n);
  38349. return q;
  38350. };
  38351. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38352. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38353. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38354. var k = nacl.box.before(publicKey, secretKey);
  38355. return nacl.secretbox(msg, nonce, k);
  38356. };
  38357. nacl.box.before = function(publicKey, secretKey) {
  38358. checkArrayTypes(publicKey, secretKey);
  38359. checkBoxLengths(publicKey, secretKey);
  38360. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38361. crypto_box_beforenm(k, publicKey, secretKey);
  38362. return k;
  38363. };
  38364. nacl.box.after = nacl.secretbox;
  38365. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38366. var k = nacl.box.before(publicKey, secretKey);
  38367. return nacl.secretbox.open(msg, nonce, k);
  38368. };
  38369. nacl.box.open.after = nacl.secretbox.open;
  38370. nacl.box.keyPair = function() {
  38371. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38372. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38373. crypto_box_keypair(pk, sk);
  38374. return {publicKey: pk, secretKey: sk};
  38375. };
  38376. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38377. checkArrayTypes(secretKey);
  38378. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38379. throw new Error('bad secret key size');
  38380. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38381. crypto_scalarmult_base(pk, secretKey);
  38382. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38383. };
  38384. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38385. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38386. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38387. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38388. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38389. nacl.sign = function(msg, secretKey) {
  38390. checkArrayTypes(msg, secretKey);
  38391. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38392. throw new Error('bad secret key size');
  38393. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38394. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38395. return signedMsg;
  38396. };
  38397. nacl.sign.open = function(signedMsg, publicKey) {
  38398. checkArrayTypes(signedMsg, publicKey);
  38399. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38400. throw new Error('bad public key size');
  38401. var tmp = new Uint8Array(signedMsg.length);
  38402. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38403. if (mlen < 0) return null;
  38404. var m = new Uint8Array(mlen);
  38405. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38406. return m;
  38407. };
  38408. nacl.sign.detached = function(msg, secretKey) {
  38409. var signedMsg = nacl.sign(msg, secretKey);
  38410. var sig = new Uint8Array(crypto_sign_BYTES);
  38411. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38412. return sig;
  38413. };
  38414. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38415. checkArrayTypes(msg, sig, publicKey);
  38416. if (sig.length !== crypto_sign_BYTES)
  38417. throw new Error('bad signature size');
  38418. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38419. throw new Error('bad public key size');
  38420. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38421. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38422. var i;
  38423. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38424. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38425. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38426. };
  38427. nacl.sign.keyPair = function() {
  38428. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38429. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38430. crypto_sign_keypair(pk, sk);
  38431. return {publicKey: pk, secretKey: sk};
  38432. };
  38433. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38434. checkArrayTypes(secretKey);
  38435. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38436. throw new Error('bad secret key size');
  38437. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38438. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38439. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38440. };
  38441. nacl.sign.keyPair.fromSeed = function(seed) {
  38442. checkArrayTypes(seed);
  38443. if (seed.length !== crypto_sign_SEEDBYTES)
  38444. throw new Error('bad seed size');
  38445. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38446. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38447. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38448. crypto_sign_keypair(pk, sk, true);
  38449. return {publicKey: pk, secretKey: sk};
  38450. };
  38451. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38452. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38453. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38454. nacl.sign.signatureLength = crypto_sign_BYTES;
  38455. nacl.hash = function(msg) {
  38456. checkArrayTypes(msg);
  38457. var h = new Uint8Array(crypto_hash_BYTES);
  38458. crypto_hash(h, msg, msg.length);
  38459. return h;
  38460. };
  38461. nacl.hash.hashLength = crypto_hash_BYTES;
  38462. nacl.verify = function(x, y) {
  38463. checkArrayTypes(x, y);
  38464. // Zero length arguments are considered not equal.
  38465. if (x.length === 0 || y.length === 0) return false;
  38466. if (x.length !== y.length) return false;
  38467. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38468. };
  38469. nacl.setPRNG = function(fn) {
  38470. randombytes = fn;
  38471. };
  38472. (function() {
  38473. // Initialize PRNG if environment provides CSPRNG.
  38474. // If not, methods calling randombytes will throw.
  38475. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38476. if (crypto && crypto.getRandomValues) {
  38477. // Browsers.
  38478. var QUOTA = 65536;
  38479. nacl.setPRNG(function(x, n) {
  38480. var i, v = new Uint8Array(n);
  38481. for (i = 0; i < n; i += QUOTA) {
  38482. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38483. }
  38484. for (i = 0; i < n; i++) x[i] = v[i];
  38485. cleanup(v);
  38486. });
  38487. } else if (true) {
  38488. // Node.js.
  38489. crypto = __webpack_require__(3);
  38490. if (crypto && crypto.randomBytes) {
  38491. nacl.setPRNG(function(x, n) {
  38492. var i, v = crypto.randomBytes(n);
  38493. for (i = 0; i < n; i++) x[i] = v[i];
  38494. cleanup(v);
  38495. });
  38496. }
  38497. }
  38498. })();
  38499. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38500. /***/ }),
  38501. /* 1 */
  38502. /***/ (function(module, exports, __webpack_require__) {
  38503. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38504. // Public domain.
  38505. (function(root, f) {
  38506. 'use strict';
  38507. if ( true && module.exports) module.exports = f();
  38508. else if (root.nacl) root.nacl.util = f();
  38509. else {
  38510. root.nacl = {};
  38511. root.nacl.util = f();
  38512. }
  38513. }(this, function() {
  38514. 'use strict';
  38515. var util = {};
  38516. function validateBase64(s) {
  38517. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38518. throw new TypeError('invalid encoding');
  38519. }
  38520. }
  38521. util.decodeUTF8 = function(s) {
  38522. if (typeof s !== 'string') throw new TypeError('expected string');
  38523. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38524. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38525. return b;
  38526. };
  38527. util.encodeUTF8 = function(arr) {
  38528. var i, s = [];
  38529. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38530. return decodeURIComponent(escape(s.join('')));
  38531. };
  38532. if (typeof atob === 'undefined') {
  38533. // Node.js
  38534. if (typeof Buffer.from !== 'undefined') {
  38535. // Node v6 and later
  38536. util.encodeBase64 = function (arr) { // v6 and later
  38537. return Buffer.from(arr).toString('base64');
  38538. };
  38539. util.decodeBase64 = function (s) {
  38540. validateBase64(s);
  38541. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38542. };
  38543. } else {
  38544. // Node earlier than v6
  38545. util.encodeBase64 = function (arr) { // v6 and later
  38546. return (new Buffer(arr)).toString('base64');
  38547. };
  38548. util.decodeBase64 = function(s) {
  38549. validateBase64(s);
  38550. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38551. };
  38552. }
  38553. } else {
  38554. // Browsers
  38555. util.encodeBase64 = function(arr) {
  38556. var i, s = [], len = arr.length;
  38557. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38558. return btoa(s.join(''));
  38559. };
  38560. util.decodeBase64 = function(s) {
  38561. validateBase64(s);
  38562. var i, d = atob(s), b = new Uint8Array(d.length);
  38563. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38564. return b;
  38565. };
  38566. }
  38567. return util;
  38568. }));
  38569. /***/ }),
  38570. /* 2 */
  38571. /***/ (function(module, exports, __webpack_require__) {
  38572. // required so we don't have to do require('pusher').default etc.
  38573. module.exports = __webpack_require__(4).default;
  38574. /***/ }),
  38575. /* 3 */
  38576. /***/ (function(module, exports) {
  38577. /* (ignored) */
  38578. /***/ }),
  38579. /* 4 */
  38580. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38581. "use strict";
  38582. __webpack_require__.r(__webpack_exports__);
  38583. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38584. var ScriptReceiverFactory = (function () {
  38585. function ScriptReceiverFactory(prefix, name) {
  38586. this.lastId = 0;
  38587. this.prefix = prefix;
  38588. this.name = name;
  38589. }
  38590. ScriptReceiverFactory.prototype.create = function (callback) {
  38591. this.lastId++;
  38592. var number = this.lastId;
  38593. var id = this.prefix + number;
  38594. var name = this.name + "[" + number + "]";
  38595. var called = false;
  38596. var callbackWrapper = function () {
  38597. if (!called) {
  38598. callback.apply(null, arguments);
  38599. called = true;
  38600. }
  38601. };
  38602. this[number] = callbackWrapper;
  38603. return { number: number, id: id, name: name, callback: callbackWrapper };
  38604. };
  38605. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38606. delete this[receiver.number];
  38607. };
  38608. return ScriptReceiverFactory;
  38609. }());
  38610. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38611. // CONCATENATED MODULE: ./src/core/defaults.ts
  38612. var Defaults = {
  38613. VERSION: "5.0.3",
  38614. PROTOCOL: 7,
  38615. host: 'ws.pusherapp.com',
  38616. ws_port: 80,
  38617. wss_port: 443,
  38618. ws_path: '',
  38619. sockjs_host: 'sockjs.pusher.com',
  38620. sockjs_http_port: 80,
  38621. sockjs_https_port: 443,
  38622. sockjs_path: '/pusher',
  38623. stats_host: 'stats.pusher.com',
  38624. channel_auth_endpoint: '/pusher/auth',
  38625. channel_auth_transport: 'ajax',
  38626. activity_timeout: 120000,
  38627. pong_timeout: 30000,
  38628. unavailable_timeout: 10000,
  38629. cdn_http: "http://js.pusher.com",
  38630. cdn_https: "https://js.pusher.com",
  38631. dependency_suffix: ""
  38632. };
  38633. /* harmony default export */ var defaults = (Defaults);
  38634. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38635. var dependency_loader_DependencyLoader = (function () {
  38636. function DependencyLoader(options) {
  38637. this.options = options;
  38638. this.receivers = options.receivers || ScriptReceivers;
  38639. this.loading = {};
  38640. }
  38641. DependencyLoader.prototype.load = function (name, options, callback) {
  38642. var self = this;
  38643. if (self.loading[name] && self.loading[name].length > 0) {
  38644. self.loading[name].push(callback);
  38645. }
  38646. else {
  38647. self.loading[name] = [callback];
  38648. var request = runtime.createScriptRequest(self.getPath(name, options));
  38649. var receiver = self.receivers.create(function (error) {
  38650. self.receivers.remove(receiver);
  38651. if (self.loading[name]) {
  38652. var callbacks = self.loading[name];
  38653. delete self.loading[name];
  38654. var successCallback = function (wasSuccessful) {
  38655. if (!wasSuccessful) {
  38656. request.cleanup();
  38657. }
  38658. };
  38659. for (var i = 0; i < callbacks.length; i++) {
  38660. callbacks[i](error, successCallback);
  38661. }
  38662. }
  38663. });
  38664. request.send(receiver);
  38665. }
  38666. };
  38667. DependencyLoader.prototype.getRoot = function (options) {
  38668. var cdn;
  38669. var protocol = runtime.getDocument().location.protocol;
  38670. if ((options && options.useTLS) || protocol === "https:") {
  38671. cdn = this.options.cdn_https;
  38672. }
  38673. else {
  38674. cdn = this.options.cdn_http;
  38675. }
  38676. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38677. };
  38678. DependencyLoader.prototype.getPath = function (name, options) {
  38679. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38680. };
  38681. ;
  38682. return DependencyLoader;
  38683. }());
  38684. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38685. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38686. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38687. var Dependencies = new dependency_loader({
  38688. cdn_http: defaults.cdn_http,
  38689. cdn_https: defaults.cdn_https,
  38690. version: defaults.VERSION,
  38691. suffix: defaults.dependency_suffix,
  38692. receivers: DependenciesReceivers
  38693. });
  38694. // CONCATENATED MODULE: ./src/core/base64.ts
  38695. function encode(s) {
  38696. return btoa(utob(s));
  38697. }
  38698. var fromCharCode = String.fromCharCode;
  38699. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38700. var b64tab = {};
  38701. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38702. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38703. }
  38704. var cb_utob = function (c) {
  38705. var cc = c.charCodeAt(0);
  38706. return cc < 0x80
  38707. ? c
  38708. : cc < 0x800
  38709. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38710. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38711. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38712. fromCharCode(0x80 | (cc & 0x3f));
  38713. };
  38714. var utob = function (u) {
  38715. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38716. };
  38717. var cb_encode = function (ccc) {
  38718. var padlen = [0, 2, 1][ccc.length % 3];
  38719. var ord = (ccc.charCodeAt(0) << 16) |
  38720. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38721. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38722. var chars = [
  38723. b64chars.charAt(ord >>> 18),
  38724. b64chars.charAt((ord >>> 12) & 63),
  38725. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38726. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38727. ];
  38728. return chars.join('');
  38729. };
  38730. var btoa = window.btoa ||
  38731. function (b) {
  38732. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38733. };
  38734. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38735. var Timer = (function () {
  38736. function Timer(set, clear, delay, callback) {
  38737. var _this = this;
  38738. this.clear = clear;
  38739. this.timer = set(function () {
  38740. if (_this.timer) {
  38741. _this.timer = callback(_this.timer);
  38742. }
  38743. }, delay);
  38744. }
  38745. Timer.prototype.isRunning = function () {
  38746. return this.timer !== null;
  38747. };
  38748. Timer.prototype.ensureAborted = function () {
  38749. if (this.timer) {
  38750. this.clear(this.timer);
  38751. this.timer = null;
  38752. }
  38753. };
  38754. return Timer;
  38755. }());
  38756. /* harmony default export */ var abstract_timer = (Timer);
  38757. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38758. var __extends = (undefined && undefined.__extends) || (function () {
  38759. var extendStatics = function (d, b) {
  38760. extendStatics = Object.setPrototypeOf ||
  38761. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38762. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38763. return extendStatics(d, b);
  38764. };
  38765. return function (d, b) {
  38766. extendStatics(d, b);
  38767. function __() { this.constructor = d; }
  38768. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38769. };
  38770. })();
  38771. function timers_clearTimeout(timer) {
  38772. window.clearTimeout(timer);
  38773. }
  38774. function timers_clearInterval(timer) {
  38775. window.clearInterval(timer);
  38776. }
  38777. var OneOffTimer = (function (_super) {
  38778. __extends(OneOffTimer, _super);
  38779. function OneOffTimer(delay, callback) {
  38780. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38781. callback();
  38782. return null;
  38783. }) || this;
  38784. }
  38785. return OneOffTimer;
  38786. }(abstract_timer));
  38787. var PeriodicTimer = (function (_super) {
  38788. __extends(PeriodicTimer, _super);
  38789. function PeriodicTimer(delay, callback) {
  38790. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38791. callback();
  38792. return timer;
  38793. }) || this;
  38794. }
  38795. return PeriodicTimer;
  38796. }(abstract_timer));
  38797. // CONCATENATED MODULE: ./src/core/util.ts
  38798. var Util = {
  38799. now: function () {
  38800. if (Date.now) {
  38801. return Date.now();
  38802. }
  38803. else {
  38804. return new Date().valueOf();
  38805. }
  38806. },
  38807. defer: function (callback) {
  38808. return new OneOffTimer(0, callback);
  38809. },
  38810. method: function (name) {
  38811. var args = [];
  38812. for (var _i = 1; _i < arguments.length; _i++) {
  38813. args[_i - 1] = arguments[_i];
  38814. }
  38815. var boundArguments = Array.prototype.slice.call(arguments, 1);
  38816. return function (object) {
  38817. return object[name].apply(object, boundArguments.concat(arguments));
  38818. };
  38819. }
  38820. };
  38821. /* harmony default export */ var util = (Util);
  38822. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  38823. function extend(target) {
  38824. var sources = [];
  38825. for (var _i = 1; _i < arguments.length; _i++) {
  38826. sources[_i - 1] = arguments[_i];
  38827. }
  38828. for (var i = 0; i < sources.length; i++) {
  38829. var extensions = sources[i];
  38830. for (var property in extensions) {
  38831. if (extensions[property] && extensions[property].constructor &&
  38832. extensions[property].constructor === Object) {
  38833. target[property] = extend(target[property] || {}, extensions[property]);
  38834. }
  38835. else {
  38836. target[property] = extensions[property];
  38837. }
  38838. }
  38839. }
  38840. return target;
  38841. }
  38842. function stringify() {
  38843. var m = ["Pusher"];
  38844. for (var i = 0; i < arguments.length; i++) {
  38845. if (typeof arguments[i] === "string") {
  38846. m.push(arguments[i]);
  38847. }
  38848. else {
  38849. m.push(safeJSONStringify(arguments[i]));
  38850. }
  38851. }
  38852. return m.join(" : ");
  38853. }
  38854. function arrayIndexOf(array, item) {
  38855. var nativeIndexOf = Array.prototype.indexOf;
  38856. if (array === null) {
  38857. return -1;
  38858. }
  38859. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  38860. return array.indexOf(item);
  38861. }
  38862. for (var i = 0, l = array.length; i < l; i++) {
  38863. if (array[i] === item) {
  38864. return i;
  38865. }
  38866. }
  38867. return -1;
  38868. }
  38869. function objectApply(object, f) {
  38870. for (var key in object) {
  38871. if (Object.prototype.hasOwnProperty.call(object, key)) {
  38872. f(object[key], key, object);
  38873. }
  38874. }
  38875. }
  38876. function keys(object) {
  38877. var keys = [];
  38878. objectApply(object, function (_, key) {
  38879. keys.push(key);
  38880. });
  38881. return keys;
  38882. }
  38883. function values(object) {
  38884. var values = [];
  38885. objectApply(object, function (value) {
  38886. values.push(value);
  38887. });
  38888. return values;
  38889. }
  38890. function apply(array, f, context) {
  38891. for (var i = 0; i < array.length; i++) {
  38892. f.call(context || window, array[i], i, array);
  38893. }
  38894. }
  38895. function map(array, f) {
  38896. var result = [];
  38897. for (var i = 0; i < array.length; i++) {
  38898. result.push(f(array[i], i, array, result));
  38899. }
  38900. return result;
  38901. }
  38902. function mapObject(object, f) {
  38903. var result = {};
  38904. objectApply(object, function (value, key) {
  38905. result[key] = f(value);
  38906. });
  38907. return result;
  38908. }
  38909. function filter(array, test) {
  38910. test = test || function (value) { return !!value; };
  38911. var result = [];
  38912. for (var i = 0; i < array.length; i++) {
  38913. if (test(array[i], i, array, result)) {
  38914. result.push(array[i]);
  38915. }
  38916. }
  38917. return result;
  38918. }
  38919. function filterObject(object, test) {
  38920. var result = {};
  38921. objectApply(object, function (value, key) {
  38922. if ((test && test(value, key, object, result)) || Boolean(value)) {
  38923. result[key] = value;
  38924. }
  38925. });
  38926. return result;
  38927. }
  38928. function flatten(object) {
  38929. var result = [];
  38930. objectApply(object, function (value, key) {
  38931. result.push([key, value]);
  38932. });
  38933. return result;
  38934. }
  38935. function any(array, test) {
  38936. for (var i = 0; i < array.length; i++) {
  38937. if (test(array[i], i, array)) {
  38938. return true;
  38939. }
  38940. }
  38941. return false;
  38942. }
  38943. function collections_all(array, test) {
  38944. for (var i = 0; i < array.length; i++) {
  38945. if (!test(array[i], i, array)) {
  38946. return false;
  38947. }
  38948. }
  38949. return true;
  38950. }
  38951. function encodeParamsObject(data) {
  38952. return mapObject(data, function (value) {
  38953. if (typeof value === "object") {
  38954. value = safeJSONStringify(value);
  38955. }
  38956. return encodeURIComponent(encode(value.toString()));
  38957. });
  38958. }
  38959. function buildQueryString(data) {
  38960. var params = filterObject(data, function (value) {
  38961. return value !== undefined;
  38962. });
  38963. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  38964. return query;
  38965. }
  38966. function decycleObject(object) {
  38967. var objects = [], paths = [];
  38968. return (function derez(value, path) {
  38969. var i, name, nu;
  38970. switch (typeof value) {
  38971. case 'object':
  38972. if (!value) {
  38973. return null;
  38974. }
  38975. for (i = 0; i < objects.length; i += 1) {
  38976. if (objects[i] === value) {
  38977. return { $ref: paths[i] };
  38978. }
  38979. }
  38980. objects.push(value);
  38981. paths.push(path);
  38982. if (Object.prototype.toString.apply(value) === '[object Array]') {
  38983. nu = [];
  38984. for (i = 0; i < value.length; i += 1) {
  38985. nu[i] = derez(value[i], path + '[' + i + ']');
  38986. }
  38987. }
  38988. else {
  38989. nu = {};
  38990. for (name in value) {
  38991. if (Object.prototype.hasOwnProperty.call(value, name)) {
  38992. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  38993. }
  38994. }
  38995. }
  38996. return nu;
  38997. case 'number':
  38998. case 'string':
  38999. case 'boolean':
  39000. return value;
  39001. }
  39002. }(object, '$'));
  39003. }
  39004. function safeJSONStringify(source) {
  39005. try {
  39006. return JSON.stringify(source);
  39007. }
  39008. catch (e) {
  39009. return JSON.stringify(decycleObject(source));
  39010. }
  39011. }
  39012. // CONCATENATED MODULE: ./src/core/logger.ts
  39013. var logger_Logger = (function () {
  39014. function Logger() {
  39015. this.globalLog = function (message) {
  39016. if (window.console && window.console.log) {
  39017. window.console.log(message);
  39018. }
  39019. };
  39020. }
  39021. Logger.prototype.debug = function () {
  39022. var args = [];
  39023. for (var _i = 0; _i < arguments.length; _i++) {
  39024. args[_i] = arguments[_i];
  39025. }
  39026. this.log(this.globalLog, args);
  39027. };
  39028. Logger.prototype.warn = function () {
  39029. var args = [];
  39030. for (var _i = 0; _i < arguments.length; _i++) {
  39031. args[_i] = arguments[_i];
  39032. }
  39033. this.log(this.globalLogWarn, args);
  39034. };
  39035. Logger.prototype.error = function () {
  39036. var args = [];
  39037. for (var _i = 0; _i < arguments.length; _i++) {
  39038. args[_i] = arguments[_i];
  39039. }
  39040. this.log(this.globalLogError, args);
  39041. };
  39042. Logger.prototype.globalLogWarn = function (message) {
  39043. if (window.console && window.console.warn) {
  39044. window.console.warn(message);
  39045. }
  39046. else {
  39047. this.globalLog(message);
  39048. }
  39049. };
  39050. Logger.prototype.globalLogError = function (message) {
  39051. if (window.console && window.console.error) {
  39052. window.console.error(message);
  39053. }
  39054. else {
  39055. this.globalLogWarn(message);
  39056. }
  39057. };
  39058. Logger.prototype.log = function (defaultLoggingFunction) {
  39059. var args = [];
  39060. for (var _i = 1; _i < arguments.length; _i++) {
  39061. args[_i - 1] = arguments[_i];
  39062. }
  39063. var message = stringify.apply(this, arguments);
  39064. if (core_pusher.log) {
  39065. core_pusher.log(message);
  39066. }
  39067. else if (core_pusher.logToConsole) {
  39068. var log = defaultLoggingFunction.bind(this);
  39069. log(message);
  39070. }
  39071. };
  39072. return Logger;
  39073. }());
  39074. /* harmony default export */ var logger = (new logger_Logger());
  39075. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39076. var urlStore = {
  39077. baseUrl: "https://pusher.com",
  39078. urls: {
  39079. authenticationEndpoint: {
  39080. path: "/docs/authenticating_users",
  39081. },
  39082. javascriptQuickStart: {
  39083. path: "/docs/javascript_quick_start"
  39084. },
  39085. triggeringClientEvents: {
  39086. path: "/docs/client_api_guide/client_events#trigger-events"
  39087. }
  39088. }
  39089. };
  39090. var buildLogSuffix = function (key) {
  39091. var urlPrefix = "See:";
  39092. var urlObj = urlStore.urls[key];
  39093. if (!urlObj)
  39094. return "";
  39095. var url;
  39096. if (urlObj.fullUrl) {
  39097. url = urlObj.fullUrl;
  39098. }
  39099. else if (urlObj.path) {
  39100. url = urlStore.baseUrl + urlObj.path;
  39101. }
  39102. if (!url)
  39103. return "";
  39104. return urlPrefix + " " + url;
  39105. };
  39106. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39107. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39108. var ajax = function (context, socketId, callback) {
  39109. var self = this, xhr;
  39110. xhr = runtime.createXHR();
  39111. xhr.open("POST", self.options.authEndpoint, true);
  39112. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39113. for (var headerName in this.authOptions.headers) {
  39114. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39115. }
  39116. xhr.onreadystatechange = function () {
  39117. if (xhr.readyState === 4) {
  39118. if (xhr.status === 200) {
  39119. var data, parsed = false;
  39120. try {
  39121. data = JSON.parse(xhr.responseText);
  39122. parsed = true;
  39123. }
  39124. catch (e) {
  39125. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39126. }
  39127. if (parsed) {
  39128. callback(false, data);
  39129. }
  39130. }
  39131. else {
  39132. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39133. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39134. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39135. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39136. callback(true, xhr.status);
  39137. }
  39138. }
  39139. };
  39140. xhr.send(this.composeQuery(socketId));
  39141. return xhr;
  39142. };
  39143. /* harmony default export */ var xhr_auth = (ajax);
  39144. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39145. var jsonp = function (context, socketId, callback) {
  39146. if (this.authOptions.headers !== undefined) {
  39147. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39148. }
  39149. var callbackName = context.nextAuthCallbackID.toString();
  39150. context.nextAuthCallbackID++;
  39151. var document = context.getDocument();
  39152. var script = document.createElement("script");
  39153. context.auth_callbacks[callbackName] = function (data) {
  39154. callback(false, data);
  39155. };
  39156. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39157. script.src = this.options.authEndpoint +
  39158. '?callback=' +
  39159. encodeURIComponent(callback_name) +
  39160. '&' +
  39161. this.composeQuery(socketId);
  39162. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39163. head.insertBefore(script, head.firstChild);
  39164. };
  39165. /* harmony default export */ var jsonp_auth = (jsonp);
  39166. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39167. var ScriptRequest = (function () {
  39168. function ScriptRequest(src) {
  39169. this.src = src;
  39170. }
  39171. ScriptRequest.prototype.send = function (receiver) {
  39172. var self = this;
  39173. var errorString = "Error loading " + self.src;
  39174. self.script = document.createElement("script");
  39175. self.script.id = receiver.id;
  39176. self.script.src = self.src;
  39177. self.script.type = "text/javascript";
  39178. self.script.charset = "UTF-8";
  39179. if (self.script.addEventListener) {
  39180. self.script.onerror = function () {
  39181. receiver.callback(errorString);
  39182. };
  39183. self.script.onload = function () {
  39184. receiver.callback(null);
  39185. };
  39186. }
  39187. else {
  39188. self.script.onreadystatechange = function () {
  39189. if (self.script.readyState === 'loaded' ||
  39190. self.script.readyState === 'complete') {
  39191. receiver.callback(null);
  39192. }
  39193. };
  39194. }
  39195. if (self.script.async === undefined && document.attachEvent &&
  39196. /opera/i.test(navigator.userAgent)) {
  39197. self.errorScript = document.createElement("script");
  39198. self.errorScript.id = receiver.id + "_error";
  39199. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39200. self.script.async = self.errorScript.async = false;
  39201. }
  39202. else {
  39203. self.script.async = true;
  39204. }
  39205. var head = document.getElementsByTagName('head')[0];
  39206. head.insertBefore(self.script, head.firstChild);
  39207. if (self.errorScript) {
  39208. head.insertBefore(self.errorScript, self.script.nextSibling);
  39209. }
  39210. };
  39211. ScriptRequest.prototype.cleanup = function () {
  39212. if (this.script) {
  39213. this.script.onload = this.script.onerror = null;
  39214. this.script.onreadystatechange = null;
  39215. }
  39216. if (this.script && this.script.parentNode) {
  39217. this.script.parentNode.removeChild(this.script);
  39218. }
  39219. if (this.errorScript && this.errorScript.parentNode) {
  39220. this.errorScript.parentNode.removeChild(this.errorScript);
  39221. }
  39222. this.script = null;
  39223. this.errorScript = null;
  39224. };
  39225. return ScriptRequest;
  39226. }());
  39227. /* harmony default export */ var script_request = (ScriptRequest);
  39228. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39229. var jsonp_request_JSONPRequest = (function () {
  39230. function JSONPRequest(url, data) {
  39231. this.url = url;
  39232. this.data = data;
  39233. }
  39234. JSONPRequest.prototype.send = function (receiver) {
  39235. if (this.request) {
  39236. return;
  39237. }
  39238. var query = buildQueryString(this.data);
  39239. var url = this.url + "/" + receiver.number + "?" + query;
  39240. this.request = runtime.createScriptRequest(url);
  39241. this.request.send(receiver);
  39242. };
  39243. JSONPRequest.prototype.cleanup = function () {
  39244. if (this.request) {
  39245. this.request.cleanup();
  39246. }
  39247. };
  39248. return JSONPRequest;
  39249. }());
  39250. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39251. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39252. var getAgent = function (sender, useTLS) {
  39253. return function (data, callback) {
  39254. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39255. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39256. var request = runtime.createJSONPRequest(url, data);
  39257. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39258. ScriptReceivers.remove(receiver);
  39259. request.cleanup();
  39260. if (result && result.host) {
  39261. sender.host = result.host;
  39262. }
  39263. if (callback) {
  39264. callback(error, result);
  39265. }
  39266. });
  39267. request.send(receiver);
  39268. };
  39269. };
  39270. var jsonp_timeline_jsonp = {
  39271. name: 'jsonp',
  39272. getAgent: getAgent
  39273. };
  39274. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39275. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39276. function getGenericURL(baseScheme, params, path) {
  39277. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39278. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39279. return scheme + "://" + host + path;
  39280. }
  39281. function getGenericPath(key, queryString) {
  39282. var path = "/app/" + key;
  39283. var query = "?protocol=" + defaults.PROTOCOL +
  39284. "&client=js" +
  39285. "&version=" + defaults.VERSION +
  39286. (queryString ? ("&" + queryString) : "");
  39287. return path + query;
  39288. }
  39289. var ws = {
  39290. getInitial: function (key, params) {
  39291. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39292. return getGenericURL("ws", params, path);
  39293. }
  39294. };
  39295. var http = {
  39296. getInitial: function (key, params) {
  39297. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39298. return getGenericURL("http", params, path);
  39299. }
  39300. };
  39301. var sockjs = {
  39302. getInitial: function (key, params) {
  39303. return getGenericURL("http", params, params.httpPath || "/pusher");
  39304. },
  39305. getPath: function (key, params) {
  39306. return getGenericPath(key);
  39307. }
  39308. };
  39309. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39310. var callback_registry_CallbackRegistry = (function () {
  39311. function CallbackRegistry() {
  39312. this._callbacks = {};
  39313. }
  39314. CallbackRegistry.prototype.get = function (name) {
  39315. return this._callbacks[prefix(name)];
  39316. };
  39317. CallbackRegistry.prototype.add = function (name, callback, context) {
  39318. var prefixedEventName = prefix(name);
  39319. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39320. this._callbacks[prefixedEventName].push({
  39321. fn: callback,
  39322. context: context
  39323. });
  39324. };
  39325. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39326. if (!name && !callback && !context) {
  39327. this._callbacks = {};
  39328. return;
  39329. }
  39330. var names = name ? [prefix(name)] : keys(this._callbacks);
  39331. if (callback || context) {
  39332. this.removeCallback(names, callback, context);
  39333. }
  39334. else {
  39335. this.removeAllCallbacks(names);
  39336. }
  39337. };
  39338. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39339. apply(names, function (name) {
  39340. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39341. return (callback && callback !== binding.fn) ||
  39342. (context && context !== binding.context);
  39343. });
  39344. if (this._callbacks[name].length === 0) {
  39345. delete this._callbacks[name];
  39346. }
  39347. }, this);
  39348. };
  39349. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39350. apply(names, function (name) {
  39351. delete this._callbacks[name];
  39352. }, this);
  39353. };
  39354. return CallbackRegistry;
  39355. }());
  39356. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39357. function prefix(name) {
  39358. return "_" + name;
  39359. }
  39360. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39361. var dispatcher_Dispatcher = (function () {
  39362. function Dispatcher(failThrough) {
  39363. this.callbacks = new callback_registry();
  39364. this.global_callbacks = [];
  39365. this.failThrough = failThrough;
  39366. }
  39367. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39368. this.callbacks.add(eventName, callback, context);
  39369. return this;
  39370. };
  39371. Dispatcher.prototype.bind_global = function (callback) {
  39372. this.global_callbacks.push(callback);
  39373. return this;
  39374. };
  39375. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39376. this.callbacks.remove(eventName, callback, context);
  39377. return this;
  39378. };
  39379. Dispatcher.prototype.unbind_global = function (callback) {
  39380. if (!callback) {
  39381. this.global_callbacks = [];
  39382. return this;
  39383. }
  39384. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39385. return this;
  39386. };
  39387. Dispatcher.prototype.unbind_all = function () {
  39388. this.unbind();
  39389. this.unbind_global();
  39390. return this;
  39391. };
  39392. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39393. for (var i = 0; i < this.global_callbacks.length; i++) {
  39394. this.global_callbacks[i](eventName, data);
  39395. }
  39396. var callbacks = this.callbacks.get(eventName);
  39397. var args = [];
  39398. if (metadata) {
  39399. args.push(data, metadata);
  39400. }
  39401. else if (data) {
  39402. args.push(data);
  39403. }
  39404. if (callbacks && callbacks.length > 0) {
  39405. for (var i = 0; i < callbacks.length; i++) {
  39406. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39407. }
  39408. }
  39409. else if (this.failThrough) {
  39410. this.failThrough(eventName, data);
  39411. }
  39412. return this;
  39413. };
  39414. return Dispatcher;
  39415. }());
  39416. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39417. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39418. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39419. var extendStatics = function (d, b) {
  39420. extendStatics = Object.setPrototypeOf ||
  39421. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39422. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39423. return extendStatics(d, b);
  39424. };
  39425. return function (d, b) {
  39426. extendStatics(d, b);
  39427. function __() { this.constructor = d; }
  39428. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39429. };
  39430. })();
  39431. var transport_connection_TransportConnection = (function (_super) {
  39432. transport_connection_extends(TransportConnection, _super);
  39433. function TransportConnection(hooks, name, priority, key, options) {
  39434. var _this = _super.call(this) || this;
  39435. _this.initialize = runtime.transportConnectionInitializer;
  39436. _this.hooks = hooks;
  39437. _this.name = name;
  39438. _this.priority = priority;
  39439. _this.key = key;
  39440. _this.options = options;
  39441. _this.state = "new";
  39442. _this.timeline = options.timeline;
  39443. _this.activityTimeout = options.activityTimeout;
  39444. _this.id = _this.timeline.generateUniqueID();
  39445. return _this;
  39446. }
  39447. TransportConnection.prototype.handlesActivityChecks = function () {
  39448. return Boolean(this.hooks.handlesActivityChecks);
  39449. };
  39450. TransportConnection.prototype.supportsPing = function () {
  39451. return Boolean(this.hooks.supportsPing);
  39452. };
  39453. TransportConnection.prototype.connect = function () {
  39454. var _this = this;
  39455. if (this.socket || this.state !== "initialized") {
  39456. return false;
  39457. }
  39458. var url = this.hooks.urls.getInitial(this.key, this.options);
  39459. try {
  39460. this.socket = this.hooks.getSocket(url, this.options);
  39461. }
  39462. catch (e) {
  39463. util.defer(function () {
  39464. _this.onError(e);
  39465. _this.changeState("closed");
  39466. });
  39467. return false;
  39468. }
  39469. this.bindListeners();
  39470. logger.debug("Connecting", { transport: this.name, url: url });
  39471. this.changeState("connecting");
  39472. return true;
  39473. };
  39474. TransportConnection.prototype.close = function () {
  39475. if (this.socket) {
  39476. this.socket.close();
  39477. return true;
  39478. }
  39479. else {
  39480. return false;
  39481. }
  39482. };
  39483. TransportConnection.prototype.send = function (data) {
  39484. var _this = this;
  39485. if (this.state === "open") {
  39486. util.defer(function () {
  39487. if (_this.socket) {
  39488. _this.socket.send(data);
  39489. }
  39490. });
  39491. return true;
  39492. }
  39493. else {
  39494. return false;
  39495. }
  39496. };
  39497. TransportConnection.prototype.ping = function () {
  39498. if (this.state === "open" && this.supportsPing()) {
  39499. this.socket.ping();
  39500. }
  39501. };
  39502. TransportConnection.prototype.onOpen = function () {
  39503. if (this.hooks.beforeOpen) {
  39504. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39505. }
  39506. this.changeState("open");
  39507. this.socket.onopen = undefined;
  39508. };
  39509. TransportConnection.prototype.onError = function (error) {
  39510. this.emit("error", { type: 'WebSocketError', error: error });
  39511. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39512. };
  39513. TransportConnection.prototype.onClose = function (closeEvent) {
  39514. if (closeEvent) {
  39515. this.changeState("closed", {
  39516. code: closeEvent.code,
  39517. reason: closeEvent.reason,
  39518. wasClean: closeEvent.wasClean
  39519. });
  39520. }
  39521. else {
  39522. this.changeState("closed");
  39523. }
  39524. this.unbindListeners();
  39525. this.socket = undefined;
  39526. };
  39527. TransportConnection.prototype.onMessage = function (message) {
  39528. this.emit("message", message);
  39529. };
  39530. TransportConnection.prototype.onActivity = function () {
  39531. this.emit("activity");
  39532. };
  39533. TransportConnection.prototype.bindListeners = function () {
  39534. var _this = this;
  39535. this.socket.onopen = function () {
  39536. _this.onOpen();
  39537. };
  39538. this.socket.onerror = function (error) {
  39539. _this.onError(error);
  39540. };
  39541. this.socket.onclose = function (closeEvent) {
  39542. _this.onClose(closeEvent);
  39543. };
  39544. this.socket.onmessage = function (message) {
  39545. _this.onMessage(message);
  39546. };
  39547. if (this.supportsPing()) {
  39548. this.socket.onactivity = function () { _this.onActivity(); };
  39549. }
  39550. };
  39551. TransportConnection.prototype.unbindListeners = function () {
  39552. if (this.socket) {
  39553. this.socket.onopen = undefined;
  39554. this.socket.onerror = undefined;
  39555. this.socket.onclose = undefined;
  39556. this.socket.onmessage = undefined;
  39557. if (this.supportsPing()) {
  39558. this.socket.onactivity = undefined;
  39559. }
  39560. }
  39561. };
  39562. TransportConnection.prototype.changeState = function (state, params) {
  39563. this.state = state;
  39564. this.timeline.info(this.buildTimelineMessage({
  39565. state: state,
  39566. params: params
  39567. }));
  39568. this.emit(state, params);
  39569. };
  39570. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39571. return extend({ cid: this.id }, message);
  39572. };
  39573. return TransportConnection;
  39574. }(dispatcher));
  39575. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39576. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39577. var transport_Transport = (function () {
  39578. function Transport(hooks) {
  39579. this.hooks = hooks;
  39580. }
  39581. Transport.prototype.isSupported = function (environment) {
  39582. return this.hooks.isSupported(environment);
  39583. };
  39584. Transport.prototype.createConnection = function (name, priority, key, options) {
  39585. return new transport_connection(this.hooks, name, priority, key, options);
  39586. };
  39587. return Transport;
  39588. }());
  39589. /* harmony default export */ var transports_transport = (transport_Transport);
  39590. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39591. var WSTransport = new transports_transport({
  39592. urls: ws,
  39593. handlesActivityChecks: false,
  39594. supportsPing: false,
  39595. isInitialized: function () {
  39596. return Boolean(runtime.getWebSocketAPI());
  39597. },
  39598. isSupported: function () {
  39599. return Boolean(runtime.getWebSocketAPI());
  39600. },
  39601. getSocket: function (url) {
  39602. return runtime.createWebSocket(url);
  39603. }
  39604. });
  39605. var httpConfiguration = {
  39606. urls: http,
  39607. handlesActivityChecks: false,
  39608. supportsPing: true,
  39609. isInitialized: function () {
  39610. return true;
  39611. }
  39612. };
  39613. var streamingConfiguration = extend({ getSocket: function (url) {
  39614. return runtime.HTTPFactory.createStreamingSocket(url);
  39615. }
  39616. }, httpConfiguration);
  39617. var pollingConfiguration = extend({ getSocket: function (url) {
  39618. return runtime.HTTPFactory.createPollingSocket(url);
  39619. }
  39620. }, httpConfiguration);
  39621. var xhrConfiguration = {
  39622. isSupported: function () {
  39623. return runtime.isXHRSupported();
  39624. }
  39625. };
  39626. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39627. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39628. var Transports = {
  39629. ws: WSTransport,
  39630. xhr_streaming: XHRStreamingTransport,
  39631. xhr_polling: XHRPollingTransport
  39632. };
  39633. /* harmony default export */ var transports = (Transports);
  39634. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39635. var SockJSTransport = new transports_transport({
  39636. file: "sockjs",
  39637. urls: sockjs,
  39638. handlesActivityChecks: true,
  39639. supportsPing: false,
  39640. isSupported: function () {
  39641. return true;
  39642. },
  39643. isInitialized: function () {
  39644. return window.SockJS !== undefined;
  39645. },
  39646. getSocket: function (url, options) {
  39647. return new window.SockJS(url, null, {
  39648. js_path: Dependencies.getPath("sockjs", {
  39649. useTLS: options.useTLS
  39650. }),
  39651. ignore_null_origin: options.ignoreNullOrigin
  39652. });
  39653. },
  39654. beforeOpen: function (socket, path) {
  39655. socket.send(JSON.stringify({
  39656. path: path
  39657. }));
  39658. }
  39659. });
  39660. var xdrConfiguration = {
  39661. isSupported: function (environment) {
  39662. var yes = runtime.isXDRSupported(environment.useTLS);
  39663. return yes;
  39664. }
  39665. };
  39666. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39667. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39668. transports.xdr_streaming = XDRStreamingTransport;
  39669. transports.xdr_polling = XDRPollingTransport;
  39670. transports.sockjs = SockJSTransport;
  39671. /* harmony default export */ var transports_transports = (transports);
  39672. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39673. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39674. var extendStatics = function (d, b) {
  39675. extendStatics = Object.setPrototypeOf ||
  39676. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39677. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39678. return extendStatics(d, b);
  39679. };
  39680. return function (d, b) {
  39681. extendStatics(d, b);
  39682. function __() { this.constructor = d; }
  39683. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39684. };
  39685. })();
  39686. var NetInfo = (function (_super) {
  39687. net_info_extends(NetInfo, _super);
  39688. function NetInfo() {
  39689. var _this = _super.call(this) || this;
  39690. var self = _this;
  39691. if (window.addEventListener !== undefined) {
  39692. window.addEventListener("online", function () {
  39693. self.emit('online');
  39694. }, false);
  39695. window.addEventListener("offline", function () {
  39696. self.emit('offline');
  39697. }, false);
  39698. }
  39699. return _this;
  39700. }
  39701. NetInfo.prototype.isOnline = function () {
  39702. if (window.navigator.onLine === undefined) {
  39703. return true;
  39704. }
  39705. else {
  39706. return window.navigator.onLine;
  39707. }
  39708. };
  39709. return NetInfo;
  39710. }(dispatcher));
  39711. var net_info_Network = new NetInfo();
  39712. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39713. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39714. function AssistantToTheTransportManager(manager, transport, options) {
  39715. this.manager = manager;
  39716. this.transport = transport;
  39717. this.minPingDelay = options.minPingDelay;
  39718. this.maxPingDelay = options.maxPingDelay;
  39719. this.pingDelay = undefined;
  39720. }
  39721. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39722. var _this = this;
  39723. options = extend({}, options, {
  39724. activityTimeout: this.pingDelay
  39725. });
  39726. var connection = this.transport.createConnection(name, priority, key, options);
  39727. var openTimestamp = null;
  39728. var onOpen = function () {
  39729. connection.unbind("open", onOpen);
  39730. connection.bind("closed", onClosed);
  39731. openTimestamp = util.now();
  39732. };
  39733. var onClosed = function (closeEvent) {
  39734. connection.unbind("closed", onClosed);
  39735. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39736. _this.manager.reportDeath();
  39737. }
  39738. else if (!closeEvent.wasClean && openTimestamp) {
  39739. var lifespan = util.now() - openTimestamp;
  39740. if (lifespan < 2 * _this.maxPingDelay) {
  39741. _this.manager.reportDeath();
  39742. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39743. }
  39744. }
  39745. };
  39746. connection.bind("open", onOpen);
  39747. return connection;
  39748. };
  39749. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39750. return this.manager.isAlive() && this.transport.isSupported(environment);
  39751. };
  39752. return AssistantToTheTransportManager;
  39753. }());
  39754. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39755. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39756. var Protocol = {
  39757. decodeMessage: function (messageEvent) {
  39758. try {
  39759. var messageData = JSON.parse(messageEvent.data);
  39760. var pusherEventData = messageData.data;
  39761. if (typeof pusherEventData === 'string') {
  39762. try {
  39763. pusherEventData = JSON.parse(messageData.data);
  39764. }
  39765. catch (e) { }
  39766. }
  39767. var pusherEvent = {
  39768. event: messageData.event,
  39769. channel: messageData.channel,
  39770. data: pusherEventData,
  39771. };
  39772. if (messageData.user_id) {
  39773. pusherEvent.user_id = messageData.user_id;
  39774. }
  39775. return pusherEvent;
  39776. }
  39777. catch (e) {
  39778. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39779. }
  39780. },
  39781. encodeMessage: function (event) {
  39782. return JSON.stringify(event);
  39783. },
  39784. processHandshake: function (messageEvent) {
  39785. var message = Protocol.decodeMessage(messageEvent);
  39786. if (message.event === "pusher:connection_established") {
  39787. if (!message.data.activity_timeout) {
  39788. throw "No activity timeout specified in handshake";
  39789. }
  39790. return {
  39791. action: "connected",
  39792. id: message.data.socket_id,
  39793. activityTimeout: message.data.activity_timeout * 1000
  39794. };
  39795. }
  39796. else if (message.event === "pusher:error") {
  39797. return {
  39798. action: this.getCloseAction(message.data),
  39799. error: this.getCloseError(message.data)
  39800. };
  39801. }
  39802. else {
  39803. throw "Invalid handshake";
  39804. }
  39805. },
  39806. getCloseAction: function (closeEvent) {
  39807. if (closeEvent.code < 4000) {
  39808. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  39809. return "backoff";
  39810. }
  39811. else {
  39812. return null;
  39813. }
  39814. }
  39815. else if (closeEvent.code === 4000) {
  39816. return "tls_only";
  39817. }
  39818. else if (closeEvent.code < 4100) {
  39819. return "refused";
  39820. }
  39821. else if (closeEvent.code < 4200) {
  39822. return "backoff";
  39823. }
  39824. else if (closeEvent.code < 4300) {
  39825. return "retry";
  39826. }
  39827. else {
  39828. return "refused";
  39829. }
  39830. },
  39831. getCloseError: function (closeEvent) {
  39832. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  39833. return {
  39834. type: 'PusherError',
  39835. data: {
  39836. code: closeEvent.code,
  39837. message: closeEvent.reason || closeEvent.message
  39838. }
  39839. };
  39840. }
  39841. else {
  39842. return null;
  39843. }
  39844. }
  39845. };
  39846. /* harmony default export */ var protocol_protocol = (Protocol);
  39847. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  39848. var connection_extends = (undefined && undefined.__extends) || (function () {
  39849. var extendStatics = function (d, b) {
  39850. extendStatics = Object.setPrototypeOf ||
  39851. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39852. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39853. return extendStatics(d, b);
  39854. };
  39855. return function (d, b) {
  39856. extendStatics(d, b);
  39857. function __() { this.constructor = d; }
  39858. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39859. };
  39860. })();
  39861. var connection_Connection = (function (_super) {
  39862. connection_extends(Connection, _super);
  39863. function Connection(id, transport) {
  39864. var _this = _super.call(this) || this;
  39865. _this.id = id;
  39866. _this.transport = transport;
  39867. _this.activityTimeout = transport.activityTimeout;
  39868. _this.bindListeners();
  39869. return _this;
  39870. }
  39871. Connection.prototype.handlesActivityChecks = function () {
  39872. return this.transport.handlesActivityChecks();
  39873. };
  39874. Connection.prototype.send = function (data) {
  39875. return this.transport.send(data);
  39876. };
  39877. Connection.prototype.send_event = function (name, data, channel) {
  39878. var event = { event: name, data: data };
  39879. if (channel) {
  39880. event.channel = channel;
  39881. }
  39882. logger.debug('Event sent', event);
  39883. return this.send(protocol_protocol.encodeMessage(event));
  39884. };
  39885. Connection.prototype.ping = function () {
  39886. if (this.transport.supportsPing()) {
  39887. this.transport.ping();
  39888. }
  39889. else {
  39890. this.send_event('pusher:ping', {});
  39891. }
  39892. };
  39893. Connection.prototype.close = function () {
  39894. this.transport.close();
  39895. };
  39896. Connection.prototype.bindListeners = function () {
  39897. var _this = this;
  39898. var listeners = {
  39899. message: function (messageEvent) {
  39900. var pusherEvent;
  39901. try {
  39902. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  39903. }
  39904. catch (e) {
  39905. _this.emit('error', {
  39906. type: 'MessageParseError',
  39907. error: e,
  39908. data: messageEvent.data
  39909. });
  39910. }
  39911. if (pusherEvent !== undefined) {
  39912. logger.debug('Event recd', pusherEvent);
  39913. switch (pusherEvent.event) {
  39914. case 'pusher:error':
  39915. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  39916. break;
  39917. case 'pusher:ping':
  39918. _this.emit("ping");
  39919. break;
  39920. case 'pusher:pong':
  39921. _this.emit("pong");
  39922. break;
  39923. }
  39924. _this.emit('message', pusherEvent);
  39925. }
  39926. },
  39927. activity: function () {
  39928. _this.emit("activity");
  39929. },
  39930. error: function (error) {
  39931. _this.emit("error", { type: "WebSocketError", error: error });
  39932. },
  39933. closed: function (closeEvent) {
  39934. unbindListeners();
  39935. if (closeEvent && closeEvent.code) {
  39936. _this.handleCloseEvent(closeEvent);
  39937. }
  39938. _this.transport = null;
  39939. _this.emit("closed");
  39940. }
  39941. };
  39942. var unbindListeners = function () {
  39943. objectApply(listeners, function (listener, event) {
  39944. _this.transport.unbind(event, listener);
  39945. });
  39946. };
  39947. objectApply(listeners, function (listener, event) {
  39948. _this.transport.bind(event, listener);
  39949. });
  39950. };
  39951. Connection.prototype.handleCloseEvent = function (closeEvent) {
  39952. var action = protocol_protocol.getCloseAction(closeEvent);
  39953. var error = protocol_protocol.getCloseError(closeEvent);
  39954. if (error) {
  39955. this.emit('error', error);
  39956. }
  39957. if (action) {
  39958. this.emit(action, { action: action, error: error });
  39959. }
  39960. };
  39961. return Connection;
  39962. }(dispatcher));
  39963. /* harmony default export */ var connection_connection = (connection_Connection);
  39964. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  39965. var handshake_Handshake = (function () {
  39966. function Handshake(transport, callback) {
  39967. this.transport = transport;
  39968. this.callback = callback;
  39969. this.bindListeners();
  39970. }
  39971. Handshake.prototype.close = function () {
  39972. this.unbindListeners();
  39973. this.transport.close();
  39974. };
  39975. Handshake.prototype.bindListeners = function () {
  39976. var _this = this;
  39977. this.onMessage = function (m) {
  39978. _this.unbindListeners();
  39979. var result;
  39980. try {
  39981. result = protocol_protocol.processHandshake(m);
  39982. }
  39983. catch (e) {
  39984. _this.finish("error", { error: e });
  39985. _this.transport.close();
  39986. return;
  39987. }
  39988. if (result.action === "connected") {
  39989. _this.finish("connected", {
  39990. connection: new connection_connection(result.id, _this.transport),
  39991. activityTimeout: result.activityTimeout
  39992. });
  39993. }
  39994. else {
  39995. _this.finish(result.action, { error: result.error });
  39996. _this.transport.close();
  39997. }
  39998. };
  39999. this.onClosed = function (closeEvent) {
  40000. _this.unbindListeners();
  40001. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40002. var error = protocol_protocol.getCloseError(closeEvent);
  40003. _this.finish(action, { error: error });
  40004. };
  40005. this.transport.bind("message", this.onMessage);
  40006. this.transport.bind("closed", this.onClosed);
  40007. };
  40008. Handshake.prototype.unbindListeners = function () {
  40009. this.transport.unbind("message", this.onMessage);
  40010. this.transport.unbind("closed", this.onClosed);
  40011. };
  40012. Handshake.prototype.finish = function (action, params) {
  40013. this.callback(extend({ transport: this.transport, action: action }, params));
  40014. };
  40015. return Handshake;
  40016. }());
  40017. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40018. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40019. var pusher_authorizer_PusherAuthorizer = (function () {
  40020. function PusherAuthorizer(channel, options) {
  40021. this.channel = channel;
  40022. var authTransport = options.authTransport;
  40023. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40024. throw "'" + authTransport + "' is not a recognized auth transport";
  40025. }
  40026. this.type = authTransport;
  40027. this.options = options;
  40028. this.authOptions = (options || {}).auth || {};
  40029. }
  40030. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40031. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40032. '&channel_name=' + encodeURIComponent(this.channel.name);
  40033. for (var i in this.authOptions.params) {
  40034. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40035. }
  40036. return query;
  40037. };
  40038. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40039. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40040. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40041. };
  40042. return PusherAuthorizer;
  40043. }());
  40044. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40045. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40046. var timeline_sender_TimelineSender = (function () {
  40047. function TimelineSender(timeline, options) {
  40048. this.timeline = timeline;
  40049. this.options = options || {};
  40050. }
  40051. TimelineSender.prototype.send = function (useTLS, callback) {
  40052. if (this.timeline.isEmpty()) {
  40053. return;
  40054. }
  40055. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40056. };
  40057. return TimelineSender;
  40058. }());
  40059. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40060. // CONCATENATED MODULE: ./src/core/errors.ts
  40061. var errors_extends = (undefined && undefined.__extends) || (function () {
  40062. var extendStatics = function (d, b) {
  40063. extendStatics = Object.setPrototypeOf ||
  40064. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40065. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40066. return extendStatics(d, b);
  40067. };
  40068. return function (d, b) {
  40069. extendStatics(d, b);
  40070. function __() { this.constructor = d; }
  40071. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40072. };
  40073. })();
  40074. var BadEventName = (function (_super) {
  40075. errors_extends(BadEventName, _super);
  40076. function BadEventName(msg) {
  40077. var _newTarget = this.constructor;
  40078. var _this = _super.call(this, msg) || this;
  40079. Object.setPrototypeOf(_this, _newTarget.prototype);
  40080. return _this;
  40081. }
  40082. return BadEventName;
  40083. }(Error));
  40084. var RequestTimedOut = (function (_super) {
  40085. errors_extends(RequestTimedOut, _super);
  40086. function RequestTimedOut(msg) {
  40087. var _newTarget = this.constructor;
  40088. var _this = _super.call(this, msg) || this;
  40089. Object.setPrototypeOf(_this, _newTarget.prototype);
  40090. return _this;
  40091. }
  40092. return RequestTimedOut;
  40093. }(Error));
  40094. var TransportPriorityTooLow = (function (_super) {
  40095. errors_extends(TransportPriorityTooLow, _super);
  40096. function TransportPriorityTooLow(msg) {
  40097. var _newTarget = this.constructor;
  40098. var _this = _super.call(this, msg) || this;
  40099. Object.setPrototypeOf(_this, _newTarget.prototype);
  40100. return _this;
  40101. }
  40102. return TransportPriorityTooLow;
  40103. }(Error));
  40104. var TransportClosed = (function (_super) {
  40105. errors_extends(TransportClosed, _super);
  40106. function TransportClosed(msg) {
  40107. var _newTarget = this.constructor;
  40108. var _this = _super.call(this, msg) || this;
  40109. Object.setPrototypeOf(_this, _newTarget.prototype);
  40110. return _this;
  40111. }
  40112. return TransportClosed;
  40113. }(Error));
  40114. var UnsupportedFeature = (function (_super) {
  40115. errors_extends(UnsupportedFeature, _super);
  40116. function UnsupportedFeature(msg) {
  40117. var _newTarget = this.constructor;
  40118. var _this = _super.call(this, msg) || this;
  40119. Object.setPrototypeOf(_this, _newTarget.prototype);
  40120. return _this;
  40121. }
  40122. return UnsupportedFeature;
  40123. }(Error));
  40124. var UnsupportedTransport = (function (_super) {
  40125. errors_extends(UnsupportedTransport, _super);
  40126. function UnsupportedTransport(msg) {
  40127. var _newTarget = this.constructor;
  40128. var _this = _super.call(this, msg) || this;
  40129. Object.setPrototypeOf(_this, _newTarget.prototype);
  40130. return _this;
  40131. }
  40132. return UnsupportedTransport;
  40133. }(Error));
  40134. var UnsupportedStrategy = (function (_super) {
  40135. errors_extends(UnsupportedStrategy, _super);
  40136. function UnsupportedStrategy(msg) {
  40137. var _newTarget = this.constructor;
  40138. var _this = _super.call(this, msg) || this;
  40139. Object.setPrototypeOf(_this, _newTarget.prototype);
  40140. return _this;
  40141. }
  40142. return UnsupportedStrategy;
  40143. }(Error));
  40144. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40145. var channel_extends = (undefined && undefined.__extends) || (function () {
  40146. var extendStatics = function (d, b) {
  40147. extendStatics = Object.setPrototypeOf ||
  40148. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40149. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40150. return extendStatics(d, b);
  40151. };
  40152. return function (d, b) {
  40153. extendStatics(d, b);
  40154. function __() { this.constructor = d; }
  40155. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40156. };
  40157. })();
  40158. var channel_Channel = (function (_super) {
  40159. channel_extends(Channel, _super);
  40160. function Channel(name, pusher) {
  40161. var _this = _super.call(this, function (event, data) {
  40162. logger.debug('No callbacks on ' + name + ' for ' + event);
  40163. }) || this;
  40164. _this.name = name;
  40165. _this.pusher = pusher;
  40166. _this.subscribed = false;
  40167. _this.subscriptionPending = false;
  40168. _this.subscriptionCancelled = false;
  40169. return _this;
  40170. }
  40171. Channel.prototype.authorize = function (socketId, callback) {
  40172. return callback(false, {});
  40173. };
  40174. Channel.prototype.trigger = function (event, data) {
  40175. if (event.indexOf("client-") !== 0) {
  40176. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40177. }
  40178. if (!this.subscribed) {
  40179. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40180. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40181. }
  40182. return this.pusher.send_event(event, data, this.name);
  40183. };
  40184. Channel.prototype.disconnect = function () {
  40185. this.subscribed = false;
  40186. this.subscriptionPending = false;
  40187. };
  40188. Channel.prototype.handleEvent = function (event) {
  40189. var eventName = event.event;
  40190. var data = event.data;
  40191. if (eventName === "pusher_internal:subscription_succeeded") {
  40192. this.handleSubscriptionSucceededEvent(event);
  40193. }
  40194. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40195. var metadata = {};
  40196. this.emit(eventName, data, metadata);
  40197. }
  40198. };
  40199. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40200. this.subscriptionPending = false;
  40201. this.subscribed = true;
  40202. if (this.subscriptionCancelled) {
  40203. this.pusher.unsubscribe(this.name);
  40204. }
  40205. else {
  40206. this.emit("pusher:subscription_succeeded", event.data);
  40207. }
  40208. };
  40209. Channel.prototype.subscribe = function () {
  40210. var _this = this;
  40211. if (this.subscribed) {
  40212. return;
  40213. }
  40214. this.subscriptionPending = true;
  40215. this.subscriptionCancelled = false;
  40216. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40217. if (error) {
  40218. logger.error(data);
  40219. _this.emit('pusher:subscription_error', data);
  40220. }
  40221. else {
  40222. _this.pusher.send_event('pusher:subscribe', {
  40223. auth: data.auth,
  40224. channel_data: data.channel_data,
  40225. channel: _this.name
  40226. });
  40227. }
  40228. });
  40229. };
  40230. Channel.prototype.unsubscribe = function () {
  40231. this.subscribed = false;
  40232. this.pusher.send_event('pusher:unsubscribe', {
  40233. channel: this.name
  40234. });
  40235. };
  40236. Channel.prototype.cancelSubscription = function () {
  40237. this.subscriptionCancelled = true;
  40238. };
  40239. Channel.prototype.reinstateSubscription = function () {
  40240. this.subscriptionCancelled = false;
  40241. };
  40242. return Channel;
  40243. }(dispatcher));
  40244. /* harmony default export */ var channels_channel = (channel_Channel);
  40245. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40246. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40247. var extendStatics = function (d, b) {
  40248. extendStatics = Object.setPrototypeOf ||
  40249. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40250. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40251. return extendStatics(d, b);
  40252. };
  40253. return function (d, b) {
  40254. extendStatics(d, b);
  40255. function __() { this.constructor = d; }
  40256. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40257. };
  40258. })();
  40259. var private_channel_PrivateChannel = (function (_super) {
  40260. private_channel_extends(PrivateChannel, _super);
  40261. function PrivateChannel() {
  40262. return _super !== null && _super.apply(this, arguments) || this;
  40263. }
  40264. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40265. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40266. return authorizer.authorize(socketId, callback);
  40267. };
  40268. return PrivateChannel;
  40269. }(channels_channel));
  40270. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40271. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40272. var members_Members = (function () {
  40273. function Members() {
  40274. this.reset();
  40275. }
  40276. Members.prototype.get = function (id) {
  40277. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40278. return {
  40279. id: id,
  40280. info: this.members[id]
  40281. };
  40282. }
  40283. else {
  40284. return null;
  40285. }
  40286. };
  40287. Members.prototype.each = function (callback) {
  40288. var _this = this;
  40289. objectApply(this.members, function (member, id) {
  40290. callback(_this.get(id));
  40291. });
  40292. };
  40293. Members.prototype.setMyID = function (id) {
  40294. this.myID = id;
  40295. };
  40296. Members.prototype.onSubscription = function (subscriptionData) {
  40297. this.members = subscriptionData.presence.hash;
  40298. this.count = subscriptionData.presence.count;
  40299. this.me = this.get(this.myID);
  40300. };
  40301. Members.prototype.addMember = function (memberData) {
  40302. if (this.get(memberData.user_id) === null) {
  40303. this.count++;
  40304. }
  40305. this.members[memberData.user_id] = memberData.user_info;
  40306. return this.get(memberData.user_id);
  40307. };
  40308. Members.prototype.removeMember = function (memberData) {
  40309. var member = this.get(memberData.user_id);
  40310. if (member) {
  40311. delete this.members[memberData.user_id];
  40312. this.count--;
  40313. }
  40314. return member;
  40315. };
  40316. Members.prototype.reset = function () {
  40317. this.members = {};
  40318. this.count = 0;
  40319. this.myID = null;
  40320. this.me = null;
  40321. };
  40322. return Members;
  40323. }());
  40324. /* harmony default export */ var members = (members_Members);
  40325. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40326. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40327. var extendStatics = function (d, b) {
  40328. extendStatics = Object.setPrototypeOf ||
  40329. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40330. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40331. return extendStatics(d, b);
  40332. };
  40333. return function (d, b) {
  40334. extendStatics(d, b);
  40335. function __() { this.constructor = d; }
  40336. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40337. };
  40338. })();
  40339. var presence_channel_PresenceChannel = (function (_super) {
  40340. presence_channel_extends(PresenceChannel, _super);
  40341. function PresenceChannel(name, pusher) {
  40342. var _this = _super.call(this, name, pusher) || this;
  40343. _this.members = new members();
  40344. return _this;
  40345. }
  40346. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40347. var _this = this;
  40348. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40349. if (!error) {
  40350. if (authData.channel_data === undefined) {
  40351. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40352. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40353. ("expected 'channel_data' field. " + suffix));
  40354. callback("Invalid auth response");
  40355. return;
  40356. }
  40357. var channelData = JSON.parse(authData.channel_data);
  40358. _this.members.setMyID(channelData.user_id);
  40359. }
  40360. callback(error, authData);
  40361. });
  40362. };
  40363. PresenceChannel.prototype.handleEvent = function (event) {
  40364. var eventName = event.event;
  40365. if (eventName.indexOf("pusher_internal:") === 0) {
  40366. this.handleInternalEvent(event);
  40367. }
  40368. else {
  40369. var data = event.data;
  40370. var metadata = {};
  40371. if (event.user_id) {
  40372. metadata.user_id = event.user_id;
  40373. }
  40374. this.emit(eventName, data, metadata);
  40375. }
  40376. };
  40377. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40378. var eventName = event.event;
  40379. var data = event.data;
  40380. switch (eventName) {
  40381. case "pusher_internal:subscription_succeeded":
  40382. this.handleSubscriptionSucceededEvent(event);
  40383. break;
  40384. case "pusher_internal:member_added":
  40385. var addedMember = this.members.addMember(data);
  40386. this.emit('pusher:member_added', addedMember);
  40387. break;
  40388. case "pusher_internal:member_removed":
  40389. var removedMember = this.members.removeMember(data);
  40390. if (removedMember) {
  40391. this.emit('pusher:member_removed', removedMember);
  40392. }
  40393. break;
  40394. }
  40395. };
  40396. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40397. this.subscriptionPending = false;
  40398. this.subscribed = true;
  40399. if (this.subscriptionCancelled) {
  40400. this.pusher.unsubscribe(this.name);
  40401. }
  40402. else {
  40403. this.members.onSubscription(event.data);
  40404. this.emit("pusher:subscription_succeeded", this.members);
  40405. }
  40406. };
  40407. PresenceChannel.prototype.disconnect = function () {
  40408. this.members.reset();
  40409. _super.prototype.disconnect.call(this);
  40410. };
  40411. return PresenceChannel;
  40412. }(private_channel));
  40413. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40414. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40415. var nacl_fast = __webpack_require__(0);
  40416. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40417. var nacl_util = __webpack_require__(1);
  40418. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40419. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40420. var extendStatics = function (d, b) {
  40421. extendStatics = Object.setPrototypeOf ||
  40422. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40423. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40424. return extendStatics(d, b);
  40425. };
  40426. return function (d, b) {
  40427. extendStatics(d, b);
  40428. function __() { this.constructor = d; }
  40429. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40430. };
  40431. })();
  40432. var encrypted_channel_EncryptedChannel = (function (_super) {
  40433. encrypted_channel_extends(EncryptedChannel, _super);
  40434. function EncryptedChannel() {
  40435. var _this = _super !== null && _super.apply(this, arguments) || this;
  40436. _this.key = null;
  40437. return _this;
  40438. }
  40439. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40440. var _this = this;
  40441. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40442. if (error) {
  40443. callback(true, authData);
  40444. return;
  40445. }
  40446. var sharedSecret = authData["shared_secret"];
  40447. if (!sharedSecret) {
  40448. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40449. callback(true, errorMsg);
  40450. return;
  40451. }
  40452. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40453. delete authData["shared_secret"];
  40454. callback(false, authData);
  40455. });
  40456. };
  40457. EncryptedChannel.prototype.trigger = function (event, data) {
  40458. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40459. };
  40460. EncryptedChannel.prototype.handleEvent = function (event) {
  40461. var eventName = event.event;
  40462. var data = event.data;
  40463. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40464. _super.prototype.handleEvent.call(this, event);
  40465. return;
  40466. }
  40467. this.handleEncryptedEvent(eventName, data);
  40468. };
  40469. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40470. var _this = this;
  40471. if (!this.key) {
  40472. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40473. return;
  40474. }
  40475. if (!data.ciphertext || !data.nonce) {
  40476. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40477. return;
  40478. }
  40479. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40480. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40481. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40482. return;
  40483. }
  40484. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40485. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40486. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40487. return;
  40488. }
  40489. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40490. if (bytes === null) {
  40491. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40492. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40493. if (error) {
  40494. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40495. return;
  40496. }
  40497. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40498. if (bytes === null) {
  40499. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40500. return;
  40501. }
  40502. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40503. return;
  40504. });
  40505. return;
  40506. }
  40507. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40508. };
  40509. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40510. try {
  40511. this.emit(eventName, JSON.parse(data));
  40512. }
  40513. catch (e) {
  40514. this.emit(eventName, data);
  40515. }
  40516. return this;
  40517. };
  40518. return EncryptedChannel;
  40519. }(private_channel));
  40520. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40521. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40522. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40523. var extendStatics = function (d, b) {
  40524. extendStatics = Object.setPrototypeOf ||
  40525. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40526. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40527. return extendStatics(d, b);
  40528. };
  40529. return function (d, b) {
  40530. extendStatics(d, b);
  40531. function __() { this.constructor = d; }
  40532. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40533. };
  40534. })();
  40535. var connection_manager_ConnectionManager = (function (_super) {
  40536. connection_manager_extends(ConnectionManager, _super);
  40537. function ConnectionManager(key, options) {
  40538. var _this = _super.call(this) || this;
  40539. _this.key = key;
  40540. _this.options = options || {};
  40541. _this.state = "initialized";
  40542. _this.connection = null;
  40543. _this.usingTLS = !!options.useTLS;
  40544. _this.timeline = _this.options.timeline;
  40545. _this.errorCallbacks = _this.buildErrorCallbacks();
  40546. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40547. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40548. var Network = runtime.getNetwork();
  40549. Network.bind("online", function () {
  40550. _this.timeline.info({ netinfo: "online" });
  40551. if (_this.state === "connecting" || _this.state === "unavailable") {
  40552. _this.retryIn(0);
  40553. }
  40554. });
  40555. Network.bind("offline", function () {
  40556. _this.timeline.info({ netinfo: "offline" });
  40557. if (_this.connection) {
  40558. _this.sendActivityCheck();
  40559. }
  40560. });
  40561. _this.updateStrategy();
  40562. return _this;
  40563. }
  40564. ConnectionManager.prototype.connect = function () {
  40565. if (this.connection || this.runner) {
  40566. return;
  40567. }
  40568. if (!this.strategy.isSupported()) {
  40569. this.updateState("failed");
  40570. return;
  40571. }
  40572. this.updateState("connecting");
  40573. this.startConnecting();
  40574. this.setUnavailableTimer();
  40575. };
  40576. ;
  40577. ConnectionManager.prototype.send = function (data) {
  40578. if (this.connection) {
  40579. return this.connection.send(data);
  40580. }
  40581. else {
  40582. return false;
  40583. }
  40584. };
  40585. ;
  40586. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40587. if (this.connection) {
  40588. return this.connection.send_event(name, data, channel);
  40589. }
  40590. else {
  40591. return false;
  40592. }
  40593. };
  40594. ;
  40595. ConnectionManager.prototype.disconnect = function () {
  40596. this.disconnectInternally();
  40597. this.updateState("disconnected");
  40598. };
  40599. ;
  40600. ConnectionManager.prototype.isUsingTLS = function () {
  40601. return this.usingTLS;
  40602. };
  40603. ;
  40604. ConnectionManager.prototype.startConnecting = function () {
  40605. var _this = this;
  40606. var callback = function (error, handshake) {
  40607. if (error) {
  40608. _this.runner = _this.strategy.connect(0, callback);
  40609. }
  40610. else {
  40611. if (handshake.action === "error") {
  40612. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40613. _this.timeline.error({ handshakeError: handshake.error });
  40614. }
  40615. else {
  40616. _this.abortConnecting();
  40617. _this.handshakeCallbacks[handshake.action](handshake);
  40618. }
  40619. }
  40620. };
  40621. this.runner = this.strategy.connect(0, callback);
  40622. };
  40623. ;
  40624. ConnectionManager.prototype.abortConnecting = function () {
  40625. if (this.runner) {
  40626. this.runner.abort();
  40627. this.runner = null;
  40628. }
  40629. };
  40630. ;
  40631. ConnectionManager.prototype.disconnectInternally = function () {
  40632. this.abortConnecting();
  40633. this.clearRetryTimer();
  40634. this.clearUnavailableTimer();
  40635. if (this.connection) {
  40636. var connection = this.abandonConnection();
  40637. connection.close();
  40638. }
  40639. };
  40640. ;
  40641. ConnectionManager.prototype.updateStrategy = function () {
  40642. this.strategy = this.options.getStrategy({
  40643. key: this.key,
  40644. timeline: this.timeline,
  40645. useTLS: this.usingTLS
  40646. });
  40647. };
  40648. ;
  40649. ConnectionManager.prototype.retryIn = function (delay) {
  40650. var _this = this;
  40651. this.timeline.info({ action: "retry", delay: delay });
  40652. if (delay > 0) {
  40653. this.emit("connecting_in", Math.round(delay / 1000));
  40654. }
  40655. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40656. _this.disconnectInternally();
  40657. _this.connect();
  40658. });
  40659. };
  40660. ;
  40661. ConnectionManager.prototype.clearRetryTimer = function () {
  40662. if (this.retryTimer) {
  40663. this.retryTimer.ensureAborted();
  40664. this.retryTimer = null;
  40665. }
  40666. };
  40667. ;
  40668. ConnectionManager.prototype.setUnavailableTimer = function () {
  40669. var _this = this;
  40670. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40671. _this.updateState("unavailable");
  40672. });
  40673. };
  40674. ;
  40675. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40676. if (this.unavailableTimer) {
  40677. this.unavailableTimer.ensureAborted();
  40678. }
  40679. };
  40680. ;
  40681. ConnectionManager.prototype.sendActivityCheck = function () {
  40682. var _this = this;
  40683. this.stopActivityCheck();
  40684. this.connection.ping();
  40685. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40686. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40687. _this.retryIn(0);
  40688. });
  40689. };
  40690. ;
  40691. ConnectionManager.prototype.resetActivityCheck = function () {
  40692. var _this = this;
  40693. this.stopActivityCheck();
  40694. if (this.connection && !this.connection.handlesActivityChecks()) {
  40695. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40696. _this.sendActivityCheck();
  40697. });
  40698. }
  40699. };
  40700. ;
  40701. ConnectionManager.prototype.stopActivityCheck = function () {
  40702. if (this.activityTimer) {
  40703. this.activityTimer.ensureAborted();
  40704. }
  40705. };
  40706. ;
  40707. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40708. var _this = this;
  40709. return extend({}, errorCallbacks, {
  40710. message: function (message) {
  40711. _this.resetActivityCheck();
  40712. _this.emit('message', message);
  40713. },
  40714. ping: function () {
  40715. _this.send_event('pusher:pong', {});
  40716. },
  40717. activity: function () {
  40718. _this.resetActivityCheck();
  40719. },
  40720. error: function (error) {
  40721. _this.emit("error", { type: "WebSocketError", error: error });
  40722. },
  40723. closed: function () {
  40724. _this.abandonConnection();
  40725. if (_this.shouldRetry()) {
  40726. _this.retryIn(1000);
  40727. }
  40728. }
  40729. });
  40730. };
  40731. ;
  40732. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40733. var _this = this;
  40734. return extend({}, errorCallbacks, {
  40735. connected: function (handshake) {
  40736. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40737. _this.clearUnavailableTimer();
  40738. _this.setConnection(handshake.connection);
  40739. _this.socket_id = _this.connection.id;
  40740. _this.updateState("connected", { socket_id: _this.socket_id });
  40741. }
  40742. });
  40743. };
  40744. ;
  40745. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40746. var _this = this;
  40747. var withErrorEmitted = function (callback) {
  40748. return function (result) {
  40749. if (result.error) {
  40750. _this.emit("error", { type: "WebSocketError", error: result.error });
  40751. }
  40752. callback(result);
  40753. };
  40754. };
  40755. return {
  40756. tls_only: withErrorEmitted(function () {
  40757. _this.usingTLS = true;
  40758. _this.updateStrategy();
  40759. _this.retryIn(0);
  40760. }),
  40761. refused: withErrorEmitted(function () {
  40762. _this.disconnect();
  40763. }),
  40764. backoff: withErrorEmitted(function () {
  40765. _this.retryIn(1000);
  40766. }),
  40767. retry: withErrorEmitted(function () {
  40768. _this.retryIn(0);
  40769. })
  40770. };
  40771. };
  40772. ;
  40773. ConnectionManager.prototype.setConnection = function (connection) {
  40774. this.connection = connection;
  40775. for (var event in this.connectionCallbacks) {
  40776. this.connection.bind(event, this.connectionCallbacks[event]);
  40777. }
  40778. this.resetActivityCheck();
  40779. };
  40780. ;
  40781. ConnectionManager.prototype.abandonConnection = function () {
  40782. if (!this.connection) {
  40783. return;
  40784. }
  40785. this.stopActivityCheck();
  40786. for (var event in this.connectionCallbacks) {
  40787. this.connection.unbind(event, this.connectionCallbacks[event]);
  40788. }
  40789. var connection = this.connection;
  40790. this.connection = null;
  40791. return connection;
  40792. };
  40793. ConnectionManager.prototype.updateState = function (newState, data) {
  40794. var previousState = this.state;
  40795. this.state = newState;
  40796. if (previousState !== newState) {
  40797. var newStateDescription = newState;
  40798. if (newStateDescription === "connected") {
  40799. newStateDescription += " with new socket ID " + data.socket_id;
  40800. }
  40801. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  40802. this.timeline.info({ state: newState, params: data });
  40803. this.emit('state_change', { previous: previousState, current: newState });
  40804. this.emit(newState, data);
  40805. }
  40806. };
  40807. ConnectionManager.prototype.shouldRetry = function () {
  40808. return this.state === "connecting" || this.state === "connected";
  40809. };
  40810. return ConnectionManager;
  40811. }(dispatcher));
  40812. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  40813. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  40814. var channels_Channels = (function () {
  40815. function Channels() {
  40816. this.channels = {};
  40817. }
  40818. Channels.prototype.add = function (name, pusher) {
  40819. if (!this.channels[name]) {
  40820. this.channels[name] = createChannel(name, pusher);
  40821. }
  40822. return this.channels[name];
  40823. };
  40824. Channels.prototype.all = function () {
  40825. return values(this.channels);
  40826. };
  40827. Channels.prototype.find = function (name) {
  40828. return this.channels[name];
  40829. };
  40830. Channels.prototype.remove = function (name) {
  40831. var channel = this.channels[name];
  40832. delete this.channels[name];
  40833. return channel;
  40834. };
  40835. Channels.prototype.disconnect = function () {
  40836. objectApply(this.channels, function (channel) {
  40837. channel.disconnect();
  40838. });
  40839. };
  40840. return Channels;
  40841. }());
  40842. /* harmony default export */ var channels = (channels_Channels);
  40843. function createChannel(name, pusher) {
  40844. if (name.indexOf('private-encrypted-') === 0) {
  40845. if (false) { var errorMsg; }
  40846. return factory.createEncryptedChannel(name, pusher);
  40847. }
  40848. else if (name.indexOf('private-') === 0) {
  40849. return factory.createPrivateChannel(name, pusher);
  40850. }
  40851. else if (name.indexOf('presence-') === 0) {
  40852. return factory.createPresenceChannel(name, pusher);
  40853. }
  40854. else {
  40855. return factory.createChannel(name, pusher);
  40856. }
  40857. }
  40858. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  40859. var Factory = {
  40860. createChannels: function () {
  40861. return new channels();
  40862. },
  40863. createConnectionManager: function (key, options) {
  40864. return new connection_manager(key, options);
  40865. },
  40866. createChannel: function (name, pusher) {
  40867. return new channels_channel(name, pusher);
  40868. },
  40869. createPrivateChannel: function (name, pusher) {
  40870. return new private_channel(name, pusher);
  40871. },
  40872. createPresenceChannel: function (name, pusher) {
  40873. return new presence_channel(name, pusher);
  40874. },
  40875. createEncryptedChannel: function (name, pusher) {
  40876. return new encrypted_channel(name, pusher);
  40877. },
  40878. createTimelineSender: function (timeline, options) {
  40879. return new timeline_sender(timeline, options);
  40880. },
  40881. createAuthorizer: function (channel, options) {
  40882. if (options.authorizer) {
  40883. return options.authorizer(channel, options);
  40884. }
  40885. return new pusher_authorizer(channel, options);
  40886. },
  40887. createHandshake: function (transport, callback) {
  40888. return new connection_handshake(transport, callback);
  40889. },
  40890. createAssistantToTheTransportManager: function (manager, transport, options) {
  40891. return new assistant_to_the_transport_manager(manager, transport, options);
  40892. }
  40893. };
  40894. /* harmony default export */ var factory = (Factory);
  40895. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  40896. var transport_manager_TransportManager = (function () {
  40897. function TransportManager(options) {
  40898. this.options = options || {};
  40899. this.livesLeft = this.options.lives || Infinity;
  40900. }
  40901. TransportManager.prototype.getAssistant = function (transport) {
  40902. return factory.createAssistantToTheTransportManager(this, transport, {
  40903. minPingDelay: this.options.minPingDelay,
  40904. maxPingDelay: this.options.maxPingDelay
  40905. });
  40906. };
  40907. TransportManager.prototype.isAlive = function () {
  40908. return this.livesLeft > 0;
  40909. };
  40910. TransportManager.prototype.reportDeath = function () {
  40911. this.livesLeft -= 1;
  40912. };
  40913. return TransportManager;
  40914. }());
  40915. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  40916. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  40917. var sequential_strategy_SequentialStrategy = (function () {
  40918. function SequentialStrategy(strategies, options) {
  40919. this.strategies = strategies;
  40920. this.loop = Boolean(options.loop);
  40921. this.failFast = Boolean(options.failFast);
  40922. this.timeout = options.timeout;
  40923. this.timeoutLimit = options.timeoutLimit;
  40924. }
  40925. SequentialStrategy.prototype.isSupported = function () {
  40926. return any(this.strategies, util.method("isSupported"));
  40927. };
  40928. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  40929. var _this = this;
  40930. var strategies = this.strategies;
  40931. var current = 0;
  40932. var timeout = this.timeout;
  40933. var runner = null;
  40934. var tryNextStrategy = function (error, handshake) {
  40935. if (handshake) {
  40936. callback(null, handshake);
  40937. }
  40938. else {
  40939. current = current + 1;
  40940. if (_this.loop) {
  40941. current = current % strategies.length;
  40942. }
  40943. if (current < strategies.length) {
  40944. if (timeout) {
  40945. timeout = timeout * 2;
  40946. if (_this.timeoutLimit) {
  40947. timeout = Math.min(timeout, _this.timeoutLimit);
  40948. }
  40949. }
  40950. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  40951. }
  40952. else {
  40953. callback(true);
  40954. }
  40955. }
  40956. };
  40957. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  40958. return {
  40959. abort: function () {
  40960. runner.abort();
  40961. },
  40962. forceMinPriority: function (p) {
  40963. minPriority = p;
  40964. if (runner) {
  40965. runner.forceMinPriority(p);
  40966. }
  40967. }
  40968. };
  40969. };
  40970. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  40971. var timer = null;
  40972. var runner = null;
  40973. if (options.timeout > 0) {
  40974. timer = new OneOffTimer(options.timeout, function () {
  40975. runner.abort();
  40976. callback(true);
  40977. });
  40978. }
  40979. runner = strategy.connect(minPriority, function (error, handshake) {
  40980. if (error && timer && timer.isRunning() && !options.failFast) {
  40981. return;
  40982. }
  40983. if (timer) {
  40984. timer.ensureAborted();
  40985. }
  40986. callback(error, handshake);
  40987. });
  40988. return {
  40989. abort: function () {
  40990. if (timer) {
  40991. timer.ensureAborted();
  40992. }
  40993. runner.abort();
  40994. },
  40995. forceMinPriority: function (p) {
  40996. runner.forceMinPriority(p);
  40997. }
  40998. };
  40999. };
  41000. return SequentialStrategy;
  41001. }());
  41002. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41003. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41004. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41005. function BestConnectedEverStrategy(strategies) {
  41006. this.strategies = strategies;
  41007. }
  41008. BestConnectedEverStrategy.prototype.isSupported = function () {
  41009. return any(this.strategies, util.method("isSupported"));
  41010. };
  41011. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41012. return connect(this.strategies, minPriority, function (i, runners) {
  41013. return function (error, handshake) {
  41014. runners[i].error = error;
  41015. if (error) {
  41016. if (allRunnersFailed(runners)) {
  41017. callback(true);
  41018. }
  41019. return;
  41020. }
  41021. apply(runners, function (runner) {
  41022. runner.forceMinPriority(handshake.transport.priority);
  41023. });
  41024. callback(null, handshake);
  41025. };
  41026. });
  41027. };
  41028. return BestConnectedEverStrategy;
  41029. }());
  41030. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41031. function connect(strategies, minPriority, callbackBuilder) {
  41032. var runners = map(strategies, function (strategy, i, _, rs) {
  41033. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41034. });
  41035. return {
  41036. abort: function () {
  41037. apply(runners, abortRunner);
  41038. },
  41039. forceMinPriority: function (p) {
  41040. apply(runners, function (runner) {
  41041. runner.forceMinPriority(p);
  41042. });
  41043. }
  41044. };
  41045. }
  41046. function allRunnersFailed(runners) {
  41047. return collections_all(runners, function (runner) {
  41048. return Boolean(runner.error);
  41049. });
  41050. }
  41051. function abortRunner(runner) {
  41052. if (!runner.error && !runner.aborted) {
  41053. runner.abort();
  41054. runner.aborted = true;
  41055. }
  41056. }
  41057. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41058. var cached_strategy_CachedStrategy = (function () {
  41059. function CachedStrategy(strategy, transports, options) {
  41060. this.strategy = strategy;
  41061. this.transports = transports;
  41062. this.ttl = options.ttl || 1800 * 1000;
  41063. this.usingTLS = options.useTLS;
  41064. this.timeline = options.timeline;
  41065. }
  41066. CachedStrategy.prototype.isSupported = function () {
  41067. return this.strategy.isSupported();
  41068. };
  41069. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41070. var usingTLS = this.usingTLS;
  41071. var info = fetchTransportCache(usingTLS);
  41072. var strategies = [this.strategy];
  41073. if (info && info.timestamp + this.ttl >= util.now()) {
  41074. var transport = this.transports[info.transport];
  41075. if (transport) {
  41076. this.timeline.info({
  41077. cached: true,
  41078. transport: info.transport,
  41079. latency: info.latency
  41080. });
  41081. strategies.push(new sequential_strategy([transport], {
  41082. timeout: info.latency * 2 + 1000,
  41083. failFast: true
  41084. }));
  41085. }
  41086. }
  41087. var startTimestamp = util.now();
  41088. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41089. if (error) {
  41090. flushTransportCache(usingTLS);
  41091. if (strategies.length > 0) {
  41092. startTimestamp = util.now();
  41093. runner = strategies.pop().connect(minPriority, cb);
  41094. }
  41095. else {
  41096. callback(error);
  41097. }
  41098. }
  41099. else {
  41100. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41101. callback(null, handshake);
  41102. }
  41103. });
  41104. return {
  41105. abort: function () {
  41106. runner.abort();
  41107. },
  41108. forceMinPriority: function (p) {
  41109. minPriority = p;
  41110. if (runner) {
  41111. runner.forceMinPriority(p);
  41112. }
  41113. }
  41114. };
  41115. };
  41116. return CachedStrategy;
  41117. }());
  41118. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41119. function getTransportCacheKey(usingTLS) {
  41120. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41121. }
  41122. function fetchTransportCache(usingTLS) {
  41123. var storage = runtime.getLocalStorage();
  41124. if (storage) {
  41125. try {
  41126. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41127. if (serializedCache) {
  41128. return JSON.parse(serializedCache);
  41129. }
  41130. }
  41131. catch (e) {
  41132. flushTransportCache(usingTLS);
  41133. }
  41134. }
  41135. return null;
  41136. }
  41137. function storeTransportCache(usingTLS, transport, latency) {
  41138. var storage = runtime.getLocalStorage();
  41139. if (storage) {
  41140. try {
  41141. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41142. timestamp: util.now(),
  41143. transport: transport,
  41144. latency: latency
  41145. });
  41146. }
  41147. catch (e) {
  41148. }
  41149. }
  41150. }
  41151. function flushTransportCache(usingTLS) {
  41152. var storage = runtime.getLocalStorage();
  41153. if (storage) {
  41154. try {
  41155. delete storage[getTransportCacheKey(usingTLS)];
  41156. }
  41157. catch (e) {
  41158. }
  41159. }
  41160. }
  41161. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41162. var delayed_strategy_DelayedStrategy = (function () {
  41163. function DelayedStrategy(strategy, _a) {
  41164. var number = _a.delay;
  41165. this.strategy = strategy;
  41166. this.options = { delay: number };
  41167. }
  41168. DelayedStrategy.prototype.isSupported = function () {
  41169. return this.strategy.isSupported();
  41170. };
  41171. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41172. var strategy = this.strategy;
  41173. var runner;
  41174. var timer = new OneOffTimer(this.options.delay, function () {
  41175. runner = strategy.connect(minPriority, callback);
  41176. });
  41177. return {
  41178. abort: function () {
  41179. timer.ensureAborted();
  41180. if (runner) {
  41181. runner.abort();
  41182. }
  41183. },
  41184. forceMinPriority: function (p) {
  41185. minPriority = p;
  41186. if (runner) {
  41187. runner.forceMinPriority(p);
  41188. }
  41189. }
  41190. };
  41191. };
  41192. return DelayedStrategy;
  41193. }());
  41194. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41195. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41196. var IfStrategy = (function () {
  41197. function IfStrategy(test, trueBranch, falseBranch) {
  41198. this.test = test;
  41199. this.trueBranch = trueBranch;
  41200. this.falseBranch = falseBranch;
  41201. }
  41202. IfStrategy.prototype.isSupported = function () {
  41203. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41204. return branch.isSupported();
  41205. };
  41206. IfStrategy.prototype.connect = function (minPriority, callback) {
  41207. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41208. return branch.connect(minPriority, callback);
  41209. };
  41210. return IfStrategy;
  41211. }());
  41212. /* harmony default export */ var if_strategy = (IfStrategy);
  41213. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41214. var FirstConnectedStrategy = (function () {
  41215. function FirstConnectedStrategy(strategy) {
  41216. this.strategy = strategy;
  41217. }
  41218. FirstConnectedStrategy.prototype.isSupported = function () {
  41219. return this.strategy.isSupported();
  41220. };
  41221. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41222. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41223. if (handshake) {
  41224. runner.abort();
  41225. }
  41226. callback(error, handshake);
  41227. });
  41228. return runner;
  41229. };
  41230. return FirstConnectedStrategy;
  41231. }());
  41232. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41233. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41234. function testSupportsStrategy(strategy) {
  41235. return function () {
  41236. return strategy.isSupported();
  41237. };
  41238. }
  41239. var getDefaultStrategy = function (config, defineTransport) {
  41240. var definedTransports = {};
  41241. function defineTransportStrategy(name, type, priority, options, manager) {
  41242. var transport = defineTransport(config, name, type, priority, options, manager);
  41243. definedTransports[name] = transport;
  41244. return transport;
  41245. }
  41246. var ws_options = {
  41247. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41248. hostTLS: config.wsHost + ":" + config.wssPort,
  41249. httpPath: config.wsPath
  41250. };
  41251. var wss_options = extend({}, ws_options, {
  41252. useTLS: true
  41253. });
  41254. var sockjs_options = {
  41255. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41256. hostTLS: config.httpHost + ":" + config.httpsPort,
  41257. httpPath: config.httpPath
  41258. };
  41259. var timeouts = {
  41260. loop: true,
  41261. timeout: 15000,
  41262. timeoutLimit: 60000
  41263. };
  41264. var ws_manager = new transport_manager({
  41265. lives: 2,
  41266. minPingDelay: 10000,
  41267. maxPingDelay: config.activity_timeout
  41268. });
  41269. var streaming_manager = new transport_manager({
  41270. lives: 2,
  41271. minPingDelay: 10000,
  41272. maxPingDelay: config.activity_timeout
  41273. });
  41274. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41275. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41276. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41277. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41278. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41279. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41280. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41281. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41282. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41283. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41284. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41285. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41286. var http_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([streaming_loop, new delayed_strategy(polling_loop, { delay: 4000 })]), polling_loop)], timeouts);
  41287. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41288. var wsStrategy;
  41289. if (config.useTLS) {
  41290. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41291. }
  41292. else {
  41293. wsStrategy = new best_connected_ever_strategy([
  41294. ws_loop,
  41295. new delayed_strategy(wss_loop, { delay: 2000 }),
  41296. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41297. ]);
  41298. }
  41299. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41300. ttl: 1800000,
  41301. timeline: config.timeline,
  41302. useTLS: config.useTLS
  41303. });
  41304. };
  41305. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41306. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41307. /* harmony default export */ var transport_connection_initializer = (function () {
  41308. var self = this;
  41309. self.timeline.info(self.buildTimelineMessage({
  41310. transport: self.name + (self.options.useTLS ? "s" : "")
  41311. }));
  41312. if (self.hooks.isInitialized()) {
  41313. self.changeState("initialized");
  41314. }
  41315. else if (self.hooks.file) {
  41316. self.changeState("initializing");
  41317. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41318. if (self.hooks.isInitialized()) {
  41319. self.changeState("initialized");
  41320. callback(true);
  41321. }
  41322. else {
  41323. if (error) {
  41324. self.onError(error);
  41325. }
  41326. self.onClose();
  41327. callback(false);
  41328. }
  41329. });
  41330. }
  41331. else {
  41332. self.onClose();
  41333. }
  41334. });
  41335. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41336. var http_xdomain_request_hooks = {
  41337. getRequest: function (socket) {
  41338. var xdr = new window.XDomainRequest();
  41339. xdr.ontimeout = function () {
  41340. socket.emit("error", new RequestTimedOut());
  41341. socket.close();
  41342. };
  41343. xdr.onerror = function (e) {
  41344. socket.emit("error", e);
  41345. socket.close();
  41346. };
  41347. xdr.onprogress = function () {
  41348. if (xdr.responseText && xdr.responseText.length > 0) {
  41349. socket.onChunk(200, xdr.responseText);
  41350. }
  41351. };
  41352. xdr.onload = function () {
  41353. if (xdr.responseText && xdr.responseText.length > 0) {
  41354. socket.onChunk(200, xdr.responseText);
  41355. }
  41356. socket.emit("finished", 200);
  41357. socket.close();
  41358. };
  41359. return xdr;
  41360. },
  41361. abortRequest: function (xdr) {
  41362. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41363. xdr.abort();
  41364. }
  41365. };
  41366. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41367. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41368. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41369. var extendStatics = function (d, b) {
  41370. extendStatics = Object.setPrototypeOf ||
  41371. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41372. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41373. return extendStatics(d, b);
  41374. };
  41375. return function (d, b) {
  41376. extendStatics(d, b);
  41377. function __() { this.constructor = d; }
  41378. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41379. };
  41380. })();
  41381. var MAX_BUFFER_LENGTH = 256 * 1024;
  41382. var http_request_HTTPRequest = (function (_super) {
  41383. http_request_extends(HTTPRequest, _super);
  41384. function HTTPRequest(hooks, method, url) {
  41385. var _this = _super.call(this) || this;
  41386. _this.hooks = hooks;
  41387. _this.method = method;
  41388. _this.url = url;
  41389. return _this;
  41390. }
  41391. HTTPRequest.prototype.start = function (payload) {
  41392. var _this = this;
  41393. this.position = 0;
  41394. this.xhr = this.hooks.getRequest(this);
  41395. this.unloader = function () {
  41396. _this.close();
  41397. };
  41398. runtime.addUnloadListener(this.unloader);
  41399. this.xhr.open(this.method, this.url, true);
  41400. if (this.xhr.setRequestHeader) {
  41401. this.xhr.setRequestHeader("Content-Type", "application/json");
  41402. }
  41403. this.xhr.send(payload);
  41404. };
  41405. HTTPRequest.prototype.close = function () {
  41406. if (this.unloader) {
  41407. runtime.removeUnloadListener(this.unloader);
  41408. this.unloader = null;
  41409. }
  41410. if (this.xhr) {
  41411. this.hooks.abortRequest(this.xhr);
  41412. this.xhr = null;
  41413. }
  41414. };
  41415. HTTPRequest.prototype.onChunk = function (status, data) {
  41416. while (true) {
  41417. var chunk = this.advanceBuffer(data);
  41418. if (chunk) {
  41419. this.emit("chunk", { status: status, data: chunk });
  41420. }
  41421. else {
  41422. break;
  41423. }
  41424. }
  41425. if (this.isBufferTooLong(data)) {
  41426. this.emit("buffer_too_long");
  41427. }
  41428. };
  41429. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41430. var unreadData = buffer.slice(this.position);
  41431. var endOfLinePosition = unreadData.indexOf("\n");
  41432. if (endOfLinePosition !== -1) {
  41433. this.position += endOfLinePosition + 1;
  41434. return unreadData.slice(0, endOfLinePosition);
  41435. }
  41436. else {
  41437. return null;
  41438. }
  41439. };
  41440. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41441. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41442. };
  41443. return HTTPRequest;
  41444. }(dispatcher));
  41445. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41446. // CONCATENATED MODULE: ./src/core/http/state.ts
  41447. var State;
  41448. (function (State) {
  41449. State[State["CONNECTING"] = 0] = "CONNECTING";
  41450. State[State["OPEN"] = 1] = "OPEN";
  41451. State[State["CLOSED"] = 3] = "CLOSED";
  41452. })(State || (State = {}));
  41453. /* harmony default export */ var state = (State);
  41454. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41455. var autoIncrement = 1;
  41456. var http_socket_HTTPSocket = (function () {
  41457. function HTTPSocket(hooks, url) {
  41458. this.hooks = hooks;
  41459. this.session = randomNumber(1000) + "/" + randomString(8);
  41460. this.location = getLocation(url);
  41461. this.readyState = state.CONNECTING;
  41462. this.openStream();
  41463. }
  41464. HTTPSocket.prototype.send = function (payload) {
  41465. return this.sendRaw(JSON.stringify([payload]));
  41466. };
  41467. HTTPSocket.prototype.ping = function () {
  41468. this.hooks.sendHeartbeat(this);
  41469. };
  41470. HTTPSocket.prototype.close = function (code, reason) {
  41471. this.onClose(code, reason, true);
  41472. };
  41473. HTTPSocket.prototype.sendRaw = function (payload) {
  41474. if (this.readyState === state.OPEN) {
  41475. try {
  41476. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41477. return true;
  41478. }
  41479. catch (e) {
  41480. return false;
  41481. }
  41482. }
  41483. else {
  41484. return false;
  41485. }
  41486. };
  41487. HTTPSocket.prototype.reconnect = function () {
  41488. this.closeStream();
  41489. this.openStream();
  41490. };
  41491. ;
  41492. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41493. this.closeStream();
  41494. this.readyState = state.CLOSED;
  41495. if (this.onclose) {
  41496. this.onclose({
  41497. code: code,
  41498. reason: reason,
  41499. wasClean: wasClean
  41500. });
  41501. }
  41502. };
  41503. HTTPSocket.prototype.onChunk = function (chunk) {
  41504. if (chunk.status !== 200) {
  41505. return;
  41506. }
  41507. if (this.readyState === state.OPEN) {
  41508. this.onActivity();
  41509. }
  41510. var payload;
  41511. var type = chunk.data.slice(0, 1);
  41512. switch (type) {
  41513. case 'o':
  41514. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41515. this.onOpen(payload);
  41516. break;
  41517. case 'a':
  41518. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41519. for (var i = 0; i < payload.length; i++) {
  41520. this.onEvent(payload[i]);
  41521. }
  41522. break;
  41523. case 'm':
  41524. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41525. this.onEvent(payload);
  41526. break;
  41527. case 'h':
  41528. this.hooks.onHeartbeat(this);
  41529. break;
  41530. case 'c':
  41531. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41532. this.onClose(payload[0], payload[1], true);
  41533. break;
  41534. }
  41535. };
  41536. HTTPSocket.prototype.onOpen = function (options) {
  41537. if (this.readyState === state.CONNECTING) {
  41538. if (options && options.hostname) {
  41539. this.location.base = replaceHost(this.location.base, options.hostname);
  41540. }
  41541. this.readyState = state.OPEN;
  41542. if (this.onopen) {
  41543. this.onopen();
  41544. }
  41545. }
  41546. else {
  41547. this.onClose(1006, "Server lost session", true);
  41548. }
  41549. };
  41550. HTTPSocket.prototype.onEvent = function (event) {
  41551. if (this.readyState === state.OPEN && this.onmessage) {
  41552. this.onmessage({ data: event });
  41553. }
  41554. };
  41555. HTTPSocket.prototype.onActivity = function () {
  41556. if (this.onactivity) {
  41557. this.onactivity();
  41558. }
  41559. };
  41560. HTTPSocket.prototype.onError = function (error) {
  41561. if (this.onerror) {
  41562. this.onerror(error);
  41563. }
  41564. };
  41565. HTTPSocket.prototype.openStream = function () {
  41566. var _this = this;
  41567. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41568. this.stream.bind("chunk", function (chunk) {
  41569. _this.onChunk(chunk);
  41570. });
  41571. this.stream.bind("finished", function (status) {
  41572. _this.hooks.onFinished(_this, status);
  41573. });
  41574. this.stream.bind("buffer_too_long", function () {
  41575. _this.reconnect();
  41576. });
  41577. try {
  41578. this.stream.start();
  41579. }
  41580. catch (error) {
  41581. util.defer(function () {
  41582. _this.onError(error);
  41583. _this.onClose(1006, "Could not start streaming", false);
  41584. });
  41585. }
  41586. };
  41587. HTTPSocket.prototype.closeStream = function () {
  41588. if (this.stream) {
  41589. this.stream.unbind_all();
  41590. this.stream.close();
  41591. this.stream = null;
  41592. }
  41593. };
  41594. return HTTPSocket;
  41595. }());
  41596. function getLocation(url) {
  41597. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41598. return {
  41599. base: parts[1],
  41600. queryString: parts[2]
  41601. };
  41602. }
  41603. function getSendURL(url, session) {
  41604. return url.base + "/" + session + "/xhr_send";
  41605. }
  41606. function getUniqueURL(url) {
  41607. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41608. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41609. }
  41610. function replaceHost(url, hostname) {
  41611. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41612. return urlParts[1] + hostname + urlParts[3];
  41613. }
  41614. function randomNumber(max) {
  41615. return Math.floor(Math.random() * max);
  41616. }
  41617. function randomString(length) {
  41618. var result = [];
  41619. for (var i = 0; i < length; i++) {
  41620. result.push(randomNumber(32).toString(32));
  41621. }
  41622. return result.join('');
  41623. }
  41624. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41625. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41626. var http_streaming_socket_hooks = {
  41627. getReceiveURL: function (url, session) {
  41628. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41629. },
  41630. onHeartbeat: function (socket) {
  41631. socket.sendRaw("[]");
  41632. },
  41633. sendHeartbeat: function (socket) {
  41634. socket.sendRaw("[]");
  41635. },
  41636. onFinished: function (socket, status) {
  41637. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41638. }
  41639. };
  41640. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41641. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41642. var http_polling_socket_hooks = {
  41643. getReceiveURL: function (url, session) {
  41644. return url.base + "/" + session + "/xhr" + url.queryString;
  41645. },
  41646. onHeartbeat: function () {
  41647. },
  41648. sendHeartbeat: function (socket) {
  41649. socket.sendRaw("[]");
  41650. },
  41651. onFinished: function (socket, status) {
  41652. if (status === 200) {
  41653. socket.reconnect();
  41654. }
  41655. else {
  41656. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41657. }
  41658. }
  41659. };
  41660. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41661. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41662. var http_xhr_request_hooks = {
  41663. getRequest: function (socket) {
  41664. var Constructor = runtime.getXHRAPI();
  41665. var xhr = new Constructor();
  41666. xhr.onreadystatechange = xhr.onprogress = function () {
  41667. switch (xhr.readyState) {
  41668. case 3:
  41669. if (xhr.responseText && xhr.responseText.length > 0) {
  41670. socket.onChunk(xhr.status, xhr.responseText);
  41671. }
  41672. break;
  41673. case 4:
  41674. if (xhr.responseText && xhr.responseText.length > 0) {
  41675. socket.onChunk(xhr.status, xhr.responseText);
  41676. }
  41677. socket.emit("finished", xhr.status);
  41678. socket.close();
  41679. break;
  41680. }
  41681. };
  41682. return xhr;
  41683. },
  41684. abortRequest: function (xhr) {
  41685. xhr.onreadystatechange = null;
  41686. xhr.abort();
  41687. }
  41688. };
  41689. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41690. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41691. var HTTP = {
  41692. createStreamingSocket: function (url) {
  41693. return this.createSocket(http_streaming_socket, url);
  41694. },
  41695. createPollingSocket: function (url) {
  41696. return this.createSocket(http_polling_socket, url);
  41697. },
  41698. createSocket: function (hooks, url) {
  41699. return new http_socket(hooks, url);
  41700. },
  41701. createXHR: function (method, url) {
  41702. return this.createRequest(http_xhr_request, method, url);
  41703. },
  41704. createRequest: function (hooks, method, url) {
  41705. return new http_request(hooks, method, url);
  41706. }
  41707. };
  41708. /* harmony default export */ var http_http = (HTTP);
  41709. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41710. http_http.createXDR = function (method, url) {
  41711. return this.createRequest(http_xdomain_request, method, url);
  41712. };
  41713. /* harmony default export */ var web_http_http = (http_http);
  41714. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41715. var Runtime = {
  41716. nextAuthCallbackID: 1,
  41717. auth_callbacks: {},
  41718. ScriptReceivers: ScriptReceivers,
  41719. DependenciesReceivers: DependenciesReceivers,
  41720. getDefaultStrategy: default_strategy,
  41721. Transports: transports_transports,
  41722. transportConnectionInitializer: transport_connection_initializer,
  41723. HTTPFactory: web_http_http,
  41724. TimelineTransport: jsonp_timeline,
  41725. getXHRAPI: function () {
  41726. return window.XMLHttpRequest;
  41727. },
  41728. getWebSocketAPI: function () {
  41729. return window.WebSocket || window.MozWebSocket;
  41730. },
  41731. setup: function (PusherClass) {
  41732. var _this = this;
  41733. window.Pusher = PusherClass;
  41734. var initializeOnDocumentBody = function () {
  41735. _this.onDocumentBody(PusherClass.ready);
  41736. };
  41737. if (!window.JSON) {
  41738. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41739. }
  41740. else {
  41741. initializeOnDocumentBody();
  41742. }
  41743. },
  41744. getDocument: function () {
  41745. return document;
  41746. },
  41747. getProtocol: function () {
  41748. return this.getDocument().location.protocol;
  41749. },
  41750. getAuthorizers: function () {
  41751. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41752. },
  41753. onDocumentBody: function (callback) {
  41754. var _this = this;
  41755. if (document.body) {
  41756. callback();
  41757. }
  41758. else {
  41759. setTimeout(function () {
  41760. _this.onDocumentBody(callback);
  41761. }, 0);
  41762. }
  41763. },
  41764. createJSONPRequest: function (url, data) {
  41765. return new jsonp_request(url, data);
  41766. },
  41767. createScriptRequest: function (src) {
  41768. return new script_request(src);
  41769. },
  41770. getLocalStorage: function () {
  41771. try {
  41772. return window.localStorage;
  41773. }
  41774. catch (e) {
  41775. return undefined;
  41776. }
  41777. },
  41778. createXHR: function () {
  41779. if (this.getXHRAPI()) {
  41780. return this.createXMLHttpRequest();
  41781. }
  41782. else {
  41783. return this.createMicrosoftXHR();
  41784. }
  41785. },
  41786. createXMLHttpRequest: function () {
  41787. var Constructor = this.getXHRAPI();
  41788. return new Constructor();
  41789. },
  41790. createMicrosoftXHR: function () {
  41791. return new ActiveXObject("Microsoft.XMLHTTP");
  41792. },
  41793. getNetwork: function () {
  41794. return net_info_Network;
  41795. },
  41796. createWebSocket: function (url) {
  41797. var Constructor = this.getWebSocketAPI();
  41798. return new Constructor(url);
  41799. },
  41800. createSocketRequest: function (method, url) {
  41801. if (this.isXHRSupported()) {
  41802. return this.HTTPFactory.createXHR(method, url);
  41803. }
  41804. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  41805. return this.HTTPFactory.createXDR(method, url);
  41806. }
  41807. else {
  41808. throw "Cross-origin HTTP requests are not supported";
  41809. }
  41810. },
  41811. isXHRSupported: function () {
  41812. var Constructor = this.getXHRAPI();
  41813. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  41814. },
  41815. isXDRSupported: function (useTLS) {
  41816. var protocol = useTLS ? "https:" : "http:";
  41817. var documentProtocol = this.getProtocol();
  41818. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  41819. },
  41820. addUnloadListener: function (listener) {
  41821. if (window.addEventListener !== undefined) {
  41822. window.addEventListener("unload", listener, false);
  41823. }
  41824. else if (window.attachEvent !== undefined) {
  41825. window.attachEvent("onunload", listener);
  41826. }
  41827. },
  41828. removeUnloadListener: function (listener) {
  41829. if (window.addEventListener !== undefined) {
  41830. window.removeEventListener("unload", listener, false);
  41831. }
  41832. else if (window.detachEvent !== undefined) {
  41833. window.detachEvent("onunload", listener);
  41834. }
  41835. }
  41836. };
  41837. /* harmony default export */ var runtime = (Runtime);
  41838. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  41839. var TimelineLevel;
  41840. (function (TimelineLevel) {
  41841. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  41842. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  41843. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  41844. })(TimelineLevel || (TimelineLevel = {}));
  41845. /* harmony default export */ var timeline_level = (TimelineLevel);
  41846. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  41847. var timeline_Timeline = (function () {
  41848. function Timeline(key, session, options) {
  41849. this.key = key;
  41850. this.session = session;
  41851. this.events = [];
  41852. this.options = options || {};
  41853. this.sent = 0;
  41854. this.uniqueID = 0;
  41855. }
  41856. Timeline.prototype.log = function (level, event) {
  41857. if (level <= this.options.level) {
  41858. this.events.push(extend({}, event, { timestamp: util.now() }));
  41859. if (this.options.limit && this.events.length > this.options.limit) {
  41860. this.events.shift();
  41861. }
  41862. }
  41863. };
  41864. Timeline.prototype.error = function (event) {
  41865. this.log(timeline_level.ERROR, event);
  41866. };
  41867. Timeline.prototype.info = function (event) {
  41868. this.log(timeline_level.INFO, event);
  41869. };
  41870. Timeline.prototype.debug = function (event) {
  41871. this.log(timeline_level.DEBUG, event);
  41872. };
  41873. Timeline.prototype.isEmpty = function () {
  41874. return this.events.length === 0;
  41875. };
  41876. Timeline.prototype.send = function (sendfn, callback) {
  41877. var _this = this;
  41878. var data = extend({
  41879. session: this.session,
  41880. bundle: this.sent + 1,
  41881. key: this.key,
  41882. lib: "js",
  41883. version: this.options.version,
  41884. cluster: this.options.cluster,
  41885. features: this.options.features,
  41886. timeline: this.events
  41887. }, this.options.params);
  41888. this.events = [];
  41889. sendfn(data, function (error, result) {
  41890. if (!error) {
  41891. _this.sent++;
  41892. }
  41893. if (callback) {
  41894. callback(error, result);
  41895. }
  41896. });
  41897. return true;
  41898. };
  41899. Timeline.prototype.generateUniqueID = function () {
  41900. this.uniqueID++;
  41901. return this.uniqueID;
  41902. };
  41903. return Timeline;
  41904. }());
  41905. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  41906. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  41907. var transport_strategy_TransportStrategy = (function () {
  41908. function TransportStrategy(name, priority, transport, options) {
  41909. this.name = name;
  41910. this.priority = priority;
  41911. this.transport = transport;
  41912. this.options = options || {};
  41913. }
  41914. TransportStrategy.prototype.isSupported = function () {
  41915. return this.transport.isSupported({
  41916. useTLS: this.options.useTLS
  41917. });
  41918. };
  41919. TransportStrategy.prototype.connect = function (minPriority, callback) {
  41920. var _this = this;
  41921. if (!this.isSupported()) {
  41922. return failAttempt(new UnsupportedStrategy(), callback);
  41923. }
  41924. else if (this.priority < minPriority) {
  41925. return failAttempt(new TransportPriorityTooLow(), callback);
  41926. }
  41927. var connected = false;
  41928. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  41929. var handshake = null;
  41930. var onInitialized = function () {
  41931. transport.unbind("initialized", onInitialized);
  41932. transport.connect();
  41933. };
  41934. var onOpen = function () {
  41935. handshake = factory.createHandshake(transport, function (result) {
  41936. connected = true;
  41937. unbindListeners();
  41938. callback(null, result);
  41939. });
  41940. };
  41941. var onError = function (error) {
  41942. unbindListeners();
  41943. callback(error);
  41944. };
  41945. var onClosed = function () {
  41946. unbindListeners();
  41947. var serializedTransport;
  41948. serializedTransport = safeJSONStringify(transport);
  41949. callback(new TransportClosed(serializedTransport));
  41950. };
  41951. var unbindListeners = function () {
  41952. transport.unbind("initialized", onInitialized);
  41953. transport.unbind("open", onOpen);
  41954. transport.unbind("error", onError);
  41955. transport.unbind("closed", onClosed);
  41956. };
  41957. transport.bind("initialized", onInitialized);
  41958. transport.bind("open", onOpen);
  41959. transport.bind("error", onError);
  41960. transport.bind("closed", onClosed);
  41961. transport.initialize();
  41962. return {
  41963. abort: function () {
  41964. if (connected) {
  41965. return;
  41966. }
  41967. unbindListeners();
  41968. if (handshake) {
  41969. handshake.close();
  41970. }
  41971. else {
  41972. transport.close();
  41973. }
  41974. },
  41975. forceMinPriority: function (p) {
  41976. if (connected) {
  41977. return;
  41978. }
  41979. if (_this.priority < p) {
  41980. if (handshake) {
  41981. handshake.close();
  41982. }
  41983. else {
  41984. transport.close();
  41985. }
  41986. }
  41987. }
  41988. };
  41989. };
  41990. return TransportStrategy;
  41991. }());
  41992. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  41993. function failAttempt(error, callback) {
  41994. util.defer(function () {
  41995. callback(error);
  41996. });
  41997. return {
  41998. abort: function () { },
  41999. forceMinPriority: function () { }
  42000. };
  42001. }
  42002. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42003. var strategy_builder_Transports = runtime.Transports;
  42004. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42005. var transportClass = strategy_builder_Transports[type];
  42006. if (!transportClass) {
  42007. throw new UnsupportedTransport(type);
  42008. }
  42009. var enabled = (!config.enabledTransports ||
  42010. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42011. (!config.disabledTransports ||
  42012. arrayIndexOf(config.disabledTransports, name) === -1);
  42013. var transport;
  42014. if (enabled) {
  42015. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42016. key: config.key,
  42017. useTLS: config.useTLS,
  42018. timeline: config.timeline,
  42019. ignoreNullOrigin: config.ignoreNullOrigin
  42020. }, options));
  42021. }
  42022. else {
  42023. transport = strategy_builder_UnsupportedStrategy;
  42024. }
  42025. return transport;
  42026. };
  42027. var strategy_builder_UnsupportedStrategy = {
  42028. isSupported: function () {
  42029. return false;
  42030. },
  42031. connect: function (_, callback) {
  42032. var deferred = util.defer(function () {
  42033. callback(new UnsupportedStrategy());
  42034. });
  42035. return {
  42036. abort: function () {
  42037. deferred.ensureAborted();
  42038. },
  42039. forceMinPriority: function () { }
  42040. };
  42041. }
  42042. };
  42043. // CONCATENATED MODULE: ./src/core/config.ts
  42044. var getGlobalConfig = function () {
  42045. return {
  42046. wsHost: defaults.host,
  42047. wsPort: defaults.ws_port,
  42048. wssPort: defaults.wss_port,
  42049. wsPath: defaults.ws_path,
  42050. httpHost: defaults.sockjs_host,
  42051. httpPort: defaults.sockjs_http_port,
  42052. httpsPort: defaults.sockjs_https_port,
  42053. httpPath: defaults.sockjs_path,
  42054. statsHost: defaults.stats_host,
  42055. authEndpoint: defaults.channel_auth_endpoint,
  42056. authTransport: defaults.channel_auth_transport,
  42057. activity_timeout: defaults.activity_timeout,
  42058. pong_timeout: defaults.pong_timeout,
  42059. unavailable_timeout: defaults.unavailable_timeout
  42060. };
  42061. };
  42062. var getClusterConfig = function (clusterName) {
  42063. return {
  42064. wsHost: 'ws-' + clusterName + '.pusher.com',
  42065. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42066. };
  42067. };
  42068. // CONCATENATED MODULE: ./src/core/pusher.ts
  42069. var pusher_Pusher = (function () {
  42070. function Pusher(app_key, options) {
  42071. var _this = this;
  42072. checkAppKey(app_key);
  42073. options = options || {};
  42074. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42075. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42076. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42077. }
  42078. this.key = app_key;
  42079. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42080. this.channels = factory.createChannels();
  42081. this.global_emitter = new dispatcher();
  42082. this.sessionID = Math.floor(Math.random() * 1000000000);
  42083. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42084. cluster: this.config.cluster,
  42085. features: Pusher.getClientFeatures(),
  42086. params: this.config.timelineParams || {},
  42087. limit: 50,
  42088. level: timeline_level.INFO,
  42089. version: defaults.VERSION
  42090. });
  42091. if (!this.config.disableStats) {
  42092. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42093. host: this.config.statsHost,
  42094. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42095. });
  42096. }
  42097. var getStrategy = function (options) {
  42098. var config = extend({}, _this.config, options);
  42099. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42100. };
  42101. this.connection = factory.createConnectionManager(this.key, extend({
  42102. getStrategy: getStrategy,
  42103. timeline: this.timeline,
  42104. activityTimeout: this.config.activity_timeout,
  42105. pongTimeout: this.config.pong_timeout,
  42106. unavailableTimeout: this.config.unavailable_timeout
  42107. }, this.config, { useTLS: this.shouldUseTLS() }));
  42108. this.connection.bind('connected', function () {
  42109. _this.subscribeAll();
  42110. if (_this.timelineSender) {
  42111. _this.timelineSender.send(_this.connection.isUsingTLS());
  42112. }
  42113. });
  42114. this.connection.bind('message', function (event) {
  42115. var eventName = event.event;
  42116. var internal = eventName.indexOf('pusher_internal:') === 0;
  42117. if (event.channel) {
  42118. var channel = _this.channel(event.channel);
  42119. if (channel) {
  42120. channel.handleEvent(event);
  42121. }
  42122. }
  42123. if (!internal) {
  42124. _this.global_emitter.emit(event.event, event.data);
  42125. }
  42126. });
  42127. this.connection.bind('connecting', function () {
  42128. _this.channels.disconnect();
  42129. });
  42130. this.connection.bind('disconnected', function () {
  42131. _this.channels.disconnect();
  42132. });
  42133. this.connection.bind('error', function (err) {
  42134. logger.warn(err);
  42135. });
  42136. Pusher.instances.push(this);
  42137. this.timeline.info({ instances: Pusher.instances.length });
  42138. if (Pusher.isReady) {
  42139. this.connect();
  42140. }
  42141. }
  42142. Pusher.ready = function () {
  42143. Pusher.isReady = true;
  42144. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42145. Pusher.instances[i].connect();
  42146. }
  42147. };
  42148. Pusher.getClientFeatures = function () {
  42149. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42150. return t.isSupported({});
  42151. }));
  42152. };
  42153. Pusher.prototype.channel = function (name) {
  42154. return this.channels.find(name);
  42155. };
  42156. Pusher.prototype.allChannels = function () {
  42157. return this.channels.all();
  42158. };
  42159. Pusher.prototype.connect = function () {
  42160. this.connection.connect();
  42161. if (this.timelineSender) {
  42162. if (!this.timelineSenderTimer) {
  42163. var usingTLS = this.connection.isUsingTLS();
  42164. var timelineSender = this.timelineSender;
  42165. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42166. timelineSender.send(usingTLS);
  42167. });
  42168. }
  42169. }
  42170. };
  42171. Pusher.prototype.disconnect = function () {
  42172. this.connection.disconnect();
  42173. if (this.timelineSenderTimer) {
  42174. this.timelineSenderTimer.ensureAborted();
  42175. this.timelineSenderTimer = null;
  42176. }
  42177. };
  42178. Pusher.prototype.bind = function (event_name, callback, context) {
  42179. this.global_emitter.bind(event_name, callback, context);
  42180. return this;
  42181. };
  42182. Pusher.prototype.unbind = function (event_name, callback, context) {
  42183. this.global_emitter.unbind(event_name, callback, context);
  42184. return this;
  42185. };
  42186. Pusher.prototype.bind_global = function (callback) {
  42187. this.global_emitter.bind_global(callback);
  42188. return this;
  42189. };
  42190. Pusher.prototype.unbind_global = function (callback) {
  42191. this.global_emitter.unbind_global(callback);
  42192. return this;
  42193. };
  42194. Pusher.prototype.unbind_all = function (callback) {
  42195. this.global_emitter.unbind_all();
  42196. return this;
  42197. };
  42198. Pusher.prototype.subscribeAll = function () {
  42199. var channelName;
  42200. for (channelName in this.channels.channels) {
  42201. if (this.channels.channels.hasOwnProperty(channelName)) {
  42202. this.subscribe(channelName);
  42203. }
  42204. }
  42205. };
  42206. Pusher.prototype.subscribe = function (channel_name) {
  42207. var channel = this.channels.add(channel_name, this);
  42208. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42209. channel.reinstateSubscription();
  42210. }
  42211. else if (!channel.subscriptionPending &&
  42212. this.connection.state === 'connected') {
  42213. channel.subscribe();
  42214. }
  42215. return channel;
  42216. };
  42217. Pusher.prototype.unsubscribe = function (channel_name) {
  42218. var channel = this.channels.find(channel_name);
  42219. if (channel && channel.subscriptionPending) {
  42220. channel.cancelSubscription();
  42221. }
  42222. else {
  42223. channel = this.channels.remove(channel_name);
  42224. if (channel && this.connection.state === 'connected') {
  42225. channel.unsubscribe();
  42226. }
  42227. }
  42228. };
  42229. Pusher.prototype.send_event = function (event_name, data, channel) {
  42230. return this.connection.send_event(event_name, data, channel);
  42231. };
  42232. Pusher.prototype.shouldUseTLS = function () {
  42233. if (runtime.getProtocol() === 'https:') {
  42234. return true;
  42235. }
  42236. else if (this.config.forceTLS === true) {
  42237. return true;
  42238. }
  42239. else {
  42240. return Boolean(this.config.encrypted);
  42241. }
  42242. };
  42243. Pusher.instances = [];
  42244. Pusher.isReady = false;
  42245. Pusher.logToConsole = false;
  42246. Pusher.Runtime = runtime;
  42247. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42248. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42249. Pusher.auth_callbacks = runtime.auth_callbacks;
  42250. return Pusher;
  42251. }());
  42252. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42253. function checkAppKey(key) {
  42254. if (key === null || key === undefined) {
  42255. throw 'You must pass your app key when you instantiate Pusher.';
  42256. }
  42257. }
  42258. runtime.setup(pusher_Pusher);
  42259. /***/ })
  42260. /******/ ]);
  42261. });
  42262. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42263. /***/ }),
  42264. /***/ "./node_modules/setimmediate/setImmediate.js":
  42265. /*!***************************************************!*\
  42266. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42267. \***************************************************/
  42268. /*! no static exports found */
  42269. /***/ (function(module, exports, __webpack_require__) {
  42270. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42271. "use strict";
  42272. if (global.setImmediate) {
  42273. return;
  42274. }
  42275. var nextHandle = 1; // Spec says greater than zero
  42276. var tasksByHandle = {};
  42277. var currentlyRunningATask = false;
  42278. var doc = global.document;
  42279. var registerImmediate;
  42280. function setImmediate(callback) {
  42281. // Callback can either be a function or a string
  42282. if (typeof callback !== "function") {
  42283. callback = new Function("" + callback);
  42284. }
  42285. // Copy function arguments
  42286. var args = new Array(arguments.length - 1);
  42287. for (var i = 0; i < args.length; i++) {
  42288. args[i] = arguments[i + 1];
  42289. }
  42290. // Store and register the task
  42291. var task = { callback: callback, args: args };
  42292. tasksByHandle[nextHandle] = task;
  42293. registerImmediate(nextHandle);
  42294. return nextHandle++;
  42295. }
  42296. function clearImmediate(handle) {
  42297. delete tasksByHandle[handle];
  42298. }
  42299. function run(task) {
  42300. var callback = task.callback;
  42301. var args = task.args;
  42302. switch (args.length) {
  42303. case 0:
  42304. callback();
  42305. break;
  42306. case 1:
  42307. callback(args[0]);
  42308. break;
  42309. case 2:
  42310. callback(args[0], args[1]);
  42311. break;
  42312. case 3:
  42313. callback(args[0], args[1], args[2]);
  42314. break;
  42315. default:
  42316. callback.apply(undefined, args);
  42317. break;
  42318. }
  42319. }
  42320. function runIfPresent(handle) {
  42321. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42322. // So if we're currently running a task, we'll need to delay this invocation.
  42323. if (currentlyRunningATask) {
  42324. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42325. // "too much recursion" error.
  42326. setTimeout(runIfPresent, 0, handle);
  42327. } else {
  42328. var task = tasksByHandle[handle];
  42329. if (task) {
  42330. currentlyRunningATask = true;
  42331. try {
  42332. run(task);
  42333. } finally {
  42334. clearImmediate(handle);
  42335. currentlyRunningATask = false;
  42336. }
  42337. }
  42338. }
  42339. }
  42340. function installNextTickImplementation() {
  42341. registerImmediate = function(handle) {
  42342. process.nextTick(function () { runIfPresent(handle); });
  42343. };
  42344. }
  42345. function canUsePostMessage() {
  42346. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42347. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42348. if (global.postMessage && !global.importScripts) {
  42349. var postMessageIsAsynchronous = true;
  42350. var oldOnMessage = global.onmessage;
  42351. global.onmessage = function() {
  42352. postMessageIsAsynchronous = false;
  42353. };
  42354. global.postMessage("", "*");
  42355. global.onmessage = oldOnMessage;
  42356. return postMessageIsAsynchronous;
  42357. }
  42358. }
  42359. function installPostMessageImplementation() {
  42360. // Installs an event handler on `global` for the `message` event: see
  42361. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42362. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42363. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42364. var onGlobalMessage = function(event) {
  42365. if (event.source === global &&
  42366. typeof event.data === "string" &&
  42367. event.data.indexOf(messagePrefix) === 0) {
  42368. runIfPresent(+event.data.slice(messagePrefix.length));
  42369. }
  42370. };
  42371. if (global.addEventListener) {
  42372. global.addEventListener("message", onGlobalMessage, false);
  42373. } else {
  42374. global.attachEvent("onmessage", onGlobalMessage);
  42375. }
  42376. registerImmediate = function(handle) {
  42377. global.postMessage(messagePrefix + handle, "*");
  42378. };
  42379. }
  42380. function installMessageChannelImplementation() {
  42381. var channel = new MessageChannel();
  42382. channel.port1.onmessage = function(event) {
  42383. var handle = event.data;
  42384. runIfPresent(handle);
  42385. };
  42386. registerImmediate = function(handle) {
  42387. channel.port2.postMessage(handle);
  42388. };
  42389. }
  42390. function installReadyStateChangeImplementation() {
  42391. var html = doc.documentElement;
  42392. registerImmediate = function(handle) {
  42393. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42394. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42395. var script = doc.createElement("script");
  42396. script.onreadystatechange = function () {
  42397. runIfPresent(handle);
  42398. script.onreadystatechange = null;
  42399. html.removeChild(script);
  42400. script = null;
  42401. };
  42402. html.appendChild(script);
  42403. };
  42404. }
  42405. function installSetTimeoutImplementation() {
  42406. registerImmediate = function(handle) {
  42407. setTimeout(runIfPresent, 0, handle);
  42408. };
  42409. }
  42410. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42411. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42412. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42413. // Don't get fooled by e.g. browserify environments.
  42414. if ({}.toString.call(global.process) === "[object process]") {
  42415. // For Node.js before 0.9
  42416. installNextTickImplementation();
  42417. } else if (canUsePostMessage()) {
  42418. // For non-IE10 modern browsers
  42419. installPostMessageImplementation();
  42420. } else if (global.MessageChannel) {
  42421. // For web workers, where supported
  42422. installMessageChannelImplementation();
  42423. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42424. // For IE 6–8
  42425. installReadyStateChangeImplementation();
  42426. } else {
  42427. // For older browsers
  42428. installSetTimeoutImplementation();
  42429. }
  42430. attachTo.setImmediate = setImmediate;
  42431. attachTo.clearImmediate = clearImmediate;
  42432. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42433. /* 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")))
  42434. /***/ }),
  42435. /***/ "./node_modules/timers-browserify/main.js":
  42436. /*!************************************************!*\
  42437. !*** ./node_modules/timers-browserify/main.js ***!
  42438. \************************************************/
  42439. /*! no static exports found */
  42440. /***/ (function(module, exports, __webpack_require__) {
  42441. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42442. (typeof self !== "undefined" && self) ||
  42443. window;
  42444. var apply = Function.prototype.apply;
  42445. // DOM APIs, for completeness
  42446. exports.setTimeout = function() {
  42447. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42448. };
  42449. exports.setInterval = function() {
  42450. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42451. };
  42452. exports.clearTimeout =
  42453. exports.clearInterval = function(timeout) {
  42454. if (timeout) {
  42455. timeout.close();
  42456. }
  42457. };
  42458. function Timeout(id, clearFn) {
  42459. this._id = id;
  42460. this._clearFn = clearFn;
  42461. }
  42462. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42463. Timeout.prototype.close = function() {
  42464. this._clearFn.call(scope, this._id);
  42465. };
  42466. // Does not start the time, just sets up the members needed.
  42467. exports.enroll = function(item, msecs) {
  42468. clearTimeout(item._idleTimeoutId);
  42469. item._idleTimeout = msecs;
  42470. };
  42471. exports.unenroll = function(item) {
  42472. clearTimeout(item._idleTimeoutId);
  42473. item._idleTimeout = -1;
  42474. };
  42475. exports._unrefActive = exports.active = function(item) {
  42476. clearTimeout(item._idleTimeoutId);
  42477. var msecs = item._idleTimeout;
  42478. if (msecs >= 0) {
  42479. item._idleTimeoutId = setTimeout(function onTimeout() {
  42480. if (item._onTimeout)
  42481. item._onTimeout();
  42482. }, msecs);
  42483. }
  42484. };
  42485. // setimmediate attaches itself to the global object
  42486. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42487. // On some exotic environments, it's not clear which object `setimmediate` was
  42488. // able to install onto. Search each possibility in the same order as the
  42489. // `setimmediate` library.
  42490. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42491. (typeof global !== "undefined" && global.setImmediate) ||
  42492. (this && this.setImmediate);
  42493. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42494. (typeof global !== "undefined" && global.clearImmediate) ||
  42495. (this && this.clearImmediate);
  42496. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42497. /***/ }),
  42498. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  42499. /*!*******************************************************************************************************************************************************************************************************************!*\
  42500. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  42501. \*******************************************************************************************************************************************************************************************************************/
  42502. /*! exports provided: render, staticRenderFns */
  42503. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42504. "use strict";
  42505. __webpack_require__.r(__webpack_exports__);
  42506. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42508. var render = function() {
  42509. var _vm = this
  42510. var _h = _vm.$createElement
  42511. var _c = _vm._self._c || _h
  42512. return _vm._m(0)
  42513. }
  42514. var staticRenderFns = [
  42515. function() {
  42516. var _vm = this
  42517. var _h = _vm.$createElement
  42518. var _c = _vm._self._c || _h
  42519. return _c("div", { staticClass: "container" }, [
  42520. _c("div", { staticClass: "row justify-content-center" }, [
  42521. _c("div", { staticClass: "col-md-8" }, [
  42522. _c("div", { staticClass: "card" }, [
  42523. _c("div", { staticClass: "card-header" }, [
  42524. _vm._v("Example Component")
  42525. ]),
  42526. _vm._v(" "),
  42527. _c("div", { staticClass: "card-body" }, [
  42528. _vm._v(
  42529. "\n I'm an example component.\n "
  42530. )
  42531. ])
  42532. ])
  42533. ])
  42534. ])
  42535. ])
  42536. }
  42537. ]
  42538. render._withStripped = true
  42539. /***/ }),
  42540. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  42541. /*!************************************************************************************************************************************************************************************************************!*\
  42542. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  42543. \************************************************************************************************************************************************************************************************************/
  42544. /*! exports provided: render, staticRenderFns */
  42545. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42546. "use strict";
  42547. __webpack_require__.r(__webpack_exports__);
  42548. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42549. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42550. var render = function() {
  42551. var _vm = this
  42552. var _h = _vm.$createElement
  42553. var _c = _vm._self._c || _h
  42554. return _c("div", [
  42555. _c("h4", { staticClass: "text-center" }, [
  42556. _vm._v(_vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "),
  42557. _c("small", { staticClass: "text-muted" }, [
  42558. _vm._v(_vm._s(this.data.pcnickname))
  42559. ])
  42560. ]),
  42561. _vm._v(" "),
  42562. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  42563. _vm._v(" "),
  42564. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  42565. _vm._v(" "),
  42566. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  42567. _vm._v(" "),
  42568. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  42569. _vm._v(" "),
  42570. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))])
  42571. ])
  42572. }
  42573. var staticRenderFns = []
  42574. render._withStripped = true
  42575. /***/ }),
  42576. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  42577. /*!*************************************************************************************************************************************************************************************************************!*\
  42578. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  42579. \*************************************************************************************************************************************************************************************************************/
  42580. /*! exports provided: render, staticRenderFns */
  42581. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42582. "use strict";
  42583. __webpack_require__.r(__webpack_exports__);
  42584. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42585. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42586. var render = function() {
  42587. var _vm = this
  42588. var _h = _vm.$createElement
  42589. var _c = _vm._self._c || _h
  42590. return _c(
  42591. "div",
  42592. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  42593. [
  42594. _c("div", { staticClass: "row no-gutters" }, [
  42595. _c("div", { staticClass: "h5 col-3 text-left" }, [
  42596. _vm._v(_vm._s(this.data.creddesc))
  42597. ]),
  42598. _vm._v(" "),
  42599. _c("div", { staticClass: "col-9 text-right" }, [
  42600. _vm._v(_vm._s(this.data.creddate))
  42601. ])
  42602. ]),
  42603. _vm._v(" "),
  42604. _c("div", { staticClass: "row" }, [
  42605. _c("div", { staticClass: "col-lg-9" }, [
  42606. _c("div", [
  42607. _vm._m(0),
  42608. _vm._v(" "),
  42609. _c("input", {
  42610. staticClass: "border-0 credential",
  42611. attrs: {
  42612. type: "text",
  42613. id: "username" + this.data.credid,
  42614. readonly: ""
  42615. },
  42616. domProps: { value: this.data.creduser }
  42617. }),
  42618. _vm._v(" "),
  42619. _c(
  42620. "button",
  42621. {
  42622. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  42623. attrs: {
  42624. id: "btn-username" + this.data.credid,
  42625. "data-clipboard-target": "#username" + this.data.credid
  42626. }
  42627. },
  42628. [_c("i", { staticClass: "far fa-clone" })]
  42629. )
  42630. ]),
  42631. _vm._v(" "),
  42632. _c("div", [
  42633. _vm._m(1),
  42634. _vm._v(" "),
  42635. _c("input", {
  42636. staticClass: "border-0 credential",
  42637. attrs: {
  42638. type: "text",
  42639. id: "password" + this.data.credid,
  42640. readonly: ""
  42641. },
  42642. domProps: { value: this.data.credpass }
  42643. }),
  42644. _vm._v(" "),
  42645. _c(
  42646. "button",
  42647. {
  42648. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  42649. attrs: {
  42650. id: "btn-password" + this.data.credid,
  42651. "data-clipboard-target": "#password" + this.data.credid
  42652. }
  42653. },
  42654. [_c("i", { staticClass: "far fa-clone" })]
  42655. )
  42656. ])
  42657. ]),
  42658. _vm._v(" "),
  42659. _vm._m(2)
  42660. ])
  42661. ]
  42662. )
  42663. }
  42664. var staticRenderFns = [
  42665. function() {
  42666. var _vm = this
  42667. var _h = _vm.$createElement
  42668. var _c = _vm._self._c || _h
  42669. return _c("label", { attrs: { for: "username" } }, [
  42670. _c("i", { staticClass: "fas fa-fw fa-user" })
  42671. ])
  42672. },
  42673. function() {
  42674. var _vm = this
  42675. var _h = _vm.$createElement
  42676. var _c = _vm._self._c || _h
  42677. return _c("label", { attrs: { for: "password" } }, [
  42678. _c("i", { staticClass: "fas fa-fw fa-key" })
  42679. ])
  42680. },
  42681. function() {
  42682. var _vm = this
  42683. var _h = _vm.$createElement
  42684. var _c = _vm._self._c || _h
  42685. return _c(
  42686. "div",
  42687. {
  42688. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  42689. attrs: { role: "group", "aria-label": "Edit and Delete" }
  42690. },
  42691. [
  42692. _c(
  42693. "button",
  42694. {
  42695. staticClass: "btn btn-sm btn-secondary p-lg-1",
  42696. attrs: { type: "button" }
  42697. },
  42698. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  42699. ),
  42700. _vm._v(" "),
  42701. _c(
  42702. "button",
  42703. {
  42704. staticClass: "btn btn-sm btn-danger p-lg-1",
  42705. attrs: { type: "button" }
  42706. },
  42707. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  42708. )
  42709. ]
  42710. )
  42711. }
  42712. ]
  42713. render._withStripped = true
  42714. /***/ }),
  42715. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  42716. /*!********************************************************************************************************************************************************************************************************!*\
  42717. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  42718. \********************************************************************************************************************************************************************************************************/
  42719. /*! exports provided: render, staticRenderFns */
  42720. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42721. "use strict";
  42722. __webpack_require__.r(__webpack_exports__);
  42723. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42724. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42725. var render = function() {
  42726. var _vm = this
  42727. var _h = _vm.$createElement
  42728. var _c = _vm._self._c || _h
  42729. return _c("div", { staticClass: "modal fade" }, [
  42730. _c(
  42731. "div",
  42732. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  42733. [
  42734. _c("div", { staticClass: "modal-content" }, [
  42735. _c(
  42736. "div",
  42737. { staticClass: "modal-header" },
  42738. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  42739. 2
  42740. ),
  42741. _vm._v(" "),
  42742. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  42743. _vm._v(" "),
  42744. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  42745. ])
  42746. ]
  42747. )
  42748. ])
  42749. }
  42750. var staticRenderFns = [
  42751. function() {
  42752. var _vm = this
  42753. var _h = _vm.$createElement
  42754. var _c = _vm._self._c || _h
  42755. return _c(
  42756. "button",
  42757. {
  42758. staticClass: "close",
  42759. attrs: {
  42760. type: "button",
  42761. "data-dismiss": "modal",
  42762. "aria-label": "Close"
  42763. }
  42764. },
  42765. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  42766. )
  42767. }
  42768. ]
  42769. render._withStripped = true
  42770. /***/ }),
  42771. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  42772. /*!********************************************************************************************************************************************************************************************************!*\
  42773. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  42774. \********************************************************************************************************************************************************************************************************/
  42775. /*! exports provided: render, staticRenderFns */
  42776. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42777. "use strict";
  42778. __webpack_require__.r(__webpack_exports__);
  42779. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42780. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42781. var render = function() {
  42782. var _vm = this
  42783. var _h = _vm.$createElement
  42784. var _c = _vm._self._c || _h
  42785. return _c(
  42786. "ul",
  42787. { staticClass: "list-unstyled" },
  42788. _vm._l(this.notes, function(note) {
  42789. return _c(
  42790. "li",
  42791. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  42792. [
  42793. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  42794. _c("div", { staticClass: "text-center p-0 m-0" }, [
  42795. _vm._v(_vm._s(note.noteuser))
  42796. ]),
  42797. _vm._v(" "),
  42798. _c(
  42799. "div",
  42800. { staticClass: "text-muted text-small text-center p-0 m-0" },
  42801. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  42802. ),
  42803. _vm._v(" "),
  42804. _c(
  42805. "div",
  42806. { staticClass: "btn-group justify-content-center p-0 m-0" },
  42807. [
  42808. _vm.authusername === note.noteuser ||
  42809. _vm.authusername === "admin"
  42810. ? [
  42811. _vm._m(0, true),
  42812. _vm._v(" "),
  42813. _vm._m(1, true),
  42814. _vm._v(" "),
  42815. _vm._m(2, true)
  42816. ]
  42817. : _vm._e()
  42818. ],
  42819. 2
  42820. )
  42821. ]),
  42822. _vm._v(" "),
  42823. _c("div", { staticClass: "col-md-10" }, [
  42824. _c("div", { staticClass: "card m-2" }, [
  42825. _c("div", { staticClass: "card-body p-2" }, [
  42826. _vm._v(
  42827. "\n " +
  42828. _vm._s(note.thenote) +
  42829. "\n "
  42830. )
  42831. ])
  42832. ])
  42833. ])
  42834. ]
  42835. )
  42836. }),
  42837. 0
  42838. )
  42839. }
  42840. var staticRenderFns = [
  42841. function() {
  42842. var _vm = this
  42843. var _h = _vm.$createElement
  42844. var _c = _vm._self._c || _h
  42845. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  42846. _c("i", { staticClass: "fas fa-fw fa-edit" })
  42847. ])
  42848. },
  42849. function() {
  42850. var _vm = this
  42851. var _h = _vm.$createElement
  42852. var _c = _vm._self._c || _h
  42853. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  42854. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  42855. ])
  42856. },
  42857. function() {
  42858. var _vm = this
  42859. var _h = _vm.$createElement
  42860. var _c = _vm._self._c || _h
  42861. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  42862. _c("i", { staticClass: "fa fa-fw fa-random" })
  42863. ])
  42864. }
  42865. ]
  42866. render._withStripped = true
  42867. /***/ }),
  42868. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  42869. /*!*********************************************************************************************************************************************************************************************************!*\
  42870. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  42871. \*********************************************************************************************************************************************************************************************************/
  42872. /*! exports provided: render, staticRenderFns */
  42873. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42874. "use strict";
  42875. __webpack_require__.r(__webpack_exports__);
  42876. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42877. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42878. var render = function() {
  42879. var _vm = this
  42880. var _h = _vm.$createElement
  42881. var _c = _vm._self._c || _h
  42882. return _c(
  42883. "div",
  42884. [
  42885. _c(
  42886. "modal",
  42887. {
  42888. attrs: {
  42889. id: "workordereditModal",
  42890. tabindex: "-1",
  42891. role: "dialog",
  42892. "aria-labelledby": "workordereditModalLabel"
  42893. }
  42894. },
  42895. [
  42896. _c(
  42897. "h5",
  42898. {
  42899. staticClass: "modal-title",
  42900. attrs: { slot: "header", id: "workordereditModalLabel" },
  42901. slot: "header"
  42902. },
  42903. [_vm._v("\n Edit Work Order Information\n ")]
  42904. ),
  42905. _vm._v(" "),
  42906. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42907. _c("div", { staticClass: "form-group" }, [
  42908. _c("label", { attrs: { for: "probdesc" } }, [
  42909. _vm._v("Problem Description")
  42910. ]),
  42911. _vm._v(" "),
  42912. _c("textarea", {
  42913. directives: [
  42914. {
  42915. name: "model",
  42916. rawName: "v-model",
  42917. value: _vm.data.probdesc,
  42918. expression: "data.probdesc"
  42919. }
  42920. ],
  42921. staticClass: "form-control",
  42922. attrs: { id: "probdesc", name: "probdesc" },
  42923. domProps: { value: _vm.data.probdesc },
  42924. on: {
  42925. input: function($event) {
  42926. if ($event.target.composing) {
  42927. return
  42928. }
  42929. _vm.$set(_vm.data, "probdesc", $event.target.value)
  42930. }
  42931. }
  42932. })
  42933. ]),
  42934. _vm._v(" "),
  42935. _c("div", { staticClass: "form-group" }, [
  42936. _c("label", { attrs: { for: "suggested" } }, [
  42937. _vm._v("Suggested Solution")
  42938. ]),
  42939. _vm._v(" "),
  42940. _c("textarea", {
  42941. directives: [
  42942. {
  42943. name: "model",
  42944. rawName: "v-model",
  42945. value: _vm.data.suggested,
  42946. expression: "data.suggested"
  42947. }
  42948. ],
  42949. staticClass: "form-control",
  42950. attrs: { id: "suggested", name: "suggested" },
  42951. domProps: { value: _vm.data.suggested },
  42952. on: {
  42953. input: function($event) {
  42954. if ($event.target.composing) {
  42955. return
  42956. }
  42957. _vm.$set(_vm.data, "suggested", $event.target.value)
  42958. }
  42959. }
  42960. })
  42961. ])
  42962. ]),
  42963. _vm._v(" "),
  42964. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  42965. _c(
  42966. "button",
  42967. {
  42968. staticClass: "btn btn-secondary",
  42969. attrs: { type: "button", "data-dismiss": "modal" }
  42970. },
  42971. [_vm._v("Close")]
  42972. ),
  42973. _vm._v(" "),
  42974. _c(
  42975. "button",
  42976. {
  42977. staticClass: "btn btn-primary",
  42978. attrs: { type: "button" },
  42979. on: {
  42980. click: function($event) {
  42981. return _vm.updateWorkOrder()
  42982. }
  42983. }
  42984. },
  42985. [_vm._v("Save")]
  42986. )
  42987. ])
  42988. ]
  42989. ),
  42990. _vm._v(" "),
  42991. _c("p", [
  42992. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  42993. _vm._v(" "),
  42994. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  42995. ]),
  42996. _vm._v(" "),
  42997. _c("p", [
  42998. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  42999. _vm._v(" "),
  43000. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  43001. ]),
  43002. _vm._v(" "),
  43003. _c("p", [
  43004. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43005. _vm._v(" "),
  43006. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  43007. ]),
  43008. _vm._v(" "),
  43009. _c("p", [
  43010. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43011. _vm._v(" "),
  43012. _c("span", { domProps: { textContent: _vm._s(this.data.storeid) } })
  43013. ]),
  43014. _vm._v(" "),
  43015. _c("p", [
  43016. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43017. _vm._v(" "),
  43018. _c(
  43019. "span",
  43020. {
  43021. staticClass: "dashed-underline",
  43022. attrs: {
  43023. "data-toggle": "tooltip",
  43024. "data-placement": "bottom",
  43025. title: this.getHRDate(this.data.dropdate)
  43026. }
  43027. },
  43028. [
  43029. _vm._v(
  43030. "\n " +
  43031. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  43032. " days ago\n "
  43033. )
  43034. ]
  43035. )
  43036. ]),
  43037. _vm._v(" "),
  43038. _c("p", [
  43039. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43040. _vm._v(" "),
  43041. !this.isZero(this.data.pickupdate)
  43042. ? _c(
  43043. "span",
  43044. {
  43045. staticClass: "dashed-underline",
  43046. attrs: {
  43047. "data-toggle": "tooltip",
  43048. "data-placement": "bottom",
  43049. title: this.getHRDate(this.data.pickupdate)
  43050. }
  43051. },
  43052. [
  43053. _vm._v(
  43054. "\n " +
  43055. _vm._s(
  43056. Math.floor(this.daysSinceToday(this.data.pickupdate))
  43057. ) +
  43058. " days ago\n "
  43059. )
  43060. ]
  43061. )
  43062. : _vm._e()
  43063. ]),
  43064. _vm._v(" "),
  43065. _c(
  43066. "button",
  43067. {
  43068. staticClass: "btn btn-primary",
  43069. attrs: {
  43070. type: "button",
  43071. "data-toggle": "modal",
  43072. "data-target": "#workordereditModal"
  43073. }
  43074. },
  43075. [_vm._v("Edit")]
  43076. )
  43077. ],
  43078. 1
  43079. )
  43080. }
  43081. var staticRenderFns = []
  43082. render._withStripped = true
  43083. /***/ }),
  43084. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43085. /*!********************************************************************!*\
  43086. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43087. \********************************************************************/
  43088. /*! exports provided: default */
  43089. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43090. "use strict";
  43091. __webpack_require__.r(__webpack_exports__);
  43092. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43093. /* globals __VUE_SSR_CONTEXT__ */
  43094. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43095. // This module is a runtime utility for cleaner component module output and will
  43096. // be included in the final webpack user bundle.
  43097. function normalizeComponent (
  43098. scriptExports,
  43099. render,
  43100. staticRenderFns,
  43101. functionalTemplate,
  43102. injectStyles,
  43103. scopeId,
  43104. moduleIdentifier, /* server only */
  43105. shadowMode /* vue-cli only */
  43106. ) {
  43107. // Vue.extend constructor export interop
  43108. var options = typeof scriptExports === 'function'
  43109. ? scriptExports.options
  43110. : scriptExports
  43111. // render functions
  43112. if (render) {
  43113. options.render = render
  43114. options.staticRenderFns = staticRenderFns
  43115. options._compiled = true
  43116. }
  43117. // functional template
  43118. if (functionalTemplate) {
  43119. options.functional = true
  43120. }
  43121. // scopedId
  43122. if (scopeId) {
  43123. options._scopeId = 'data-v-' + scopeId
  43124. }
  43125. var hook
  43126. if (moduleIdentifier) { // server build
  43127. hook = function (context) {
  43128. // 2.3 injection
  43129. context =
  43130. context || // cached call
  43131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43133. // 2.2 with runInNewContext: true
  43134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43135. context = __VUE_SSR_CONTEXT__
  43136. }
  43137. // inject component styles
  43138. if (injectStyles) {
  43139. injectStyles.call(this, context)
  43140. }
  43141. // register component module identifier for async chunk inferrence
  43142. if (context && context._registeredComponents) {
  43143. context._registeredComponents.add(moduleIdentifier)
  43144. }
  43145. }
  43146. // used by ssr in case component is cached and beforeCreate
  43147. // never gets called
  43148. options._ssrRegister = hook
  43149. } else if (injectStyles) {
  43150. hook = shadowMode
  43151. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  43152. : injectStyles
  43153. }
  43154. if (hook) {
  43155. if (options.functional) {
  43156. // for template-only hot-reload because in that case the render fn doesn't
  43157. // go through the normalizer
  43158. options._injectStyles = hook
  43159. // register for functioal component in vue file
  43160. var originalRender = options.render
  43161. options.render = function renderWithStyleInjection (h, context) {
  43162. hook.call(context)
  43163. return originalRender(h, context)
  43164. }
  43165. } else {
  43166. // inject component registration as beforeCreate hook
  43167. var existing = options.beforeCreate
  43168. options.beforeCreate = existing
  43169. ? [].concat(existing, hook)
  43170. : [hook]
  43171. }
  43172. }
  43173. return {
  43174. exports: scriptExports,
  43175. options: options
  43176. }
  43177. }
  43178. /***/ }),
  43179. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  43180. /*!*************************************************!*\
  43181. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  43182. \*************************************************/
  43183. /*! no static exports found */
  43184. /***/ (function(module, exports, __webpack_require__) {
  43185. "use strict";
  43186. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  43187. * Vue.js v2.6.11
  43188. * (c) 2014-2019 Evan You
  43189. * Released under the MIT License.
  43190. */
  43191. /* */
  43192. var emptyObject = Object.freeze({});
  43193. // These helpers produce better VM code in JS engines due to their
  43194. // explicitness and function inlining.
  43195. function isUndef (v) {
  43196. return v === undefined || v === null
  43197. }
  43198. function isDef (v) {
  43199. return v !== undefined && v !== null
  43200. }
  43201. function isTrue (v) {
  43202. return v === true
  43203. }
  43204. function isFalse (v) {
  43205. return v === false
  43206. }
  43207. /**
  43208. * Check if value is primitive.
  43209. */
  43210. function isPrimitive (value) {
  43211. return (
  43212. typeof value === 'string' ||
  43213. typeof value === 'number' ||
  43214. // $flow-disable-line
  43215. typeof value === 'symbol' ||
  43216. typeof value === 'boolean'
  43217. )
  43218. }
  43219. /**
  43220. * Quick object check - this is primarily used to tell
  43221. * Objects from primitive values when we know the value
  43222. * is a JSON-compliant type.
  43223. */
  43224. function isObject (obj) {
  43225. return obj !== null && typeof obj === 'object'
  43226. }
  43227. /**
  43228. * Get the raw type string of a value, e.g., [object Object].
  43229. */
  43230. var _toString = Object.prototype.toString;
  43231. function toRawType (value) {
  43232. return _toString.call(value).slice(8, -1)
  43233. }
  43234. /**
  43235. * Strict object type check. Only returns true
  43236. * for plain JavaScript objects.
  43237. */
  43238. function isPlainObject (obj) {
  43239. return _toString.call(obj) === '[object Object]'
  43240. }
  43241. function isRegExp (v) {
  43242. return _toString.call(v) === '[object RegExp]'
  43243. }
  43244. /**
  43245. * Check if val is a valid array index.
  43246. */
  43247. function isValidArrayIndex (val) {
  43248. var n = parseFloat(String(val));
  43249. return n >= 0 && Math.floor(n) === n && isFinite(val)
  43250. }
  43251. function isPromise (val) {
  43252. return (
  43253. isDef(val) &&
  43254. typeof val.then === 'function' &&
  43255. typeof val.catch === 'function'
  43256. )
  43257. }
  43258. /**
  43259. * Convert a value to a string that is actually rendered.
  43260. */
  43261. function toString (val) {
  43262. return val == null
  43263. ? ''
  43264. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  43265. ? JSON.stringify(val, null, 2)
  43266. : String(val)
  43267. }
  43268. /**
  43269. * Convert an input value to a number for persistence.
  43270. * If the conversion fails, return original string.
  43271. */
  43272. function toNumber (val) {
  43273. var n = parseFloat(val);
  43274. return isNaN(n) ? val : n
  43275. }
  43276. /**
  43277. * Make a map and return a function for checking if a key
  43278. * is in that map.
  43279. */
  43280. function makeMap (
  43281. str,
  43282. expectsLowerCase
  43283. ) {
  43284. var map = Object.create(null);
  43285. var list = str.split(',');
  43286. for (var i = 0; i < list.length; i++) {
  43287. map[list[i]] = true;
  43288. }
  43289. return expectsLowerCase
  43290. ? function (val) { return map[val.toLowerCase()]; }
  43291. : function (val) { return map[val]; }
  43292. }
  43293. /**
  43294. * Check if a tag is a built-in tag.
  43295. */
  43296. var isBuiltInTag = makeMap('slot,component', true);
  43297. /**
  43298. * Check if an attribute is a reserved attribute.
  43299. */
  43300. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  43301. /**
  43302. * Remove an item from an array.
  43303. */
  43304. function remove (arr, item) {
  43305. if (arr.length) {
  43306. var index = arr.indexOf(item);
  43307. if (index > -1) {
  43308. return arr.splice(index, 1)
  43309. }
  43310. }
  43311. }
  43312. /**
  43313. * Check whether an object has the property.
  43314. */
  43315. var hasOwnProperty = Object.prototype.hasOwnProperty;
  43316. function hasOwn (obj, key) {
  43317. return hasOwnProperty.call(obj, key)
  43318. }
  43319. /**
  43320. * Create a cached version of a pure function.
  43321. */
  43322. function cached (fn) {
  43323. var cache = Object.create(null);
  43324. return (function cachedFn (str) {
  43325. var hit = cache[str];
  43326. return hit || (cache[str] = fn(str))
  43327. })
  43328. }
  43329. /**
  43330. * Camelize a hyphen-delimited string.
  43331. */
  43332. var camelizeRE = /-(\w)/g;
  43333. var camelize = cached(function (str) {
  43334. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  43335. });
  43336. /**
  43337. * Capitalize a string.
  43338. */
  43339. var capitalize = cached(function (str) {
  43340. return str.charAt(0).toUpperCase() + str.slice(1)
  43341. });
  43342. /**
  43343. * Hyphenate a camelCase string.
  43344. */
  43345. var hyphenateRE = /\B([A-Z])/g;
  43346. var hyphenate = cached(function (str) {
  43347. return str.replace(hyphenateRE, '-$1').toLowerCase()
  43348. });
  43349. /**
  43350. * Simple bind polyfill for environments that do not support it,
  43351. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  43352. * since native bind is now performant enough in most browsers.
  43353. * But removing it would mean breaking code that was able to run in
  43354. * PhantomJS 1.x, so this must be kept for backward compatibility.
  43355. */
  43356. /* istanbul ignore next */
  43357. function polyfillBind (fn, ctx) {
  43358. function boundFn (a) {
  43359. var l = arguments.length;
  43360. return l
  43361. ? l > 1
  43362. ? fn.apply(ctx, arguments)
  43363. : fn.call(ctx, a)
  43364. : fn.call(ctx)
  43365. }
  43366. boundFn._length = fn.length;
  43367. return boundFn
  43368. }
  43369. function nativeBind (fn, ctx) {
  43370. return fn.bind(ctx)
  43371. }
  43372. var bind = Function.prototype.bind
  43373. ? nativeBind
  43374. : polyfillBind;
  43375. /**
  43376. * Convert an Array-like object to a real Array.
  43377. */
  43378. function toArray (list, start) {
  43379. start = start || 0;
  43380. var i = list.length - start;
  43381. var ret = new Array(i);
  43382. while (i--) {
  43383. ret[i] = list[i + start];
  43384. }
  43385. return ret
  43386. }
  43387. /**
  43388. * Mix properties into target object.
  43389. */
  43390. function extend (to, _from) {
  43391. for (var key in _from) {
  43392. to[key] = _from[key];
  43393. }
  43394. return to
  43395. }
  43396. /**
  43397. * Merge an Array of Objects into a single Object.
  43398. */
  43399. function toObject (arr) {
  43400. var res = {};
  43401. for (var i = 0; i < arr.length; i++) {
  43402. if (arr[i]) {
  43403. extend(res, arr[i]);
  43404. }
  43405. }
  43406. return res
  43407. }
  43408. /* eslint-disable no-unused-vars */
  43409. /**
  43410. * Perform no operation.
  43411. * Stubbing args to make Flow happy without leaving useless transpiled code
  43412. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  43413. */
  43414. function noop (a, b, c) {}
  43415. /**
  43416. * Always return false.
  43417. */
  43418. var no = function (a, b, c) { return false; };
  43419. /* eslint-enable no-unused-vars */
  43420. /**
  43421. * Return the same value.
  43422. */
  43423. var identity = function (_) { return _; };
  43424. /**
  43425. * Generate a string containing static keys from compiler modules.
  43426. */
  43427. function genStaticKeys (modules) {
  43428. return modules.reduce(function (keys, m) {
  43429. return keys.concat(m.staticKeys || [])
  43430. }, []).join(',')
  43431. }
  43432. /**
  43433. * Check if two values are loosely equal - that is,
  43434. * if they are plain objects, do they have the same shape?
  43435. */
  43436. function looseEqual (a, b) {
  43437. if (a === b) { return true }
  43438. var isObjectA = isObject(a);
  43439. var isObjectB = isObject(b);
  43440. if (isObjectA && isObjectB) {
  43441. try {
  43442. var isArrayA = Array.isArray(a);
  43443. var isArrayB = Array.isArray(b);
  43444. if (isArrayA && isArrayB) {
  43445. return a.length === b.length && a.every(function (e, i) {
  43446. return looseEqual(e, b[i])
  43447. })
  43448. } else if (a instanceof Date && b instanceof Date) {
  43449. return a.getTime() === b.getTime()
  43450. } else if (!isArrayA && !isArrayB) {
  43451. var keysA = Object.keys(a);
  43452. var keysB = Object.keys(b);
  43453. return keysA.length === keysB.length && keysA.every(function (key) {
  43454. return looseEqual(a[key], b[key])
  43455. })
  43456. } else {
  43457. /* istanbul ignore next */
  43458. return false
  43459. }
  43460. } catch (e) {
  43461. /* istanbul ignore next */
  43462. return false
  43463. }
  43464. } else if (!isObjectA && !isObjectB) {
  43465. return String(a) === String(b)
  43466. } else {
  43467. return false
  43468. }
  43469. }
  43470. /**
  43471. * Return the first index at which a loosely equal value can be
  43472. * found in the array (if value is a plain object, the array must
  43473. * contain an object of the same shape), or -1 if it is not present.
  43474. */
  43475. function looseIndexOf (arr, val) {
  43476. for (var i = 0; i < arr.length; i++) {
  43477. if (looseEqual(arr[i], val)) { return i }
  43478. }
  43479. return -1
  43480. }
  43481. /**
  43482. * Ensure a function is called only once.
  43483. */
  43484. function once (fn) {
  43485. var called = false;
  43486. return function () {
  43487. if (!called) {
  43488. called = true;
  43489. fn.apply(this, arguments);
  43490. }
  43491. }
  43492. }
  43493. var SSR_ATTR = 'data-server-rendered';
  43494. var ASSET_TYPES = [
  43495. 'component',
  43496. 'directive',
  43497. 'filter'
  43498. ];
  43499. var LIFECYCLE_HOOKS = [
  43500. 'beforeCreate',
  43501. 'created',
  43502. 'beforeMount',
  43503. 'mounted',
  43504. 'beforeUpdate',
  43505. 'updated',
  43506. 'beforeDestroy',
  43507. 'destroyed',
  43508. 'activated',
  43509. 'deactivated',
  43510. 'errorCaptured',
  43511. 'serverPrefetch'
  43512. ];
  43513. /* */
  43514. var config = ({
  43515. /**
  43516. * Option merge strategies (used in core/util/options)
  43517. */
  43518. // $flow-disable-line
  43519. optionMergeStrategies: Object.create(null),
  43520. /**
  43521. * Whether to suppress warnings.
  43522. */
  43523. silent: false,
  43524. /**
  43525. * Show production mode tip message on boot?
  43526. */
  43527. productionTip: "development" !== 'production',
  43528. /**
  43529. * Whether to enable devtools
  43530. */
  43531. devtools: "development" !== 'production',
  43532. /**
  43533. * Whether to record perf
  43534. */
  43535. performance: false,
  43536. /**
  43537. * Error handler for watcher errors
  43538. */
  43539. errorHandler: null,
  43540. /**
  43541. * Warn handler for watcher warns
  43542. */
  43543. warnHandler: null,
  43544. /**
  43545. * Ignore certain custom elements
  43546. */
  43547. ignoredElements: [],
  43548. /**
  43549. * Custom user key aliases for v-on
  43550. */
  43551. // $flow-disable-line
  43552. keyCodes: Object.create(null),
  43553. /**
  43554. * Check if a tag is reserved so that it cannot be registered as a
  43555. * component. This is platform-dependent and may be overwritten.
  43556. */
  43557. isReservedTag: no,
  43558. /**
  43559. * Check if an attribute is reserved so that it cannot be used as a component
  43560. * prop. This is platform-dependent and may be overwritten.
  43561. */
  43562. isReservedAttr: no,
  43563. /**
  43564. * Check if a tag is an unknown element.
  43565. * Platform-dependent.
  43566. */
  43567. isUnknownElement: no,
  43568. /**
  43569. * Get the namespace of an element
  43570. */
  43571. getTagNamespace: noop,
  43572. /**
  43573. * Parse the real tag name for the specific platform.
  43574. */
  43575. parsePlatformTagName: identity,
  43576. /**
  43577. * Check if an attribute must be bound using property, e.g. value
  43578. * Platform-dependent.
  43579. */
  43580. mustUseProp: no,
  43581. /**
  43582. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  43583. * This will significantly reduce performance if set to false.
  43584. */
  43585. async: true,
  43586. /**
  43587. * Exposed for legacy reasons
  43588. */
  43589. _lifecycleHooks: LIFECYCLE_HOOKS
  43590. });
  43591. /* */
  43592. /**
  43593. * unicode letters used for parsing html tags, component names and property paths.
  43594. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  43595. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  43596. */
  43597. 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/;
  43598. /**
  43599. * Check if a string starts with $ or _
  43600. */
  43601. function isReserved (str) {
  43602. var c = (str + '').charCodeAt(0);
  43603. return c === 0x24 || c === 0x5F
  43604. }
  43605. /**
  43606. * Define a property.
  43607. */
  43608. function def (obj, key, val, enumerable) {
  43609. Object.defineProperty(obj, key, {
  43610. value: val,
  43611. enumerable: !!enumerable,
  43612. writable: true,
  43613. configurable: true
  43614. });
  43615. }
  43616. /**
  43617. * Parse simple path.
  43618. */
  43619. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  43620. function parsePath (path) {
  43621. if (bailRE.test(path)) {
  43622. return
  43623. }
  43624. var segments = path.split('.');
  43625. return function (obj) {
  43626. for (var i = 0; i < segments.length; i++) {
  43627. if (!obj) { return }
  43628. obj = obj[segments[i]];
  43629. }
  43630. return obj
  43631. }
  43632. }
  43633. /* */
  43634. // can we use __proto__?
  43635. var hasProto = '__proto__' in {};
  43636. // Browser environment sniffing
  43637. var inBrowser = typeof window !== 'undefined';
  43638. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  43639. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  43640. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  43641. var isIE = UA && /msie|trident/.test(UA);
  43642. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  43643. var isEdge = UA && UA.indexOf('edge/') > 0;
  43644. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  43645. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  43646. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  43647. var isPhantomJS = UA && /phantomjs/.test(UA);
  43648. var isFF = UA && UA.match(/firefox\/(\d+)/);
  43649. // Firefox has a "watch" function on Object.prototype...
  43650. var nativeWatch = ({}).watch;
  43651. var supportsPassive = false;
  43652. if (inBrowser) {
  43653. try {
  43654. var opts = {};
  43655. Object.defineProperty(opts, 'passive', ({
  43656. get: function get () {
  43657. /* istanbul ignore next */
  43658. supportsPassive = true;
  43659. }
  43660. })); // https://github.com/facebook/flow/issues/285
  43661. window.addEventListener('test-passive', null, opts);
  43662. } catch (e) {}
  43663. }
  43664. // this needs to be lazy-evaled because vue may be required before
  43665. // vue-server-renderer can set VUE_ENV
  43666. var _isServer;
  43667. var isServerRendering = function () {
  43668. if (_isServer === undefined) {
  43669. /* istanbul ignore if */
  43670. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  43671. // detect presence of vue-server-renderer and avoid
  43672. // Webpack shimming the process
  43673. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  43674. } else {
  43675. _isServer = false;
  43676. }
  43677. }
  43678. return _isServer
  43679. };
  43680. // detect devtools
  43681. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  43682. /* istanbul ignore next */
  43683. function isNative (Ctor) {
  43684. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  43685. }
  43686. var hasSymbol =
  43687. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  43688. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  43689. var _Set;
  43690. /* istanbul ignore if */ // $flow-disable-line
  43691. if (typeof Set !== 'undefined' && isNative(Set)) {
  43692. // use native Set when available.
  43693. _Set = Set;
  43694. } else {
  43695. // a non-standard Set polyfill that only works with primitive keys.
  43696. _Set = /*@__PURE__*/(function () {
  43697. function Set () {
  43698. this.set = Object.create(null);
  43699. }
  43700. Set.prototype.has = function has (key) {
  43701. return this.set[key] === true
  43702. };
  43703. Set.prototype.add = function add (key) {
  43704. this.set[key] = true;
  43705. };
  43706. Set.prototype.clear = function clear () {
  43707. this.set = Object.create(null);
  43708. };
  43709. return Set;
  43710. }());
  43711. }
  43712. /* */
  43713. var warn = noop;
  43714. var tip = noop;
  43715. var generateComponentTrace = (noop); // work around flow check
  43716. var formatComponentName = (noop);
  43717. {
  43718. var hasConsole = typeof console !== 'undefined';
  43719. var classifyRE = /(?:^|[-_])(\w)/g;
  43720. var classify = function (str) { return str
  43721. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  43722. .replace(/[-_]/g, ''); };
  43723. warn = function (msg, vm) {
  43724. var trace = vm ? generateComponentTrace(vm) : '';
  43725. if (config.warnHandler) {
  43726. config.warnHandler.call(null, msg, vm, trace);
  43727. } else if (hasConsole && (!config.silent)) {
  43728. console.error(("[Vue warn]: " + msg + trace));
  43729. }
  43730. };
  43731. tip = function (msg, vm) {
  43732. if (hasConsole && (!config.silent)) {
  43733. console.warn("[Vue tip]: " + msg + (
  43734. vm ? generateComponentTrace(vm) : ''
  43735. ));
  43736. }
  43737. };
  43738. formatComponentName = function (vm, includeFile) {
  43739. if (vm.$root === vm) {
  43740. return '<Root>'
  43741. }
  43742. var options = typeof vm === 'function' && vm.cid != null
  43743. ? vm.options
  43744. : vm._isVue
  43745. ? vm.$options || vm.constructor.options
  43746. : vm;
  43747. var name = options.name || options._componentTag;
  43748. var file = options.__file;
  43749. if (!name && file) {
  43750. var match = file.match(/([^/\\]+)\.vue$/);
  43751. name = match && match[1];
  43752. }
  43753. return (
  43754. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  43755. (file && includeFile !== false ? (" at " + file) : '')
  43756. )
  43757. };
  43758. var repeat = function (str, n) {
  43759. var res = '';
  43760. while (n) {
  43761. if (n % 2 === 1) { res += str; }
  43762. if (n > 1) { str += str; }
  43763. n >>= 1;
  43764. }
  43765. return res
  43766. };
  43767. generateComponentTrace = function (vm) {
  43768. if (vm._isVue && vm.$parent) {
  43769. var tree = [];
  43770. var currentRecursiveSequence = 0;
  43771. while (vm) {
  43772. if (tree.length > 0) {
  43773. var last = tree[tree.length - 1];
  43774. if (last.constructor === vm.constructor) {
  43775. currentRecursiveSequence++;
  43776. vm = vm.$parent;
  43777. continue
  43778. } else if (currentRecursiveSequence > 0) {
  43779. tree[tree.length - 1] = [last, currentRecursiveSequence];
  43780. currentRecursiveSequence = 0;
  43781. }
  43782. }
  43783. tree.push(vm);
  43784. vm = vm.$parent;
  43785. }
  43786. return '\n\nfound in\n\n' + tree
  43787. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  43788. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  43789. : formatComponentName(vm))); })
  43790. .join('\n')
  43791. } else {
  43792. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  43793. }
  43794. };
  43795. }
  43796. /* */
  43797. var uid = 0;
  43798. /**
  43799. * A dep is an observable that can have multiple
  43800. * directives subscribing to it.
  43801. */
  43802. var Dep = function Dep () {
  43803. this.id = uid++;
  43804. this.subs = [];
  43805. };
  43806. Dep.prototype.addSub = function addSub (sub) {
  43807. this.subs.push(sub);
  43808. };
  43809. Dep.prototype.removeSub = function removeSub (sub) {
  43810. remove(this.subs, sub);
  43811. };
  43812. Dep.prototype.depend = function depend () {
  43813. if (Dep.target) {
  43814. Dep.target.addDep(this);
  43815. }
  43816. };
  43817. Dep.prototype.notify = function notify () {
  43818. // stabilize the subscriber list first
  43819. var subs = this.subs.slice();
  43820. if (!config.async) {
  43821. // subs aren't sorted in scheduler if not running async
  43822. // we need to sort them now to make sure they fire in correct
  43823. // order
  43824. subs.sort(function (a, b) { return a.id - b.id; });
  43825. }
  43826. for (var i = 0, l = subs.length; i < l; i++) {
  43827. subs[i].update();
  43828. }
  43829. };
  43830. // The current target watcher being evaluated.
  43831. // This is globally unique because only one watcher
  43832. // can be evaluated at a time.
  43833. Dep.target = null;
  43834. var targetStack = [];
  43835. function pushTarget (target) {
  43836. targetStack.push(target);
  43837. Dep.target = target;
  43838. }
  43839. function popTarget () {
  43840. targetStack.pop();
  43841. Dep.target = targetStack[targetStack.length - 1];
  43842. }
  43843. /* */
  43844. var VNode = function VNode (
  43845. tag,
  43846. data,
  43847. children,
  43848. text,
  43849. elm,
  43850. context,
  43851. componentOptions,
  43852. asyncFactory
  43853. ) {
  43854. this.tag = tag;
  43855. this.data = data;
  43856. this.children = children;
  43857. this.text = text;
  43858. this.elm = elm;
  43859. this.ns = undefined;
  43860. this.context = context;
  43861. this.fnContext = undefined;
  43862. this.fnOptions = undefined;
  43863. this.fnScopeId = undefined;
  43864. this.key = data && data.key;
  43865. this.componentOptions = componentOptions;
  43866. this.componentInstance = undefined;
  43867. this.parent = undefined;
  43868. this.raw = false;
  43869. this.isStatic = false;
  43870. this.isRootInsert = true;
  43871. this.isComment = false;
  43872. this.isCloned = false;
  43873. this.isOnce = false;
  43874. this.asyncFactory = asyncFactory;
  43875. this.asyncMeta = undefined;
  43876. this.isAsyncPlaceholder = false;
  43877. };
  43878. var prototypeAccessors = { child: { configurable: true } };
  43879. // DEPRECATED: alias for componentInstance for backwards compat.
  43880. /* istanbul ignore next */
  43881. prototypeAccessors.child.get = function () {
  43882. return this.componentInstance
  43883. };
  43884. Object.defineProperties( VNode.prototype, prototypeAccessors );
  43885. var createEmptyVNode = function (text) {
  43886. if ( text === void 0 ) text = '';
  43887. var node = new VNode();
  43888. node.text = text;
  43889. node.isComment = true;
  43890. return node
  43891. };
  43892. function createTextVNode (val) {
  43893. return new VNode(undefined, undefined, undefined, String(val))
  43894. }
  43895. // optimized shallow clone
  43896. // used for static nodes and slot nodes because they may be reused across
  43897. // multiple renders, cloning them avoids errors when DOM manipulations rely
  43898. // on their elm reference.
  43899. function cloneVNode (vnode) {
  43900. var cloned = new VNode(
  43901. vnode.tag,
  43902. vnode.data,
  43903. // #7975
  43904. // clone children array to avoid mutating original in case of cloning
  43905. // a child.
  43906. vnode.children && vnode.children.slice(),
  43907. vnode.text,
  43908. vnode.elm,
  43909. vnode.context,
  43910. vnode.componentOptions,
  43911. vnode.asyncFactory
  43912. );
  43913. cloned.ns = vnode.ns;
  43914. cloned.isStatic = vnode.isStatic;
  43915. cloned.key = vnode.key;
  43916. cloned.isComment = vnode.isComment;
  43917. cloned.fnContext = vnode.fnContext;
  43918. cloned.fnOptions = vnode.fnOptions;
  43919. cloned.fnScopeId = vnode.fnScopeId;
  43920. cloned.asyncMeta = vnode.asyncMeta;
  43921. cloned.isCloned = true;
  43922. return cloned
  43923. }
  43924. /*
  43925. * not type checking this file because flow doesn't play well with
  43926. * dynamically accessing methods on Array prototype
  43927. */
  43928. var arrayProto = Array.prototype;
  43929. var arrayMethods = Object.create(arrayProto);
  43930. var methodsToPatch = [
  43931. 'push',
  43932. 'pop',
  43933. 'shift',
  43934. 'unshift',
  43935. 'splice',
  43936. 'sort',
  43937. 'reverse'
  43938. ];
  43939. /**
  43940. * Intercept mutating methods and emit events
  43941. */
  43942. methodsToPatch.forEach(function (method) {
  43943. // cache original method
  43944. var original = arrayProto[method];
  43945. def(arrayMethods, method, function mutator () {
  43946. var args = [], len = arguments.length;
  43947. while ( len-- ) args[ len ] = arguments[ len ];
  43948. var result = original.apply(this, args);
  43949. var ob = this.__ob__;
  43950. var inserted;
  43951. switch (method) {
  43952. case 'push':
  43953. case 'unshift':
  43954. inserted = args;
  43955. break
  43956. case 'splice':
  43957. inserted = args.slice(2);
  43958. break
  43959. }
  43960. if (inserted) { ob.observeArray(inserted); }
  43961. // notify change
  43962. ob.dep.notify();
  43963. return result
  43964. });
  43965. });
  43966. /* */
  43967. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  43968. /**
  43969. * In some cases we may want to disable observation inside a component's
  43970. * update computation.
  43971. */
  43972. var shouldObserve = true;
  43973. function toggleObserving (value) {
  43974. shouldObserve = value;
  43975. }
  43976. /**
  43977. * Observer class that is attached to each observed
  43978. * object. Once attached, the observer converts the target
  43979. * object's property keys into getter/setters that
  43980. * collect dependencies and dispatch updates.
  43981. */
  43982. var Observer = function Observer (value) {
  43983. this.value = value;
  43984. this.dep = new Dep();
  43985. this.vmCount = 0;
  43986. def(value, '__ob__', this);
  43987. if (Array.isArray(value)) {
  43988. if (hasProto) {
  43989. protoAugment(value, arrayMethods);
  43990. } else {
  43991. copyAugment(value, arrayMethods, arrayKeys);
  43992. }
  43993. this.observeArray(value);
  43994. } else {
  43995. this.walk(value);
  43996. }
  43997. };
  43998. /**
  43999. * Walk through all properties and convert them into
  44000. * getter/setters. This method should only be called when
  44001. * value type is Object.
  44002. */
  44003. Observer.prototype.walk = function walk (obj) {
  44004. var keys = Object.keys(obj);
  44005. for (var i = 0; i < keys.length; i++) {
  44006. defineReactive$$1(obj, keys[i]);
  44007. }
  44008. };
  44009. /**
  44010. * Observe a list of Array items.
  44011. */
  44012. Observer.prototype.observeArray = function observeArray (items) {
  44013. for (var i = 0, l = items.length; i < l; i++) {
  44014. observe(items[i]);
  44015. }
  44016. };
  44017. // helpers
  44018. /**
  44019. * Augment a target Object or Array by intercepting
  44020. * the prototype chain using __proto__
  44021. */
  44022. function protoAugment (target, src) {
  44023. /* eslint-disable no-proto */
  44024. target.__proto__ = src;
  44025. /* eslint-enable no-proto */
  44026. }
  44027. /**
  44028. * Augment a target Object or Array by defining
  44029. * hidden properties.
  44030. */
  44031. /* istanbul ignore next */
  44032. function copyAugment (target, src, keys) {
  44033. for (var i = 0, l = keys.length; i < l; i++) {
  44034. var key = keys[i];
  44035. def(target, key, src[key]);
  44036. }
  44037. }
  44038. /**
  44039. * Attempt to create an observer instance for a value,
  44040. * returns the new observer if successfully observed,
  44041. * or the existing observer if the value already has one.
  44042. */
  44043. function observe (value, asRootData) {
  44044. if (!isObject(value) || value instanceof VNode) {
  44045. return
  44046. }
  44047. var ob;
  44048. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  44049. ob = value.__ob__;
  44050. } else if (
  44051. shouldObserve &&
  44052. !isServerRendering() &&
  44053. (Array.isArray(value) || isPlainObject(value)) &&
  44054. Object.isExtensible(value) &&
  44055. !value._isVue
  44056. ) {
  44057. ob = new Observer(value);
  44058. }
  44059. if (asRootData && ob) {
  44060. ob.vmCount++;
  44061. }
  44062. return ob
  44063. }
  44064. /**
  44065. * Define a reactive property on an Object.
  44066. */
  44067. function defineReactive$$1 (
  44068. obj,
  44069. key,
  44070. val,
  44071. customSetter,
  44072. shallow
  44073. ) {
  44074. var dep = new Dep();
  44075. var property = Object.getOwnPropertyDescriptor(obj, key);
  44076. if (property && property.configurable === false) {
  44077. return
  44078. }
  44079. // cater for pre-defined getter/setters
  44080. var getter = property && property.get;
  44081. var setter = property && property.set;
  44082. if ((!getter || setter) && arguments.length === 2) {
  44083. val = obj[key];
  44084. }
  44085. var childOb = !shallow && observe(val);
  44086. Object.defineProperty(obj, key, {
  44087. enumerable: true,
  44088. configurable: true,
  44089. get: function reactiveGetter () {
  44090. var value = getter ? getter.call(obj) : val;
  44091. if (Dep.target) {
  44092. dep.depend();
  44093. if (childOb) {
  44094. childOb.dep.depend();
  44095. if (Array.isArray(value)) {
  44096. dependArray(value);
  44097. }
  44098. }
  44099. }
  44100. return value
  44101. },
  44102. set: function reactiveSetter (newVal) {
  44103. var value = getter ? getter.call(obj) : val;
  44104. /* eslint-disable no-self-compare */
  44105. if (newVal === value || (newVal !== newVal && value !== value)) {
  44106. return
  44107. }
  44108. /* eslint-enable no-self-compare */
  44109. if (customSetter) {
  44110. customSetter();
  44111. }
  44112. // #7981: for accessor properties without setter
  44113. if (getter && !setter) { return }
  44114. if (setter) {
  44115. setter.call(obj, newVal);
  44116. } else {
  44117. val = newVal;
  44118. }
  44119. childOb = !shallow && observe(newVal);
  44120. dep.notify();
  44121. }
  44122. });
  44123. }
  44124. /**
  44125. * Set a property on an object. Adds the new property and
  44126. * triggers change notification if the property doesn't
  44127. * already exist.
  44128. */
  44129. function set (target, key, val) {
  44130. if (isUndef(target) || isPrimitive(target)
  44131. ) {
  44132. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  44133. }
  44134. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44135. target.length = Math.max(target.length, key);
  44136. target.splice(key, 1, val);
  44137. return val
  44138. }
  44139. if (key in target && !(key in Object.prototype)) {
  44140. target[key] = val;
  44141. return val
  44142. }
  44143. var ob = (target).__ob__;
  44144. if (target._isVue || (ob && ob.vmCount)) {
  44145. warn(
  44146. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  44147. 'at runtime - declare it upfront in the data option.'
  44148. );
  44149. return val
  44150. }
  44151. if (!ob) {
  44152. target[key] = val;
  44153. return val
  44154. }
  44155. defineReactive$$1(ob.value, key, val);
  44156. ob.dep.notify();
  44157. return val
  44158. }
  44159. /**
  44160. * Delete a property and trigger change if necessary.
  44161. */
  44162. function del (target, key) {
  44163. if (isUndef(target) || isPrimitive(target)
  44164. ) {
  44165. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  44166. }
  44167. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44168. target.splice(key, 1);
  44169. return
  44170. }
  44171. var ob = (target).__ob__;
  44172. if (target._isVue || (ob && ob.vmCount)) {
  44173. warn(
  44174. 'Avoid deleting properties on a Vue instance or its root $data ' +
  44175. '- just set it to null.'
  44176. );
  44177. return
  44178. }
  44179. if (!hasOwn(target, key)) {
  44180. return
  44181. }
  44182. delete target[key];
  44183. if (!ob) {
  44184. return
  44185. }
  44186. ob.dep.notify();
  44187. }
  44188. /**
  44189. * Collect dependencies on array elements when the array is touched, since
  44190. * we cannot intercept array element access like property getters.
  44191. */
  44192. function dependArray (value) {
  44193. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  44194. e = value[i];
  44195. e && e.__ob__ && e.__ob__.dep.depend();
  44196. if (Array.isArray(e)) {
  44197. dependArray(e);
  44198. }
  44199. }
  44200. }
  44201. /* */
  44202. /**
  44203. * Option overwriting strategies are functions that handle
  44204. * how to merge a parent option value and a child option
  44205. * value into the final value.
  44206. */
  44207. var strats = config.optionMergeStrategies;
  44208. /**
  44209. * Options with restrictions
  44210. */
  44211. {
  44212. strats.el = strats.propsData = function (parent, child, vm, key) {
  44213. if (!vm) {
  44214. warn(
  44215. "option \"" + key + "\" can only be used during instance " +
  44216. 'creation with the `new` keyword.'
  44217. );
  44218. }
  44219. return defaultStrat(parent, child)
  44220. };
  44221. }
  44222. /**
  44223. * Helper that recursively merges two data objects together.
  44224. */
  44225. function mergeData (to, from) {
  44226. if (!from) { return to }
  44227. var key, toVal, fromVal;
  44228. var keys = hasSymbol
  44229. ? Reflect.ownKeys(from)
  44230. : Object.keys(from);
  44231. for (var i = 0; i < keys.length; i++) {
  44232. key = keys[i];
  44233. // in case the object is already observed...
  44234. if (key === '__ob__') { continue }
  44235. toVal = to[key];
  44236. fromVal = from[key];
  44237. if (!hasOwn(to, key)) {
  44238. set(to, key, fromVal);
  44239. } else if (
  44240. toVal !== fromVal &&
  44241. isPlainObject(toVal) &&
  44242. isPlainObject(fromVal)
  44243. ) {
  44244. mergeData(toVal, fromVal);
  44245. }
  44246. }
  44247. return to
  44248. }
  44249. /**
  44250. * Data
  44251. */
  44252. function mergeDataOrFn (
  44253. parentVal,
  44254. childVal,
  44255. vm
  44256. ) {
  44257. if (!vm) {
  44258. // in a Vue.extend merge, both should be functions
  44259. if (!childVal) {
  44260. return parentVal
  44261. }
  44262. if (!parentVal) {
  44263. return childVal
  44264. }
  44265. // when parentVal & childVal are both present,
  44266. // we need to return a function that returns the
  44267. // merged result of both functions... no need to
  44268. // check if parentVal is a function here because
  44269. // it has to be a function to pass previous merges.
  44270. return function mergedDataFn () {
  44271. return mergeData(
  44272. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  44273. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  44274. )
  44275. }
  44276. } else {
  44277. return function mergedInstanceDataFn () {
  44278. // instance merge
  44279. var instanceData = typeof childVal === 'function'
  44280. ? childVal.call(vm, vm)
  44281. : childVal;
  44282. var defaultData = typeof parentVal === 'function'
  44283. ? parentVal.call(vm, vm)
  44284. : parentVal;
  44285. if (instanceData) {
  44286. return mergeData(instanceData, defaultData)
  44287. } else {
  44288. return defaultData
  44289. }
  44290. }
  44291. }
  44292. }
  44293. strats.data = function (
  44294. parentVal,
  44295. childVal,
  44296. vm
  44297. ) {
  44298. if (!vm) {
  44299. if (childVal && typeof childVal !== 'function') {
  44300. warn(
  44301. 'The "data" option should be a function ' +
  44302. 'that returns a per-instance value in component ' +
  44303. 'definitions.',
  44304. vm
  44305. );
  44306. return parentVal
  44307. }
  44308. return mergeDataOrFn(parentVal, childVal)
  44309. }
  44310. return mergeDataOrFn(parentVal, childVal, vm)
  44311. };
  44312. /**
  44313. * Hooks and props are merged as arrays.
  44314. */
  44315. function mergeHook (
  44316. parentVal,
  44317. childVal
  44318. ) {
  44319. var res = childVal
  44320. ? parentVal
  44321. ? parentVal.concat(childVal)
  44322. : Array.isArray(childVal)
  44323. ? childVal
  44324. : [childVal]
  44325. : parentVal;
  44326. return res
  44327. ? dedupeHooks(res)
  44328. : res
  44329. }
  44330. function dedupeHooks (hooks) {
  44331. var res = [];
  44332. for (var i = 0; i < hooks.length; i++) {
  44333. if (res.indexOf(hooks[i]) === -1) {
  44334. res.push(hooks[i]);
  44335. }
  44336. }
  44337. return res
  44338. }
  44339. LIFECYCLE_HOOKS.forEach(function (hook) {
  44340. strats[hook] = mergeHook;
  44341. });
  44342. /**
  44343. * Assets
  44344. *
  44345. * When a vm is present (instance creation), we need to do
  44346. * a three-way merge between constructor options, instance
  44347. * options and parent options.
  44348. */
  44349. function mergeAssets (
  44350. parentVal,
  44351. childVal,
  44352. vm,
  44353. key
  44354. ) {
  44355. var res = Object.create(parentVal || null);
  44356. if (childVal) {
  44357. assertObjectType(key, childVal, vm);
  44358. return extend(res, childVal)
  44359. } else {
  44360. return res
  44361. }
  44362. }
  44363. ASSET_TYPES.forEach(function (type) {
  44364. strats[type + 's'] = mergeAssets;
  44365. });
  44366. /**
  44367. * Watchers.
  44368. *
  44369. * Watchers hashes should not overwrite one
  44370. * another, so we merge them as arrays.
  44371. */
  44372. strats.watch = function (
  44373. parentVal,
  44374. childVal,
  44375. vm,
  44376. key
  44377. ) {
  44378. // work around Firefox's Object.prototype.watch...
  44379. if (parentVal === nativeWatch) { parentVal = undefined; }
  44380. if (childVal === nativeWatch) { childVal = undefined; }
  44381. /* istanbul ignore if */
  44382. if (!childVal) { return Object.create(parentVal || null) }
  44383. {
  44384. assertObjectType(key, childVal, vm);
  44385. }
  44386. if (!parentVal) { return childVal }
  44387. var ret = {};
  44388. extend(ret, parentVal);
  44389. for (var key$1 in childVal) {
  44390. var parent = ret[key$1];
  44391. var child = childVal[key$1];
  44392. if (parent && !Array.isArray(parent)) {
  44393. parent = [parent];
  44394. }
  44395. ret[key$1] = parent
  44396. ? parent.concat(child)
  44397. : Array.isArray(child) ? child : [child];
  44398. }
  44399. return ret
  44400. };
  44401. /**
  44402. * Other object hashes.
  44403. */
  44404. strats.props =
  44405. strats.methods =
  44406. strats.inject =
  44407. strats.computed = function (
  44408. parentVal,
  44409. childVal,
  44410. vm,
  44411. key
  44412. ) {
  44413. if (childVal && "development" !== 'production') {
  44414. assertObjectType(key, childVal, vm);
  44415. }
  44416. if (!parentVal) { return childVal }
  44417. var ret = Object.create(null);
  44418. extend(ret, parentVal);
  44419. if (childVal) { extend(ret, childVal); }
  44420. return ret
  44421. };
  44422. strats.provide = mergeDataOrFn;
  44423. /**
  44424. * Default strategy.
  44425. */
  44426. var defaultStrat = function (parentVal, childVal) {
  44427. return childVal === undefined
  44428. ? parentVal
  44429. : childVal
  44430. };
  44431. /**
  44432. * Validate component names
  44433. */
  44434. function checkComponents (options) {
  44435. for (var key in options.components) {
  44436. validateComponentName(key);
  44437. }
  44438. }
  44439. function validateComponentName (name) {
  44440. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  44441. warn(
  44442. 'Invalid component name: "' + name + '". Component names ' +
  44443. 'should conform to valid custom element name in html5 specification.'
  44444. );
  44445. }
  44446. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  44447. warn(
  44448. 'Do not use built-in or reserved HTML elements as component ' +
  44449. 'id: ' + name
  44450. );
  44451. }
  44452. }
  44453. /**
  44454. * Ensure all props option syntax are normalized into the
  44455. * Object-based format.
  44456. */
  44457. function normalizeProps (options, vm) {
  44458. var props = options.props;
  44459. if (!props) { return }
  44460. var res = {};
  44461. var i, val, name;
  44462. if (Array.isArray(props)) {
  44463. i = props.length;
  44464. while (i--) {
  44465. val = props[i];
  44466. if (typeof val === 'string') {
  44467. name = camelize(val);
  44468. res[name] = { type: null };
  44469. } else {
  44470. warn('props must be strings when using array syntax.');
  44471. }
  44472. }
  44473. } else if (isPlainObject(props)) {
  44474. for (var key in props) {
  44475. val = props[key];
  44476. name = camelize(key);
  44477. res[name] = isPlainObject(val)
  44478. ? val
  44479. : { type: val };
  44480. }
  44481. } else {
  44482. warn(
  44483. "Invalid value for option \"props\": expected an Array or an Object, " +
  44484. "but got " + (toRawType(props)) + ".",
  44485. vm
  44486. );
  44487. }
  44488. options.props = res;
  44489. }
  44490. /**
  44491. * Normalize all injections into Object-based format
  44492. */
  44493. function normalizeInject (options, vm) {
  44494. var inject = options.inject;
  44495. if (!inject) { return }
  44496. var normalized = options.inject = {};
  44497. if (Array.isArray(inject)) {
  44498. for (var i = 0; i < inject.length; i++) {
  44499. normalized[inject[i]] = { from: inject[i] };
  44500. }
  44501. } else if (isPlainObject(inject)) {
  44502. for (var key in inject) {
  44503. var val = inject[key];
  44504. normalized[key] = isPlainObject(val)
  44505. ? extend({ from: key }, val)
  44506. : { from: val };
  44507. }
  44508. } else {
  44509. warn(
  44510. "Invalid value for option \"inject\": expected an Array or an Object, " +
  44511. "but got " + (toRawType(inject)) + ".",
  44512. vm
  44513. );
  44514. }
  44515. }
  44516. /**
  44517. * Normalize raw function directives into object format.
  44518. */
  44519. function normalizeDirectives (options) {
  44520. var dirs = options.directives;
  44521. if (dirs) {
  44522. for (var key in dirs) {
  44523. var def$$1 = dirs[key];
  44524. if (typeof def$$1 === 'function') {
  44525. dirs[key] = { bind: def$$1, update: def$$1 };
  44526. }
  44527. }
  44528. }
  44529. }
  44530. function assertObjectType (name, value, vm) {
  44531. if (!isPlainObject(value)) {
  44532. warn(
  44533. "Invalid value for option \"" + name + "\": expected an Object, " +
  44534. "but got " + (toRawType(value)) + ".",
  44535. vm
  44536. );
  44537. }
  44538. }
  44539. /**
  44540. * Merge two option objects into a new one.
  44541. * Core utility used in both instantiation and inheritance.
  44542. */
  44543. function mergeOptions (
  44544. parent,
  44545. child,
  44546. vm
  44547. ) {
  44548. {
  44549. checkComponents(child);
  44550. }
  44551. if (typeof child === 'function') {
  44552. child = child.options;
  44553. }
  44554. normalizeProps(child, vm);
  44555. normalizeInject(child, vm);
  44556. normalizeDirectives(child);
  44557. // Apply extends and mixins on the child options,
  44558. // but only if it is a raw options object that isn't
  44559. // the result of another mergeOptions call.
  44560. // Only merged options has the _base property.
  44561. if (!child._base) {
  44562. if (child.extends) {
  44563. parent = mergeOptions(parent, child.extends, vm);
  44564. }
  44565. if (child.mixins) {
  44566. for (var i = 0, l = child.mixins.length; i < l; i++) {
  44567. parent = mergeOptions(parent, child.mixins[i], vm);
  44568. }
  44569. }
  44570. }
  44571. var options = {};
  44572. var key;
  44573. for (key in parent) {
  44574. mergeField(key);
  44575. }
  44576. for (key in child) {
  44577. if (!hasOwn(parent, key)) {
  44578. mergeField(key);
  44579. }
  44580. }
  44581. function mergeField (key) {
  44582. var strat = strats[key] || defaultStrat;
  44583. options[key] = strat(parent[key], child[key], vm, key);
  44584. }
  44585. return options
  44586. }
  44587. /**
  44588. * Resolve an asset.
  44589. * This function is used because child instances need access
  44590. * to assets defined in its ancestor chain.
  44591. */
  44592. function resolveAsset (
  44593. options,
  44594. type,
  44595. id,
  44596. warnMissing
  44597. ) {
  44598. /* istanbul ignore if */
  44599. if (typeof id !== 'string') {
  44600. return
  44601. }
  44602. var assets = options[type];
  44603. // check local registration variations first
  44604. if (hasOwn(assets, id)) { return assets[id] }
  44605. var camelizedId = camelize(id);
  44606. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  44607. var PascalCaseId = capitalize(camelizedId);
  44608. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  44609. // fallback to prototype chain
  44610. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  44611. if (warnMissing && !res) {
  44612. warn(
  44613. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  44614. options
  44615. );
  44616. }
  44617. return res
  44618. }
  44619. /* */
  44620. function validateProp (
  44621. key,
  44622. propOptions,
  44623. propsData,
  44624. vm
  44625. ) {
  44626. var prop = propOptions[key];
  44627. var absent = !hasOwn(propsData, key);
  44628. var value = propsData[key];
  44629. // boolean casting
  44630. var booleanIndex = getTypeIndex(Boolean, prop.type);
  44631. if (booleanIndex > -1) {
  44632. if (absent && !hasOwn(prop, 'default')) {
  44633. value = false;
  44634. } else if (value === '' || value === hyphenate(key)) {
  44635. // only cast empty string / same name to boolean if
  44636. // boolean has higher priority
  44637. var stringIndex = getTypeIndex(String, prop.type);
  44638. if (stringIndex < 0 || booleanIndex < stringIndex) {
  44639. value = true;
  44640. }
  44641. }
  44642. }
  44643. // check default value
  44644. if (value === undefined) {
  44645. value = getPropDefaultValue(vm, prop, key);
  44646. // since the default value is a fresh copy,
  44647. // make sure to observe it.
  44648. var prevShouldObserve = shouldObserve;
  44649. toggleObserving(true);
  44650. observe(value);
  44651. toggleObserving(prevShouldObserve);
  44652. }
  44653. {
  44654. assertProp(prop, key, value, vm, absent);
  44655. }
  44656. return value
  44657. }
  44658. /**
  44659. * Get the default value of a prop.
  44660. */
  44661. function getPropDefaultValue (vm, prop, key) {
  44662. // no default, return undefined
  44663. if (!hasOwn(prop, 'default')) {
  44664. return undefined
  44665. }
  44666. var def = prop.default;
  44667. // warn against non-factory defaults for Object & Array
  44668. if (isObject(def)) {
  44669. warn(
  44670. 'Invalid default value for prop "' + key + '": ' +
  44671. 'Props with type Object/Array must use a factory function ' +
  44672. 'to return the default value.',
  44673. vm
  44674. );
  44675. }
  44676. // the raw prop value was also undefined from previous render,
  44677. // return previous default value to avoid unnecessary watcher trigger
  44678. if (vm && vm.$options.propsData &&
  44679. vm.$options.propsData[key] === undefined &&
  44680. vm._props[key] !== undefined
  44681. ) {
  44682. return vm._props[key]
  44683. }
  44684. // call factory function for non-Function types
  44685. // a value is Function if its prototype is function even across different execution context
  44686. return typeof def === 'function' && getType(prop.type) !== 'Function'
  44687. ? def.call(vm)
  44688. : def
  44689. }
  44690. /**
  44691. * Assert whether a prop is valid.
  44692. */
  44693. function assertProp (
  44694. prop,
  44695. name,
  44696. value,
  44697. vm,
  44698. absent
  44699. ) {
  44700. if (prop.required && absent) {
  44701. warn(
  44702. 'Missing required prop: "' + name + '"',
  44703. vm
  44704. );
  44705. return
  44706. }
  44707. if (value == null && !prop.required) {
  44708. return
  44709. }
  44710. var type = prop.type;
  44711. var valid = !type || type === true;
  44712. var expectedTypes = [];
  44713. if (type) {
  44714. if (!Array.isArray(type)) {
  44715. type = [type];
  44716. }
  44717. for (var i = 0; i < type.length && !valid; i++) {
  44718. var assertedType = assertType(value, type[i]);
  44719. expectedTypes.push(assertedType.expectedType || '');
  44720. valid = assertedType.valid;
  44721. }
  44722. }
  44723. if (!valid) {
  44724. warn(
  44725. getInvalidTypeMessage(name, value, expectedTypes),
  44726. vm
  44727. );
  44728. return
  44729. }
  44730. var validator = prop.validator;
  44731. if (validator) {
  44732. if (!validator(value)) {
  44733. warn(
  44734. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  44735. vm
  44736. );
  44737. }
  44738. }
  44739. }
  44740. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  44741. function assertType (value, type) {
  44742. var valid;
  44743. var expectedType = getType(type);
  44744. if (simpleCheckRE.test(expectedType)) {
  44745. var t = typeof value;
  44746. valid = t === expectedType.toLowerCase();
  44747. // for primitive wrapper objects
  44748. if (!valid && t === 'object') {
  44749. valid = value instanceof type;
  44750. }
  44751. } else if (expectedType === 'Object') {
  44752. valid = isPlainObject(value);
  44753. } else if (expectedType === 'Array') {
  44754. valid = Array.isArray(value);
  44755. } else {
  44756. valid = value instanceof type;
  44757. }
  44758. return {
  44759. valid: valid,
  44760. expectedType: expectedType
  44761. }
  44762. }
  44763. /**
  44764. * Use function string name to check built-in types,
  44765. * because a simple equality check will fail when running
  44766. * across different vms / iframes.
  44767. */
  44768. function getType (fn) {
  44769. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  44770. return match ? match[1] : ''
  44771. }
  44772. function isSameType (a, b) {
  44773. return getType(a) === getType(b)
  44774. }
  44775. function getTypeIndex (type, expectedTypes) {
  44776. if (!Array.isArray(expectedTypes)) {
  44777. return isSameType(expectedTypes, type) ? 0 : -1
  44778. }
  44779. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  44780. if (isSameType(expectedTypes[i], type)) {
  44781. return i
  44782. }
  44783. }
  44784. return -1
  44785. }
  44786. function getInvalidTypeMessage (name, value, expectedTypes) {
  44787. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  44788. " Expected " + (expectedTypes.map(capitalize).join(', '));
  44789. var expectedType = expectedTypes[0];
  44790. var receivedType = toRawType(value);
  44791. var expectedValue = styleValue(value, expectedType);
  44792. var receivedValue = styleValue(value, receivedType);
  44793. // check if we need to specify expected value
  44794. if (expectedTypes.length === 1 &&
  44795. isExplicable(expectedType) &&
  44796. !isBoolean(expectedType, receivedType)) {
  44797. message += " with value " + expectedValue;
  44798. }
  44799. message += ", got " + receivedType + " ";
  44800. // check if we need to specify received value
  44801. if (isExplicable(receivedType)) {
  44802. message += "with value " + receivedValue + ".";
  44803. }
  44804. return message
  44805. }
  44806. function styleValue (value, type) {
  44807. if (type === 'String') {
  44808. return ("\"" + value + "\"")
  44809. } else if (type === 'Number') {
  44810. return ("" + (Number(value)))
  44811. } else {
  44812. return ("" + value)
  44813. }
  44814. }
  44815. function isExplicable (value) {
  44816. var explicitTypes = ['string', 'number', 'boolean'];
  44817. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  44818. }
  44819. function isBoolean () {
  44820. var args = [], len = arguments.length;
  44821. while ( len-- ) args[ len ] = arguments[ len ];
  44822. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  44823. }
  44824. /* */
  44825. function handleError (err, vm, info) {
  44826. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  44827. // See: https://github.com/vuejs/vuex/issues/1505
  44828. pushTarget();
  44829. try {
  44830. if (vm) {
  44831. var cur = vm;
  44832. while ((cur = cur.$parent)) {
  44833. var hooks = cur.$options.errorCaptured;
  44834. if (hooks) {
  44835. for (var i = 0; i < hooks.length; i++) {
  44836. try {
  44837. var capture = hooks[i].call(cur, err, vm, info) === false;
  44838. if (capture) { return }
  44839. } catch (e) {
  44840. globalHandleError(e, cur, 'errorCaptured hook');
  44841. }
  44842. }
  44843. }
  44844. }
  44845. }
  44846. globalHandleError(err, vm, info);
  44847. } finally {
  44848. popTarget();
  44849. }
  44850. }
  44851. function invokeWithErrorHandling (
  44852. handler,
  44853. context,
  44854. args,
  44855. vm,
  44856. info
  44857. ) {
  44858. var res;
  44859. try {
  44860. res = args ? handler.apply(context, args) : handler.call(context);
  44861. if (res && !res._isVue && isPromise(res) && !res._handled) {
  44862. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  44863. // issue #9511
  44864. // avoid catch triggering multiple times when nested calls
  44865. res._handled = true;
  44866. }
  44867. } catch (e) {
  44868. handleError(e, vm, info);
  44869. }
  44870. return res
  44871. }
  44872. function globalHandleError (err, vm, info) {
  44873. if (config.errorHandler) {
  44874. try {
  44875. return config.errorHandler.call(null, err, vm, info)
  44876. } catch (e) {
  44877. // if the user intentionally throws the original error in the handler,
  44878. // do not log it twice
  44879. if (e !== err) {
  44880. logError(e, null, 'config.errorHandler');
  44881. }
  44882. }
  44883. }
  44884. logError(err, vm, info);
  44885. }
  44886. function logError (err, vm, info) {
  44887. {
  44888. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  44889. }
  44890. /* istanbul ignore else */
  44891. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  44892. console.error(err);
  44893. } else {
  44894. throw err
  44895. }
  44896. }
  44897. /* */
  44898. var isUsingMicroTask = false;
  44899. var callbacks = [];
  44900. var pending = false;
  44901. function flushCallbacks () {
  44902. pending = false;
  44903. var copies = callbacks.slice(0);
  44904. callbacks.length = 0;
  44905. for (var i = 0; i < copies.length; i++) {
  44906. copies[i]();
  44907. }
  44908. }
  44909. // Here we have async deferring wrappers using microtasks.
  44910. // In 2.5 we used (macro) tasks (in combination with microtasks).
  44911. // However, it has subtle problems when state is changed right before repaint
  44912. // (e.g. #6813, out-in transitions).
  44913. // Also, using (macro) tasks in event handler would cause some weird behaviors
  44914. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  44915. // So we now use microtasks everywhere, again.
  44916. // A major drawback of this tradeoff is that there are some scenarios
  44917. // where microtasks have too high a priority and fire in between supposedly
  44918. // sequential events (e.g. #4521, #6690, which have workarounds)
  44919. // or even between bubbling of the same event (#6566).
  44920. var timerFunc;
  44921. // The nextTick behavior leverages the microtask queue, which can be accessed
  44922. // via either native Promise.then or MutationObserver.
  44923. // MutationObserver has wider support, however it is seriously bugged in
  44924. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  44925. // completely stops working after triggering a few times... so, if native
  44926. // Promise is available, we will use it:
  44927. /* istanbul ignore next, $flow-disable-line */
  44928. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  44929. var p = Promise.resolve();
  44930. timerFunc = function () {
  44931. p.then(flushCallbacks);
  44932. // In problematic UIWebViews, Promise.then doesn't completely break, but
  44933. // it can get stuck in a weird state where callbacks are pushed into the
  44934. // microtask queue but the queue isn't being flushed, until the browser
  44935. // needs to do some other work, e.g. handle a timer. Therefore we can
  44936. // "force" the microtask queue to be flushed by adding an empty timer.
  44937. if (isIOS) { setTimeout(noop); }
  44938. };
  44939. isUsingMicroTask = true;
  44940. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  44941. isNative(MutationObserver) ||
  44942. // PhantomJS and iOS 7.x
  44943. MutationObserver.toString() === '[object MutationObserverConstructor]'
  44944. )) {
  44945. // Use MutationObserver where native Promise is not available,
  44946. // e.g. PhantomJS, iOS7, Android 4.4
  44947. // (#6466 MutationObserver is unreliable in IE11)
  44948. var counter = 1;
  44949. var observer = new MutationObserver(flushCallbacks);
  44950. var textNode = document.createTextNode(String(counter));
  44951. observer.observe(textNode, {
  44952. characterData: true
  44953. });
  44954. timerFunc = function () {
  44955. counter = (counter + 1) % 2;
  44956. textNode.data = String(counter);
  44957. };
  44958. isUsingMicroTask = true;
  44959. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  44960. // Fallback to setImmediate.
  44961. // Technically it leverages the (macro) task queue,
  44962. // but it is still a better choice than setTimeout.
  44963. timerFunc = function () {
  44964. setImmediate(flushCallbacks);
  44965. };
  44966. } else {
  44967. // Fallback to setTimeout.
  44968. timerFunc = function () {
  44969. setTimeout(flushCallbacks, 0);
  44970. };
  44971. }
  44972. function nextTick (cb, ctx) {
  44973. var _resolve;
  44974. callbacks.push(function () {
  44975. if (cb) {
  44976. try {
  44977. cb.call(ctx);
  44978. } catch (e) {
  44979. handleError(e, ctx, 'nextTick');
  44980. }
  44981. } else if (_resolve) {
  44982. _resolve(ctx);
  44983. }
  44984. });
  44985. if (!pending) {
  44986. pending = true;
  44987. timerFunc();
  44988. }
  44989. // $flow-disable-line
  44990. if (!cb && typeof Promise !== 'undefined') {
  44991. return new Promise(function (resolve) {
  44992. _resolve = resolve;
  44993. })
  44994. }
  44995. }
  44996. /* */
  44997. var mark;
  44998. var measure;
  44999. {
  45000. var perf = inBrowser && window.performance;
  45001. /* istanbul ignore if */
  45002. if (
  45003. perf &&
  45004. perf.mark &&
  45005. perf.measure &&
  45006. perf.clearMarks &&
  45007. perf.clearMeasures
  45008. ) {
  45009. mark = function (tag) { return perf.mark(tag); };
  45010. measure = function (name, startTag, endTag) {
  45011. perf.measure(name, startTag, endTag);
  45012. perf.clearMarks(startTag);
  45013. perf.clearMarks(endTag);
  45014. // perf.clearMeasures(name)
  45015. };
  45016. }
  45017. }
  45018. /* not type checking this file because flow doesn't play well with Proxy */
  45019. var initProxy;
  45020. {
  45021. var allowedGlobals = makeMap(
  45022. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  45023. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  45024. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  45025. 'require' // for Webpack/Browserify
  45026. );
  45027. var warnNonPresent = function (target, key) {
  45028. warn(
  45029. "Property or method \"" + key + "\" is not defined on the instance but " +
  45030. 'referenced during render. Make sure that this property is reactive, ' +
  45031. 'either in the data option, or for class-based components, by ' +
  45032. 'initializing the property. ' +
  45033. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  45034. target
  45035. );
  45036. };
  45037. var warnReservedPrefix = function (target, key) {
  45038. warn(
  45039. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  45040. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  45041. 'prevent conflicts with Vue internals. ' +
  45042. 'See: https://vuejs.org/v2/api/#data',
  45043. target
  45044. );
  45045. };
  45046. var hasProxy =
  45047. typeof Proxy !== 'undefined' && isNative(Proxy);
  45048. if (hasProxy) {
  45049. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  45050. config.keyCodes = new Proxy(config.keyCodes, {
  45051. set: function set (target, key, value) {
  45052. if (isBuiltInModifier(key)) {
  45053. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  45054. return false
  45055. } else {
  45056. target[key] = value;
  45057. return true
  45058. }
  45059. }
  45060. });
  45061. }
  45062. var hasHandler = {
  45063. has: function has (target, key) {
  45064. var has = key in target;
  45065. var isAllowed = allowedGlobals(key) ||
  45066. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  45067. if (!has && !isAllowed) {
  45068. if (key in target.$data) { warnReservedPrefix(target, key); }
  45069. else { warnNonPresent(target, key); }
  45070. }
  45071. return has || !isAllowed
  45072. }
  45073. };
  45074. var getHandler = {
  45075. get: function get (target, key) {
  45076. if (typeof key === 'string' && !(key in target)) {
  45077. if (key in target.$data) { warnReservedPrefix(target, key); }
  45078. else { warnNonPresent(target, key); }
  45079. }
  45080. return target[key]
  45081. }
  45082. };
  45083. initProxy = function initProxy (vm) {
  45084. if (hasProxy) {
  45085. // determine which proxy handler to use
  45086. var options = vm.$options;
  45087. var handlers = options.render && options.render._withStripped
  45088. ? getHandler
  45089. : hasHandler;
  45090. vm._renderProxy = new Proxy(vm, handlers);
  45091. } else {
  45092. vm._renderProxy = vm;
  45093. }
  45094. };
  45095. }
  45096. /* */
  45097. var seenObjects = new _Set();
  45098. /**
  45099. * Recursively traverse an object to evoke all converted
  45100. * getters, so that every nested property inside the object
  45101. * is collected as a "deep" dependency.
  45102. */
  45103. function traverse (val) {
  45104. _traverse(val, seenObjects);
  45105. seenObjects.clear();
  45106. }
  45107. function _traverse (val, seen) {
  45108. var i, keys;
  45109. var isA = Array.isArray(val);
  45110. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  45111. return
  45112. }
  45113. if (val.__ob__) {
  45114. var depId = val.__ob__.dep.id;
  45115. if (seen.has(depId)) {
  45116. return
  45117. }
  45118. seen.add(depId);
  45119. }
  45120. if (isA) {
  45121. i = val.length;
  45122. while (i--) { _traverse(val[i], seen); }
  45123. } else {
  45124. keys = Object.keys(val);
  45125. i = keys.length;
  45126. while (i--) { _traverse(val[keys[i]], seen); }
  45127. }
  45128. }
  45129. /* */
  45130. var normalizeEvent = cached(function (name) {
  45131. var passive = name.charAt(0) === '&';
  45132. name = passive ? name.slice(1) : name;
  45133. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  45134. name = once$$1 ? name.slice(1) : name;
  45135. var capture = name.charAt(0) === '!';
  45136. name = capture ? name.slice(1) : name;
  45137. return {
  45138. name: name,
  45139. once: once$$1,
  45140. capture: capture,
  45141. passive: passive
  45142. }
  45143. });
  45144. function createFnInvoker (fns, vm) {
  45145. function invoker () {
  45146. var arguments$1 = arguments;
  45147. var fns = invoker.fns;
  45148. if (Array.isArray(fns)) {
  45149. var cloned = fns.slice();
  45150. for (var i = 0; i < cloned.length; i++) {
  45151. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  45152. }
  45153. } else {
  45154. // return handler return value for single handlers
  45155. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  45156. }
  45157. }
  45158. invoker.fns = fns;
  45159. return invoker
  45160. }
  45161. function updateListeners (
  45162. on,
  45163. oldOn,
  45164. add,
  45165. remove$$1,
  45166. createOnceHandler,
  45167. vm
  45168. ) {
  45169. var name, def$$1, cur, old, event;
  45170. for (name in on) {
  45171. def$$1 = cur = on[name];
  45172. old = oldOn[name];
  45173. event = normalizeEvent(name);
  45174. if (isUndef(cur)) {
  45175. warn(
  45176. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  45177. vm
  45178. );
  45179. } else if (isUndef(old)) {
  45180. if (isUndef(cur.fns)) {
  45181. cur = on[name] = createFnInvoker(cur, vm);
  45182. }
  45183. if (isTrue(event.once)) {
  45184. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  45185. }
  45186. add(event.name, cur, event.capture, event.passive, event.params);
  45187. } else if (cur !== old) {
  45188. old.fns = cur;
  45189. on[name] = old;
  45190. }
  45191. }
  45192. for (name in oldOn) {
  45193. if (isUndef(on[name])) {
  45194. event = normalizeEvent(name);
  45195. remove$$1(event.name, oldOn[name], event.capture);
  45196. }
  45197. }
  45198. }
  45199. /* */
  45200. function mergeVNodeHook (def, hookKey, hook) {
  45201. if (def instanceof VNode) {
  45202. def = def.data.hook || (def.data.hook = {});
  45203. }
  45204. var invoker;
  45205. var oldHook = def[hookKey];
  45206. function wrappedHook () {
  45207. hook.apply(this, arguments);
  45208. // important: remove merged hook to ensure it's called only once
  45209. // and prevent memory leak
  45210. remove(invoker.fns, wrappedHook);
  45211. }
  45212. if (isUndef(oldHook)) {
  45213. // no existing hook
  45214. invoker = createFnInvoker([wrappedHook]);
  45215. } else {
  45216. /* istanbul ignore if */
  45217. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  45218. // already a merged invoker
  45219. invoker = oldHook;
  45220. invoker.fns.push(wrappedHook);
  45221. } else {
  45222. // existing plain hook
  45223. invoker = createFnInvoker([oldHook, wrappedHook]);
  45224. }
  45225. }
  45226. invoker.merged = true;
  45227. def[hookKey] = invoker;
  45228. }
  45229. /* */
  45230. function extractPropsFromVNodeData (
  45231. data,
  45232. Ctor,
  45233. tag
  45234. ) {
  45235. // we are only extracting raw values here.
  45236. // validation and default values are handled in the child
  45237. // component itself.
  45238. var propOptions = Ctor.options.props;
  45239. if (isUndef(propOptions)) {
  45240. return
  45241. }
  45242. var res = {};
  45243. var attrs = data.attrs;
  45244. var props = data.props;
  45245. if (isDef(attrs) || isDef(props)) {
  45246. for (var key in propOptions) {
  45247. var altKey = hyphenate(key);
  45248. {
  45249. var keyInLowerCase = key.toLowerCase();
  45250. if (
  45251. key !== keyInLowerCase &&
  45252. attrs && hasOwn(attrs, keyInLowerCase)
  45253. ) {
  45254. tip(
  45255. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  45256. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  45257. " \"" + key + "\". " +
  45258. "Note that HTML attributes are case-insensitive and camelCased " +
  45259. "props need to use their kebab-case equivalents when using in-DOM " +
  45260. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  45261. );
  45262. }
  45263. }
  45264. checkProp(res, props, key, altKey, true) ||
  45265. checkProp(res, attrs, key, altKey, false);
  45266. }
  45267. }
  45268. return res
  45269. }
  45270. function checkProp (
  45271. res,
  45272. hash,
  45273. key,
  45274. altKey,
  45275. preserve
  45276. ) {
  45277. if (isDef(hash)) {
  45278. if (hasOwn(hash, key)) {
  45279. res[key] = hash[key];
  45280. if (!preserve) {
  45281. delete hash[key];
  45282. }
  45283. return true
  45284. } else if (hasOwn(hash, altKey)) {
  45285. res[key] = hash[altKey];
  45286. if (!preserve) {
  45287. delete hash[altKey];
  45288. }
  45289. return true
  45290. }
  45291. }
  45292. return false
  45293. }
  45294. /* */
  45295. // The template compiler attempts to minimize the need for normalization by
  45296. // statically analyzing the template at compile time.
  45297. //
  45298. // For plain HTML markup, normalization can be completely skipped because the
  45299. // generated render function is guaranteed to return Array<VNode>. There are
  45300. // two cases where extra normalization is needed:
  45301. // 1. When the children contains components - because a functional component
  45302. // may return an Array instead of a single root. In this case, just a simple
  45303. // normalization is needed - if any child is an Array, we flatten the whole
  45304. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  45305. // because functional components already normalize their own children.
  45306. function simpleNormalizeChildren (children) {
  45307. for (var i = 0; i < children.length; i++) {
  45308. if (Array.isArray(children[i])) {
  45309. return Array.prototype.concat.apply([], children)
  45310. }
  45311. }
  45312. return children
  45313. }
  45314. // 2. When the children contains constructs that always generated nested Arrays,
  45315. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  45316. // with hand-written render functions / JSX. In such cases a full normalization
  45317. // is needed to cater to all possible types of children values.
  45318. function normalizeChildren (children) {
  45319. return isPrimitive(children)
  45320. ? [createTextVNode(children)]
  45321. : Array.isArray(children)
  45322. ? normalizeArrayChildren(children)
  45323. : undefined
  45324. }
  45325. function isTextNode (node) {
  45326. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  45327. }
  45328. function normalizeArrayChildren (children, nestedIndex) {
  45329. var res = [];
  45330. var i, c, lastIndex, last;
  45331. for (i = 0; i < children.length; i++) {
  45332. c = children[i];
  45333. if (isUndef(c) || typeof c === 'boolean') { continue }
  45334. lastIndex = res.length - 1;
  45335. last = res[lastIndex];
  45336. // nested
  45337. if (Array.isArray(c)) {
  45338. if (c.length > 0) {
  45339. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  45340. // merge adjacent text nodes
  45341. if (isTextNode(c[0]) && isTextNode(last)) {
  45342. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  45343. c.shift();
  45344. }
  45345. res.push.apply(res, c);
  45346. }
  45347. } else if (isPrimitive(c)) {
  45348. if (isTextNode(last)) {
  45349. // merge adjacent text nodes
  45350. // this is necessary for SSR hydration because text nodes are
  45351. // essentially merged when rendered to HTML strings
  45352. res[lastIndex] = createTextVNode(last.text + c);
  45353. } else if (c !== '') {
  45354. // convert primitive to vnode
  45355. res.push(createTextVNode(c));
  45356. }
  45357. } else {
  45358. if (isTextNode(c) && isTextNode(last)) {
  45359. // merge adjacent text nodes
  45360. res[lastIndex] = createTextVNode(last.text + c.text);
  45361. } else {
  45362. // default key for nested array children (likely generated by v-for)
  45363. if (isTrue(children._isVList) &&
  45364. isDef(c.tag) &&
  45365. isUndef(c.key) &&
  45366. isDef(nestedIndex)) {
  45367. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  45368. }
  45369. res.push(c);
  45370. }
  45371. }
  45372. }
  45373. return res
  45374. }
  45375. /* */
  45376. function initProvide (vm) {
  45377. var provide = vm.$options.provide;
  45378. if (provide) {
  45379. vm._provided = typeof provide === 'function'
  45380. ? provide.call(vm)
  45381. : provide;
  45382. }
  45383. }
  45384. function initInjections (vm) {
  45385. var result = resolveInject(vm.$options.inject, vm);
  45386. if (result) {
  45387. toggleObserving(false);
  45388. Object.keys(result).forEach(function (key) {
  45389. /* istanbul ignore else */
  45390. {
  45391. defineReactive$$1(vm, key, result[key], function () {
  45392. warn(
  45393. "Avoid mutating an injected value directly since the changes will be " +
  45394. "overwritten whenever the provided component re-renders. " +
  45395. "injection being mutated: \"" + key + "\"",
  45396. vm
  45397. );
  45398. });
  45399. }
  45400. });
  45401. toggleObserving(true);
  45402. }
  45403. }
  45404. function resolveInject (inject, vm) {
  45405. if (inject) {
  45406. // inject is :any because flow is not smart enough to figure out cached
  45407. var result = Object.create(null);
  45408. var keys = hasSymbol
  45409. ? Reflect.ownKeys(inject)
  45410. : Object.keys(inject);
  45411. for (var i = 0; i < keys.length; i++) {
  45412. var key = keys[i];
  45413. // #6574 in case the inject object is observed...
  45414. if (key === '__ob__') { continue }
  45415. var provideKey = inject[key].from;
  45416. var source = vm;
  45417. while (source) {
  45418. if (source._provided && hasOwn(source._provided, provideKey)) {
  45419. result[key] = source._provided[provideKey];
  45420. break
  45421. }
  45422. source = source.$parent;
  45423. }
  45424. if (!source) {
  45425. if ('default' in inject[key]) {
  45426. var provideDefault = inject[key].default;
  45427. result[key] = typeof provideDefault === 'function'
  45428. ? provideDefault.call(vm)
  45429. : provideDefault;
  45430. } else {
  45431. warn(("Injection \"" + key + "\" not found"), vm);
  45432. }
  45433. }
  45434. }
  45435. return result
  45436. }
  45437. }
  45438. /* */
  45439. /**
  45440. * Runtime helper for resolving raw children VNodes into a slot object.
  45441. */
  45442. function resolveSlots (
  45443. children,
  45444. context
  45445. ) {
  45446. if (!children || !children.length) {
  45447. return {}
  45448. }
  45449. var slots = {};
  45450. for (var i = 0, l = children.length; i < l; i++) {
  45451. var child = children[i];
  45452. var data = child.data;
  45453. // remove slot attribute if the node is resolved as a Vue slot node
  45454. if (data && data.attrs && data.attrs.slot) {
  45455. delete data.attrs.slot;
  45456. }
  45457. // named slots should only be respected if the vnode was rendered in the
  45458. // same context.
  45459. if ((child.context === context || child.fnContext === context) &&
  45460. data && data.slot != null
  45461. ) {
  45462. var name = data.slot;
  45463. var slot = (slots[name] || (slots[name] = []));
  45464. if (child.tag === 'template') {
  45465. slot.push.apply(slot, child.children || []);
  45466. } else {
  45467. slot.push(child);
  45468. }
  45469. } else {
  45470. (slots.default || (slots.default = [])).push(child);
  45471. }
  45472. }
  45473. // ignore slots that contains only whitespace
  45474. for (var name$1 in slots) {
  45475. if (slots[name$1].every(isWhitespace)) {
  45476. delete slots[name$1];
  45477. }
  45478. }
  45479. return slots
  45480. }
  45481. function isWhitespace (node) {
  45482. return (node.isComment && !node.asyncFactory) || node.text === ' '
  45483. }
  45484. /* */
  45485. function normalizeScopedSlots (
  45486. slots,
  45487. normalSlots,
  45488. prevSlots
  45489. ) {
  45490. var res;
  45491. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  45492. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  45493. var key = slots && slots.$key;
  45494. if (!slots) {
  45495. res = {};
  45496. } else if (slots._normalized) {
  45497. // fast path 1: child component re-render only, parent did not change
  45498. return slots._normalized
  45499. } else if (
  45500. isStable &&
  45501. prevSlots &&
  45502. prevSlots !== emptyObject &&
  45503. key === prevSlots.$key &&
  45504. !hasNormalSlots &&
  45505. !prevSlots.$hasNormal
  45506. ) {
  45507. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  45508. // only need to normalize once
  45509. return prevSlots
  45510. } else {
  45511. res = {};
  45512. for (var key$1 in slots) {
  45513. if (slots[key$1] && key$1[0] !== '$') {
  45514. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  45515. }
  45516. }
  45517. }
  45518. // expose normal slots on scopedSlots
  45519. for (var key$2 in normalSlots) {
  45520. if (!(key$2 in res)) {
  45521. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  45522. }
  45523. }
  45524. // avoriaz seems to mock a non-extensible $scopedSlots object
  45525. // and when that is passed down this would cause an error
  45526. if (slots && Object.isExtensible(slots)) {
  45527. (slots)._normalized = res;
  45528. }
  45529. def(res, '$stable', isStable);
  45530. def(res, '$key', key);
  45531. def(res, '$hasNormal', hasNormalSlots);
  45532. return res
  45533. }
  45534. function normalizeScopedSlot(normalSlots, key, fn) {
  45535. var normalized = function () {
  45536. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  45537. res = res && typeof res === 'object' && !Array.isArray(res)
  45538. ? [res] // single vnode
  45539. : normalizeChildren(res);
  45540. return res && (
  45541. res.length === 0 ||
  45542. (res.length === 1 && res[0].isComment) // #9658
  45543. ) ? undefined
  45544. : res
  45545. };
  45546. // this is a slot using the new v-slot syntax without scope. although it is
  45547. // compiled as a scoped slot, render fn users would expect it to be present
  45548. // on this.$slots because the usage is semantically a normal slot.
  45549. if (fn.proxy) {
  45550. Object.defineProperty(normalSlots, key, {
  45551. get: normalized,
  45552. enumerable: true,
  45553. configurable: true
  45554. });
  45555. }
  45556. return normalized
  45557. }
  45558. function proxyNormalSlot(slots, key) {
  45559. return function () { return slots[key]; }
  45560. }
  45561. /* */
  45562. /**
  45563. * Runtime helper for rendering v-for lists.
  45564. */
  45565. function renderList (
  45566. val,
  45567. render
  45568. ) {
  45569. var ret, i, l, keys, key;
  45570. if (Array.isArray(val) || typeof val === 'string') {
  45571. ret = new Array(val.length);
  45572. for (i = 0, l = val.length; i < l; i++) {
  45573. ret[i] = render(val[i], i);
  45574. }
  45575. } else if (typeof val === 'number') {
  45576. ret = new Array(val);
  45577. for (i = 0; i < val; i++) {
  45578. ret[i] = render(i + 1, i);
  45579. }
  45580. } else if (isObject(val)) {
  45581. if (hasSymbol && val[Symbol.iterator]) {
  45582. ret = [];
  45583. var iterator = val[Symbol.iterator]();
  45584. var result = iterator.next();
  45585. while (!result.done) {
  45586. ret.push(render(result.value, ret.length));
  45587. result = iterator.next();
  45588. }
  45589. } else {
  45590. keys = Object.keys(val);
  45591. ret = new Array(keys.length);
  45592. for (i = 0, l = keys.length; i < l; i++) {
  45593. key = keys[i];
  45594. ret[i] = render(val[key], key, i);
  45595. }
  45596. }
  45597. }
  45598. if (!isDef(ret)) {
  45599. ret = [];
  45600. }
  45601. (ret)._isVList = true;
  45602. return ret
  45603. }
  45604. /* */
  45605. /**
  45606. * Runtime helper for rendering <slot>
  45607. */
  45608. function renderSlot (
  45609. name,
  45610. fallback,
  45611. props,
  45612. bindObject
  45613. ) {
  45614. var scopedSlotFn = this.$scopedSlots[name];
  45615. var nodes;
  45616. if (scopedSlotFn) { // scoped slot
  45617. props = props || {};
  45618. if (bindObject) {
  45619. if (!isObject(bindObject)) {
  45620. warn(
  45621. 'slot v-bind without argument expects an Object',
  45622. this
  45623. );
  45624. }
  45625. props = extend(extend({}, bindObject), props);
  45626. }
  45627. nodes = scopedSlotFn(props) || fallback;
  45628. } else {
  45629. nodes = this.$slots[name] || fallback;
  45630. }
  45631. var target = props && props.slot;
  45632. if (target) {
  45633. return this.$createElement('template', { slot: target }, nodes)
  45634. } else {
  45635. return nodes
  45636. }
  45637. }
  45638. /* */
  45639. /**
  45640. * Runtime helper for resolving filters
  45641. */
  45642. function resolveFilter (id) {
  45643. return resolveAsset(this.$options, 'filters', id, true) || identity
  45644. }
  45645. /* */
  45646. function isKeyNotMatch (expect, actual) {
  45647. if (Array.isArray(expect)) {
  45648. return expect.indexOf(actual) === -1
  45649. } else {
  45650. return expect !== actual
  45651. }
  45652. }
  45653. /**
  45654. * Runtime helper for checking keyCodes from config.
  45655. * exposed as Vue.prototype._k
  45656. * passing in eventKeyName as last argument separately for backwards compat
  45657. */
  45658. function checkKeyCodes (
  45659. eventKeyCode,
  45660. key,
  45661. builtInKeyCode,
  45662. eventKeyName,
  45663. builtInKeyName
  45664. ) {
  45665. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  45666. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  45667. return isKeyNotMatch(builtInKeyName, eventKeyName)
  45668. } else if (mappedKeyCode) {
  45669. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  45670. } else if (eventKeyName) {
  45671. return hyphenate(eventKeyName) !== key
  45672. }
  45673. }
  45674. /* */
  45675. /**
  45676. * Runtime helper for merging v-bind="object" into a VNode's data.
  45677. */
  45678. function bindObjectProps (
  45679. data,
  45680. tag,
  45681. value,
  45682. asProp,
  45683. isSync
  45684. ) {
  45685. if (value) {
  45686. if (!isObject(value)) {
  45687. warn(
  45688. 'v-bind without argument expects an Object or Array value',
  45689. this
  45690. );
  45691. } else {
  45692. if (Array.isArray(value)) {
  45693. value = toObject(value);
  45694. }
  45695. var hash;
  45696. var loop = function ( key ) {
  45697. if (
  45698. key === 'class' ||
  45699. key === 'style' ||
  45700. isReservedAttribute(key)
  45701. ) {
  45702. hash = data;
  45703. } else {
  45704. var type = data.attrs && data.attrs.type;
  45705. hash = asProp || config.mustUseProp(tag, type, key)
  45706. ? data.domProps || (data.domProps = {})
  45707. : data.attrs || (data.attrs = {});
  45708. }
  45709. var camelizedKey = camelize(key);
  45710. var hyphenatedKey = hyphenate(key);
  45711. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  45712. hash[key] = value[key];
  45713. if (isSync) {
  45714. var on = data.on || (data.on = {});
  45715. on[("update:" + key)] = function ($event) {
  45716. value[key] = $event;
  45717. };
  45718. }
  45719. }
  45720. };
  45721. for (var key in value) loop( key );
  45722. }
  45723. }
  45724. return data
  45725. }
  45726. /* */
  45727. /**
  45728. * Runtime helper for rendering static trees.
  45729. */
  45730. function renderStatic (
  45731. index,
  45732. isInFor
  45733. ) {
  45734. var cached = this._staticTrees || (this._staticTrees = []);
  45735. var tree = cached[index];
  45736. // if has already-rendered static tree and not inside v-for,
  45737. // we can reuse the same tree.
  45738. if (tree && !isInFor) {
  45739. return tree
  45740. }
  45741. // otherwise, render a fresh tree.
  45742. tree = cached[index] = this.$options.staticRenderFns[index].call(
  45743. this._renderProxy,
  45744. null,
  45745. this // for render fns generated for functional component templates
  45746. );
  45747. markStatic(tree, ("__static__" + index), false);
  45748. return tree
  45749. }
  45750. /**
  45751. * Runtime helper for v-once.
  45752. * Effectively it means marking the node as static with a unique key.
  45753. */
  45754. function markOnce (
  45755. tree,
  45756. index,
  45757. key
  45758. ) {
  45759. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  45760. return tree
  45761. }
  45762. function markStatic (
  45763. tree,
  45764. key,
  45765. isOnce
  45766. ) {
  45767. if (Array.isArray(tree)) {
  45768. for (var i = 0; i < tree.length; i++) {
  45769. if (tree[i] && typeof tree[i] !== 'string') {
  45770. markStaticNode(tree[i], (key + "_" + i), isOnce);
  45771. }
  45772. }
  45773. } else {
  45774. markStaticNode(tree, key, isOnce);
  45775. }
  45776. }
  45777. function markStaticNode (node, key, isOnce) {
  45778. node.isStatic = true;
  45779. node.key = key;
  45780. node.isOnce = isOnce;
  45781. }
  45782. /* */
  45783. function bindObjectListeners (data, value) {
  45784. if (value) {
  45785. if (!isPlainObject(value)) {
  45786. warn(
  45787. 'v-on without argument expects an Object value',
  45788. this
  45789. );
  45790. } else {
  45791. var on = data.on = data.on ? extend({}, data.on) : {};
  45792. for (var key in value) {
  45793. var existing = on[key];
  45794. var ours = value[key];
  45795. on[key] = existing ? [].concat(existing, ours) : ours;
  45796. }
  45797. }
  45798. }
  45799. return data
  45800. }
  45801. /* */
  45802. function resolveScopedSlots (
  45803. fns, // see flow/vnode
  45804. res,
  45805. // the following are added in 2.6
  45806. hasDynamicKeys,
  45807. contentHashKey
  45808. ) {
  45809. res = res || { $stable: !hasDynamicKeys };
  45810. for (var i = 0; i < fns.length; i++) {
  45811. var slot = fns[i];
  45812. if (Array.isArray(slot)) {
  45813. resolveScopedSlots(slot, res, hasDynamicKeys);
  45814. } else if (slot) {
  45815. // marker for reverse proxying v-slot without scope on this.$slots
  45816. if (slot.proxy) {
  45817. slot.fn.proxy = true;
  45818. }
  45819. res[slot.key] = slot.fn;
  45820. }
  45821. }
  45822. if (contentHashKey) {
  45823. (res).$key = contentHashKey;
  45824. }
  45825. return res
  45826. }
  45827. /* */
  45828. function bindDynamicKeys (baseObj, values) {
  45829. for (var i = 0; i < values.length; i += 2) {
  45830. var key = values[i];
  45831. if (typeof key === 'string' && key) {
  45832. baseObj[values[i]] = values[i + 1];
  45833. } else if (key !== '' && key !== null) {
  45834. // null is a special value for explicitly removing a binding
  45835. warn(
  45836. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  45837. this
  45838. );
  45839. }
  45840. }
  45841. return baseObj
  45842. }
  45843. // helper to dynamically append modifier runtime markers to event names.
  45844. // ensure only append when value is already string, otherwise it will be cast
  45845. // to string and cause the type check to miss.
  45846. function prependModifier (value, symbol) {
  45847. return typeof value === 'string' ? symbol + value : value
  45848. }
  45849. /* */
  45850. function installRenderHelpers (target) {
  45851. target._o = markOnce;
  45852. target._n = toNumber;
  45853. target._s = toString;
  45854. target._l = renderList;
  45855. target._t = renderSlot;
  45856. target._q = looseEqual;
  45857. target._i = looseIndexOf;
  45858. target._m = renderStatic;
  45859. target._f = resolveFilter;
  45860. target._k = checkKeyCodes;
  45861. target._b = bindObjectProps;
  45862. target._v = createTextVNode;
  45863. target._e = createEmptyVNode;
  45864. target._u = resolveScopedSlots;
  45865. target._g = bindObjectListeners;
  45866. target._d = bindDynamicKeys;
  45867. target._p = prependModifier;
  45868. }
  45869. /* */
  45870. function FunctionalRenderContext (
  45871. data,
  45872. props,
  45873. children,
  45874. parent,
  45875. Ctor
  45876. ) {
  45877. var this$1 = this;
  45878. var options = Ctor.options;
  45879. // ensure the createElement function in functional components
  45880. // gets a unique context - this is necessary for correct named slot check
  45881. var contextVm;
  45882. if (hasOwn(parent, '_uid')) {
  45883. contextVm = Object.create(parent);
  45884. // $flow-disable-line
  45885. contextVm._original = parent;
  45886. } else {
  45887. // the context vm passed in is a functional context as well.
  45888. // in this case we want to make sure we are able to get a hold to the
  45889. // real context instance.
  45890. contextVm = parent;
  45891. // $flow-disable-line
  45892. parent = parent._original;
  45893. }
  45894. var isCompiled = isTrue(options._compiled);
  45895. var needNormalization = !isCompiled;
  45896. this.data = data;
  45897. this.props = props;
  45898. this.children = children;
  45899. this.parent = parent;
  45900. this.listeners = data.on || emptyObject;
  45901. this.injections = resolveInject(options.inject, parent);
  45902. this.slots = function () {
  45903. if (!this$1.$slots) {
  45904. normalizeScopedSlots(
  45905. data.scopedSlots,
  45906. this$1.$slots = resolveSlots(children, parent)
  45907. );
  45908. }
  45909. return this$1.$slots
  45910. };
  45911. Object.defineProperty(this, 'scopedSlots', ({
  45912. enumerable: true,
  45913. get: function get () {
  45914. return normalizeScopedSlots(data.scopedSlots, this.slots())
  45915. }
  45916. }));
  45917. // support for compiled functional template
  45918. if (isCompiled) {
  45919. // exposing $options for renderStatic()
  45920. this.$options = options;
  45921. // pre-resolve slots for renderSlot()
  45922. this.$slots = this.slots();
  45923. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  45924. }
  45925. if (options._scopeId) {
  45926. this._c = function (a, b, c, d) {
  45927. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  45928. if (vnode && !Array.isArray(vnode)) {
  45929. vnode.fnScopeId = options._scopeId;
  45930. vnode.fnContext = parent;
  45931. }
  45932. return vnode
  45933. };
  45934. } else {
  45935. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  45936. }
  45937. }
  45938. installRenderHelpers(FunctionalRenderContext.prototype);
  45939. function createFunctionalComponent (
  45940. Ctor,
  45941. propsData,
  45942. data,
  45943. contextVm,
  45944. children
  45945. ) {
  45946. var options = Ctor.options;
  45947. var props = {};
  45948. var propOptions = options.props;
  45949. if (isDef(propOptions)) {
  45950. for (var key in propOptions) {
  45951. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  45952. }
  45953. } else {
  45954. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  45955. if (isDef(data.props)) { mergeProps(props, data.props); }
  45956. }
  45957. var renderContext = new FunctionalRenderContext(
  45958. data,
  45959. props,
  45960. children,
  45961. contextVm,
  45962. Ctor
  45963. );
  45964. var vnode = options.render.call(null, renderContext._c, renderContext);
  45965. if (vnode instanceof VNode) {
  45966. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  45967. } else if (Array.isArray(vnode)) {
  45968. var vnodes = normalizeChildren(vnode) || [];
  45969. var res = new Array(vnodes.length);
  45970. for (var i = 0; i < vnodes.length; i++) {
  45971. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  45972. }
  45973. return res
  45974. }
  45975. }
  45976. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  45977. // #7817 clone node before setting fnContext, otherwise if the node is reused
  45978. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  45979. // that should not be matched to match.
  45980. var clone = cloneVNode(vnode);
  45981. clone.fnContext = contextVm;
  45982. clone.fnOptions = options;
  45983. {
  45984. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  45985. }
  45986. if (data.slot) {
  45987. (clone.data || (clone.data = {})).slot = data.slot;
  45988. }
  45989. return clone
  45990. }
  45991. function mergeProps (to, from) {
  45992. for (var key in from) {
  45993. to[camelize(key)] = from[key];
  45994. }
  45995. }
  45996. /* */
  45997. /* */
  45998. /* */
  45999. /* */
  46000. // inline hooks to be invoked on component VNodes during patch
  46001. var componentVNodeHooks = {
  46002. init: function init (vnode, hydrating) {
  46003. if (
  46004. vnode.componentInstance &&
  46005. !vnode.componentInstance._isDestroyed &&
  46006. vnode.data.keepAlive
  46007. ) {
  46008. // kept-alive components, treat as a patch
  46009. var mountedNode = vnode; // work around flow
  46010. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  46011. } else {
  46012. var child = vnode.componentInstance = createComponentInstanceForVnode(
  46013. vnode,
  46014. activeInstance
  46015. );
  46016. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  46017. }
  46018. },
  46019. prepatch: function prepatch (oldVnode, vnode) {
  46020. var options = vnode.componentOptions;
  46021. var child = vnode.componentInstance = oldVnode.componentInstance;
  46022. updateChildComponent(
  46023. child,
  46024. options.propsData, // updated props
  46025. options.listeners, // updated listeners
  46026. vnode, // new parent vnode
  46027. options.children // new children
  46028. );
  46029. },
  46030. insert: function insert (vnode) {
  46031. var context = vnode.context;
  46032. var componentInstance = vnode.componentInstance;
  46033. if (!componentInstance._isMounted) {
  46034. componentInstance._isMounted = true;
  46035. callHook(componentInstance, 'mounted');
  46036. }
  46037. if (vnode.data.keepAlive) {
  46038. if (context._isMounted) {
  46039. // vue-router#1212
  46040. // During updates, a kept-alive component's child components may
  46041. // change, so directly walking the tree here may call activated hooks
  46042. // on incorrect children. Instead we push them into a queue which will
  46043. // be processed after the whole patch process ended.
  46044. queueActivatedComponent(componentInstance);
  46045. } else {
  46046. activateChildComponent(componentInstance, true /* direct */);
  46047. }
  46048. }
  46049. },
  46050. destroy: function destroy (vnode) {
  46051. var componentInstance = vnode.componentInstance;
  46052. if (!componentInstance._isDestroyed) {
  46053. if (!vnode.data.keepAlive) {
  46054. componentInstance.$destroy();
  46055. } else {
  46056. deactivateChildComponent(componentInstance, true /* direct */);
  46057. }
  46058. }
  46059. }
  46060. };
  46061. var hooksToMerge = Object.keys(componentVNodeHooks);
  46062. function createComponent (
  46063. Ctor,
  46064. data,
  46065. context,
  46066. children,
  46067. tag
  46068. ) {
  46069. if (isUndef(Ctor)) {
  46070. return
  46071. }
  46072. var baseCtor = context.$options._base;
  46073. // plain options object: turn it into a constructor
  46074. if (isObject(Ctor)) {
  46075. Ctor = baseCtor.extend(Ctor);
  46076. }
  46077. // if at this stage it's not a constructor or an async component factory,
  46078. // reject.
  46079. if (typeof Ctor !== 'function') {
  46080. {
  46081. warn(("Invalid Component definition: " + (String(Ctor))), context);
  46082. }
  46083. return
  46084. }
  46085. // async component
  46086. var asyncFactory;
  46087. if (isUndef(Ctor.cid)) {
  46088. asyncFactory = Ctor;
  46089. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  46090. if (Ctor === undefined) {
  46091. // return a placeholder node for async component, which is rendered
  46092. // as a comment node but preserves all the raw information for the node.
  46093. // the information will be used for async server-rendering and hydration.
  46094. return createAsyncPlaceholder(
  46095. asyncFactory,
  46096. data,
  46097. context,
  46098. children,
  46099. tag
  46100. )
  46101. }
  46102. }
  46103. data = data || {};
  46104. // resolve constructor options in case global mixins are applied after
  46105. // component constructor creation
  46106. resolveConstructorOptions(Ctor);
  46107. // transform component v-model data into props & events
  46108. if (isDef(data.model)) {
  46109. transformModel(Ctor.options, data);
  46110. }
  46111. // extract props
  46112. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  46113. // functional component
  46114. if (isTrue(Ctor.options.functional)) {
  46115. return createFunctionalComponent(Ctor, propsData, data, context, children)
  46116. }
  46117. // extract listeners, since these needs to be treated as
  46118. // child component listeners instead of DOM listeners
  46119. var listeners = data.on;
  46120. // replace with listeners with .native modifier
  46121. // so it gets processed during parent component patch.
  46122. data.on = data.nativeOn;
  46123. if (isTrue(Ctor.options.abstract)) {
  46124. // abstract components do not keep anything
  46125. // other than props & listeners & slot
  46126. // work around flow
  46127. var slot = data.slot;
  46128. data = {};
  46129. if (slot) {
  46130. data.slot = slot;
  46131. }
  46132. }
  46133. // install component management hooks onto the placeholder node
  46134. installComponentHooks(data);
  46135. // return a placeholder vnode
  46136. var name = Ctor.options.name || tag;
  46137. var vnode = new VNode(
  46138. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  46139. data, undefined, undefined, undefined, context,
  46140. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  46141. asyncFactory
  46142. );
  46143. return vnode
  46144. }
  46145. function createComponentInstanceForVnode (
  46146. vnode, // we know it's MountedComponentVNode but flow doesn't
  46147. parent // activeInstance in lifecycle state
  46148. ) {
  46149. var options = {
  46150. _isComponent: true,
  46151. _parentVnode: vnode,
  46152. parent: parent
  46153. };
  46154. // check inline-template render functions
  46155. var inlineTemplate = vnode.data.inlineTemplate;
  46156. if (isDef(inlineTemplate)) {
  46157. options.render = inlineTemplate.render;
  46158. options.staticRenderFns = inlineTemplate.staticRenderFns;
  46159. }
  46160. return new vnode.componentOptions.Ctor(options)
  46161. }
  46162. function installComponentHooks (data) {
  46163. var hooks = data.hook || (data.hook = {});
  46164. for (var i = 0; i < hooksToMerge.length; i++) {
  46165. var key = hooksToMerge[i];
  46166. var existing = hooks[key];
  46167. var toMerge = componentVNodeHooks[key];
  46168. if (existing !== toMerge && !(existing && existing._merged)) {
  46169. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  46170. }
  46171. }
  46172. }
  46173. function mergeHook$1 (f1, f2) {
  46174. var merged = function (a, b) {
  46175. // flow complains about extra args which is why we use any
  46176. f1(a, b);
  46177. f2(a, b);
  46178. };
  46179. merged._merged = true;
  46180. return merged
  46181. }
  46182. // transform component v-model info (value and callback) into
  46183. // prop and event handler respectively.
  46184. function transformModel (options, data) {
  46185. var prop = (options.model && options.model.prop) || 'value';
  46186. var event = (options.model && options.model.event) || 'input'
  46187. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  46188. var on = data.on || (data.on = {});
  46189. var existing = on[event];
  46190. var callback = data.model.callback;
  46191. if (isDef(existing)) {
  46192. if (
  46193. Array.isArray(existing)
  46194. ? existing.indexOf(callback) === -1
  46195. : existing !== callback
  46196. ) {
  46197. on[event] = [callback].concat(existing);
  46198. }
  46199. } else {
  46200. on[event] = callback;
  46201. }
  46202. }
  46203. /* */
  46204. var SIMPLE_NORMALIZE = 1;
  46205. var ALWAYS_NORMALIZE = 2;
  46206. // wrapper function for providing a more flexible interface
  46207. // without getting yelled at by flow
  46208. function createElement (
  46209. context,
  46210. tag,
  46211. data,
  46212. children,
  46213. normalizationType,
  46214. alwaysNormalize
  46215. ) {
  46216. if (Array.isArray(data) || isPrimitive(data)) {
  46217. normalizationType = children;
  46218. children = data;
  46219. data = undefined;
  46220. }
  46221. if (isTrue(alwaysNormalize)) {
  46222. normalizationType = ALWAYS_NORMALIZE;
  46223. }
  46224. return _createElement(context, tag, data, children, normalizationType)
  46225. }
  46226. function _createElement (
  46227. context,
  46228. tag,
  46229. data,
  46230. children,
  46231. normalizationType
  46232. ) {
  46233. if (isDef(data) && isDef((data).__ob__)) {
  46234. warn(
  46235. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  46236. 'Always create fresh vnode data objects in each render!',
  46237. context
  46238. );
  46239. return createEmptyVNode()
  46240. }
  46241. // object syntax in v-bind
  46242. if (isDef(data) && isDef(data.is)) {
  46243. tag = data.is;
  46244. }
  46245. if (!tag) {
  46246. // in case of component :is set to falsy value
  46247. return createEmptyVNode()
  46248. }
  46249. // warn against non-primitive key
  46250. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  46251. ) {
  46252. {
  46253. warn(
  46254. 'Avoid using non-primitive value as key, ' +
  46255. 'use string/number value instead.',
  46256. context
  46257. );
  46258. }
  46259. }
  46260. // support single function children as default scoped slot
  46261. if (Array.isArray(children) &&
  46262. typeof children[0] === 'function'
  46263. ) {
  46264. data = data || {};
  46265. data.scopedSlots = { default: children[0] };
  46266. children.length = 0;
  46267. }
  46268. if (normalizationType === ALWAYS_NORMALIZE) {
  46269. children = normalizeChildren(children);
  46270. } else if (normalizationType === SIMPLE_NORMALIZE) {
  46271. children = simpleNormalizeChildren(children);
  46272. }
  46273. var vnode, ns;
  46274. if (typeof tag === 'string') {
  46275. var Ctor;
  46276. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  46277. if (config.isReservedTag(tag)) {
  46278. // platform built-in elements
  46279. if (isDef(data) && isDef(data.nativeOn)) {
  46280. warn(
  46281. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  46282. context
  46283. );
  46284. }
  46285. vnode = new VNode(
  46286. config.parsePlatformTagName(tag), data, children,
  46287. undefined, undefined, context
  46288. );
  46289. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  46290. // component
  46291. vnode = createComponent(Ctor, data, context, children, tag);
  46292. } else {
  46293. // unknown or unlisted namespaced elements
  46294. // check at runtime because it may get assigned a namespace when its
  46295. // parent normalizes children
  46296. vnode = new VNode(
  46297. tag, data, children,
  46298. undefined, undefined, context
  46299. );
  46300. }
  46301. } else {
  46302. // direct component options / constructor
  46303. vnode = createComponent(tag, data, context, children);
  46304. }
  46305. if (Array.isArray(vnode)) {
  46306. return vnode
  46307. } else if (isDef(vnode)) {
  46308. if (isDef(ns)) { applyNS(vnode, ns); }
  46309. if (isDef(data)) { registerDeepBindings(data); }
  46310. return vnode
  46311. } else {
  46312. return createEmptyVNode()
  46313. }
  46314. }
  46315. function applyNS (vnode, ns, force) {
  46316. vnode.ns = ns;
  46317. if (vnode.tag === 'foreignObject') {
  46318. // use default namespace inside foreignObject
  46319. ns = undefined;
  46320. force = true;
  46321. }
  46322. if (isDef(vnode.children)) {
  46323. for (var i = 0, l = vnode.children.length; i < l; i++) {
  46324. var child = vnode.children[i];
  46325. if (isDef(child.tag) && (
  46326. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  46327. applyNS(child, ns, force);
  46328. }
  46329. }
  46330. }
  46331. }
  46332. // ref #5318
  46333. // necessary to ensure parent re-render when deep bindings like :style and
  46334. // :class are used on slot nodes
  46335. function registerDeepBindings (data) {
  46336. if (isObject(data.style)) {
  46337. traverse(data.style);
  46338. }
  46339. if (isObject(data.class)) {
  46340. traverse(data.class);
  46341. }
  46342. }
  46343. /* */
  46344. function initRender (vm) {
  46345. vm._vnode = null; // the root of the child tree
  46346. vm._staticTrees = null; // v-once cached trees
  46347. var options = vm.$options;
  46348. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  46349. var renderContext = parentVnode && parentVnode.context;
  46350. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  46351. vm.$scopedSlots = emptyObject;
  46352. // bind the createElement fn to this instance
  46353. // so that we get proper render context inside it.
  46354. // args order: tag, data, children, normalizationType, alwaysNormalize
  46355. // internal version is used by render functions compiled from templates
  46356. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  46357. // normalization is always applied for the public version, used in
  46358. // user-written render functions.
  46359. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  46360. // $attrs & $listeners are exposed for easier HOC creation.
  46361. // they need to be reactive so that HOCs using them are always updated
  46362. var parentData = parentVnode && parentVnode.data;
  46363. /* istanbul ignore else */
  46364. {
  46365. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  46366. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  46367. }, true);
  46368. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  46369. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  46370. }, true);
  46371. }
  46372. }
  46373. var currentRenderingInstance = null;
  46374. function renderMixin (Vue) {
  46375. // install runtime convenience helpers
  46376. installRenderHelpers(Vue.prototype);
  46377. Vue.prototype.$nextTick = function (fn) {
  46378. return nextTick(fn, this)
  46379. };
  46380. Vue.prototype._render = function () {
  46381. var vm = this;
  46382. var ref = vm.$options;
  46383. var render = ref.render;
  46384. var _parentVnode = ref._parentVnode;
  46385. if (_parentVnode) {
  46386. vm.$scopedSlots = normalizeScopedSlots(
  46387. _parentVnode.data.scopedSlots,
  46388. vm.$slots,
  46389. vm.$scopedSlots
  46390. );
  46391. }
  46392. // set parent vnode. this allows render functions to have access
  46393. // to the data on the placeholder node.
  46394. vm.$vnode = _parentVnode;
  46395. // render self
  46396. var vnode;
  46397. try {
  46398. // There's no need to maintain a stack because all render fns are called
  46399. // separately from one another. Nested component's render fns are called
  46400. // when parent component is patched.
  46401. currentRenderingInstance = vm;
  46402. vnode = render.call(vm._renderProxy, vm.$createElement);
  46403. } catch (e) {
  46404. handleError(e, vm, "render");
  46405. // return error render result,
  46406. // or previous vnode to prevent render error causing blank component
  46407. /* istanbul ignore else */
  46408. if (vm.$options.renderError) {
  46409. try {
  46410. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  46411. } catch (e) {
  46412. handleError(e, vm, "renderError");
  46413. vnode = vm._vnode;
  46414. }
  46415. } else {
  46416. vnode = vm._vnode;
  46417. }
  46418. } finally {
  46419. currentRenderingInstance = null;
  46420. }
  46421. // if the returned array contains only a single node, allow it
  46422. if (Array.isArray(vnode) && vnode.length === 1) {
  46423. vnode = vnode[0];
  46424. }
  46425. // return empty vnode in case the render function errored out
  46426. if (!(vnode instanceof VNode)) {
  46427. if (Array.isArray(vnode)) {
  46428. warn(
  46429. 'Multiple root nodes returned from render function. Render function ' +
  46430. 'should return a single root node.',
  46431. vm
  46432. );
  46433. }
  46434. vnode = createEmptyVNode();
  46435. }
  46436. // set parent
  46437. vnode.parent = _parentVnode;
  46438. return vnode
  46439. };
  46440. }
  46441. /* */
  46442. function ensureCtor (comp, base) {
  46443. if (
  46444. comp.__esModule ||
  46445. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  46446. ) {
  46447. comp = comp.default;
  46448. }
  46449. return isObject(comp)
  46450. ? base.extend(comp)
  46451. : comp
  46452. }
  46453. function createAsyncPlaceholder (
  46454. factory,
  46455. data,
  46456. context,
  46457. children,
  46458. tag
  46459. ) {
  46460. var node = createEmptyVNode();
  46461. node.asyncFactory = factory;
  46462. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  46463. return node
  46464. }
  46465. function resolveAsyncComponent (
  46466. factory,
  46467. baseCtor
  46468. ) {
  46469. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  46470. return factory.errorComp
  46471. }
  46472. if (isDef(factory.resolved)) {
  46473. return factory.resolved
  46474. }
  46475. var owner = currentRenderingInstance;
  46476. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  46477. // already pending
  46478. factory.owners.push(owner);
  46479. }
  46480. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  46481. return factory.loadingComp
  46482. }
  46483. if (owner && !isDef(factory.owners)) {
  46484. var owners = factory.owners = [owner];
  46485. var sync = true;
  46486. var timerLoading = null;
  46487. var timerTimeout = null
  46488. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  46489. var forceRender = function (renderCompleted) {
  46490. for (var i = 0, l = owners.length; i < l; i++) {
  46491. (owners[i]).$forceUpdate();
  46492. }
  46493. if (renderCompleted) {
  46494. owners.length = 0;
  46495. if (timerLoading !== null) {
  46496. clearTimeout(timerLoading);
  46497. timerLoading = null;
  46498. }
  46499. if (timerTimeout !== null) {
  46500. clearTimeout(timerTimeout);
  46501. timerTimeout = null;
  46502. }
  46503. }
  46504. };
  46505. var resolve = once(function (res) {
  46506. // cache resolved
  46507. factory.resolved = ensureCtor(res, baseCtor);
  46508. // invoke callbacks only if this is not a synchronous resolve
  46509. // (async resolves are shimmed as synchronous during SSR)
  46510. if (!sync) {
  46511. forceRender(true);
  46512. } else {
  46513. owners.length = 0;
  46514. }
  46515. });
  46516. var reject = once(function (reason) {
  46517. warn(
  46518. "Failed to resolve async component: " + (String(factory)) +
  46519. (reason ? ("\nReason: " + reason) : '')
  46520. );
  46521. if (isDef(factory.errorComp)) {
  46522. factory.error = true;
  46523. forceRender(true);
  46524. }
  46525. });
  46526. var res = factory(resolve, reject);
  46527. if (isObject(res)) {
  46528. if (isPromise(res)) {
  46529. // () => Promise
  46530. if (isUndef(factory.resolved)) {
  46531. res.then(resolve, reject);
  46532. }
  46533. } else if (isPromise(res.component)) {
  46534. res.component.then(resolve, reject);
  46535. if (isDef(res.error)) {
  46536. factory.errorComp = ensureCtor(res.error, baseCtor);
  46537. }
  46538. if (isDef(res.loading)) {
  46539. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  46540. if (res.delay === 0) {
  46541. factory.loading = true;
  46542. } else {
  46543. timerLoading = setTimeout(function () {
  46544. timerLoading = null;
  46545. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  46546. factory.loading = true;
  46547. forceRender(false);
  46548. }
  46549. }, res.delay || 200);
  46550. }
  46551. }
  46552. if (isDef(res.timeout)) {
  46553. timerTimeout = setTimeout(function () {
  46554. timerTimeout = null;
  46555. if (isUndef(factory.resolved)) {
  46556. reject(
  46557. "timeout (" + (res.timeout) + "ms)"
  46558. );
  46559. }
  46560. }, res.timeout);
  46561. }
  46562. }
  46563. }
  46564. sync = false;
  46565. // return in case resolved synchronously
  46566. return factory.loading
  46567. ? factory.loadingComp
  46568. : factory.resolved
  46569. }
  46570. }
  46571. /* */
  46572. function isAsyncPlaceholder (node) {
  46573. return node.isComment && node.asyncFactory
  46574. }
  46575. /* */
  46576. function getFirstComponentChild (children) {
  46577. if (Array.isArray(children)) {
  46578. for (var i = 0; i < children.length; i++) {
  46579. var c = children[i];
  46580. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  46581. return c
  46582. }
  46583. }
  46584. }
  46585. }
  46586. /* */
  46587. /* */
  46588. function initEvents (vm) {
  46589. vm._events = Object.create(null);
  46590. vm._hasHookEvent = false;
  46591. // init parent attached events
  46592. var listeners = vm.$options._parentListeners;
  46593. if (listeners) {
  46594. updateComponentListeners(vm, listeners);
  46595. }
  46596. }
  46597. var target;
  46598. function add (event, fn) {
  46599. target.$on(event, fn);
  46600. }
  46601. function remove$1 (event, fn) {
  46602. target.$off(event, fn);
  46603. }
  46604. function createOnceHandler (event, fn) {
  46605. var _target = target;
  46606. return function onceHandler () {
  46607. var res = fn.apply(null, arguments);
  46608. if (res !== null) {
  46609. _target.$off(event, onceHandler);
  46610. }
  46611. }
  46612. }
  46613. function updateComponentListeners (
  46614. vm,
  46615. listeners,
  46616. oldListeners
  46617. ) {
  46618. target = vm;
  46619. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  46620. target = undefined;
  46621. }
  46622. function eventsMixin (Vue) {
  46623. var hookRE = /^hook:/;
  46624. Vue.prototype.$on = function (event, fn) {
  46625. var vm = this;
  46626. if (Array.isArray(event)) {
  46627. for (var i = 0, l = event.length; i < l; i++) {
  46628. vm.$on(event[i], fn);
  46629. }
  46630. } else {
  46631. (vm._events[event] || (vm._events[event] = [])).push(fn);
  46632. // optimize hook:event cost by using a boolean flag marked at registration
  46633. // instead of a hash lookup
  46634. if (hookRE.test(event)) {
  46635. vm._hasHookEvent = true;
  46636. }
  46637. }
  46638. return vm
  46639. };
  46640. Vue.prototype.$once = function (event, fn) {
  46641. var vm = this;
  46642. function on () {
  46643. vm.$off(event, on);
  46644. fn.apply(vm, arguments);
  46645. }
  46646. on.fn = fn;
  46647. vm.$on(event, on);
  46648. return vm
  46649. };
  46650. Vue.prototype.$off = function (event, fn) {
  46651. var vm = this;
  46652. // all
  46653. if (!arguments.length) {
  46654. vm._events = Object.create(null);
  46655. return vm
  46656. }
  46657. // array of events
  46658. if (Array.isArray(event)) {
  46659. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  46660. vm.$off(event[i$1], fn);
  46661. }
  46662. return vm
  46663. }
  46664. // specific event
  46665. var cbs = vm._events[event];
  46666. if (!cbs) {
  46667. return vm
  46668. }
  46669. if (!fn) {
  46670. vm._events[event] = null;
  46671. return vm
  46672. }
  46673. // specific handler
  46674. var cb;
  46675. var i = cbs.length;
  46676. while (i--) {
  46677. cb = cbs[i];
  46678. if (cb === fn || cb.fn === fn) {
  46679. cbs.splice(i, 1);
  46680. break
  46681. }
  46682. }
  46683. return vm
  46684. };
  46685. Vue.prototype.$emit = function (event) {
  46686. var vm = this;
  46687. {
  46688. var lowerCaseEvent = event.toLowerCase();
  46689. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  46690. tip(
  46691. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  46692. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  46693. "Note that HTML attributes are case-insensitive and you cannot use " +
  46694. "v-on to listen to camelCase events when using in-DOM templates. " +
  46695. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  46696. );
  46697. }
  46698. }
  46699. var cbs = vm._events[event];
  46700. if (cbs) {
  46701. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  46702. var args = toArray(arguments, 1);
  46703. var info = "event handler for \"" + event + "\"";
  46704. for (var i = 0, l = cbs.length; i < l; i++) {
  46705. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  46706. }
  46707. }
  46708. return vm
  46709. };
  46710. }
  46711. /* */
  46712. var activeInstance = null;
  46713. var isUpdatingChildComponent = false;
  46714. function setActiveInstance(vm) {
  46715. var prevActiveInstance = activeInstance;
  46716. activeInstance = vm;
  46717. return function () {
  46718. activeInstance = prevActiveInstance;
  46719. }
  46720. }
  46721. function initLifecycle (vm) {
  46722. var options = vm.$options;
  46723. // locate first non-abstract parent
  46724. var parent = options.parent;
  46725. if (parent && !options.abstract) {
  46726. while (parent.$options.abstract && parent.$parent) {
  46727. parent = parent.$parent;
  46728. }
  46729. parent.$children.push(vm);
  46730. }
  46731. vm.$parent = parent;
  46732. vm.$root = parent ? parent.$root : vm;
  46733. vm.$children = [];
  46734. vm.$refs = {};
  46735. vm._watcher = null;
  46736. vm._inactive = null;
  46737. vm._directInactive = false;
  46738. vm._isMounted = false;
  46739. vm._isDestroyed = false;
  46740. vm._isBeingDestroyed = false;
  46741. }
  46742. function lifecycleMixin (Vue) {
  46743. Vue.prototype._update = function (vnode, hydrating) {
  46744. var vm = this;
  46745. var prevEl = vm.$el;
  46746. var prevVnode = vm._vnode;
  46747. var restoreActiveInstance = setActiveInstance(vm);
  46748. vm._vnode = vnode;
  46749. // Vue.prototype.__patch__ is injected in entry points
  46750. // based on the rendering backend used.
  46751. if (!prevVnode) {
  46752. // initial render
  46753. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  46754. } else {
  46755. // updates
  46756. vm.$el = vm.__patch__(prevVnode, vnode);
  46757. }
  46758. restoreActiveInstance();
  46759. // update __vue__ reference
  46760. if (prevEl) {
  46761. prevEl.__vue__ = null;
  46762. }
  46763. if (vm.$el) {
  46764. vm.$el.__vue__ = vm;
  46765. }
  46766. // if parent is an HOC, update its $el as well
  46767. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  46768. vm.$parent.$el = vm.$el;
  46769. }
  46770. // updated hook is called by the scheduler to ensure that children are
  46771. // updated in a parent's updated hook.
  46772. };
  46773. Vue.prototype.$forceUpdate = function () {
  46774. var vm = this;
  46775. if (vm._watcher) {
  46776. vm._watcher.update();
  46777. }
  46778. };
  46779. Vue.prototype.$destroy = function () {
  46780. var vm = this;
  46781. if (vm._isBeingDestroyed) {
  46782. return
  46783. }
  46784. callHook(vm, 'beforeDestroy');
  46785. vm._isBeingDestroyed = true;
  46786. // remove self from parent
  46787. var parent = vm.$parent;
  46788. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  46789. remove(parent.$children, vm);
  46790. }
  46791. // teardown watchers
  46792. if (vm._watcher) {
  46793. vm._watcher.teardown();
  46794. }
  46795. var i = vm._watchers.length;
  46796. while (i--) {
  46797. vm._watchers[i].teardown();
  46798. }
  46799. // remove reference from data ob
  46800. // frozen object may not have observer.
  46801. if (vm._data.__ob__) {
  46802. vm._data.__ob__.vmCount--;
  46803. }
  46804. // call the last hook...
  46805. vm._isDestroyed = true;
  46806. // invoke destroy hooks on current rendered tree
  46807. vm.__patch__(vm._vnode, null);
  46808. // fire destroyed hook
  46809. callHook(vm, 'destroyed');
  46810. // turn off all instance listeners.
  46811. vm.$off();
  46812. // remove __vue__ reference
  46813. if (vm.$el) {
  46814. vm.$el.__vue__ = null;
  46815. }
  46816. // release circular reference (#6759)
  46817. if (vm.$vnode) {
  46818. vm.$vnode.parent = null;
  46819. }
  46820. };
  46821. }
  46822. function mountComponent (
  46823. vm,
  46824. el,
  46825. hydrating
  46826. ) {
  46827. vm.$el = el;
  46828. if (!vm.$options.render) {
  46829. vm.$options.render = createEmptyVNode;
  46830. {
  46831. /* istanbul ignore if */
  46832. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  46833. vm.$options.el || el) {
  46834. warn(
  46835. 'You are using the runtime-only build of Vue where the template ' +
  46836. 'compiler is not available. Either pre-compile the templates into ' +
  46837. 'render functions, or use the compiler-included build.',
  46838. vm
  46839. );
  46840. } else {
  46841. warn(
  46842. 'Failed to mount component: template or render function not defined.',
  46843. vm
  46844. );
  46845. }
  46846. }
  46847. }
  46848. callHook(vm, 'beforeMount');
  46849. var updateComponent;
  46850. /* istanbul ignore if */
  46851. if (config.performance && mark) {
  46852. updateComponent = function () {
  46853. var name = vm._name;
  46854. var id = vm._uid;
  46855. var startTag = "vue-perf-start:" + id;
  46856. var endTag = "vue-perf-end:" + id;
  46857. mark(startTag);
  46858. var vnode = vm._render();
  46859. mark(endTag);
  46860. measure(("vue " + name + " render"), startTag, endTag);
  46861. mark(startTag);
  46862. vm._update(vnode, hydrating);
  46863. mark(endTag);
  46864. measure(("vue " + name + " patch"), startTag, endTag);
  46865. };
  46866. } else {
  46867. updateComponent = function () {
  46868. vm._update(vm._render(), hydrating);
  46869. };
  46870. }
  46871. // we set this to vm._watcher inside the watcher's constructor
  46872. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  46873. // component's mounted hook), which relies on vm._watcher being already defined
  46874. new Watcher(vm, updateComponent, noop, {
  46875. before: function before () {
  46876. if (vm._isMounted && !vm._isDestroyed) {
  46877. callHook(vm, 'beforeUpdate');
  46878. }
  46879. }
  46880. }, true /* isRenderWatcher */);
  46881. hydrating = false;
  46882. // manually mounted instance, call mounted on self
  46883. // mounted is called for render-created child components in its inserted hook
  46884. if (vm.$vnode == null) {
  46885. vm._isMounted = true;
  46886. callHook(vm, 'mounted');
  46887. }
  46888. return vm
  46889. }
  46890. function updateChildComponent (
  46891. vm,
  46892. propsData,
  46893. listeners,
  46894. parentVnode,
  46895. renderChildren
  46896. ) {
  46897. {
  46898. isUpdatingChildComponent = true;
  46899. }
  46900. // determine whether component has slot children
  46901. // we need to do this before overwriting $options._renderChildren.
  46902. // check if there are dynamic scopedSlots (hand-written or compiled but with
  46903. // dynamic slot names). Static scoped slots compiled from template has the
  46904. // "$stable" marker.
  46905. var newScopedSlots = parentVnode.data.scopedSlots;
  46906. var oldScopedSlots = vm.$scopedSlots;
  46907. var hasDynamicScopedSlot = !!(
  46908. (newScopedSlots && !newScopedSlots.$stable) ||
  46909. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  46910. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  46911. );
  46912. // Any static slot children from the parent may have changed during parent's
  46913. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  46914. // update is necessary to ensure correctness.
  46915. var needsForceUpdate = !!(
  46916. renderChildren || // has new static slots
  46917. vm.$options._renderChildren || // has old static slots
  46918. hasDynamicScopedSlot
  46919. );
  46920. vm.$options._parentVnode = parentVnode;
  46921. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  46922. if (vm._vnode) { // update child tree's parent
  46923. vm._vnode.parent = parentVnode;
  46924. }
  46925. vm.$options._renderChildren = renderChildren;
  46926. // update $attrs and $listeners hash
  46927. // these are also reactive so they may trigger child update if the child
  46928. // used them during render
  46929. vm.$attrs = parentVnode.data.attrs || emptyObject;
  46930. vm.$listeners = listeners || emptyObject;
  46931. // update props
  46932. if (propsData && vm.$options.props) {
  46933. toggleObserving(false);
  46934. var props = vm._props;
  46935. var propKeys = vm.$options._propKeys || [];
  46936. for (var i = 0; i < propKeys.length; i++) {
  46937. var key = propKeys[i];
  46938. var propOptions = vm.$options.props; // wtf flow?
  46939. props[key] = validateProp(key, propOptions, propsData, vm);
  46940. }
  46941. toggleObserving(true);
  46942. // keep a copy of raw propsData
  46943. vm.$options.propsData = propsData;
  46944. }
  46945. // update listeners
  46946. listeners = listeners || emptyObject;
  46947. var oldListeners = vm.$options._parentListeners;
  46948. vm.$options._parentListeners = listeners;
  46949. updateComponentListeners(vm, listeners, oldListeners);
  46950. // resolve slots + force update if has children
  46951. if (needsForceUpdate) {
  46952. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  46953. vm.$forceUpdate();
  46954. }
  46955. {
  46956. isUpdatingChildComponent = false;
  46957. }
  46958. }
  46959. function isInInactiveTree (vm) {
  46960. while (vm && (vm = vm.$parent)) {
  46961. if (vm._inactive) { return true }
  46962. }
  46963. return false
  46964. }
  46965. function activateChildComponent (vm, direct) {
  46966. if (direct) {
  46967. vm._directInactive = false;
  46968. if (isInInactiveTree(vm)) {
  46969. return
  46970. }
  46971. } else if (vm._directInactive) {
  46972. return
  46973. }
  46974. if (vm._inactive || vm._inactive === null) {
  46975. vm._inactive = false;
  46976. for (var i = 0; i < vm.$children.length; i++) {
  46977. activateChildComponent(vm.$children[i]);
  46978. }
  46979. callHook(vm, 'activated');
  46980. }
  46981. }
  46982. function deactivateChildComponent (vm, direct) {
  46983. if (direct) {
  46984. vm._directInactive = true;
  46985. if (isInInactiveTree(vm)) {
  46986. return
  46987. }
  46988. }
  46989. if (!vm._inactive) {
  46990. vm._inactive = true;
  46991. for (var i = 0; i < vm.$children.length; i++) {
  46992. deactivateChildComponent(vm.$children[i]);
  46993. }
  46994. callHook(vm, 'deactivated');
  46995. }
  46996. }
  46997. function callHook (vm, hook) {
  46998. // #7573 disable dep collection when invoking lifecycle hooks
  46999. pushTarget();
  47000. var handlers = vm.$options[hook];
  47001. var info = hook + " hook";
  47002. if (handlers) {
  47003. for (var i = 0, j = handlers.length; i < j; i++) {
  47004. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  47005. }
  47006. }
  47007. if (vm._hasHookEvent) {
  47008. vm.$emit('hook:' + hook);
  47009. }
  47010. popTarget();
  47011. }
  47012. /* */
  47013. var MAX_UPDATE_COUNT = 100;
  47014. var queue = [];
  47015. var activatedChildren = [];
  47016. var has = {};
  47017. var circular = {};
  47018. var waiting = false;
  47019. var flushing = false;
  47020. var index = 0;
  47021. /**
  47022. * Reset the scheduler's state.
  47023. */
  47024. function resetSchedulerState () {
  47025. index = queue.length = activatedChildren.length = 0;
  47026. has = {};
  47027. {
  47028. circular = {};
  47029. }
  47030. waiting = flushing = false;
  47031. }
  47032. // Async edge case #6566 requires saving the timestamp when event listeners are
  47033. // attached. However, calling performance.now() has a perf overhead especially
  47034. // if the page has thousands of event listeners. Instead, we take a timestamp
  47035. // every time the scheduler flushes and use that for all event listeners
  47036. // attached during that flush.
  47037. var currentFlushTimestamp = 0;
  47038. // Async edge case fix requires storing an event listener's attach timestamp.
  47039. var getNow = Date.now;
  47040. // Determine what event timestamp the browser is using. Annoyingly, the
  47041. // timestamp can either be hi-res (relative to page load) or low-res
  47042. // (relative to UNIX epoch), so in order to compare time we have to use the
  47043. // same timestamp type when saving the flush timestamp.
  47044. // All IE versions use low-res event timestamps, and have problematic clock
  47045. // implementations (#9632)
  47046. if (inBrowser && !isIE) {
  47047. var performance = window.performance;
  47048. if (
  47049. performance &&
  47050. typeof performance.now === 'function' &&
  47051. getNow() > document.createEvent('Event').timeStamp
  47052. ) {
  47053. // if the event timestamp, although evaluated AFTER the Date.now(), is
  47054. // smaller than it, it means the event is using a hi-res timestamp,
  47055. // and we need to use the hi-res version for event listener timestamps as
  47056. // well.
  47057. getNow = function () { return performance.now(); };
  47058. }
  47059. }
  47060. /**
  47061. * Flush both queues and run the watchers.
  47062. */
  47063. function flushSchedulerQueue () {
  47064. currentFlushTimestamp = getNow();
  47065. flushing = true;
  47066. var watcher, id;
  47067. // Sort queue before flush.
  47068. // This ensures that:
  47069. // 1. Components are updated from parent to child. (because parent is always
  47070. // created before the child)
  47071. // 2. A component's user watchers are run before its render watcher (because
  47072. // user watchers are created before the render watcher)
  47073. // 3. If a component is destroyed during a parent component's watcher run,
  47074. // its watchers can be skipped.
  47075. queue.sort(function (a, b) { return a.id - b.id; });
  47076. // do not cache length because more watchers might be pushed
  47077. // as we run existing watchers
  47078. for (index = 0; index < queue.length; index++) {
  47079. watcher = queue[index];
  47080. if (watcher.before) {
  47081. watcher.before();
  47082. }
  47083. id = watcher.id;
  47084. has[id] = null;
  47085. watcher.run();
  47086. // in dev build, check and stop circular updates.
  47087. if (has[id] != null) {
  47088. circular[id] = (circular[id] || 0) + 1;
  47089. if (circular[id] > MAX_UPDATE_COUNT) {
  47090. warn(
  47091. 'You may have an infinite update loop ' + (
  47092. watcher.user
  47093. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  47094. : "in a component render function."
  47095. ),
  47096. watcher.vm
  47097. );
  47098. break
  47099. }
  47100. }
  47101. }
  47102. // keep copies of post queues before resetting state
  47103. var activatedQueue = activatedChildren.slice();
  47104. var updatedQueue = queue.slice();
  47105. resetSchedulerState();
  47106. // call component updated and activated hooks
  47107. callActivatedHooks(activatedQueue);
  47108. callUpdatedHooks(updatedQueue);
  47109. // devtool hook
  47110. /* istanbul ignore if */
  47111. if (devtools && config.devtools) {
  47112. devtools.emit('flush');
  47113. }
  47114. }
  47115. function callUpdatedHooks (queue) {
  47116. var i = queue.length;
  47117. while (i--) {
  47118. var watcher = queue[i];
  47119. var vm = watcher.vm;
  47120. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  47121. callHook(vm, 'updated');
  47122. }
  47123. }
  47124. }
  47125. /**
  47126. * Queue a kept-alive component that was activated during patch.
  47127. * The queue will be processed after the entire tree has been patched.
  47128. */
  47129. function queueActivatedComponent (vm) {
  47130. // setting _inactive to false here so that a render function can
  47131. // rely on checking whether it's in an inactive tree (e.g. router-view)
  47132. vm._inactive = false;
  47133. activatedChildren.push(vm);
  47134. }
  47135. function callActivatedHooks (queue) {
  47136. for (var i = 0; i < queue.length; i++) {
  47137. queue[i]._inactive = true;
  47138. activateChildComponent(queue[i], true /* true */);
  47139. }
  47140. }
  47141. /**
  47142. * Push a watcher into the watcher queue.
  47143. * Jobs with duplicate IDs will be skipped unless it's
  47144. * pushed when the queue is being flushed.
  47145. */
  47146. function queueWatcher (watcher) {
  47147. var id = watcher.id;
  47148. if (has[id] == null) {
  47149. has[id] = true;
  47150. if (!flushing) {
  47151. queue.push(watcher);
  47152. } else {
  47153. // if already flushing, splice the watcher based on its id
  47154. // if already past its id, it will be run next immediately.
  47155. var i = queue.length - 1;
  47156. while (i > index && queue[i].id > watcher.id) {
  47157. i--;
  47158. }
  47159. queue.splice(i + 1, 0, watcher);
  47160. }
  47161. // queue the flush
  47162. if (!waiting) {
  47163. waiting = true;
  47164. if (!config.async) {
  47165. flushSchedulerQueue();
  47166. return
  47167. }
  47168. nextTick(flushSchedulerQueue);
  47169. }
  47170. }
  47171. }
  47172. /* */
  47173. var uid$2 = 0;
  47174. /**
  47175. * A watcher parses an expression, collects dependencies,
  47176. * and fires callback when the expression value changes.
  47177. * This is used for both the $watch() api and directives.
  47178. */
  47179. var Watcher = function Watcher (
  47180. vm,
  47181. expOrFn,
  47182. cb,
  47183. options,
  47184. isRenderWatcher
  47185. ) {
  47186. this.vm = vm;
  47187. if (isRenderWatcher) {
  47188. vm._watcher = this;
  47189. }
  47190. vm._watchers.push(this);
  47191. // options
  47192. if (options) {
  47193. this.deep = !!options.deep;
  47194. this.user = !!options.user;
  47195. this.lazy = !!options.lazy;
  47196. this.sync = !!options.sync;
  47197. this.before = options.before;
  47198. } else {
  47199. this.deep = this.user = this.lazy = this.sync = false;
  47200. }
  47201. this.cb = cb;
  47202. this.id = ++uid$2; // uid for batching
  47203. this.active = true;
  47204. this.dirty = this.lazy; // for lazy watchers
  47205. this.deps = [];
  47206. this.newDeps = [];
  47207. this.depIds = new _Set();
  47208. this.newDepIds = new _Set();
  47209. this.expression = expOrFn.toString();
  47210. // parse expression for getter
  47211. if (typeof expOrFn === 'function') {
  47212. this.getter = expOrFn;
  47213. } else {
  47214. this.getter = parsePath(expOrFn);
  47215. if (!this.getter) {
  47216. this.getter = noop;
  47217. warn(
  47218. "Failed watching path: \"" + expOrFn + "\" " +
  47219. 'Watcher only accepts simple dot-delimited paths. ' +
  47220. 'For full control, use a function instead.',
  47221. vm
  47222. );
  47223. }
  47224. }
  47225. this.value = this.lazy
  47226. ? undefined
  47227. : this.get();
  47228. };
  47229. /**
  47230. * Evaluate the getter, and re-collect dependencies.
  47231. */
  47232. Watcher.prototype.get = function get () {
  47233. pushTarget(this);
  47234. var value;
  47235. var vm = this.vm;
  47236. try {
  47237. value = this.getter.call(vm, vm);
  47238. } catch (e) {
  47239. if (this.user) {
  47240. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  47241. } else {
  47242. throw e
  47243. }
  47244. } finally {
  47245. // "touch" every property so they are all tracked as
  47246. // dependencies for deep watching
  47247. if (this.deep) {
  47248. traverse(value);
  47249. }
  47250. popTarget();
  47251. this.cleanupDeps();
  47252. }
  47253. return value
  47254. };
  47255. /**
  47256. * Add a dependency to this directive.
  47257. */
  47258. Watcher.prototype.addDep = function addDep (dep) {
  47259. var id = dep.id;
  47260. if (!this.newDepIds.has(id)) {
  47261. this.newDepIds.add(id);
  47262. this.newDeps.push(dep);
  47263. if (!this.depIds.has(id)) {
  47264. dep.addSub(this);
  47265. }
  47266. }
  47267. };
  47268. /**
  47269. * Clean up for dependency collection.
  47270. */
  47271. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  47272. var i = this.deps.length;
  47273. while (i--) {
  47274. var dep = this.deps[i];
  47275. if (!this.newDepIds.has(dep.id)) {
  47276. dep.removeSub(this);
  47277. }
  47278. }
  47279. var tmp = this.depIds;
  47280. this.depIds = this.newDepIds;
  47281. this.newDepIds = tmp;
  47282. this.newDepIds.clear();
  47283. tmp = this.deps;
  47284. this.deps = this.newDeps;
  47285. this.newDeps = tmp;
  47286. this.newDeps.length = 0;
  47287. };
  47288. /**
  47289. * Subscriber interface.
  47290. * Will be called when a dependency changes.
  47291. */
  47292. Watcher.prototype.update = function update () {
  47293. /* istanbul ignore else */
  47294. if (this.lazy) {
  47295. this.dirty = true;
  47296. } else if (this.sync) {
  47297. this.run();
  47298. } else {
  47299. queueWatcher(this);
  47300. }
  47301. };
  47302. /**
  47303. * Scheduler job interface.
  47304. * Will be called by the scheduler.
  47305. */
  47306. Watcher.prototype.run = function run () {
  47307. if (this.active) {
  47308. var value = this.get();
  47309. if (
  47310. value !== this.value ||
  47311. // Deep watchers and watchers on Object/Arrays should fire even
  47312. // when the value is the same, because the value may
  47313. // have mutated.
  47314. isObject(value) ||
  47315. this.deep
  47316. ) {
  47317. // set new value
  47318. var oldValue = this.value;
  47319. this.value = value;
  47320. if (this.user) {
  47321. try {
  47322. this.cb.call(this.vm, value, oldValue);
  47323. } catch (e) {
  47324. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  47325. }
  47326. } else {
  47327. this.cb.call(this.vm, value, oldValue);
  47328. }
  47329. }
  47330. }
  47331. };
  47332. /**
  47333. * Evaluate the value of the watcher.
  47334. * This only gets called for lazy watchers.
  47335. */
  47336. Watcher.prototype.evaluate = function evaluate () {
  47337. this.value = this.get();
  47338. this.dirty = false;
  47339. };
  47340. /**
  47341. * Depend on all deps collected by this watcher.
  47342. */
  47343. Watcher.prototype.depend = function depend () {
  47344. var i = this.deps.length;
  47345. while (i--) {
  47346. this.deps[i].depend();
  47347. }
  47348. };
  47349. /**
  47350. * Remove self from all dependencies' subscriber list.
  47351. */
  47352. Watcher.prototype.teardown = function teardown () {
  47353. if (this.active) {
  47354. // remove self from vm's watcher list
  47355. // this is a somewhat expensive operation so we skip it
  47356. // if the vm is being destroyed.
  47357. if (!this.vm._isBeingDestroyed) {
  47358. remove(this.vm._watchers, this);
  47359. }
  47360. var i = this.deps.length;
  47361. while (i--) {
  47362. this.deps[i].removeSub(this);
  47363. }
  47364. this.active = false;
  47365. }
  47366. };
  47367. /* */
  47368. var sharedPropertyDefinition = {
  47369. enumerable: true,
  47370. configurable: true,
  47371. get: noop,
  47372. set: noop
  47373. };
  47374. function proxy (target, sourceKey, key) {
  47375. sharedPropertyDefinition.get = function proxyGetter () {
  47376. return this[sourceKey][key]
  47377. };
  47378. sharedPropertyDefinition.set = function proxySetter (val) {
  47379. this[sourceKey][key] = val;
  47380. };
  47381. Object.defineProperty(target, key, sharedPropertyDefinition);
  47382. }
  47383. function initState (vm) {
  47384. vm._watchers = [];
  47385. var opts = vm.$options;
  47386. if (opts.props) { initProps(vm, opts.props); }
  47387. if (opts.methods) { initMethods(vm, opts.methods); }
  47388. if (opts.data) {
  47389. initData(vm);
  47390. } else {
  47391. observe(vm._data = {}, true /* asRootData */);
  47392. }
  47393. if (opts.computed) { initComputed(vm, opts.computed); }
  47394. if (opts.watch && opts.watch !== nativeWatch) {
  47395. initWatch(vm, opts.watch);
  47396. }
  47397. }
  47398. function initProps (vm, propsOptions) {
  47399. var propsData = vm.$options.propsData || {};
  47400. var props = vm._props = {};
  47401. // cache prop keys so that future props updates can iterate using Array
  47402. // instead of dynamic object key enumeration.
  47403. var keys = vm.$options._propKeys = [];
  47404. var isRoot = !vm.$parent;
  47405. // root instance props should be converted
  47406. if (!isRoot) {
  47407. toggleObserving(false);
  47408. }
  47409. var loop = function ( key ) {
  47410. keys.push(key);
  47411. var value = validateProp(key, propsOptions, propsData, vm);
  47412. /* istanbul ignore else */
  47413. {
  47414. var hyphenatedKey = hyphenate(key);
  47415. if (isReservedAttribute(hyphenatedKey) ||
  47416. config.isReservedAttr(hyphenatedKey)) {
  47417. warn(
  47418. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  47419. vm
  47420. );
  47421. }
  47422. defineReactive$$1(props, key, value, function () {
  47423. if (!isRoot && !isUpdatingChildComponent) {
  47424. warn(
  47425. "Avoid mutating a prop directly since the value will be " +
  47426. "overwritten whenever the parent component re-renders. " +
  47427. "Instead, use a data or computed property based on the prop's " +
  47428. "value. Prop being mutated: \"" + key + "\"",
  47429. vm
  47430. );
  47431. }
  47432. });
  47433. }
  47434. // static props are already proxied on the component's prototype
  47435. // during Vue.extend(). We only need to proxy props defined at
  47436. // instantiation here.
  47437. if (!(key in vm)) {
  47438. proxy(vm, "_props", key);
  47439. }
  47440. };
  47441. for (var key in propsOptions) loop( key );
  47442. toggleObserving(true);
  47443. }
  47444. function initData (vm) {
  47445. var data = vm.$options.data;
  47446. data = vm._data = typeof data === 'function'
  47447. ? getData(data, vm)
  47448. : data || {};
  47449. if (!isPlainObject(data)) {
  47450. data = {};
  47451. warn(
  47452. 'data functions should return an object:\n' +
  47453. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  47454. vm
  47455. );
  47456. }
  47457. // proxy data on instance
  47458. var keys = Object.keys(data);
  47459. var props = vm.$options.props;
  47460. var methods = vm.$options.methods;
  47461. var i = keys.length;
  47462. while (i--) {
  47463. var key = keys[i];
  47464. {
  47465. if (methods && hasOwn(methods, key)) {
  47466. warn(
  47467. ("Method \"" + key + "\" has already been defined as a data property."),
  47468. vm
  47469. );
  47470. }
  47471. }
  47472. if (props && hasOwn(props, key)) {
  47473. warn(
  47474. "The data property \"" + key + "\" is already declared as a prop. " +
  47475. "Use prop default value instead.",
  47476. vm
  47477. );
  47478. } else if (!isReserved(key)) {
  47479. proxy(vm, "_data", key);
  47480. }
  47481. }
  47482. // observe data
  47483. observe(data, true /* asRootData */);
  47484. }
  47485. function getData (data, vm) {
  47486. // #7573 disable dep collection when invoking data getters
  47487. pushTarget();
  47488. try {
  47489. return data.call(vm, vm)
  47490. } catch (e) {
  47491. handleError(e, vm, "data()");
  47492. return {}
  47493. } finally {
  47494. popTarget();
  47495. }
  47496. }
  47497. var computedWatcherOptions = { lazy: true };
  47498. function initComputed (vm, computed) {
  47499. // $flow-disable-line
  47500. var watchers = vm._computedWatchers = Object.create(null);
  47501. // computed properties are just getters during SSR
  47502. var isSSR = isServerRendering();
  47503. for (var key in computed) {
  47504. var userDef = computed[key];
  47505. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  47506. if (getter == null) {
  47507. warn(
  47508. ("Getter is missing for computed property \"" + key + "\"."),
  47509. vm
  47510. );
  47511. }
  47512. if (!isSSR) {
  47513. // create internal watcher for the computed property.
  47514. watchers[key] = new Watcher(
  47515. vm,
  47516. getter || noop,
  47517. noop,
  47518. computedWatcherOptions
  47519. );
  47520. }
  47521. // component-defined computed properties are already defined on the
  47522. // component prototype. We only need to define computed properties defined
  47523. // at instantiation here.
  47524. if (!(key in vm)) {
  47525. defineComputed(vm, key, userDef);
  47526. } else {
  47527. if (key in vm.$data) {
  47528. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  47529. } else if (vm.$options.props && key in vm.$options.props) {
  47530. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  47531. }
  47532. }
  47533. }
  47534. }
  47535. function defineComputed (
  47536. target,
  47537. key,
  47538. userDef
  47539. ) {
  47540. var shouldCache = !isServerRendering();
  47541. if (typeof userDef === 'function') {
  47542. sharedPropertyDefinition.get = shouldCache
  47543. ? createComputedGetter(key)
  47544. : createGetterInvoker(userDef);
  47545. sharedPropertyDefinition.set = noop;
  47546. } else {
  47547. sharedPropertyDefinition.get = userDef.get
  47548. ? shouldCache && userDef.cache !== false
  47549. ? createComputedGetter(key)
  47550. : createGetterInvoker(userDef.get)
  47551. : noop;
  47552. sharedPropertyDefinition.set = userDef.set || noop;
  47553. }
  47554. if (sharedPropertyDefinition.set === noop) {
  47555. sharedPropertyDefinition.set = function () {
  47556. warn(
  47557. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  47558. this
  47559. );
  47560. };
  47561. }
  47562. Object.defineProperty(target, key, sharedPropertyDefinition);
  47563. }
  47564. function createComputedGetter (key) {
  47565. return function computedGetter () {
  47566. var watcher = this._computedWatchers && this._computedWatchers[key];
  47567. if (watcher) {
  47568. if (watcher.dirty) {
  47569. watcher.evaluate();
  47570. }
  47571. if (Dep.target) {
  47572. watcher.depend();
  47573. }
  47574. return watcher.value
  47575. }
  47576. }
  47577. }
  47578. function createGetterInvoker(fn) {
  47579. return function computedGetter () {
  47580. return fn.call(this, this)
  47581. }
  47582. }
  47583. function initMethods (vm, methods) {
  47584. var props = vm.$options.props;
  47585. for (var key in methods) {
  47586. {
  47587. if (typeof methods[key] !== 'function') {
  47588. warn(
  47589. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  47590. "Did you reference the function correctly?",
  47591. vm
  47592. );
  47593. }
  47594. if (props && hasOwn(props, key)) {
  47595. warn(
  47596. ("Method \"" + key + "\" has already been defined as a prop."),
  47597. vm
  47598. );
  47599. }
  47600. if ((key in vm) && isReserved(key)) {
  47601. warn(
  47602. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  47603. "Avoid defining component methods that start with _ or $."
  47604. );
  47605. }
  47606. }
  47607. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  47608. }
  47609. }
  47610. function initWatch (vm, watch) {
  47611. for (var key in watch) {
  47612. var handler = watch[key];
  47613. if (Array.isArray(handler)) {
  47614. for (var i = 0; i < handler.length; i++) {
  47615. createWatcher(vm, key, handler[i]);
  47616. }
  47617. } else {
  47618. createWatcher(vm, key, handler);
  47619. }
  47620. }
  47621. }
  47622. function createWatcher (
  47623. vm,
  47624. expOrFn,
  47625. handler,
  47626. options
  47627. ) {
  47628. if (isPlainObject(handler)) {
  47629. options = handler;
  47630. handler = handler.handler;
  47631. }
  47632. if (typeof handler === 'string') {
  47633. handler = vm[handler];
  47634. }
  47635. return vm.$watch(expOrFn, handler, options)
  47636. }
  47637. function stateMixin (Vue) {
  47638. // flow somehow has problems with directly declared definition object
  47639. // when using Object.defineProperty, so we have to procedurally build up
  47640. // the object here.
  47641. var dataDef = {};
  47642. dataDef.get = function () { return this._data };
  47643. var propsDef = {};
  47644. propsDef.get = function () { return this._props };
  47645. {
  47646. dataDef.set = function () {
  47647. warn(
  47648. 'Avoid replacing instance root $data. ' +
  47649. 'Use nested data properties instead.',
  47650. this
  47651. );
  47652. };
  47653. propsDef.set = function () {
  47654. warn("$props is readonly.", this);
  47655. };
  47656. }
  47657. Object.defineProperty(Vue.prototype, '$data', dataDef);
  47658. Object.defineProperty(Vue.prototype, '$props', propsDef);
  47659. Vue.prototype.$set = set;
  47660. Vue.prototype.$delete = del;
  47661. Vue.prototype.$watch = function (
  47662. expOrFn,
  47663. cb,
  47664. options
  47665. ) {
  47666. var vm = this;
  47667. if (isPlainObject(cb)) {
  47668. return createWatcher(vm, expOrFn, cb, options)
  47669. }
  47670. options = options || {};
  47671. options.user = true;
  47672. var watcher = new Watcher(vm, expOrFn, cb, options);
  47673. if (options.immediate) {
  47674. try {
  47675. cb.call(vm, watcher.value);
  47676. } catch (error) {
  47677. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  47678. }
  47679. }
  47680. return function unwatchFn () {
  47681. watcher.teardown();
  47682. }
  47683. };
  47684. }
  47685. /* */
  47686. var uid$3 = 0;
  47687. function initMixin (Vue) {
  47688. Vue.prototype._init = function (options) {
  47689. var vm = this;
  47690. // a uid
  47691. vm._uid = uid$3++;
  47692. var startTag, endTag;
  47693. /* istanbul ignore if */
  47694. if (config.performance && mark) {
  47695. startTag = "vue-perf-start:" + (vm._uid);
  47696. endTag = "vue-perf-end:" + (vm._uid);
  47697. mark(startTag);
  47698. }
  47699. // a flag to avoid this being observed
  47700. vm._isVue = true;
  47701. // merge options
  47702. if (options && options._isComponent) {
  47703. // optimize internal component instantiation
  47704. // since dynamic options merging is pretty slow, and none of the
  47705. // internal component options needs special treatment.
  47706. initInternalComponent(vm, options);
  47707. } else {
  47708. vm.$options = mergeOptions(
  47709. resolveConstructorOptions(vm.constructor),
  47710. options || {},
  47711. vm
  47712. );
  47713. }
  47714. /* istanbul ignore else */
  47715. {
  47716. initProxy(vm);
  47717. }
  47718. // expose real self
  47719. vm._self = vm;
  47720. initLifecycle(vm);
  47721. initEvents(vm);
  47722. initRender(vm);
  47723. callHook(vm, 'beforeCreate');
  47724. initInjections(vm); // resolve injections before data/props
  47725. initState(vm);
  47726. initProvide(vm); // resolve provide after data/props
  47727. callHook(vm, 'created');
  47728. /* istanbul ignore if */
  47729. if (config.performance && mark) {
  47730. vm._name = formatComponentName(vm, false);
  47731. mark(endTag);
  47732. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  47733. }
  47734. if (vm.$options.el) {
  47735. vm.$mount(vm.$options.el);
  47736. }
  47737. };
  47738. }
  47739. function initInternalComponent (vm, options) {
  47740. var opts = vm.$options = Object.create(vm.constructor.options);
  47741. // doing this because it's faster than dynamic enumeration.
  47742. var parentVnode = options._parentVnode;
  47743. opts.parent = options.parent;
  47744. opts._parentVnode = parentVnode;
  47745. var vnodeComponentOptions = parentVnode.componentOptions;
  47746. opts.propsData = vnodeComponentOptions.propsData;
  47747. opts._parentListeners = vnodeComponentOptions.listeners;
  47748. opts._renderChildren = vnodeComponentOptions.children;
  47749. opts._componentTag = vnodeComponentOptions.tag;
  47750. if (options.render) {
  47751. opts.render = options.render;
  47752. opts.staticRenderFns = options.staticRenderFns;
  47753. }
  47754. }
  47755. function resolveConstructorOptions (Ctor) {
  47756. var options = Ctor.options;
  47757. if (Ctor.super) {
  47758. var superOptions = resolveConstructorOptions(Ctor.super);
  47759. var cachedSuperOptions = Ctor.superOptions;
  47760. if (superOptions !== cachedSuperOptions) {
  47761. // super option changed,
  47762. // need to resolve new options.
  47763. Ctor.superOptions = superOptions;
  47764. // check if there are any late-modified/attached options (#4976)
  47765. var modifiedOptions = resolveModifiedOptions(Ctor);
  47766. // update base extend options
  47767. if (modifiedOptions) {
  47768. extend(Ctor.extendOptions, modifiedOptions);
  47769. }
  47770. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  47771. if (options.name) {
  47772. options.components[options.name] = Ctor;
  47773. }
  47774. }
  47775. }
  47776. return options
  47777. }
  47778. function resolveModifiedOptions (Ctor) {
  47779. var modified;
  47780. var latest = Ctor.options;
  47781. var sealed = Ctor.sealedOptions;
  47782. for (var key in latest) {
  47783. if (latest[key] !== sealed[key]) {
  47784. if (!modified) { modified = {}; }
  47785. modified[key] = latest[key];
  47786. }
  47787. }
  47788. return modified
  47789. }
  47790. function Vue (options) {
  47791. if (!(this instanceof Vue)
  47792. ) {
  47793. warn('Vue is a constructor and should be called with the `new` keyword');
  47794. }
  47795. this._init(options);
  47796. }
  47797. initMixin(Vue);
  47798. stateMixin(Vue);
  47799. eventsMixin(Vue);
  47800. lifecycleMixin(Vue);
  47801. renderMixin(Vue);
  47802. /* */
  47803. function initUse (Vue) {
  47804. Vue.use = function (plugin) {
  47805. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  47806. if (installedPlugins.indexOf(plugin) > -1) {
  47807. return this
  47808. }
  47809. // additional parameters
  47810. var args = toArray(arguments, 1);
  47811. args.unshift(this);
  47812. if (typeof plugin.install === 'function') {
  47813. plugin.install.apply(plugin, args);
  47814. } else if (typeof plugin === 'function') {
  47815. plugin.apply(null, args);
  47816. }
  47817. installedPlugins.push(plugin);
  47818. return this
  47819. };
  47820. }
  47821. /* */
  47822. function initMixin$1 (Vue) {
  47823. Vue.mixin = function (mixin) {
  47824. this.options = mergeOptions(this.options, mixin);
  47825. return this
  47826. };
  47827. }
  47828. /* */
  47829. function initExtend (Vue) {
  47830. /**
  47831. * Each instance constructor, including Vue, has a unique
  47832. * cid. This enables us to create wrapped "child
  47833. * constructors" for prototypal inheritance and cache them.
  47834. */
  47835. Vue.cid = 0;
  47836. var cid = 1;
  47837. /**
  47838. * Class inheritance
  47839. */
  47840. Vue.extend = function (extendOptions) {
  47841. extendOptions = extendOptions || {};
  47842. var Super = this;
  47843. var SuperId = Super.cid;
  47844. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  47845. if (cachedCtors[SuperId]) {
  47846. return cachedCtors[SuperId]
  47847. }
  47848. var name = extendOptions.name || Super.options.name;
  47849. if (name) {
  47850. validateComponentName(name);
  47851. }
  47852. var Sub = function VueComponent (options) {
  47853. this._init(options);
  47854. };
  47855. Sub.prototype = Object.create(Super.prototype);
  47856. Sub.prototype.constructor = Sub;
  47857. Sub.cid = cid++;
  47858. Sub.options = mergeOptions(
  47859. Super.options,
  47860. extendOptions
  47861. );
  47862. Sub['super'] = Super;
  47863. // For props and computed properties, we define the proxy getters on
  47864. // the Vue instances at extension time, on the extended prototype. This
  47865. // avoids Object.defineProperty calls for each instance created.
  47866. if (Sub.options.props) {
  47867. initProps$1(Sub);
  47868. }
  47869. if (Sub.options.computed) {
  47870. initComputed$1(Sub);
  47871. }
  47872. // allow further extension/mixin/plugin usage
  47873. Sub.extend = Super.extend;
  47874. Sub.mixin = Super.mixin;
  47875. Sub.use = Super.use;
  47876. // create asset registers, so extended classes
  47877. // can have their private assets too.
  47878. ASSET_TYPES.forEach(function (type) {
  47879. Sub[type] = Super[type];
  47880. });
  47881. // enable recursive self-lookup
  47882. if (name) {
  47883. Sub.options.components[name] = Sub;
  47884. }
  47885. // keep a reference to the super options at extension time.
  47886. // later at instantiation we can check if Super's options have
  47887. // been updated.
  47888. Sub.superOptions = Super.options;
  47889. Sub.extendOptions = extendOptions;
  47890. Sub.sealedOptions = extend({}, Sub.options);
  47891. // cache constructor
  47892. cachedCtors[SuperId] = Sub;
  47893. return Sub
  47894. };
  47895. }
  47896. function initProps$1 (Comp) {
  47897. var props = Comp.options.props;
  47898. for (var key in props) {
  47899. proxy(Comp.prototype, "_props", key);
  47900. }
  47901. }
  47902. function initComputed$1 (Comp) {
  47903. var computed = Comp.options.computed;
  47904. for (var key in computed) {
  47905. defineComputed(Comp.prototype, key, computed[key]);
  47906. }
  47907. }
  47908. /* */
  47909. function initAssetRegisters (Vue) {
  47910. /**
  47911. * Create asset registration methods.
  47912. */
  47913. ASSET_TYPES.forEach(function (type) {
  47914. Vue[type] = function (
  47915. id,
  47916. definition
  47917. ) {
  47918. if (!definition) {
  47919. return this.options[type + 's'][id]
  47920. } else {
  47921. /* istanbul ignore if */
  47922. if (type === 'component') {
  47923. validateComponentName(id);
  47924. }
  47925. if (type === 'component' && isPlainObject(definition)) {
  47926. definition.name = definition.name || id;
  47927. definition = this.options._base.extend(definition);
  47928. }
  47929. if (type === 'directive' && typeof definition === 'function') {
  47930. definition = { bind: definition, update: definition };
  47931. }
  47932. this.options[type + 's'][id] = definition;
  47933. return definition
  47934. }
  47935. };
  47936. });
  47937. }
  47938. /* */
  47939. function getComponentName (opts) {
  47940. return opts && (opts.Ctor.options.name || opts.tag)
  47941. }
  47942. function matches (pattern, name) {
  47943. if (Array.isArray(pattern)) {
  47944. return pattern.indexOf(name) > -1
  47945. } else if (typeof pattern === 'string') {
  47946. return pattern.split(',').indexOf(name) > -1
  47947. } else if (isRegExp(pattern)) {
  47948. return pattern.test(name)
  47949. }
  47950. /* istanbul ignore next */
  47951. return false
  47952. }
  47953. function pruneCache (keepAliveInstance, filter) {
  47954. var cache = keepAliveInstance.cache;
  47955. var keys = keepAliveInstance.keys;
  47956. var _vnode = keepAliveInstance._vnode;
  47957. for (var key in cache) {
  47958. var cachedNode = cache[key];
  47959. if (cachedNode) {
  47960. var name = getComponentName(cachedNode.componentOptions);
  47961. if (name && !filter(name)) {
  47962. pruneCacheEntry(cache, key, keys, _vnode);
  47963. }
  47964. }
  47965. }
  47966. }
  47967. function pruneCacheEntry (
  47968. cache,
  47969. key,
  47970. keys,
  47971. current
  47972. ) {
  47973. var cached$$1 = cache[key];
  47974. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  47975. cached$$1.componentInstance.$destroy();
  47976. }
  47977. cache[key] = null;
  47978. remove(keys, key);
  47979. }
  47980. var patternTypes = [String, RegExp, Array];
  47981. var KeepAlive = {
  47982. name: 'keep-alive',
  47983. abstract: true,
  47984. props: {
  47985. include: patternTypes,
  47986. exclude: patternTypes,
  47987. max: [String, Number]
  47988. },
  47989. created: function created () {
  47990. this.cache = Object.create(null);
  47991. this.keys = [];
  47992. },
  47993. destroyed: function destroyed () {
  47994. for (var key in this.cache) {
  47995. pruneCacheEntry(this.cache, key, this.keys);
  47996. }
  47997. },
  47998. mounted: function mounted () {
  47999. var this$1 = this;
  48000. this.$watch('include', function (val) {
  48001. pruneCache(this$1, function (name) { return matches(val, name); });
  48002. });
  48003. this.$watch('exclude', function (val) {
  48004. pruneCache(this$1, function (name) { return !matches(val, name); });
  48005. });
  48006. },
  48007. render: function render () {
  48008. var slot = this.$slots.default;
  48009. var vnode = getFirstComponentChild(slot);
  48010. var componentOptions = vnode && vnode.componentOptions;
  48011. if (componentOptions) {
  48012. // check pattern
  48013. var name = getComponentName(componentOptions);
  48014. var ref = this;
  48015. var include = ref.include;
  48016. var exclude = ref.exclude;
  48017. if (
  48018. // not included
  48019. (include && (!name || !matches(include, name))) ||
  48020. // excluded
  48021. (exclude && name && matches(exclude, name))
  48022. ) {
  48023. return vnode
  48024. }
  48025. var ref$1 = this;
  48026. var cache = ref$1.cache;
  48027. var keys = ref$1.keys;
  48028. var key = vnode.key == null
  48029. // same constructor may get registered as different local components
  48030. // so cid alone is not enough (#3269)
  48031. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  48032. : vnode.key;
  48033. if (cache[key]) {
  48034. vnode.componentInstance = cache[key].componentInstance;
  48035. // make current key freshest
  48036. remove(keys, key);
  48037. keys.push(key);
  48038. } else {
  48039. cache[key] = vnode;
  48040. keys.push(key);
  48041. // prune oldest entry
  48042. if (this.max && keys.length > parseInt(this.max)) {
  48043. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  48044. }
  48045. }
  48046. vnode.data.keepAlive = true;
  48047. }
  48048. return vnode || (slot && slot[0])
  48049. }
  48050. };
  48051. var builtInComponents = {
  48052. KeepAlive: KeepAlive
  48053. };
  48054. /* */
  48055. function initGlobalAPI (Vue) {
  48056. // config
  48057. var configDef = {};
  48058. configDef.get = function () { return config; };
  48059. {
  48060. configDef.set = function () {
  48061. warn(
  48062. 'Do not replace the Vue.config object, set individual fields instead.'
  48063. );
  48064. };
  48065. }
  48066. Object.defineProperty(Vue, 'config', configDef);
  48067. // exposed util methods.
  48068. // NOTE: these are not considered part of the public API - avoid relying on
  48069. // them unless you are aware of the risk.
  48070. Vue.util = {
  48071. warn: warn,
  48072. extend: extend,
  48073. mergeOptions: mergeOptions,
  48074. defineReactive: defineReactive$$1
  48075. };
  48076. Vue.set = set;
  48077. Vue.delete = del;
  48078. Vue.nextTick = nextTick;
  48079. // 2.6 explicit observable API
  48080. Vue.observable = function (obj) {
  48081. observe(obj);
  48082. return obj
  48083. };
  48084. Vue.options = Object.create(null);
  48085. ASSET_TYPES.forEach(function (type) {
  48086. Vue.options[type + 's'] = Object.create(null);
  48087. });
  48088. // this is used to identify the "base" constructor to extend all plain-object
  48089. // components with in Weex's multi-instance scenarios.
  48090. Vue.options._base = Vue;
  48091. extend(Vue.options.components, builtInComponents);
  48092. initUse(Vue);
  48093. initMixin$1(Vue);
  48094. initExtend(Vue);
  48095. initAssetRegisters(Vue);
  48096. }
  48097. initGlobalAPI(Vue);
  48098. Object.defineProperty(Vue.prototype, '$isServer', {
  48099. get: isServerRendering
  48100. });
  48101. Object.defineProperty(Vue.prototype, '$ssrContext', {
  48102. get: function get () {
  48103. /* istanbul ignore next */
  48104. return this.$vnode && this.$vnode.ssrContext
  48105. }
  48106. });
  48107. // expose FunctionalRenderContext for ssr runtime helper installation
  48108. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  48109. value: FunctionalRenderContext
  48110. });
  48111. Vue.version = '2.6.11';
  48112. /* */
  48113. // these are reserved for web because they are directly compiled away
  48114. // during template compilation
  48115. var isReservedAttr = makeMap('style,class');
  48116. // attributes that should be using props for binding
  48117. var acceptValue = makeMap('input,textarea,option,select,progress');
  48118. var mustUseProp = function (tag, type, attr) {
  48119. return (
  48120. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  48121. (attr === 'selected' && tag === 'option') ||
  48122. (attr === 'checked' && tag === 'input') ||
  48123. (attr === 'muted' && tag === 'video')
  48124. )
  48125. };
  48126. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  48127. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  48128. var convertEnumeratedValue = function (key, value) {
  48129. return isFalsyAttrValue(value) || value === 'false'
  48130. ? 'false'
  48131. // allow arbitrary string value for contenteditable
  48132. : key === 'contenteditable' && isValidContentEditableValue(value)
  48133. ? value
  48134. : 'true'
  48135. };
  48136. var isBooleanAttr = makeMap(
  48137. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  48138. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  48139. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  48140. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  48141. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  48142. 'truespeed,typemustmatch,visible'
  48143. );
  48144. var xlinkNS = 'http://www.w3.org/1999/xlink';
  48145. var isXlink = function (name) {
  48146. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  48147. };
  48148. var getXlinkProp = function (name) {
  48149. return isXlink(name) ? name.slice(6, name.length) : ''
  48150. };
  48151. var isFalsyAttrValue = function (val) {
  48152. return val == null || val === false
  48153. };
  48154. /* */
  48155. function genClassForVnode (vnode) {
  48156. var data = vnode.data;
  48157. var parentNode = vnode;
  48158. var childNode = vnode;
  48159. while (isDef(childNode.componentInstance)) {
  48160. childNode = childNode.componentInstance._vnode;
  48161. if (childNode && childNode.data) {
  48162. data = mergeClassData(childNode.data, data);
  48163. }
  48164. }
  48165. while (isDef(parentNode = parentNode.parent)) {
  48166. if (parentNode && parentNode.data) {
  48167. data = mergeClassData(data, parentNode.data);
  48168. }
  48169. }
  48170. return renderClass(data.staticClass, data.class)
  48171. }
  48172. function mergeClassData (child, parent) {
  48173. return {
  48174. staticClass: concat(child.staticClass, parent.staticClass),
  48175. class: isDef(child.class)
  48176. ? [child.class, parent.class]
  48177. : parent.class
  48178. }
  48179. }
  48180. function renderClass (
  48181. staticClass,
  48182. dynamicClass
  48183. ) {
  48184. if (isDef(staticClass) || isDef(dynamicClass)) {
  48185. return concat(staticClass, stringifyClass(dynamicClass))
  48186. }
  48187. /* istanbul ignore next */
  48188. return ''
  48189. }
  48190. function concat (a, b) {
  48191. return a ? b ? (a + ' ' + b) : a : (b || '')
  48192. }
  48193. function stringifyClass (value) {
  48194. if (Array.isArray(value)) {
  48195. return stringifyArray(value)
  48196. }
  48197. if (isObject(value)) {
  48198. return stringifyObject(value)
  48199. }
  48200. if (typeof value === 'string') {
  48201. return value
  48202. }
  48203. /* istanbul ignore next */
  48204. return ''
  48205. }
  48206. function stringifyArray (value) {
  48207. var res = '';
  48208. var stringified;
  48209. for (var i = 0, l = value.length; i < l; i++) {
  48210. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  48211. if (res) { res += ' '; }
  48212. res += stringified;
  48213. }
  48214. }
  48215. return res
  48216. }
  48217. function stringifyObject (value) {
  48218. var res = '';
  48219. for (var key in value) {
  48220. if (value[key]) {
  48221. if (res) { res += ' '; }
  48222. res += key;
  48223. }
  48224. }
  48225. return res
  48226. }
  48227. /* */
  48228. var namespaceMap = {
  48229. svg: 'http://www.w3.org/2000/svg',
  48230. math: 'http://www.w3.org/1998/Math/MathML'
  48231. };
  48232. var isHTMLTag = makeMap(
  48233. 'html,body,base,head,link,meta,style,title,' +
  48234. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  48235. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  48236. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  48237. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  48238. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  48239. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  48240. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  48241. 'output,progress,select,textarea,' +
  48242. 'details,dialog,menu,menuitem,summary,' +
  48243. 'content,element,shadow,template,blockquote,iframe,tfoot'
  48244. );
  48245. // this map is intentionally selective, only covering SVG elements that may
  48246. // contain child elements.
  48247. var isSVG = makeMap(
  48248. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  48249. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  48250. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  48251. true
  48252. );
  48253. var isPreTag = function (tag) { return tag === 'pre'; };
  48254. var isReservedTag = function (tag) {
  48255. return isHTMLTag(tag) || isSVG(tag)
  48256. };
  48257. function getTagNamespace (tag) {
  48258. if (isSVG(tag)) {
  48259. return 'svg'
  48260. }
  48261. // basic support for MathML
  48262. // note it doesn't support other MathML elements being component roots
  48263. if (tag === 'math') {
  48264. return 'math'
  48265. }
  48266. }
  48267. var unknownElementCache = Object.create(null);
  48268. function isUnknownElement (tag) {
  48269. /* istanbul ignore if */
  48270. if (!inBrowser) {
  48271. return true
  48272. }
  48273. if (isReservedTag(tag)) {
  48274. return false
  48275. }
  48276. tag = tag.toLowerCase();
  48277. /* istanbul ignore if */
  48278. if (unknownElementCache[tag] != null) {
  48279. return unknownElementCache[tag]
  48280. }
  48281. var el = document.createElement(tag);
  48282. if (tag.indexOf('-') > -1) {
  48283. // http://stackoverflow.com/a/28210364/1070244
  48284. return (unknownElementCache[tag] = (
  48285. el.constructor === window.HTMLUnknownElement ||
  48286. el.constructor === window.HTMLElement
  48287. ))
  48288. } else {
  48289. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  48290. }
  48291. }
  48292. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  48293. /* */
  48294. /**
  48295. * Query an element selector if it's not an element already.
  48296. */
  48297. function query (el) {
  48298. if (typeof el === 'string') {
  48299. var selected = document.querySelector(el);
  48300. if (!selected) {
  48301. warn(
  48302. 'Cannot find element: ' + el
  48303. );
  48304. return document.createElement('div')
  48305. }
  48306. return selected
  48307. } else {
  48308. return el
  48309. }
  48310. }
  48311. /* */
  48312. function createElement$1 (tagName, vnode) {
  48313. var elm = document.createElement(tagName);
  48314. if (tagName !== 'select') {
  48315. return elm
  48316. }
  48317. // false or null will remove the attribute but undefined will not
  48318. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  48319. elm.setAttribute('multiple', 'multiple');
  48320. }
  48321. return elm
  48322. }
  48323. function createElementNS (namespace, tagName) {
  48324. return document.createElementNS(namespaceMap[namespace], tagName)
  48325. }
  48326. function createTextNode (text) {
  48327. return document.createTextNode(text)
  48328. }
  48329. function createComment (text) {
  48330. return document.createComment(text)
  48331. }
  48332. function insertBefore (parentNode, newNode, referenceNode) {
  48333. parentNode.insertBefore(newNode, referenceNode);
  48334. }
  48335. function removeChild (node, child) {
  48336. node.removeChild(child);
  48337. }
  48338. function appendChild (node, child) {
  48339. node.appendChild(child);
  48340. }
  48341. function parentNode (node) {
  48342. return node.parentNode
  48343. }
  48344. function nextSibling (node) {
  48345. return node.nextSibling
  48346. }
  48347. function tagName (node) {
  48348. return node.tagName
  48349. }
  48350. function setTextContent (node, text) {
  48351. node.textContent = text;
  48352. }
  48353. function setStyleScope (node, scopeId) {
  48354. node.setAttribute(scopeId, '');
  48355. }
  48356. var nodeOps = /*#__PURE__*/Object.freeze({
  48357. createElement: createElement$1,
  48358. createElementNS: createElementNS,
  48359. createTextNode: createTextNode,
  48360. createComment: createComment,
  48361. insertBefore: insertBefore,
  48362. removeChild: removeChild,
  48363. appendChild: appendChild,
  48364. parentNode: parentNode,
  48365. nextSibling: nextSibling,
  48366. tagName: tagName,
  48367. setTextContent: setTextContent,
  48368. setStyleScope: setStyleScope
  48369. });
  48370. /* */
  48371. var ref = {
  48372. create: function create (_, vnode) {
  48373. registerRef(vnode);
  48374. },
  48375. update: function update (oldVnode, vnode) {
  48376. if (oldVnode.data.ref !== vnode.data.ref) {
  48377. registerRef(oldVnode, true);
  48378. registerRef(vnode);
  48379. }
  48380. },
  48381. destroy: function destroy (vnode) {
  48382. registerRef(vnode, true);
  48383. }
  48384. };
  48385. function registerRef (vnode, isRemoval) {
  48386. var key = vnode.data.ref;
  48387. if (!isDef(key)) { return }
  48388. var vm = vnode.context;
  48389. var ref = vnode.componentInstance || vnode.elm;
  48390. var refs = vm.$refs;
  48391. if (isRemoval) {
  48392. if (Array.isArray(refs[key])) {
  48393. remove(refs[key], ref);
  48394. } else if (refs[key] === ref) {
  48395. refs[key] = undefined;
  48396. }
  48397. } else {
  48398. if (vnode.data.refInFor) {
  48399. if (!Array.isArray(refs[key])) {
  48400. refs[key] = [ref];
  48401. } else if (refs[key].indexOf(ref) < 0) {
  48402. // $flow-disable-line
  48403. refs[key].push(ref);
  48404. }
  48405. } else {
  48406. refs[key] = ref;
  48407. }
  48408. }
  48409. }
  48410. /**
  48411. * Virtual DOM patching algorithm based on Snabbdom by
  48412. * Simon Friis Vindum (@paldepind)
  48413. * Licensed under the MIT License
  48414. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  48415. *
  48416. * modified by Evan You (@yyx990803)
  48417. *
  48418. * Not type-checking this because this file is perf-critical and the cost
  48419. * of making flow understand it is not worth it.
  48420. */
  48421. var emptyNode = new VNode('', {}, []);
  48422. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  48423. function sameVnode (a, b) {
  48424. return (
  48425. a.key === b.key && (
  48426. (
  48427. a.tag === b.tag &&
  48428. a.isComment === b.isComment &&
  48429. isDef(a.data) === isDef(b.data) &&
  48430. sameInputType(a, b)
  48431. ) || (
  48432. isTrue(a.isAsyncPlaceholder) &&
  48433. a.asyncFactory === b.asyncFactory &&
  48434. isUndef(b.asyncFactory.error)
  48435. )
  48436. )
  48437. )
  48438. }
  48439. function sameInputType (a, b) {
  48440. if (a.tag !== 'input') { return true }
  48441. var i;
  48442. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  48443. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  48444. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  48445. }
  48446. function createKeyToOldIdx (children, beginIdx, endIdx) {
  48447. var i, key;
  48448. var map = {};
  48449. for (i = beginIdx; i <= endIdx; ++i) {
  48450. key = children[i].key;
  48451. if (isDef(key)) { map[key] = i; }
  48452. }
  48453. return map
  48454. }
  48455. function createPatchFunction (backend) {
  48456. var i, j;
  48457. var cbs = {};
  48458. var modules = backend.modules;
  48459. var nodeOps = backend.nodeOps;
  48460. for (i = 0; i < hooks.length; ++i) {
  48461. cbs[hooks[i]] = [];
  48462. for (j = 0; j < modules.length; ++j) {
  48463. if (isDef(modules[j][hooks[i]])) {
  48464. cbs[hooks[i]].push(modules[j][hooks[i]]);
  48465. }
  48466. }
  48467. }
  48468. function emptyNodeAt (elm) {
  48469. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  48470. }
  48471. function createRmCb (childElm, listeners) {
  48472. function remove$$1 () {
  48473. if (--remove$$1.listeners === 0) {
  48474. removeNode(childElm);
  48475. }
  48476. }
  48477. remove$$1.listeners = listeners;
  48478. return remove$$1
  48479. }
  48480. function removeNode (el) {
  48481. var parent = nodeOps.parentNode(el);
  48482. // element may have already been removed due to v-html / v-text
  48483. if (isDef(parent)) {
  48484. nodeOps.removeChild(parent, el);
  48485. }
  48486. }
  48487. function isUnknownElement$$1 (vnode, inVPre) {
  48488. return (
  48489. !inVPre &&
  48490. !vnode.ns &&
  48491. !(
  48492. config.ignoredElements.length &&
  48493. config.ignoredElements.some(function (ignore) {
  48494. return isRegExp(ignore)
  48495. ? ignore.test(vnode.tag)
  48496. : ignore === vnode.tag
  48497. })
  48498. ) &&
  48499. config.isUnknownElement(vnode.tag)
  48500. )
  48501. }
  48502. var creatingElmInVPre = 0;
  48503. function createElm (
  48504. vnode,
  48505. insertedVnodeQueue,
  48506. parentElm,
  48507. refElm,
  48508. nested,
  48509. ownerArray,
  48510. index
  48511. ) {
  48512. if (isDef(vnode.elm) && isDef(ownerArray)) {
  48513. // This vnode was used in a previous render!
  48514. // now it's used as a new node, overwriting its elm would cause
  48515. // potential patch errors down the road when it's used as an insertion
  48516. // reference node. Instead, we clone the node on-demand before creating
  48517. // associated DOM element for it.
  48518. vnode = ownerArray[index] = cloneVNode(vnode);
  48519. }
  48520. vnode.isRootInsert = !nested; // for transition enter check
  48521. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  48522. return
  48523. }
  48524. var data = vnode.data;
  48525. var children = vnode.children;
  48526. var tag = vnode.tag;
  48527. if (isDef(tag)) {
  48528. {
  48529. if (data && data.pre) {
  48530. creatingElmInVPre++;
  48531. }
  48532. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  48533. warn(
  48534. 'Unknown custom element: <' + tag + '> - did you ' +
  48535. 'register the component correctly? For recursive components, ' +
  48536. 'make sure to provide the "name" option.',
  48537. vnode.context
  48538. );
  48539. }
  48540. }
  48541. vnode.elm = vnode.ns
  48542. ? nodeOps.createElementNS(vnode.ns, tag)
  48543. : nodeOps.createElement(tag, vnode);
  48544. setScope(vnode);
  48545. /* istanbul ignore if */
  48546. {
  48547. createChildren(vnode, children, insertedVnodeQueue);
  48548. if (isDef(data)) {
  48549. invokeCreateHooks(vnode, insertedVnodeQueue);
  48550. }
  48551. insert(parentElm, vnode.elm, refElm);
  48552. }
  48553. if (data && data.pre) {
  48554. creatingElmInVPre--;
  48555. }
  48556. } else if (isTrue(vnode.isComment)) {
  48557. vnode.elm = nodeOps.createComment(vnode.text);
  48558. insert(parentElm, vnode.elm, refElm);
  48559. } else {
  48560. vnode.elm = nodeOps.createTextNode(vnode.text);
  48561. insert(parentElm, vnode.elm, refElm);
  48562. }
  48563. }
  48564. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  48565. var i = vnode.data;
  48566. if (isDef(i)) {
  48567. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  48568. if (isDef(i = i.hook) && isDef(i = i.init)) {
  48569. i(vnode, false /* hydrating */);
  48570. }
  48571. // after calling the init hook, if the vnode is a child component
  48572. // it should've created a child instance and mounted it. the child
  48573. // component also has set the placeholder vnode's elm.
  48574. // in that case we can just return the element and be done.
  48575. if (isDef(vnode.componentInstance)) {
  48576. initComponent(vnode, insertedVnodeQueue);
  48577. insert(parentElm, vnode.elm, refElm);
  48578. if (isTrue(isReactivated)) {
  48579. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  48580. }
  48581. return true
  48582. }
  48583. }
  48584. }
  48585. function initComponent (vnode, insertedVnodeQueue) {
  48586. if (isDef(vnode.data.pendingInsert)) {
  48587. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  48588. vnode.data.pendingInsert = null;
  48589. }
  48590. vnode.elm = vnode.componentInstance.$el;
  48591. if (isPatchable(vnode)) {
  48592. invokeCreateHooks(vnode, insertedVnodeQueue);
  48593. setScope(vnode);
  48594. } else {
  48595. // empty component root.
  48596. // skip all element-related modules except for ref (#3455)
  48597. registerRef(vnode);
  48598. // make sure to invoke the insert hook
  48599. insertedVnodeQueue.push(vnode);
  48600. }
  48601. }
  48602. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  48603. var i;
  48604. // hack for #4339: a reactivated component with inner transition
  48605. // does not trigger because the inner node's created hooks are not called
  48606. // again. It's not ideal to involve module-specific logic in here but
  48607. // there doesn't seem to be a better way to do it.
  48608. var innerNode = vnode;
  48609. while (innerNode.componentInstance) {
  48610. innerNode = innerNode.componentInstance._vnode;
  48611. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  48612. for (i = 0; i < cbs.activate.length; ++i) {
  48613. cbs.activate[i](emptyNode, innerNode);
  48614. }
  48615. insertedVnodeQueue.push(innerNode);
  48616. break
  48617. }
  48618. }
  48619. // unlike a newly created component,
  48620. // a reactivated keep-alive component doesn't insert itself
  48621. insert(parentElm, vnode.elm, refElm);
  48622. }
  48623. function insert (parent, elm, ref$$1) {
  48624. if (isDef(parent)) {
  48625. if (isDef(ref$$1)) {
  48626. if (nodeOps.parentNode(ref$$1) === parent) {
  48627. nodeOps.insertBefore(parent, elm, ref$$1);
  48628. }
  48629. } else {
  48630. nodeOps.appendChild(parent, elm);
  48631. }
  48632. }
  48633. }
  48634. function createChildren (vnode, children, insertedVnodeQueue) {
  48635. if (Array.isArray(children)) {
  48636. {
  48637. checkDuplicateKeys(children);
  48638. }
  48639. for (var i = 0; i < children.length; ++i) {
  48640. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  48641. }
  48642. } else if (isPrimitive(vnode.text)) {
  48643. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  48644. }
  48645. }
  48646. function isPatchable (vnode) {
  48647. while (vnode.componentInstance) {
  48648. vnode = vnode.componentInstance._vnode;
  48649. }
  48650. return isDef(vnode.tag)
  48651. }
  48652. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  48653. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  48654. cbs.create[i$1](emptyNode, vnode);
  48655. }
  48656. i = vnode.data.hook; // Reuse variable
  48657. if (isDef(i)) {
  48658. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  48659. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  48660. }
  48661. }
  48662. // set scope id attribute for scoped CSS.
  48663. // this is implemented as a special case to avoid the overhead
  48664. // of going through the normal attribute patching process.
  48665. function setScope (vnode) {
  48666. var i;
  48667. if (isDef(i = vnode.fnScopeId)) {
  48668. nodeOps.setStyleScope(vnode.elm, i);
  48669. } else {
  48670. var ancestor = vnode;
  48671. while (ancestor) {
  48672. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  48673. nodeOps.setStyleScope(vnode.elm, i);
  48674. }
  48675. ancestor = ancestor.parent;
  48676. }
  48677. }
  48678. // for slot content they should also get the scopeId from the host instance.
  48679. if (isDef(i = activeInstance) &&
  48680. i !== vnode.context &&
  48681. i !== vnode.fnContext &&
  48682. isDef(i = i.$options._scopeId)
  48683. ) {
  48684. nodeOps.setStyleScope(vnode.elm, i);
  48685. }
  48686. }
  48687. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  48688. for (; startIdx <= endIdx; ++startIdx) {
  48689. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  48690. }
  48691. }
  48692. function invokeDestroyHook (vnode) {
  48693. var i, j;
  48694. var data = vnode.data;
  48695. if (isDef(data)) {
  48696. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  48697. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  48698. }
  48699. if (isDef(i = vnode.children)) {
  48700. for (j = 0; j < vnode.children.length; ++j) {
  48701. invokeDestroyHook(vnode.children[j]);
  48702. }
  48703. }
  48704. }
  48705. function removeVnodes (vnodes, startIdx, endIdx) {
  48706. for (; startIdx <= endIdx; ++startIdx) {
  48707. var ch = vnodes[startIdx];
  48708. if (isDef(ch)) {
  48709. if (isDef(ch.tag)) {
  48710. removeAndInvokeRemoveHook(ch);
  48711. invokeDestroyHook(ch);
  48712. } else { // Text node
  48713. removeNode(ch.elm);
  48714. }
  48715. }
  48716. }
  48717. }
  48718. function removeAndInvokeRemoveHook (vnode, rm) {
  48719. if (isDef(rm) || isDef(vnode.data)) {
  48720. var i;
  48721. var listeners = cbs.remove.length + 1;
  48722. if (isDef(rm)) {
  48723. // we have a recursively passed down rm callback
  48724. // increase the listeners count
  48725. rm.listeners += listeners;
  48726. } else {
  48727. // directly removing
  48728. rm = createRmCb(vnode.elm, listeners);
  48729. }
  48730. // recursively invoke hooks on child component root node
  48731. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  48732. removeAndInvokeRemoveHook(i, rm);
  48733. }
  48734. for (i = 0; i < cbs.remove.length; ++i) {
  48735. cbs.remove[i](vnode, rm);
  48736. }
  48737. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  48738. i(vnode, rm);
  48739. } else {
  48740. rm();
  48741. }
  48742. } else {
  48743. removeNode(vnode.elm);
  48744. }
  48745. }
  48746. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  48747. var oldStartIdx = 0;
  48748. var newStartIdx = 0;
  48749. var oldEndIdx = oldCh.length - 1;
  48750. var oldStartVnode = oldCh[0];
  48751. var oldEndVnode = oldCh[oldEndIdx];
  48752. var newEndIdx = newCh.length - 1;
  48753. var newStartVnode = newCh[0];
  48754. var newEndVnode = newCh[newEndIdx];
  48755. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  48756. // removeOnly is a special flag used only by <transition-group>
  48757. // to ensure removed elements stay in correct relative positions
  48758. // during leaving transitions
  48759. var canMove = !removeOnly;
  48760. {
  48761. checkDuplicateKeys(newCh);
  48762. }
  48763. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  48764. if (isUndef(oldStartVnode)) {
  48765. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  48766. } else if (isUndef(oldEndVnode)) {
  48767. oldEndVnode = oldCh[--oldEndIdx];
  48768. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  48769. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48770. oldStartVnode = oldCh[++oldStartIdx];
  48771. newStartVnode = newCh[++newStartIdx];
  48772. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  48773. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  48774. oldEndVnode = oldCh[--oldEndIdx];
  48775. newEndVnode = newCh[--newEndIdx];
  48776. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  48777. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  48778. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  48779. oldStartVnode = oldCh[++oldStartIdx];
  48780. newEndVnode = newCh[--newEndIdx];
  48781. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  48782. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48783. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  48784. oldEndVnode = oldCh[--oldEndIdx];
  48785. newStartVnode = newCh[++newStartIdx];
  48786. } else {
  48787. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  48788. idxInOld = isDef(newStartVnode.key)
  48789. ? oldKeyToIdx[newStartVnode.key]
  48790. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  48791. if (isUndef(idxInOld)) { // New element
  48792. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  48793. } else {
  48794. vnodeToMove = oldCh[idxInOld];
  48795. if (sameVnode(vnodeToMove, newStartVnode)) {
  48796. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48797. oldCh[idxInOld] = undefined;
  48798. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  48799. } else {
  48800. // same key but different element. treat as new element
  48801. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  48802. }
  48803. }
  48804. newStartVnode = newCh[++newStartIdx];
  48805. }
  48806. }
  48807. if (oldStartIdx > oldEndIdx) {
  48808. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  48809. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  48810. } else if (newStartIdx > newEndIdx) {
  48811. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  48812. }
  48813. }
  48814. function checkDuplicateKeys (children) {
  48815. var seenKeys = {};
  48816. for (var i = 0; i < children.length; i++) {
  48817. var vnode = children[i];
  48818. var key = vnode.key;
  48819. if (isDef(key)) {
  48820. if (seenKeys[key]) {
  48821. warn(
  48822. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  48823. vnode.context
  48824. );
  48825. } else {
  48826. seenKeys[key] = true;
  48827. }
  48828. }
  48829. }
  48830. }
  48831. function findIdxInOld (node, oldCh, start, end) {
  48832. for (var i = start; i < end; i++) {
  48833. var c = oldCh[i];
  48834. if (isDef(c) && sameVnode(node, c)) { return i }
  48835. }
  48836. }
  48837. function patchVnode (
  48838. oldVnode,
  48839. vnode,
  48840. insertedVnodeQueue,
  48841. ownerArray,
  48842. index,
  48843. removeOnly
  48844. ) {
  48845. if (oldVnode === vnode) {
  48846. return
  48847. }
  48848. if (isDef(vnode.elm) && isDef(ownerArray)) {
  48849. // clone reused vnode
  48850. vnode = ownerArray[index] = cloneVNode(vnode);
  48851. }
  48852. var elm = vnode.elm = oldVnode.elm;
  48853. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  48854. if (isDef(vnode.asyncFactory.resolved)) {
  48855. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  48856. } else {
  48857. vnode.isAsyncPlaceholder = true;
  48858. }
  48859. return
  48860. }
  48861. // reuse element for static trees.
  48862. // note we only do this if the vnode is cloned -
  48863. // if the new node is not cloned it means the render functions have been
  48864. // reset by the hot-reload-api and we need to do a proper re-render.
  48865. if (isTrue(vnode.isStatic) &&
  48866. isTrue(oldVnode.isStatic) &&
  48867. vnode.key === oldVnode.key &&
  48868. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  48869. ) {
  48870. vnode.componentInstance = oldVnode.componentInstance;
  48871. return
  48872. }
  48873. var i;
  48874. var data = vnode.data;
  48875. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  48876. i(oldVnode, vnode);
  48877. }
  48878. var oldCh = oldVnode.children;
  48879. var ch = vnode.children;
  48880. if (isDef(data) && isPatchable(vnode)) {
  48881. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  48882. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  48883. }
  48884. if (isUndef(vnode.text)) {
  48885. if (isDef(oldCh) && isDef(ch)) {
  48886. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  48887. } else if (isDef(ch)) {
  48888. {
  48889. checkDuplicateKeys(ch);
  48890. }
  48891. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  48892. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  48893. } else if (isDef(oldCh)) {
  48894. removeVnodes(oldCh, 0, oldCh.length - 1);
  48895. } else if (isDef(oldVnode.text)) {
  48896. nodeOps.setTextContent(elm, '');
  48897. }
  48898. } else if (oldVnode.text !== vnode.text) {
  48899. nodeOps.setTextContent(elm, vnode.text);
  48900. }
  48901. if (isDef(data)) {
  48902. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  48903. }
  48904. }
  48905. function invokeInsertHook (vnode, queue, initial) {
  48906. // delay insert hooks for component root nodes, invoke them after the
  48907. // element is really inserted
  48908. if (isTrue(initial) && isDef(vnode.parent)) {
  48909. vnode.parent.data.pendingInsert = queue;
  48910. } else {
  48911. for (var i = 0; i < queue.length; ++i) {
  48912. queue[i].data.hook.insert(queue[i]);
  48913. }
  48914. }
  48915. }
  48916. var hydrationBailed = false;
  48917. // list of modules that can skip create hook during hydration because they
  48918. // are already rendered on the client or has no need for initialization
  48919. // Note: style is excluded because it relies on initial clone for future
  48920. // deep updates (#7063).
  48921. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  48922. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  48923. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  48924. var i;
  48925. var tag = vnode.tag;
  48926. var data = vnode.data;
  48927. var children = vnode.children;
  48928. inVPre = inVPre || (data && data.pre);
  48929. vnode.elm = elm;
  48930. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  48931. vnode.isAsyncPlaceholder = true;
  48932. return true
  48933. }
  48934. // assert node match
  48935. {
  48936. if (!assertNodeMatch(elm, vnode, inVPre)) {
  48937. return false
  48938. }
  48939. }
  48940. if (isDef(data)) {
  48941. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  48942. if (isDef(i = vnode.componentInstance)) {
  48943. // child component. it should have hydrated its own tree.
  48944. initComponent(vnode, insertedVnodeQueue);
  48945. return true
  48946. }
  48947. }
  48948. if (isDef(tag)) {
  48949. if (isDef(children)) {
  48950. // empty element, allow client to pick up and populate children
  48951. if (!elm.hasChildNodes()) {
  48952. createChildren(vnode, children, insertedVnodeQueue);
  48953. } else {
  48954. // v-html and domProps: innerHTML
  48955. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  48956. if (i !== elm.innerHTML) {
  48957. /* istanbul ignore if */
  48958. if (typeof console !== 'undefined' &&
  48959. !hydrationBailed
  48960. ) {
  48961. hydrationBailed = true;
  48962. console.warn('Parent: ', elm);
  48963. console.warn('server innerHTML: ', i);
  48964. console.warn('client innerHTML: ', elm.innerHTML);
  48965. }
  48966. return false
  48967. }
  48968. } else {
  48969. // iterate and compare children lists
  48970. var childrenMatch = true;
  48971. var childNode = elm.firstChild;
  48972. for (var i$1 = 0; i$1 < children.length; i$1++) {
  48973. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  48974. childrenMatch = false;
  48975. break
  48976. }
  48977. childNode = childNode.nextSibling;
  48978. }
  48979. // if childNode is not null, it means the actual childNodes list is
  48980. // longer than the virtual children list.
  48981. if (!childrenMatch || childNode) {
  48982. /* istanbul ignore if */
  48983. if (typeof console !== 'undefined' &&
  48984. !hydrationBailed
  48985. ) {
  48986. hydrationBailed = true;
  48987. console.warn('Parent: ', elm);
  48988. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  48989. }
  48990. return false
  48991. }
  48992. }
  48993. }
  48994. }
  48995. if (isDef(data)) {
  48996. var fullInvoke = false;
  48997. for (var key in data) {
  48998. if (!isRenderedModule(key)) {
  48999. fullInvoke = true;
  49000. invokeCreateHooks(vnode, insertedVnodeQueue);
  49001. break
  49002. }
  49003. }
  49004. if (!fullInvoke && data['class']) {
  49005. // ensure collecting deps for deep class bindings for future updates
  49006. traverse(data['class']);
  49007. }
  49008. }
  49009. } else if (elm.data !== vnode.text) {
  49010. elm.data = vnode.text;
  49011. }
  49012. return true
  49013. }
  49014. function assertNodeMatch (node, vnode, inVPre) {
  49015. if (isDef(vnode.tag)) {
  49016. return vnode.tag.indexOf('vue-component') === 0 || (
  49017. !isUnknownElement$$1(vnode, inVPre) &&
  49018. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  49019. )
  49020. } else {
  49021. return node.nodeType === (vnode.isComment ? 8 : 3)
  49022. }
  49023. }
  49024. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  49025. if (isUndef(vnode)) {
  49026. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  49027. return
  49028. }
  49029. var isInitialPatch = false;
  49030. var insertedVnodeQueue = [];
  49031. if (isUndef(oldVnode)) {
  49032. // empty mount (likely as component), create new root element
  49033. isInitialPatch = true;
  49034. createElm(vnode, insertedVnodeQueue);
  49035. } else {
  49036. var isRealElement = isDef(oldVnode.nodeType);
  49037. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  49038. // patch existing root node
  49039. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  49040. } else {
  49041. if (isRealElement) {
  49042. // mounting to a real element
  49043. // check if this is server-rendered content and if we can perform
  49044. // a successful hydration.
  49045. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  49046. oldVnode.removeAttribute(SSR_ATTR);
  49047. hydrating = true;
  49048. }
  49049. if (isTrue(hydrating)) {
  49050. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  49051. invokeInsertHook(vnode, insertedVnodeQueue, true);
  49052. return oldVnode
  49053. } else {
  49054. warn(
  49055. 'The client-side rendered virtual DOM tree is not matching ' +
  49056. 'server-rendered content. This is likely caused by incorrect ' +
  49057. 'HTML markup, for example nesting block-level elements inside ' +
  49058. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  49059. 'full client-side render.'
  49060. );
  49061. }
  49062. }
  49063. // either not server-rendered, or hydration failed.
  49064. // create an empty node and replace it
  49065. oldVnode = emptyNodeAt(oldVnode);
  49066. }
  49067. // replacing existing element
  49068. var oldElm = oldVnode.elm;
  49069. var parentElm = nodeOps.parentNode(oldElm);
  49070. // create new node
  49071. createElm(
  49072. vnode,
  49073. insertedVnodeQueue,
  49074. // extremely rare edge case: do not insert if old element is in a
  49075. // leaving transition. Only happens when combining transition +
  49076. // keep-alive + HOCs. (#4590)
  49077. oldElm._leaveCb ? null : parentElm,
  49078. nodeOps.nextSibling(oldElm)
  49079. );
  49080. // update parent placeholder node element, recursively
  49081. if (isDef(vnode.parent)) {
  49082. var ancestor = vnode.parent;
  49083. var patchable = isPatchable(vnode);
  49084. while (ancestor) {
  49085. for (var i = 0; i < cbs.destroy.length; ++i) {
  49086. cbs.destroy[i](ancestor);
  49087. }
  49088. ancestor.elm = vnode.elm;
  49089. if (patchable) {
  49090. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49091. cbs.create[i$1](emptyNode, ancestor);
  49092. }
  49093. // #6513
  49094. // invoke insert hooks that may have been merged by create hooks.
  49095. // e.g. for directives that uses the "inserted" hook.
  49096. var insert = ancestor.data.hook.insert;
  49097. if (insert.merged) {
  49098. // start at index 1 to avoid re-invoking component mounted hook
  49099. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  49100. insert.fns[i$2]();
  49101. }
  49102. }
  49103. } else {
  49104. registerRef(ancestor);
  49105. }
  49106. ancestor = ancestor.parent;
  49107. }
  49108. }
  49109. // destroy old node
  49110. if (isDef(parentElm)) {
  49111. removeVnodes([oldVnode], 0, 0);
  49112. } else if (isDef(oldVnode.tag)) {
  49113. invokeDestroyHook(oldVnode);
  49114. }
  49115. }
  49116. }
  49117. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  49118. return vnode.elm
  49119. }
  49120. }
  49121. /* */
  49122. var directives = {
  49123. create: updateDirectives,
  49124. update: updateDirectives,
  49125. destroy: function unbindDirectives (vnode) {
  49126. updateDirectives(vnode, emptyNode);
  49127. }
  49128. };
  49129. function updateDirectives (oldVnode, vnode) {
  49130. if (oldVnode.data.directives || vnode.data.directives) {
  49131. _update(oldVnode, vnode);
  49132. }
  49133. }
  49134. function _update (oldVnode, vnode) {
  49135. var isCreate = oldVnode === emptyNode;
  49136. var isDestroy = vnode === emptyNode;
  49137. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  49138. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  49139. var dirsWithInsert = [];
  49140. var dirsWithPostpatch = [];
  49141. var key, oldDir, dir;
  49142. for (key in newDirs) {
  49143. oldDir = oldDirs[key];
  49144. dir = newDirs[key];
  49145. if (!oldDir) {
  49146. // new directive, bind
  49147. callHook$1(dir, 'bind', vnode, oldVnode);
  49148. if (dir.def && dir.def.inserted) {
  49149. dirsWithInsert.push(dir);
  49150. }
  49151. } else {
  49152. // existing directive, update
  49153. dir.oldValue = oldDir.value;
  49154. dir.oldArg = oldDir.arg;
  49155. callHook$1(dir, 'update', vnode, oldVnode);
  49156. if (dir.def && dir.def.componentUpdated) {
  49157. dirsWithPostpatch.push(dir);
  49158. }
  49159. }
  49160. }
  49161. if (dirsWithInsert.length) {
  49162. var callInsert = function () {
  49163. for (var i = 0; i < dirsWithInsert.length; i++) {
  49164. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  49165. }
  49166. };
  49167. if (isCreate) {
  49168. mergeVNodeHook(vnode, 'insert', callInsert);
  49169. } else {
  49170. callInsert();
  49171. }
  49172. }
  49173. if (dirsWithPostpatch.length) {
  49174. mergeVNodeHook(vnode, 'postpatch', function () {
  49175. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  49176. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  49177. }
  49178. });
  49179. }
  49180. if (!isCreate) {
  49181. for (key in oldDirs) {
  49182. if (!newDirs[key]) {
  49183. // no longer present, unbind
  49184. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  49185. }
  49186. }
  49187. }
  49188. }
  49189. var emptyModifiers = Object.create(null);
  49190. function normalizeDirectives$1 (
  49191. dirs,
  49192. vm
  49193. ) {
  49194. var res = Object.create(null);
  49195. if (!dirs) {
  49196. // $flow-disable-line
  49197. return res
  49198. }
  49199. var i, dir;
  49200. for (i = 0; i < dirs.length; i++) {
  49201. dir = dirs[i];
  49202. if (!dir.modifiers) {
  49203. // $flow-disable-line
  49204. dir.modifiers = emptyModifiers;
  49205. }
  49206. res[getRawDirName(dir)] = dir;
  49207. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  49208. }
  49209. // $flow-disable-line
  49210. return res
  49211. }
  49212. function getRawDirName (dir) {
  49213. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  49214. }
  49215. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  49216. var fn = dir.def && dir.def[hook];
  49217. if (fn) {
  49218. try {
  49219. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  49220. } catch (e) {
  49221. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  49222. }
  49223. }
  49224. }
  49225. var baseModules = [
  49226. ref,
  49227. directives
  49228. ];
  49229. /* */
  49230. function updateAttrs (oldVnode, vnode) {
  49231. var opts = vnode.componentOptions;
  49232. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  49233. return
  49234. }
  49235. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  49236. return
  49237. }
  49238. var key, cur, old;
  49239. var elm = vnode.elm;
  49240. var oldAttrs = oldVnode.data.attrs || {};
  49241. var attrs = vnode.data.attrs || {};
  49242. // clone observed objects, as the user probably wants to mutate it
  49243. if (isDef(attrs.__ob__)) {
  49244. attrs = vnode.data.attrs = extend({}, attrs);
  49245. }
  49246. for (key in attrs) {
  49247. cur = attrs[key];
  49248. old = oldAttrs[key];
  49249. if (old !== cur) {
  49250. setAttr(elm, key, cur);
  49251. }
  49252. }
  49253. // #4391: in IE9, setting type can reset value for input[type=radio]
  49254. // #6666: IE/Edge forces progress value down to 1 before setting a max
  49255. /* istanbul ignore if */
  49256. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  49257. setAttr(elm, 'value', attrs.value);
  49258. }
  49259. for (key in oldAttrs) {
  49260. if (isUndef(attrs[key])) {
  49261. if (isXlink(key)) {
  49262. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49263. } else if (!isEnumeratedAttr(key)) {
  49264. elm.removeAttribute(key);
  49265. }
  49266. }
  49267. }
  49268. }
  49269. function setAttr (el, key, value) {
  49270. if (el.tagName.indexOf('-') > -1) {
  49271. baseSetAttr(el, key, value);
  49272. } else if (isBooleanAttr(key)) {
  49273. // set attribute for blank value
  49274. // e.g. <option disabled>Select one</option>
  49275. if (isFalsyAttrValue(value)) {
  49276. el.removeAttribute(key);
  49277. } else {
  49278. // technically allowfullscreen is a boolean attribute for <iframe>,
  49279. // but Flash expects a value of "true" when used on <embed> tag
  49280. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  49281. ? 'true'
  49282. : key;
  49283. el.setAttribute(key, value);
  49284. }
  49285. } else if (isEnumeratedAttr(key)) {
  49286. el.setAttribute(key, convertEnumeratedValue(key, value));
  49287. } else if (isXlink(key)) {
  49288. if (isFalsyAttrValue(value)) {
  49289. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49290. } else {
  49291. el.setAttributeNS(xlinkNS, key, value);
  49292. }
  49293. } else {
  49294. baseSetAttr(el, key, value);
  49295. }
  49296. }
  49297. function baseSetAttr (el, key, value) {
  49298. if (isFalsyAttrValue(value)) {
  49299. el.removeAttribute(key);
  49300. } else {
  49301. // #7138: IE10 & 11 fires input event when setting placeholder on
  49302. // <textarea>... block the first input event and remove the blocker
  49303. // immediately.
  49304. /* istanbul ignore if */
  49305. if (
  49306. isIE && !isIE9 &&
  49307. el.tagName === 'TEXTAREA' &&
  49308. key === 'placeholder' && value !== '' && !el.__ieph
  49309. ) {
  49310. var blocker = function (e) {
  49311. e.stopImmediatePropagation();
  49312. el.removeEventListener('input', blocker);
  49313. };
  49314. el.addEventListener('input', blocker);
  49315. // $flow-disable-line
  49316. el.__ieph = true; /* IE placeholder patched */
  49317. }
  49318. el.setAttribute(key, value);
  49319. }
  49320. }
  49321. var attrs = {
  49322. create: updateAttrs,
  49323. update: updateAttrs
  49324. };
  49325. /* */
  49326. function updateClass (oldVnode, vnode) {
  49327. var el = vnode.elm;
  49328. var data = vnode.data;
  49329. var oldData = oldVnode.data;
  49330. if (
  49331. isUndef(data.staticClass) &&
  49332. isUndef(data.class) && (
  49333. isUndef(oldData) || (
  49334. isUndef(oldData.staticClass) &&
  49335. isUndef(oldData.class)
  49336. )
  49337. )
  49338. ) {
  49339. return
  49340. }
  49341. var cls = genClassForVnode(vnode);
  49342. // handle transition classes
  49343. var transitionClass = el._transitionClasses;
  49344. if (isDef(transitionClass)) {
  49345. cls = concat(cls, stringifyClass(transitionClass));
  49346. }
  49347. // set the class
  49348. if (cls !== el._prevClass) {
  49349. el.setAttribute('class', cls);
  49350. el._prevClass = cls;
  49351. }
  49352. }
  49353. var klass = {
  49354. create: updateClass,
  49355. update: updateClass
  49356. };
  49357. /* */
  49358. var validDivisionCharRE = /[\w).+\-_$\]]/;
  49359. function parseFilters (exp) {
  49360. var inSingle = false;
  49361. var inDouble = false;
  49362. var inTemplateString = false;
  49363. var inRegex = false;
  49364. var curly = 0;
  49365. var square = 0;
  49366. var paren = 0;
  49367. var lastFilterIndex = 0;
  49368. var c, prev, i, expression, filters;
  49369. for (i = 0; i < exp.length; i++) {
  49370. prev = c;
  49371. c = exp.charCodeAt(i);
  49372. if (inSingle) {
  49373. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  49374. } else if (inDouble) {
  49375. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  49376. } else if (inTemplateString) {
  49377. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  49378. } else if (inRegex) {
  49379. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  49380. } else if (
  49381. c === 0x7C && // pipe
  49382. exp.charCodeAt(i + 1) !== 0x7C &&
  49383. exp.charCodeAt(i - 1) !== 0x7C &&
  49384. !curly && !square && !paren
  49385. ) {
  49386. if (expression === undefined) {
  49387. // first filter, end of expression
  49388. lastFilterIndex = i + 1;
  49389. expression = exp.slice(0, i).trim();
  49390. } else {
  49391. pushFilter();
  49392. }
  49393. } else {
  49394. switch (c) {
  49395. case 0x22: inDouble = true; break // "
  49396. case 0x27: inSingle = true; break // '
  49397. case 0x60: inTemplateString = true; break // `
  49398. case 0x28: paren++; break // (
  49399. case 0x29: paren--; break // )
  49400. case 0x5B: square++; break // [
  49401. case 0x5D: square--; break // ]
  49402. case 0x7B: curly++; break // {
  49403. case 0x7D: curly--; break // }
  49404. }
  49405. if (c === 0x2f) { // /
  49406. var j = i - 1;
  49407. var p = (void 0);
  49408. // find first non-whitespace prev char
  49409. for (; j >= 0; j--) {
  49410. p = exp.charAt(j);
  49411. if (p !== ' ') { break }
  49412. }
  49413. if (!p || !validDivisionCharRE.test(p)) {
  49414. inRegex = true;
  49415. }
  49416. }
  49417. }
  49418. }
  49419. if (expression === undefined) {
  49420. expression = exp.slice(0, i).trim();
  49421. } else if (lastFilterIndex !== 0) {
  49422. pushFilter();
  49423. }
  49424. function pushFilter () {
  49425. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  49426. lastFilterIndex = i + 1;
  49427. }
  49428. if (filters) {
  49429. for (i = 0; i < filters.length; i++) {
  49430. expression = wrapFilter(expression, filters[i]);
  49431. }
  49432. }
  49433. return expression
  49434. }
  49435. function wrapFilter (exp, filter) {
  49436. var i = filter.indexOf('(');
  49437. if (i < 0) {
  49438. // _f: resolveFilter
  49439. return ("_f(\"" + filter + "\")(" + exp + ")")
  49440. } else {
  49441. var name = filter.slice(0, i);
  49442. var args = filter.slice(i + 1);
  49443. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  49444. }
  49445. }
  49446. /* */
  49447. /* eslint-disable no-unused-vars */
  49448. function baseWarn (msg, range) {
  49449. console.error(("[Vue compiler]: " + msg));
  49450. }
  49451. /* eslint-enable no-unused-vars */
  49452. function pluckModuleFunction (
  49453. modules,
  49454. key
  49455. ) {
  49456. return modules
  49457. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  49458. : []
  49459. }
  49460. function addProp (el, name, value, range, dynamic) {
  49461. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  49462. el.plain = false;
  49463. }
  49464. function addAttr (el, name, value, range, dynamic) {
  49465. var attrs = dynamic
  49466. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  49467. : (el.attrs || (el.attrs = []));
  49468. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  49469. el.plain = false;
  49470. }
  49471. // add a raw attr (use this in preTransforms)
  49472. function addRawAttr (el, name, value, range) {
  49473. el.attrsMap[name] = value;
  49474. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  49475. }
  49476. function addDirective (
  49477. el,
  49478. name,
  49479. rawName,
  49480. value,
  49481. arg,
  49482. isDynamicArg,
  49483. modifiers,
  49484. range
  49485. ) {
  49486. (el.directives || (el.directives = [])).push(rangeSetItem({
  49487. name: name,
  49488. rawName: rawName,
  49489. value: value,
  49490. arg: arg,
  49491. isDynamicArg: isDynamicArg,
  49492. modifiers: modifiers
  49493. }, range));
  49494. el.plain = false;
  49495. }
  49496. function prependModifierMarker (symbol, name, dynamic) {
  49497. return dynamic
  49498. ? ("_p(" + name + ",\"" + symbol + "\")")
  49499. : symbol + name // mark the event as captured
  49500. }
  49501. function addHandler (
  49502. el,
  49503. name,
  49504. value,
  49505. modifiers,
  49506. important,
  49507. warn,
  49508. range,
  49509. dynamic
  49510. ) {
  49511. modifiers = modifiers || emptyObject;
  49512. // warn prevent and passive modifier
  49513. /* istanbul ignore if */
  49514. if (
  49515. warn &&
  49516. modifiers.prevent && modifiers.passive
  49517. ) {
  49518. warn(
  49519. 'passive and prevent can\'t be used together. ' +
  49520. 'Passive handler can\'t prevent default event.',
  49521. range
  49522. );
  49523. }
  49524. // normalize click.right and click.middle since they don't actually fire
  49525. // this is technically browser-specific, but at least for now browsers are
  49526. // the only target envs that have right/middle clicks.
  49527. if (modifiers.right) {
  49528. if (dynamic) {
  49529. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  49530. } else if (name === 'click') {
  49531. name = 'contextmenu';
  49532. delete modifiers.right;
  49533. }
  49534. } else if (modifiers.middle) {
  49535. if (dynamic) {
  49536. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  49537. } else if (name === 'click') {
  49538. name = 'mouseup';
  49539. }
  49540. }
  49541. // check capture modifier
  49542. if (modifiers.capture) {
  49543. delete modifiers.capture;
  49544. name = prependModifierMarker('!', name, dynamic);
  49545. }
  49546. if (modifiers.once) {
  49547. delete modifiers.once;
  49548. name = prependModifierMarker('~', name, dynamic);
  49549. }
  49550. /* istanbul ignore if */
  49551. if (modifiers.passive) {
  49552. delete modifiers.passive;
  49553. name = prependModifierMarker('&', name, dynamic);
  49554. }
  49555. var events;
  49556. if (modifiers.native) {
  49557. delete modifiers.native;
  49558. events = el.nativeEvents || (el.nativeEvents = {});
  49559. } else {
  49560. events = el.events || (el.events = {});
  49561. }
  49562. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  49563. if (modifiers !== emptyObject) {
  49564. newHandler.modifiers = modifiers;
  49565. }
  49566. var handlers = events[name];
  49567. /* istanbul ignore if */
  49568. if (Array.isArray(handlers)) {
  49569. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  49570. } else if (handlers) {
  49571. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  49572. } else {
  49573. events[name] = newHandler;
  49574. }
  49575. el.plain = false;
  49576. }
  49577. function getRawBindingAttr (
  49578. el,
  49579. name
  49580. ) {
  49581. return el.rawAttrsMap[':' + name] ||
  49582. el.rawAttrsMap['v-bind:' + name] ||
  49583. el.rawAttrsMap[name]
  49584. }
  49585. function getBindingAttr (
  49586. el,
  49587. name,
  49588. getStatic
  49589. ) {
  49590. var dynamicValue =
  49591. getAndRemoveAttr(el, ':' + name) ||
  49592. getAndRemoveAttr(el, 'v-bind:' + name);
  49593. if (dynamicValue != null) {
  49594. return parseFilters(dynamicValue)
  49595. } else if (getStatic !== false) {
  49596. var staticValue = getAndRemoveAttr(el, name);
  49597. if (staticValue != null) {
  49598. return JSON.stringify(staticValue)
  49599. }
  49600. }
  49601. }
  49602. // note: this only removes the attr from the Array (attrsList) so that it
  49603. // doesn't get processed by processAttrs.
  49604. // By default it does NOT remove it from the map (attrsMap) because the map is
  49605. // needed during codegen.
  49606. function getAndRemoveAttr (
  49607. el,
  49608. name,
  49609. removeFromMap
  49610. ) {
  49611. var val;
  49612. if ((val = el.attrsMap[name]) != null) {
  49613. var list = el.attrsList;
  49614. for (var i = 0, l = list.length; i < l; i++) {
  49615. if (list[i].name === name) {
  49616. list.splice(i, 1);
  49617. break
  49618. }
  49619. }
  49620. }
  49621. if (removeFromMap) {
  49622. delete el.attrsMap[name];
  49623. }
  49624. return val
  49625. }
  49626. function getAndRemoveAttrByRegex (
  49627. el,
  49628. name
  49629. ) {
  49630. var list = el.attrsList;
  49631. for (var i = 0, l = list.length; i < l; i++) {
  49632. var attr = list[i];
  49633. if (name.test(attr.name)) {
  49634. list.splice(i, 1);
  49635. return attr
  49636. }
  49637. }
  49638. }
  49639. function rangeSetItem (
  49640. item,
  49641. range
  49642. ) {
  49643. if (range) {
  49644. if (range.start != null) {
  49645. item.start = range.start;
  49646. }
  49647. if (range.end != null) {
  49648. item.end = range.end;
  49649. }
  49650. }
  49651. return item
  49652. }
  49653. /* */
  49654. /**
  49655. * Cross-platform code generation for component v-model
  49656. */
  49657. function genComponentModel (
  49658. el,
  49659. value,
  49660. modifiers
  49661. ) {
  49662. var ref = modifiers || {};
  49663. var number = ref.number;
  49664. var trim = ref.trim;
  49665. var baseValueExpression = '$$v';
  49666. var valueExpression = baseValueExpression;
  49667. if (trim) {
  49668. valueExpression =
  49669. "(typeof " + baseValueExpression + " === 'string'" +
  49670. "? " + baseValueExpression + ".trim()" +
  49671. ": " + baseValueExpression + ")";
  49672. }
  49673. if (number) {
  49674. valueExpression = "_n(" + valueExpression + ")";
  49675. }
  49676. var assignment = genAssignmentCode(value, valueExpression);
  49677. el.model = {
  49678. value: ("(" + value + ")"),
  49679. expression: JSON.stringify(value),
  49680. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  49681. };
  49682. }
  49683. /**
  49684. * Cross-platform codegen helper for generating v-model value assignment code.
  49685. */
  49686. function genAssignmentCode (
  49687. value,
  49688. assignment
  49689. ) {
  49690. var res = parseModel(value);
  49691. if (res.key === null) {
  49692. return (value + "=" + assignment)
  49693. } else {
  49694. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  49695. }
  49696. }
  49697. /**
  49698. * Parse a v-model expression into a base path and a final key segment.
  49699. * Handles both dot-path and possible square brackets.
  49700. *
  49701. * Possible cases:
  49702. *
  49703. * - test
  49704. * - test[key]
  49705. * - test[test1[key]]
  49706. * - test["a"][key]
  49707. * - xxx.test[a[a].test1[key]]
  49708. * - test.xxx.a["asa"][test1[key]]
  49709. *
  49710. */
  49711. var len, str, chr, index$1, expressionPos, expressionEndPos;
  49712. function parseModel (val) {
  49713. // Fix https://github.com/vuejs/vue/pull/7730
  49714. // allow v-model="obj.val " (trailing whitespace)
  49715. val = val.trim();
  49716. len = val.length;
  49717. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  49718. index$1 = val.lastIndexOf('.');
  49719. if (index$1 > -1) {
  49720. return {
  49721. exp: val.slice(0, index$1),
  49722. key: '"' + val.slice(index$1 + 1) + '"'
  49723. }
  49724. } else {
  49725. return {
  49726. exp: val,
  49727. key: null
  49728. }
  49729. }
  49730. }
  49731. str = val;
  49732. index$1 = expressionPos = expressionEndPos = 0;
  49733. while (!eof()) {
  49734. chr = next();
  49735. /* istanbul ignore if */
  49736. if (isStringStart(chr)) {
  49737. parseString(chr);
  49738. } else if (chr === 0x5B) {
  49739. parseBracket(chr);
  49740. }
  49741. }
  49742. return {
  49743. exp: val.slice(0, expressionPos),
  49744. key: val.slice(expressionPos + 1, expressionEndPos)
  49745. }
  49746. }
  49747. function next () {
  49748. return str.charCodeAt(++index$1)
  49749. }
  49750. function eof () {
  49751. return index$1 >= len
  49752. }
  49753. function isStringStart (chr) {
  49754. return chr === 0x22 || chr === 0x27
  49755. }
  49756. function parseBracket (chr) {
  49757. var inBracket = 1;
  49758. expressionPos = index$1;
  49759. while (!eof()) {
  49760. chr = next();
  49761. if (isStringStart(chr)) {
  49762. parseString(chr);
  49763. continue
  49764. }
  49765. if (chr === 0x5B) { inBracket++; }
  49766. if (chr === 0x5D) { inBracket--; }
  49767. if (inBracket === 0) {
  49768. expressionEndPos = index$1;
  49769. break
  49770. }
  49771. }
  49772. }
  49773. function parseString (chr) {
  49774. var stringQuote = chr;
  49775. while (!eof()) {
  49776. chr = next();
  49777. if (chr === stringQuote) {
  49778. break
  49779. }
  49780. }
  49781. }
  49782. /* */
  49783. var warn$1;
  49784. // in some cases, the event used has to be determined at runtime
  49785. // so we used some reserved tokens during compile.
  49786. var RANGE_TOKEN = '__r';
  49787. var CHECKBOX_RADIO_TOKEN = '__c';
  49788. function model (
  49789. el,
  49790. dir,
  49791. _warn
  49792. ) {
  49793. warn$1 = _warn;
  49794. var value = dir.value;
  49795. var modifiers = dir.modifiers;
  49796. var tag = el.tag;
  49797. var type = el.attrsMap.type;
  49798. {
  49799. // inputs with type="file" are read only and setting the input's
  49800. // value will throw an error.
  49801. if (tag === 'input' && type === 'file') {
  49802. warn$1(
  49803. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  49804. "File inputs are read only. Use a v-on:change listener instead.",
  49805. el.rawAttrsMap['v-model']
  49806. );
  49807. }
  49808. }
  49809. if (el.component) {
  49810. genComponentModel(el, value, modifiers);
  49811. // component v-model doesn't need extra runtime
  49812. return false
  49813. } else if (tag === 'select') {
  49814. genSelect(el, value, modifiers);
  49815. } else if (tag === 'input' && type === 'checkbox') {
  49816. genCheckboxModel(el, value, modifiers);
  49817. } else if (tag === 'input' && type === 'radio') {
  49818. genRadioModel(el, value, modifiers);
  49819. } else if (tag === 'input' || tag === 'textarea') {
  49820. genDefaultModel(el, value, modifiers);
  49821. } else if (!config.isReservedTag(tag)) {
  49822. genComponentModel(el, value, modifiers);
  49823. // component v-model doesn't need extra runtime
  49824. return false
  49825. } else {
  49826. warn$1(
  49827. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  49828. "v-model is not supported on this element type. " +
  49829. 'If you are working with contenteditable, it\'s recommended to ' +
  49830. 'wrap a library dedicated for that purpose inside a custom component.',
  49831. el.rawAttrsMap['v-model']
  49832. );
  49833. }
  49834. // ensure runtime directive metadata
  49835. return true
  49836. }
  49837. function genCheckboxModel (
  49838. el,
  49839. value,
  49840. modifiers
  49841. ) {
  49842. var number = modifiers && modifiers.number;
  49843. var valueBinding = getBindingAttr(el, 'value') || 'null';
  49844. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  49845. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  49846. addProp(el, 'checked',
  49847. "Array.isArray(" + value + ")" +
  49848. "?_i(" + value + "," + valueBinding + ")>-1" + (
  49849. trueValueBinding === 'true'
  49850. ? (":(" + value + ")")
  49851. : (":_q(" + value + "," + trueValueBinding + ")")
  49852. )
  49853. );
  49854. addHandler(el, 'change',
  49855. "var $$a=" + value + "," +
  49856. '$$el=$event.target,' +
  49857. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  49858. 'if(Array.isArray($$a)){' +
  49859. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  49860. '$$i=_i($$a,$$v);' +
  49861. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  49862. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  49863. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  49864. null, true
  49865. );
  49866. }
  49867. function genRadioModel (
  49868. el,
  49869. value,
  49870. modifiers
  49871. ) {
  49872. var number = modifiers && modifiers.number;
  49873. var valueBinding = getBindingAttr(el, 'value') || 'null';
  49874. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  49875. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  49876. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  49877. }
  49878. function genSelect (
  49879. el,
  49880. value,
  49881. modifiers
  49882. ) {
  49883. var number = modifiers && modifiers.number;
  49884. var selectedVal = "Array.prototype.filter" +
  49885. ".call($event.target.options,function(o){return o.selected})" +
  49886. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  49887. "return " + (number ? '_n(val)' : 'val') + "})";
  49888. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  49889. var code = "var $$selectedVal = " + selectedVal + ";";
  49890. code = code + " " + (genAssignmentCode(value, assignment));
  49891. addHandler(el, 'change', code, null, true);
  49892. }
  49893. function genDefaultModel (
  49894. el,
  49895. value,
  49896. modifiers
  49897. ) {
  49898. var type = el.attrsMap.type;
  49899. // warn if v-bind:value conflicts with v-model
  49900. // except for inputs with v-bind:type
  49901. {
  49902. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  49903. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  49904. if (value$1 && !typeBinding) {
  49905. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  49906. warn$1(
  49907. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  49908. 'because the latter already expands to a value binding internally',
  49909. el.rawAttrsMap[binding]
  49910. );
  49911. }
  49912. }
  49913. var ref = modifiers || {};
  49914. var lazy = ref.lazy;
  49915. var number = ref.number;
  49916. var trim = ref.trim;
  49917. var needCompositionGuard = !lazy && type !== 'range';
  49918. var event = lazy
  49919. ? 'change'
  49920. : type === 'range'
  49921. ? RANGE_TOKEN
  49922. : 'input';
  49923. var valueExpression = '$event.target.value';
  49924. if (trim) {
  49925. valueExpression = "$event.target.value.trim()";
  49926. }
  49927. if (number) {
  49928. valueExpression = "_n(" + valueExpression + ")";
  49929. }
  49930. var code = genAssignmentCode(value, valueExpression);
  49931. if (needCompositionGuard) {
  49932. code = "if($event.target.composing)return;" + code;
  49933. }
  49934. addProp(el, 'value', ("(" + value + ")"));
  49935. addHandler(el, event, code, null, true);
  49936. if (trim || number) {
  49937. addHandler(el, 'blur', '$forceUpdate()');
  49938. }
  49939. }
  49940. /* */
  49941. // normalize v-model event tokens that can only be determined at runtime.
  49942. // it's important to place the event as the first in the array because
  49943. // the whole point is ensuring the v-model callback gets called before
  49944. // user-attached handlers.
  49945. function normalizeEvents (on) {
  49946. /* istanbul ignore if */
  49947. if (isDef(on[RANGE_TOKEN])) {
  49948. // IE input[type=range] only supports `change` event
  49949. var event = isIE ? 'change' : 'input';
  49950. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  49951. delete on[RANGE_TOKEN];
  49952. }
  49953. // This was originally intended to fix #4521 but no longer necessary
  49954. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  49955. /* istanbul ignore if */
  49956. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  49957. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  49958. delete on[CHECKBOX_RADIO_TOKEN];
  49959. }
  49960. }
  49961. var target$1;
  49962. function createOnceHandler$1 (event, handler, capture) {
  49963. var _target = target$1; // save current target element in closure
  49964. return function onceHandler () {
  49965. var res = handler.apply(null, arguments);
  49966. if (res !== null) {
  49967. remove$2(event, onceHandler, capture, _target);
  49968. }
  49969. }
  49970. }
  49971. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  49972. // implementation and does not fire microtasks in between event propagation, so
  49973. // safe to exclude.
  49974. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  49975. function add$1 (
  49976. name,
  49977. handler,
  49978. capture,
  49979. passive
  49980. ) {
  49981. // async edge case #6566: inner click event triggers patch, event handler
  49982. // attached to outer element during patch, and triggered again. This
  49983. // happens because browsers fire microtask ticks between event propagation.
  49984. // the solution is simple: we save the timestamp when a handler is attached,
  49985. // and the handler would only fire if the event passed to it was fired
  49986. // AFTER it was attached.
  49987. if (useMicrotaskFix) {
  49988. var attachedTimestamp = currentFlushTimestamp;
  49989. var original = handler;
  49990. handler = original._wrapper = function (e) {
  49991. if (
  49992. // no bubbling, should always fire.
  49993. // this is just a safety net in case event.timeStamp is unreliable in
  49994. // certain weird environments...
  49995. e.target === e.currentTarget ||
  49996. // event is fired after handler attachment
  49997. e.timeStamp >= attachedTimestamp ||
  49998. // bail for environments that have buggy event.timeStamp implementations
  49999. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  50000. // #9681 QtWebEngine event.timeStamp is negative value
  50001. e.timeStamp <= 0 ||
  50002. // #9448 bail if event is fired in another document in a multi-page
  50003. // electron/nw.js app, since event.timeStamp will be using a different
  50004. // starting reference
  50005. e.target.ownerDocument !== document
  50006. ) {
  50007. return original.apply(this, arguments)
  50008. }
  50009. };
  50010. }
  50011. target$1.addEventListener(
  50012. name,
  50013. handler,
  50014. supportsPassive
  50015. ? { capture: capture, passive: passive }
  50016. : capture
  50017. );
  50018. }
  50019. function remove$2 (
  50020. name,
  50021. handler,
  50022. capture,
  50023. _target
  50024. ) {
  50025. (_target || target$1).removeEventListener(
  50026. name,
  50027. handler._wrapper || handler,
  50028. capture
  50029. );
  50030. }
  50031. function updateDOMListeners (oldVnode, vnode) {
  50032. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  50033. return
  50034. }
  50035. var on = vnode.data.on || {};
  50036. var oldOn = oldVnode.data.on || {};
  50037. target$1 = vnode.elm;
  50038. normalizeEvents(on);
  50039. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  50040. target$1 = undefined;
  50041. }
  50042. var events = {
  50043. create: updateDOMListeners,
  50044. update: updateDOMListeners
  50045. };
  50046. /* */
  50047. var svgContainer;
  50048. function updateDOMProps (oldVnode, vnode) {
  50049. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  50050. return
  50051. }
  50052. var key, cur;
  50053. var elm = vnode.elm;
  50054. var oldProps = oldVnode.data.domProps || {};
  50055. var props = vnode.data.domProps || {};
  50056. // clone observed objects, as the user probably wants to mutate it
  50057. if (isDef(props.__ob__)) {
  50058. props = vnode.data.domProps = extend({}, props);
  50059. }
  50060. for (key in oldProps) {
  50061. if (!(key in props)) {
  50062. elm[key] = '';
  50063. }
  50064. }
  50065. for (key in props) {
  50066. cur = props[key];
  50067. // ignore children if the node has textContent or innerHTML,
  50068. // as these will throw away existing DOM nodes and cause removal errors
  50069. // on subsequent patches (#3360)
  50070. if (key === 'textContent' || key === 'innerHTML') {
  50071. if (vnode.children) { vnode.children.length = 0; }
  50072. if (cur === oldProps[key]) { continue }
  50073. // #6601 work around Chrome version <= 55 bug where single textNode
  50074. // replaced by innerHTML/textContent retains its parentNode property
  50075. if (elm.childNodes.length === 1) {
  50076. elm.removeChild(elm.childNodes[0]);
  50077. }
  50078. }
  50079. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  50080. // store value as _value as well since
  50081. // non-string values will be stringified
  50082. elm._value = cur;
  50083. // avoid resetting cursor position when value is the same
  50084. var strCur = isUndef(cur) ? '' : String(cur);
  50085. if (shouldUpdateValue(elm, strCur)) {
  50086. elm.value = strCur;
  50087. }
  50088. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  50089. // IE doesn't support innerHTML for SVG elements
  50090. svgContainer = svgContainer || document.createElement('div');
  50091. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  50092. var svg = svgContainer.firstChild;
  50093. while (elm.firstChild) {
  50094. elm.removeChild(elm.firstChild);
  50095. }
  50096. while (svg.firstChild) {
  50097. elm.appendChild(svg.firstChild);
  50098. }
  50099. } else if (
  50100. // skip the update if old and new VDOM state is the same.
  50101. // `value` is handled separately because the DOM value may be temporarily
  50102. // out of sync with VDOM state due to focus, composition and modifiers.
  50103. // This #4521 by skipping the unnecesarry `checked` update.
  50104. cur !== oldProps[key]
  50105. ) {
  50106. // some property updates can throw
  50107. // e.g. `value` on <progress> w/ non-finite value
  50108. try {
  50109. elm[key] = cur;
  50110. } catch (e) {}
  50111. }
  50112. }
  50113. }
  50114. // check platforms/web/util/attrs.js acceptValue
  50115. function shouldUpdateValue (elm, checkVal) {
  50116. return (!elm.composing && (
  50117. elm.tagName === 'OPTION' ||
  50118. isNotInFocusAndDirty(elm, checkVal) ||
  50119. isDirtyWithModifiers(elm, checkVal)
  50120. ))
  50121. }
  50122. function isNotInFocusAndDirty (elm, checkVal) {
  50123. // return true when textbox (.number and .trim) loses focus and its value is
  50124. // not equal to the updated value
  50125. var notInFocus = true;
  50126. // #6157
  50127. // work around IE bug when accessing document.activeElement in an iframe
  50128. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  50129. return notInFocus && elm.value !== checkVal
  50130. }
  50131. function isDirtyWithModifiers (elm, newVal) {
  50132. var value = elm.value;
  50133. var modifiers = elm._vModifiers; // injected by v-model runtime
  50134. if (isDef(modifiers)) {
  50135. if (modifiers.number) {
  50136. return toNumber(value) !== toNumber(newVal)
  50137. }
  50138. if (modifiers.trim) {
  50139. return value.trim() !== newVal.trim()
  50140. }
  50141. }
  50142. return value !== newVal
  50143. }
  50144. var domProps = {
  50145. create: updateDOMProps,
  50146. update: updateDOMProps
  50147. };
  50148. /* */
  50149. var parseStyleText = cached(function (cssText) {
  50150. var res = {};
  50151. var listDelimiter = /;(?![^(]*\))/g;
  50152. var propertyDelimiter = /:(.+)/;
  50153. cssText.split(listDelimiter).forEach(function (item) {
  50154. if (item) {
  50155. var tmp = item.split(propertyDelimiter);
  50156. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  50157. }
  50158. });
  50159. return res
  50160. });
  50161. // merge static and dynamic style data on the same vnode
  50162. function normalizeStyleData (data) {
  50163. var style = normalizeStyleBinding(data.style);
  50164. // static style is pre-processed into an object during compilation
  50165. // and is always a fresh object, so it's safe to merge into it
  50166. return data.staticStyle
  50167. ? extend(data.staticStyle, style)
  50168. : style
  50169. }
  50170. // normalize possible array / string values into Object
  50171. function normalizeStyleBinding (bindingStyle) {
  50172. if (Array.isArray(bindingStyle)) {
  50173. return toObject(bindingStyle)
  50174. }
  50175. if (typeof bindingStyle === 'string') {
  50176. return parseStyleText(bindingStyle)
  50177. }
  50178. return bindingStyle
  50179. }
  50180. /**
  50181. * parent component style should be after child's
  50182. * so that parent component's style could override it
  50183. */
  50184. function getStyle (vnode, checkChild) {
  50185. var res = {};
  50186. var styleData;
  50187. if (checkChild) {
  50188. var childNode = vnode;
  50189. while (childNode.componentInstance) {
  50190. childNode = childNode.componentInstance._vnode;
  50191. if (
  50192. childNode && childNode.data &&
  50193. (styleData = normalizeStyleData(childNode.data))
  50194. ) {
  50195. extend(res, styleData);
  50196. }
  50197. }
  50198. }
  50199. if ((styleData = normalizeStyleData(vnode.data))) {
  50200. extend(res, styleData);
  50201. }
  50202. var parentNode = vnode;
  50203. while ((parentNode = parentNode.parent)) {
  50204. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  50205. extend(res, styleData);
  50206. }
  50207. }
  50208. return res
  50209. }
  50210. /* */
  50211. var cssVarRE = /^--/;
  50212. var importantRE = /\s*!important$/;
  50213. var setProp = function (el, name, val) {
  50214. /* istanbul ignore if */
  50215. if (cssVarRE.test(name)) {
  50216. el.style.setProperty(name, val);
  50217. } else if (importantRE.test(val)) {
  50218. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  50219. } else {
  50220. var normalizedName = normalize(name);
  50221. if (Array.isArray(val)) {
  50222. // Support values array created by autoprefixer, e.g.
  50223. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  50224. // Set them one by one, and the browser will only set those it can recognize
  50225. for (var i = 0, len = val.length; i < len; i++) {
  50226. el.style[normalizedName] = val[i];
  50227. }
  50228. } else {
  50229. el.style[normalizedName] = val;
  50230. }
  50231. }
  50232. };
  50233. var vendorNames = ['Webkit', 'Moz', 'ms'];
  50234. var emptyStyle;
  50235. var normalize = cached(function (prop) {
  50236. emptyStyle = emptyStyle || document.createElement('div').style;
  50237. prop = camelize(prop);
  50238. if (prop !== 'filter' && (prop in emptyStyle)) {
  50239. return prop
  50240. }
  50241. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  50242. for (var i = 0; i < vendorNames.length; i++) {
  50243. var name = vendorNames[i] + capName;
  50244. if (name in emptyStyle) {
  50245. return name
  50246. }
  50247. }
  50248. });
  50249. function updateStyle (oldVnode, vnode) {
  50250. var data = vnode.data;
  50251. var oldData = oldVnode.data;
  50252. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  50253. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  50254. ) {
  50255. return
  50256. }
  50257. var cur, name;
  50258. var el = vnode.elm;
  50259. var oldStaticStyle = oldData.staticStyle;
  50260. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  50261. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  50262. var oldStyle = oldStaticStyle || oldStyleBinding;
  50263. var style = normalizeStyleBinding(vnode.data.style) || {};
  50264. // store normalized style under a different key for next diff
  50265. // make sure to clone it if it's reactive, since the user likely wants
  50266. // to mutate it.
  50267. vnode.data.normalizedStyle = isDef(style.__ob__)
  50268. ? extend({}, style)
  50269. : style;
  50270. var newStyle = getStyle(vnode, true);
  50271. for (name in oldStyle) {
  50272. if (isUndef(newStyle[name])) {
  50273. setProp(el, name, '');
  50274. }
  50275. }
  50276. for (name in newStyle) {
  50277. cur = newStyle[name];
  50278. if (cur !== oldStyle[name]) {
  50279. // ie9 setting to null has no effect, must use empty string
  50280. setProp(el, name, cur == null ? '' : cur);
  50281. }
  50282. }
  50283. }
  50284. var style = {
  50285. create: updateStyle,
  50286. update: updateStyle
  50287. };
  50288. /* */
  50289. var whitespaceRE = /\s+/;
  50290. /**
  50291. * Add class with compatibility for SVG since classList is not supported on
  50292. * SVG elements in IE
  50293. */
  50294. function addClass (el, cls) {
  50295. /* istanbul ignore if */
  50296. if (!cls || !(cls = cls.trim())) {
  50297. return
  50298. }
  50299. /* istanbul ignore else */
  50300. if (el.classList) {
  50301. if (cls.indexOf(' ') > -1) {
  50302. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  50303. } else {
  50304. el.classList.add(cls);
  50305. }
  50306. } else {
  50307. var cur = " " + (el.getAttribute('class') || '') + " ";
  50308. if (cur.indexOf(' ' + cls + ' ') < 0) {
  50309. el.setAttribute('class', (cur + cls).trim());
  50310. }
  50311. }
  50312. }
  50313. /**
  50314. * Remove class with compatibility for SVG since classList is not supported on
  50315. * SVG elements in IE
  50316. */
  50317. function removeClass (el, cls) {
  50318. /* istanbul ignore if */
  50319. if (!cls || !(cls = cls.trim())) {
  50320. return
  50321. }
  50322. /* istanbul ignore else */
  50323. if (el.classList) {
  50324. if (cls.indexOf(' ') > -1) {
  50325. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  50326. } else {
  50327. el.classList.remove(cls);
  50328. }
  50329. if (!el.classList.length) {
  50330. el.removeAttribute('class');
  50331. }
  50332. } else {
  50333. var cur = " " + (el.getAttribute('class') || '') + " ";
  50334. var tar = ' ' + cls + ' ';
  50335. while (cur.indexOf(tar) >= 0) {
  50336. cur = cur.replace(tar, ' ');
  50337. }
  50338. cur = cur.trim();
  50339. if (cur) {
  50340. el.setAttribute('class', cur);
  50341. } else {
  50342. el.removeAttribute('class');
  50343. }
  50344. }
  50345. }
  50346. /* */
  50347. function resolveTransition (def$$1) {
  50348. if (!def$$1) {
  50349. return
  50350. }
  50351. /* istanbul ignore else */
  50352. if (typeof def$$1 === 'object') {
  50353. var res = {};
  50354. if (def$$1.css !== false) {
  50355. extend(res, autoCssTransition(def$$1.name || 'v'));
  50356. }
  50357. extend(res, def$$1);
  50358. return res
  50359. } else if (typeof def$$1 === 'string') {
  50360. return autoCssTransition(def$$1)
  50361. }
  50362. }
  50363. var autoCssTransition = cached(function (name) {
  50364. return {
  50365. enterClass: (name + "-enter"),
  50366. enterToClass: (name + "-enter-to"),
  50367. enterActiveClass: (name + "-enter-active"),
  50368. leaveClass: (name + "-leave"),
  50369. leaveToClass: (name + "-leave-to"),
  50370. leaveActiveClass: (name + "-leave-active")
  50371. }
  50372. });
  50373. var hasTransition = inBrowser && !isIE9;
  50374. var TRANSITION = 'transition';
  50375. var ANIMATION = 'animation';
  50376. // Transition property/event sniffing
  50377. var transitionProp = 'transition';
  50378. var transitionEndEvent = 'transitionend';
  50379. var animationProp = 'animation';
  50380. var animationEndEvent = 'animationend';
  50381. if (hasTransition) {
  50382. /* istanbul ignore if */
  50383. if (window.ontransitionend === undefined &&
  50384. window.onwebkittransitionend !== undefined
  50385. ) {
  50386. transitionProp = 'WebkitTransition';
  50387. transitionEndEvent = 'webkitTransitionEnd';
  50388. }
  50389. if (window.onanimationend === undefined &&
  50390. window.onwebkitanimationend !== undefined
  50391. ) {
  50392. animationProp = 'WebkitAnimation';
  50393. animationEndEvent = 'webkitAnimationEnd';
  50394. }
  50395. }
  50396. // binding to window is necessary to make hot reload work in IE in strict mode
  50397. var raf = inBrowser
  50398. ? window.requestAnimationFrame
  50399. ? window.requestAnimationFrame.bind(window)
  50400. : setTimeout
  50401. : /* istanbul ignore next */ function (fn) { return fn(); };
  50402. function nextFrame (fn) {
  50403. raf(function () {
  50404. raf(fn);
  50405. });
  50406. }
  50407. function addTransitionClass (el, cls) {
  50408. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  50409. if (transitionClasses.indexOf(cls) < 0) {
  50410. transitionClasses.push(cls);
  50411. addClass(el, cls);
  50412. }
  50413. }
  50414. function removeTransitionClass (el, cls) {
  50415. if (el._transitionClasses) {
  50416. remove(el._transitionClasses, cls);
  50417. }
  50418. removeClass(el, cls);
  50419. }
  50420. function whenTransitionEnds (
  50421. el,
  50422. expectedType,
  50423. cb
  50424. ) {
  50425. var ref = getTransitionInfo(el, expectedType);
  50426. var type = ref.type;
  50427. var timeout = ref.timeout;
  50428. var propCount = ref.propCount;
  50429. if (!type) { return cb() }
  50430. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  50431. var ended = 0;
  50432. var end = function () {
  50433. el.removeEventListener(event, onEnd);
  50434. cb();
  50435. };
  50436. var onEnd = function (e) {
  50437. if (e.target === el) {
  50438. if (++ended >= propCount) {
  50439. end();
  50440. }
  50441. }
  50442. };
  50443. setTimeout(function () {
  50444. if (ended < propCount) {
  50445. end();
  50446. }
  50447. }, timeout + 1);
  50448. el.addEventListener(event, onEnd);
  50449. }
  50450. var transformRE = /\b(transform|all)(,|$)/;
  50451. function getTransitionInfo (el, expectedType) {
  50452. var styles = window.getComputedStyle(el);
  50453. // JSDOM may return undefined for transition properties
  50454. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  50455. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  50456. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  50457. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  50458. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  50459. var animationTimeout = getTimeout(animationDelays, animationDurations);
  50460. var type;
  50461. var timeout = 0;
  50462. var propCount = 0;
  50463. /* istanbul ignore if */
  50464. if (expectedType === TRANSITION) {
  50465. if (transitionTimeout > 0) {
  50466. type = TRANSITION;
  50467. timeout = transitionTimeout;
  50468. propCount = transitionDurations.length;
  50469. }
  50470. } else if (expectedType === ANIMATION) {
  50471. if (animationTimeout > 0) {
  50472. type = ANIMATION;
  50473. timeout = animationTimeout;
  50474. propCount = animationDurations.length;
  50475. }
  50476. } else {
  50477. timeout = Math.max(transitionTimeout, animationTimeout);
  50478. type = timeout > 0
  50479. ? transitionTimeout > animationTimeout
  50480. ? TRANSITION
  50481. : ANIMATION
  50482. : null;
  50483. propCount = type
  50484. ? type === TRANSITION
  50485. ? transitionDurations.length
  50486. : animationDurations.length
  50487. : 0;
  50488. }
  50489. var hasTransform =
  50490. type === TRANSITION &&
  50491. transformRE.test(styles[transitionProp + 'Property']);
  50492. return {
  50493. type: type,
  50494. timeout: timeout,
  50495. propCount: propCount,
  50496. hasTransform: hasTransform
  50497. }
  50498. }
  50499. function getTimeout (delays, durations) {
  50500. /* istanbul ignore next */
  50501. while (delays.length < durations.length) {
  50502. delays = delays.concat(delays);
  50503. }
  50504. return Math.max.apply(null, durations.map(function (d, i) {
  50505. return toMs(d) + toMs(delays[i])
  50506. }))
  50507. }
  50508. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  50509. // in a locale-dependent way, using a comma instead of a dot.
  50510. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  50511. // as a floor function) causing unexpected behaviors
  50512. function toMs (s) {
  50513. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  50514. }
  50515. /* */
  50516. function enter (vnode, toggleDisplay) {
  50517. var el = vnode.elm;
  50518. // call leave callback now
  50519. if (isDef(el._leaveCb)) {
  50520. el._leaveCb.cancelled = true;
  50521. el._leaveCb();
  50522. }
  50523. var data = resolveTransition(vnode.data.transition);
  50524. if (isUndef(data)) {
  50525. return
  50526. }
  50527. /* istanbul ignore if */
  50528. if (isDef(el._enterCb) || el.nodeType !== 1) {
  50529. return
  50530. }
  50531. var css = data.css;
  50532. var type = data.type;
  50533. var enterClass = data.enterClass;
  50534. var enterToClass = data.enterToClass;
  50535. var enterActiveClass = data.enterActiveClass;
  50536. var appearClass = data.appearClass;
  50537. var appearToClass = data.appearToClass;
  50538. var appearActiveClass = data.appearActiveClass;
  50539. var beforeEnter = data.beforeEnter;
  50540. var enter = data.enter;
  50541. var afterEnter = data.afterEnter;
  50542. var enterCancelled = data.enterCancelled;
  50543. var beforeAppear = data.beforeAppear;
  50544. var appear = data.appear;
  50545. var afterAppear = data.afterAppear;
  50546. var appearCancelled = data.appearCancelled;
  50547. var duration = data.duration;
  50548. // activeInstance will always be the <transition> component managing this
  50549. // transition. One edge case to check is when the <transition> is placed
  50550. // as the root node of a child component. In that case we need to check
  50551. // <transition>'s parent for appear check.
  50552. var context = activeInstance;
  50553. var transitionNode = activeInstance.$vnode;
  50554. while (transitionNode && transitionNode.parent) {
  50555. context = transitionNode.context;
  50556. transitionNode = transitionNode.parent;
  50557. }
  50558. var isAppear = !context._isMounted || !vnode.isRootInsert;
  50559. if (isAppear && !appear && appear !== '') {
  50560. return
  50561. }
  50562. var startClass = isAppear && appearClass
  50563. ? appearClass
  50564. : enterClass;
  50565. var activeClass = isAppear && appearActiveClass
  50566. ? appearActiveClass
  50567. : enterActiveClass;
  50568. var toClass = isAppear && appearToClass
  50569. ? appearToClass
  50570. : enterToClass;
  50571. var beforeEnterHook = isAppear
  50572. ? (beforeAppear || beforeEnter)
  50573. : beforeEnter;
  50574. var enterHook = isAppear
  50575. ? (typeof appear === 'function' ? appear : enter)
  50576. : enter;
  50577. var afterEnterHook = isAppear
  50578. ? (afterAppear || afterEnter)
  50579. : afterEnter;
  50580. var enterCancelledHook = isAppear
  50581. ? (appearCancelled || enterCancelled)
  50582. : enterCancelled;
  50583. var explicitEnterDuration = toNumber(
  50584. isObject(duration)
  50585. ? duration.enter
  50586. : duration
  50587. );
  50588. if (explicitEnterDuration != null) {
  50589. checkDuration(explicitEnterDuration, 'enter', vnode);
  50590. }
  50591. var expectsCSS = css !== false && !isIE9;
  50592. var userWantsControl = getHookArgumentsLength(enterHook);
  50593. var cb = el._enterCb = once(function () {
  50594. if (expectsCSS) {
  50595. removeTransitionClass(el, toClass);
  50596. removeTransitionClass(el, activeClass);
  50597. }
  50598. if (cb.cancelled) {
  50599. if (expectsCSS) {
  50600. removeTransitionClass(el, startClass);
  50601. }
  50602. enterCancelledHook && enterCancelledHook(el);
  50603. } else {
  50604. afterEnterHook && afterEnterHook(el);
  50605. }
  50606. el._enterCb = null;
  50607. });
  50608. if (!vnode.data.show) {
  50609. // remove pending leave element on enter by injecting an insert hook
  50610. mergeVNodeHook(vnode, 'insert', function () {
  50611. var parent = el.parentNode;
  50612. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  50613. if (pendingNode &&
  50614. pendingNode.tag === vnode.tag &&
  50615. pendingNode.elm._leaveCb
  50616. ) {
  50617. pendingNode.elm._leaveCb();
  50618. }
  50619. enterHook && enterHook(el, cb);
  50620. });
  50621. }
  50622. // start enter transition
  50623. beforeEnterHook && beforeEnterHook(el);
  50624. if (expectsCSS) {
  50625. addTransitionClass(el, startClass);
  50626. addTransitionClass(el, activeClass);
  50627. nextFrame(function () {
  50628. removeTransitionClass(el, startClass);
  50629. if (!cb.cancelled) {
  50630. addTransitionClass(el, toClass);
  50631. if (!userWantsControl) {
  50632. if (isValidDuration(explicitEnterDuration)) {
  50633. setTimeout(cb, explicitEnterDuration);
  50634. } else {
  50635. whenTransitionEnds(el, type, cb);
  50636. }
  50637. }
  50638. }
  50639. });
  50640. }
  50641. if (vnode.data.show) {
  50642. toggleDisplay && toggleDisplay();
  50643. enterHook && enterHook(el, cb);
  50644. }
  50645. if (!expectsCSS && !userWantsControl) {
  50646. cb();
  50647. }
  50648. }
  50649. function leave (vnode, rm) {
  50650. var el = vnode.elm;
  50651. // call enter callback now
  50652. if (isDef(el._enterCb)) {
  50653. el._enterCb.cancelled = true;
  50654. el._enterCb();
  50655. }
  50656. var data = resolveTransition(vnode.data.transition);
  50657. if (isUndef(data) || el.nodeType !== 1) {
  50658. return rm()
  50659. }
  50660. /* istanbul ignore if */
  50661. if (isDef(el._leaveCb)) {
  50662. return
  50663. }
  50664. var css = data.css;
  50665. var type = data.type;
  50666. var leaveClass = data.leaveClass;
  50667. var leaveToClass = data.leaveToClass;
  50668. var leaveActiveClass = data.leaveActiveClass;
  50669. var beforeLeave = data.beforeLeave;
  50670. var leave = data.leave;
  50671. var afterLeave = data.afterLeave;
  50672. var leaveCancelled = data.leaveCancelled;
  50673. var delayLeave = data.delayLeave;
  50674. var duration = data.duration;
  50675. var expectsCSS = css !== false && !isIE9;
  50676. var userWantsControl = getHookArgumentsLength(leave);
  50677. var explicitLeaveDuration = toNumber(
  50678. isObject(duration)
  50679. ? duration.leave
  50680. : duration
  50681. );
  50682. if (isDef(explicitLeaveDuration)) {
  50683. checkDuration(explicitLeaveDuration, 'leave', vnode);
  50684. }
  50685. var cb = el._leaveCb = once(function () {
  50686. if (el.parentNode && el.parentNode._pending) {
  50687. el.parentNode._pending[vnode.key] = null;
  50688. }
  50689. if (expectsCSS) {
  50690. removeTransitionClass(el, leaveToClass);
  50691. removeTransitionClass(el, leaveActiveClass);
  50692. }
  50693. if (cb.cancelled) {
  50694. if (expectsCSS) {
  50695. removeTransitionClass(el, leaveClass);
  50696. }
  50697. leaveCancelled && leaveCancelled(el);
  50698. } else {
  50699. rm();
  50700. afterLeave && afterLeave(el);
  50701. }
  50702. el._leaveCb = null;
  50703. });
  50704. if (delayLeave) {
  50705. delayLeave(performLeave);
  50706. } else {
  50707. performLeave();
  50708. }
  50709. function performLeave () {
  50710. // the delayed leave may have already been cancelled
  50711. if (cb.cancelled) {
  50712. return
  50713. }
  50714. // record leaving element
  50715. if (!vnode.data.show && el.parentNode) {
  50716. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  50717. }
  50718. beforeLeave && beforeLeave(el);
  50719. if (expectsCSS) {
  50720. addTransitionClass(el, leaveClass);
  50721. addTransitionClass(el, leaveActiveClass);
  50722. nextFrame(function () {
  50723. removeTransitionClass(el, leaveClass);
  50724. if (!cb.cancelled) {
  50725. addTransitionClass(el, leaveToClass);
  50726. if (!userWantsControl) {
  50727. if (isValidDuration(explicitLeaveDuration)) {
  50728. setTimeout(cb, explicitLeaveDuration);
  50729. } else {
  50730. whenTransitionEnds(el, type, cb);
  50731. }
  50732. }
  50733. }
  50734. });
  50735. }
  50736. leave && leave(el, cb);
  50737. if (!expectsCSS && !userWantsControl) {
  50738. cb();
  50739. }
  50740. }
  50741. }
  50742. // only used in dev mode
  50743. function checkDuration (val, name, vnode) {
  50744. if (typeof val !== 'number') {
  50745. warn(
  50746. "<transition> explicit " + name + " duration is not a valid number - " +
  50747. "got " + (JSON.stringify(val)) + ".",
  50748. vnode.context
  50749. );
  50750. } else if (isNaN(val)) {
  50751. warn(
  50752. "<transition> explicit " + name + " duration is NaN - " +
  50753. 'the duration expression might be incorrect.',
  50754. vnode.context
  50755. );
  50756. }
  50757. }
  50758. function isValidDuration (val) {
  50759. return typeof val === 'number' && !isNaN(val)
  50760. }
  50761. /**
  50762. * Normalize a transition hook's argument length. The hook may be:
  50763. * - a merged hook (invoker) with the original in .fns
  50764. * - a wrapped component method (check ._length)
  50765. * - a plain function (.length)
  50766. */
  50767. function getHookArgumentsLength (fn) {
  50768. if (isUndef(fn)) {
  50769. return false
  50770. }
  50771. var invokerFns = fn.fns;
  50772. if (isDef(invokerFns)) {
  50773. // invoker
  50774. return getHookArgumentsLength(
  50775. Array.isArray(invokerFns)
  50776. ? invokerFns[0]
  50777. : invokerFns
  50778. )
  50779. } else {
  50780. return (fn._length || fn.length) > 1
  50781. }
  50782. }
  50783. function _enter (_, vnode) {
  50784. if (vnode.data.show !== true) {
  50785. enter(vnode);
  50786. }
  50787. }
  50788. var transition = inBrowser ? {
  50789. create: _enter,
  50790. activate: _enter,
  50791. remove: function remove$$1 (vnode, rm) {
  50792. /* istanbul ignore else */
  50793. if (vnode.data.show !== true) {
  50794. leave(vnode, rm);
  50795. } else {
  50796. rm();
  50797. }
  50798. }
  50799. } : {};
  50800. var platformModules = [
  50801. attrs,
  50802. klass,
  50803. events,
  50804. domProps,
  50805. style,
  50806. transition
  50807. ];
  50808. /* */
  50809. // the directive module should be applied last, after all
  50810. // built-in modules have been applied.
  50811. var modules = platformModules.concat(baseModules);
  50812. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  50813. /**
  50814. * Not type checking this file because flow doesn't like attaching
  50815. * properties to Elements.
  50816. */
  50817. /* istanbul ignore if */
  50818. if (isIE9) {
  50819. // http://www.matts411.com/post/internet-explorer-9-oninput/
  50820. document.addEventListener('selectionchange', function () {
  50821. var el = document.activeElement;
  50822. if (el && el.vmodel) {
  50823. trigger(el, 'input');
  50824. }
  50825. });
  50826. }
  50827. var directive = {
  50828. inserted: function inserted (el, binding, vnode, oldVnode) {
  50829. if (vnode.tag === 'select') {
  50830. // #6903
  50831. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  50832. mergeVNodeHook(vnode, 'postpatch', function () {
  50833. directive.componentUpdated(el, binding, vnode);
  50834. });
  50835. } else {
  50836. setSelected(el, binding, vnode.context);
  50837. }
  50838. el._vOptions = [].map.call(el.options, getValue);
  50839. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  50840. el._vModifiers = binding.modifiers;
  50841. if (!binding.modifiers.lazy) {
  50842. el.addEventListener('compositionstart', onCompositionStart);
  50843. el.addEventListener('compositionend', onCompositionEnd);
  50844. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  50845. // switching focus before confirming composition choice
  50846. // this also fixes the issue where some browsers e.g. iOS Chrome
  50847. // fires "change" instead of "input" on autocomplete.
  50848. el.addEventListener('change', onCompositionEnd);
  50849. /* istanbul ignore if */
  50850. if (isIE9) {
  50851. el.vmodel = true;
  50852. }
  50853. }
  50854. }
  50855. },
  50856. componentUpdated: function componentUpdated (el, binding, vnode) {
  50857. if (vnode.tag === 'select') {
  50858. setSelected(el, binding, vnode.context);
  50859. // in case the options rendered by v-for have changed,
  50860. // it's possible that the value is out-of-sync with the rendered options.
  50861. // detect such cases and filter out values that no longer has a matching
  50862. // option in the DOM.
  50863. var prevOptions = el._vOptions;
  50864. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  50865. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  50866. // trigger change event if
  50867. // no matching option found for at least one value
  50868. var needReset = el.multiple
  50869. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  50870. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  50871. if (needReset) {
  50872. trigger(el, 'change');
  50873. }
  50874. }
  50875. }
  50876. }
  50877. };
  50878. function setSelected (el, binding, vm) {
  50879. actuallySetSelected(el, binding, vm);
  50880. /* istanbul ignore if */
  50881. if (isIE || isEdge) {
  50882. setTimeout(function () {
  50883. actuallySetSelected(el, binding, vm);
  50884. }, 0);
  50885. }
  50886. }
  50887. function actuallySetSelected (el, binding, vm) {
  50888. var value = binding.value;
  50889. var isMultiple = el.multiple;
  50890. if (isMultiple && !Array.isArray(value)) {
  50891. warn(
  50892. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  50893. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  50894. vm
  50895. );
  50896. return
  50897. }
  50898. var selected, option;
  50899. for (var i = 0, l = el.options.length; i < l; i++) {
  50900. option = el.options[i];
  50901. if (isMultiple) {
  50902. selected = looseIndexOf(value, getValue(option)) > -1;
  50903. if (option.selected !== selected) {
  50904. option.selected = selected;
  50905. }
  50906. } else {
  50907. if (looseEqual(getValue(option), value)) {
  50908. if (el.selectedIndex !== i) {
  50909. el.selectedIndex = i;
  50910. }
  50911. return
  50912. }
  50913. }
  50914. }
  50915. if (!isMultiple) {
  50916. el.selectedIndex = -1;
  50917. }
  50918. }
  50919. function hasNoMatchingOption (value, options) {
  50920. return options.every(function (o) { return !looseEqual(o, value); })
  50921. }
  50922. function getValue (option) {
  50923. return '_value' in option
  50924. ? option._value
  50925. : option.value
  50926. }
  50927. function onCompositionStart (e) {
  50928. e.target.composing = true;
  50929. }
  50930. function onCompositionEnd (e) {
  50931. // prevent triggering an input event for no reason
  50932. if (!e.target.composing) { return }
  50933. e.target.composing = false;
  50934. trigger(e.target, 'input');
  50935. }
  50936. function trigger (el, type) {
  50937. var e = document.createEvent('HTMLEvents');
  50938. e.initEvent(type, true, true);
  50939. el.dispatchEvent(e);
  50940. }
  50941. /* */
  50942. // recursively search for possible transition defined inside the component root
  50943. function locateNode (vnode) {
  50944. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  50945. ? locateNode(vnode.componentInstance._vnode)
  50946. : vnode
  50947. }
  50948. var show = {
  50949. bind: function bind (el, ref, vnode) {
  50950. var value = ref.value;
  50951. vnode = locateNode(vnode);
  50952. var transition$$1 = vnode.data && vnode.data.transition;
  50953. var originalDisplay = el.__vOriginalDisplay =
  50954. el.style.display === 'none' ? '' : el.style.display;
  50955. if (value && transition$$1) {
  50956. vnode.data.show = true;
  50957. enter(vnode, function () {
  50958. el.style.display = originalDisplay;
  50959. });
  50960. } else {
  50961. el.style.display = value ? originalDisplay : 'none';
  50962. }
  50963. },
  50964. update: function update (el, ref, vnode) {
  50965. var value = ref.value;
  50966. var oldValue = ref.oldValue;
  50967. /* istanbul ignore if */
  50968. if (!value === !oldValue) { return }
  50969. vnode = locateNode(vnode);
  50970. var transition$$1 = vnode.data && vnode.data.transition;
  50971. if (transition$$1) {
  50972. vnode.data.show = true;
  50973. if (value) {
  50974. enter(vnode, function () {
  50975. el.style.display = el.__vOriginalDisplay;
  50976. });
  50977. } else {
  50978. leave(vnode, function () {
  50979. el.style.display = 'none';
  50980. });
  50981. }
  50982. } else {
  50983. el.style.display = value ? el.__vOriginalDisplay : 'none';
  50984. }
  50985. },
  50986. unbind: function unbind (
  50987. el,
  50988. binding,
  50989. vnode,
  50990. oldVnode,
  50991. isDestroy
  50992. ) {
  50993. if (!isDestroy) {
  50994. el.style.display = el.__vOriginalDisplay;
  50995. }
  50996. }
  50997. };
  50998. var platformDirectives = {
  50999. model: directive,
  51000. show: show
  51001. };
  51002. /* */
  51003. var transitionProps = {
  51004. name: String,
  51005. appear: Boolean,
  51006. css: Boolean,
  51007. mode: String,
  51008. type: String,
  51009. enterClass: String,
  51010. leaveClass: String,
  51011. enterToClass: String,
  51012. leaveToClass: String,
  51013. enterActiveClass: String,
  51014. leaveActiveClass: String,
  51015. appearClass: String,
  51016. appearActiveClass: String,
  51017. appearToClass: String,
  51018. duration: [Number, String, Object]
  51019. };
  51020. // in case the child is also an abstract component, e.g. <keep-alive>
  51021. // we want to recursively retrieve the real component to be rendered
  51022. function getRealChild (vnode) {
  51023. var compOptions = vnode && vnode.componentOptions;
  51024. if (compOptions && compOptions.Ctor.options.abstract) {
  51025. return getRealChild(getFirstComponentChild(compOptions.children))
  51026. } else {
  51027. return vnode
  51028. }
  51029. }
  51030. function extractTransitionData (comp) {
  51031. var data = {};
  51032. var options = comp.$options;
  51033. // props
  51034. for (var key in options.propsData) {
  51035. data[key] = comp[key];
  51036. }
  51037. // events.
  51038. // extract listeners and pass them directly to the transition methods
  51039. var listeners = options._parentListeners;
  51040. for (var key$1 in listeners) {
  51041. data[camelize(key$1)] = listeners[key$1];
  51042. }
  51043. return data
  51044. }
  51045. function placeholder (h, rawChild) {
  51046. if (/\d-keep-alive$/.test(rawChild.tag)) {
  51047. return h('keep-alive', {
  51048. props: rawChild.componentOptions.propsData
  51049. })
  51050. }
  51051. }
  51052. function hasParentTransition (vnode) {
  51053. while ((vnode = vnode.parent)) {
  51054. if (vnode.data.transition) {
  51055. return true
  51056. }
  51057. }
  51058. }
  51059. function isSameChild (child, oldChild) {
  51060. return oldChild.key === child.key && oldChild.tag === child.tag
  51061. }
  51062. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  51063. var isVShowDirective = function (d) { return d.name === 'show'; };
  51064. var Transition = {
  51065. name: 'transition',
  51066. props: transitionProps,
  51067. abstract: true,
  51068. render: function render (h) {
  51069. var this$1 = this;
  51070. var children = this.$slots.default;
  51071. if (!children) {
  51072. return
  51073. }
  51074. // filter out text nodes (possible whitespaces)
  51075. children = children.filter(isNotTextNode);
  51076. /* istanbul ignore if */
  51077. if (!children.length) {
  51078. return
  51079. }
  51080. // warn multiple elements
  51081. if (children.length > 1) {
  51082. warn(
  51083. '<transition> can only be used on a single element. Use ' +
  51084. '<transition-group> for lists.',
  51085. this.$parent
  51086. );
  51087. }
  51088. var mode = this.mode;
  51089. // warn invalid mode
  51090. if (mode && mode !== 'in-out' && mode !== 'out-in'
  51091. ) {
  51092. warn(
  51093. 'invalid <transition> mode: ' + mode,
  51094. this.$parent
  51095. );
  51096. }
  51097. var rawChild = children[0];
  51098. // if this is a component root node and the component's
  51099. // parent container node also has transition, skip.
  51100. if (hasParentTransition(this.$vnode)) {
  51101. return rawChild
  51102. }
  51103. // apply transition data to child
  51104. // use getRealChild() to ignore abstract components e.g. keep-alive
  51105. var child = getRealChild(rawChild);
  51106. /* istanbul ignore if */
  51107. if (!child) {
  51108. return rawChild
  51109. }
  51110. if (this._leaving) {
  51111. return placeholder(h, rawChild)
  51112. }
  51113. // ensure a key that is unique to the vnode type and to this transition
  51114. // component instance. This key will be used to remove pending leaving nodes
  51115. // during entering.
  51116. var id = "__transition-" + (this._uid) + "-";
  51117. child.key = child.key == null
  51118. ? child.isComment
  51119. ? id + 'comment'
  51120. : id + child.tag
  51121. : isPrimitive(child.key)
  51122. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  51123. : child.key;
  51124. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  51125. var oldRawChild = this._vnode;
  51126. var oldChild = getRealChild(oldRawChild);
  51127. // mark v-show
  51128. // so that the transition module can hand over the control to the directive
  51129. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  51130. child.data.show = true;
  51131. }
  51132. if (
  51133. oldChild &&
  51134. oldChild.data &&
  51135. !isSameChild(child, oldChild) &&
  51136. !isAsyncPlaceholder(oldChild) &&
  51137. // #6687 component root is a comment node
  51138. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  51139. ) {
  51140. // replace old child transition data with fresh one
  51141. // important for dynamic transitions!
  51142. var oldData = oldChild.data.transition = extend({}, data);
  51143. // handle transition mode
  51144. if (mode === 'out-in') {
  51145. // return placeholder node and queue update when leave finishes
  51146. this._leaving = true;
  51147. mergeVNodeHook(oldData, 'afterLeave', function () {
  51148. this$1._leaving = false;
  51149. this$1.$forceUpdate();
  51150. });
  51151. return placeholder(h, rawChild)
  51152. } else if (mode === 'in-out') {
  51153. if (isAsyncPlaceholder(child)) {
  51154. return oldRawChild
  51155. }
  51156. var delayedLeave;
  51157. var performLeave = function () { delayedLeave(); };
  51158. mergeVNodeHook(data, 'afterEnter', performLeave);
  51159. mergeVNodeHook(data, 'enterCancelled', performLeave);
  51160. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  51161. }
  51162. }
  51163. return rawChild
  51164. }
  51165. };
  51166. /* */
  51167. var props = extend({
  51168. tag: String,
  51169. moveClass: String
  51170. }, transitionProps);
  51171. delete props.mode;
  51172. var TransitionGroup = {
  51173. props: props,
  51174. beforeMount: function beforeMount () {
  51175. var this$1 = this;
  51176. var update = this._update;
  51177. this._update = function (vnode, hydrating) {
  51178. var restoreActiveInstance = setActiveInstance(this$1);
  51179. // force removing pass
  51180. this$1.__patch__(
  51181. this$1._vnode,
  51182. this$1.kept,
  51183. false, // hydrating
  51184. true // removeOnly (!important, avoids unnecessary moves)
  51185. );
  51186. this$1._vnode = this$1.kept;
  51187. restoreActiveInstance();
  51188. update.call(this$1, vnode, hydrating);
  51189. };
  51190. },
  51191. render: function render (h) {
  51192. var tag = this.tag || this.$vnode.data.tag || 'span';
  51193. var map = Object.create(null);
  51194. var prevChildren = this.prevChildren = this.children;
  51195. var rawChildren = this.$slots.default || [];
  51196. var children = this.children = [];
  51197. var transitionData = extractTransitionData(this);
  51198. for (var i = 0; i < rawChildren.length; i++) {
  51199. var c = rawChildren[i];
  51200. if (c.tag) {
  51201. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  51202. children.push(c);
  51203. map[c.key] = c
  51204. ;(c.data || (c.data = {})).transition = transitionData;
  51205. } else {
  51206. var opts = c.componentOptions;
  51207. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  51208. warn(("<transition-group> children must be keyed: <" + name + ">"));
  51209. }
  51210. }
  51211. }
  51212. if (prevChildren) {
  51213. var kept = [];
  51214. var removed = [];
  51215. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  51216. var c$1 = prevChildren[i$1];
  51217. c$1.data.transition = transitionData;
  51218. c$1.data.pos = c$1.elm.getBoundingClientRect();
  51219. if (map[c$1.key]) {
  51220. kept.push(c$1);
  51221. } else {
  51222. removed.push(c$1);
  51223. }
  51224. }
  51225. this.kept = h(tag, null, kept);
  51226. this.removed = removed;
  51227. }
  51228. return h(tag, null, children)
  51229. },
  51230. updated: function updated () {
  51231. var children = this.prevChildren;
  51232. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  51233. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  51234. return
  51235. }
  51236. // we divide the work into three loops to avoid mixing DOM reads and writes
  51237. // in each iteration - which helps prevent layout thrashing.
  51238. children.forEach(callPendingCbs);
  51239. children.forEach(recordPosition);
  51240. children.forEach(applyTranslation);
  51241. // force reflow to put everything in position
  51242. // assign to this to avoid being removed in tree-shaking
  51243. // $flow-disable-line
  51244. this._reflow = document.body.offsetHeight;
  51245. children.forEach(function (c) {
  51246. if (c.data.moved) {
  51247. var el = c.elm;
  51248. var s = el.style;
  51249. addTransitionClass(el, moveClass);
  51250. s.transform = s.WebkitTransform = s.transitionDuration = '';
  51251. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  51252. if (e && e.target !== el) {
  51253. return
  51254. }
  51255. if (!e || /transform$/.test(e.propertyName)) {
  51256. el.removeEventListener(transitionEndEvent, cb);
  51257. el._moveCb = null;
  51258. removeTransitionClass(el, moveClass);
  51259. }
  51260. });
  51261. }
  51262. });
  51263. },
  51264. methods: {
  51265. hasMove: function hasMove (el, moveClass) {
  51266. /* istanbul ignore if */
  51267. if (!hasTransition) {
  51268. return false
  51269. }
  51270. /* istanbul ignore if */
  51271. if (this._hasMove) {
  51272. return this._hasMove
  51273. }
  51274. // Detect whether an element with the move class applied has
  51275. // CSS transitions. Since the element may be inside an entering
  51276. // transition at this very moment, we make a clone of it and remove
  51277. // all other transition classes applied to ensure only the move class
  51278. // is applied.
  51279. var clone = el.cloneNode();
  51280. if (el._transitionClasses) {
  51281. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  51282. }
  51283. addClass(clone, moveClass);
  51284. clone.style.display = 'none';
  51285. this.$el.appendChild(clone);
  51286. var info = getTransitionInfo(clone);
  51287. this.$el.removeChild(clone);
  51288. return (this._hasMove = info.hasTransform)
  51289. }
  51290. }
  51291. };
  51292. function callPendingCbs (c) {
  51293. /* istanbul ignore if */
  51294. if (c.elm._moveCb) {
  51295. c.elm._moveCb();
  51296. }
  51297. /* istanbul ignore if */
  51298. if (c.elm._enterCb) {
  51299. c.elm._enterCb();
  51300. }
  51301. }
  51302. function recordPosition (c) {
  51303. c.data.newPos = c.elm.getBoundingClientRect();
  51304. }
  51305. function applyTranslation (c) {
  51306. var oldPos = c.data.pos;
  51307. var newPos = c.data.newPos;
  51308. var dx = oldPos.left - newPos.left;
  51309. var dy = oldPos.top - newPos.top;
  51310. if (dx || dy) {
  51311. c.data.moved = true;
  51312. var s = c.elm.style;
  51313. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  51314. s.transitionDuration = '0s';
  51315. }
  51316. }
  51317. var platformComponents = {
  51318. Transition: Transition,
  51319. TransitionGroup: TransitionGroup
  51320. };
  51321. /* */
  51322. // install platform specific utils
  51323. Vue.config.mustUseProp = mustUseProp;
  51324. Vue.config.isReservedTag = isReservedTag;
  51325. Vue.config.isReservedAttr = isReservedAttr;
  51326. Vue.config.getTagNamespace = getTagNamespace;
  51327. Vue.config.isUnknownElement = isUnknownElement;
  51328. // install platform runtime directives & components
  51329. extend(Vue.options.directives, platformDirectives);
  51330. extend(Vue.options.components, platformComponents);
  51331. // install platform patch function
  51332. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  51333. // public mount method
  51334. Vue.prototype.$mount = function (
  51335. el,
  51336. hydrating
  51337. ) {
  51338. el = el && inBrowser ? query(el) : undefined;
  51339. return mountComponent(this, el, hydrating)
  51340. };
  51341. // devtools global hook
  51342. /* istanbul ignore next */
  51343. if (inBrowser) {
  51344. setTimeout(function () {
  51345. if (config.devtools) {
  51346. if (devtools) {
  51347. devtools.emit('init', Vue);
  51348. } else {
  51349. console[console.info ? 'info' : 'log'](
  51350. 'Download the Vue Devtools extension for a better development experience:\n' +
  51351. 'https://github.com/vuejs/vue-devtools'
  51352. );
  51353. }
  51354. }
  51355. if (config.productionTip !== false &&
  51356. typeof console !== 'undefined'
  51357. ) {
  51358. console[console.info ? 'info' : 'log'](
  51359. "You are running Vue in development mode.\n" +
  51360. "Make sure to turn on production mode when deploying for production.\n" +
  51361. "See more tips at https://vuejs.org/guide/deployment.html"
  51362. );
  51363. }
  51364. }, 0);
  51365. }
  51366. /* */
  51367. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  51368. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  51369. var buildRegex = cached(function (delimiters) {
  51370. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  51371. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  51372. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  51373. });
  51374. function parseText (
  51375. text,
  51376. delimiters
  51377. ) {
  51378. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  51379. if (!tagRE.test(text)) {
  51380. return
  51381. }
  51382. var tokens = [];
  51383. var rawTokens = [];
  51384. var lastIndex = tagRE.lastIndex = 0;
  51385. var match, index, tokenValue;
  51386. while ((match = tagRE.exec(text))) {
  51387. index = match.index;
  51388. // push text token
  51389. if (index > lastIndex) {
  51390. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  51391. tokens.push(JSON.stringify(tokenValue));
  51392. }
  51393. // tag token
  51394. var exp = parseFilters(match[1].trim());
  51395. tokens.push(("_s(" + exp + ")"));
  51396. rawTokens.push({ '@binding': exp });
  51397. lastIndex = index + match[0].length;
  51398. }
  51399. if (lastIndex < text.length) {
  51400. rawTokens.push(tokenValue = text.slice(lastIndex));
  51401. tokens.push(JSON.stringify(tokenValue));
  51402. }
  51403. return {
  51404. expression: tokens.join('+'),
  51405. tokens: rawTokens
  51406. }
  51407. }
  51408. /* */
  51409. function transformNode (el, options) {
  51410. var warn = options.warn || baseWarn;
  51411. var staticClass = getAndRemoveAttr(el, 'class');
  51412. if (staticClass) {
  51413. var res = parseText(staticClass, options.delimiters);
  51414. if (res) {
  51415. warn(
  51416. "class=\"" + staticClass + "\": " +
  51417. 'Interpolation inside attributes has been removed. ' +
  51418. 'Use v-bind or the colon shorthand instead. For example, ' +
  51419. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  51420. el.rawAttrsMap['class']
  51421. );
  51422. }
  51423. }
  51424. if (staticClass) {
  51425. el.staticClass = JSON.stringify(staticClass);
  51426. }
  51427. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  51428. if (classBinding) {
  51429. el.classBinding = classBinding;
  51430. }
  51431. }
  51432. function genData (el) {
  51433. var data = '';
  51434. if (el.staticClass) {
  51435. data += "staticClass:" + (el.staticClass) + ",";
  51436. }
  51437. if (el.classBinding) {
  51438. data += "class:" + (el.classBinding) + ",";
  51439. }
  51440. return data
  51441. }
  51442. var klass$1 = {
  51443. staticKeys: ['staticClass'],
  51444. transformNode: transformNode,
  51445. genData: genData
  51446. };
  51447. /* */
  51448. function transformNode$1 (el, options) {
  51449. var warn = options.warn || baseWarn;
  51450. var staticStyle = getAndRemoveAttr(el, 'style');
  51451. if (staticStyle) {
  51452. /* istanbul ignore if */
  51453. {
  51454. var res = parseText(staticStyle, options.delimiters);
  51455. if (res) {
  51456. warn(
  51457. "style=\"" + staticStyle + "\": " +
  51458. 'Interpolation inside attributes has been removed. ' +
  51459. 'Use v-bind or the colon shorthand instead. For example, ' +
  51460. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  51461. el.rawAttrsMap['style']
  51462. );
  51463. }
  51464. }
  51465. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  51466. }
  51467. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  51468. if (styleBinding) {
  51469. el.styleBinding = styleBinding;
  51470. }
  51471. }
  51472. function genData$1 (el) {
  51473. var data = '';
  51474. if (el.staticStyle) {
  51475. data += "staticStyle:" + (el.staticStyle) + ",";
  51476. }
  51477. if (el.styleBinding) {
  51478. data += "style:(" + (el.styleBinding) + "),";
  51479. }
  51480. return data
  51481. }
  51482. var style$1 = {
  51483. staticKeys: ['staticStyle'],
  51484. transformNode: transformNode$1,
  51485. genData: genData$1
  51486. };
  51487. /* */
  51488. var decoder;
  51489. var he = {
  51490. decode: function decode (html) {
  51491. decoder = decoder || document.createElement('div');
  51492. decoder.innerHTML = html;
  51493. return decoder.textContent
  51494. }
  51495. };
  51496. /* */
  51497. var isUnaryTag = makeMap(
  51498. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  51499. 'link,meta,param,source,track,wbr'
  51500. );
  51501. // Elements that you can, intentionally, leave open
  51502. // (and which close themselves)
  51503. var canBeLeftOpenTag = makeMap(
  51504. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  51505. );
  51506. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  51507. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  51508. var isNonPhrasingTag = makeMap(
  51509. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  51510. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  51511. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  51512. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  51513. 'title,tr,track'
  51514. );
  51515. /**
  51516. * Not type-checking this file because it's mostly vendor code.
  51517. */
  51518. // Regular Expressions for parsing tags and attributes
  51519. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  51520. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  51521. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  51522. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  51523. var startTagOpen = new RegExp(("^<" + qnameCapture));
  51524. var startTagClose = /^\s*(\/?)>/;
  51525. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  51526. var doctype = /^<!DOCTYPE [^>]+>/i;
  51527. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  51528. var comment = /^<!\--/;
  51529. var conditionalComment = /^<!\[/;
  51530. // Special Elements (can contain anything)
  51531. var isPlainTextElement = makeMap('script,style,textarea', true);
  51532. var reCache = {};
  51533. var decodingMap = {
  51534. '&lt;': '<',
  51535. '&gt;': '>',
  51536. '&quot;': '"',
  51537. '&amp;': '&',
  51538. '&#10;': '\n',
  51539. '&#9;': '\t',
  51540. '&#39;': "'"
  51541. };
  51542. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  51543. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  51544. // #5992
  51545. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  51546. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  51547. function decodeAttr (value, shouldDecodeNewlines) {
  51548. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  51549. return value.replace(re, function (match) { return decodingMap[match]; })
  51550. }
  51551. function parseHTML (html, options) {
  51552. var stack = [];
  51553. var expectHTML = options.expectHTML;
  51554. var isUnaryTag$$1 = options.isUnaryTag || no;
  51555. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  51556. var index = 0;
  51557. var last, lastTag;
  51558. while (html) {
  51559. last = html;
  51560. // Make sure we're not in a plaintext content element like script/style
  51561. if (!lastTag || !isPlainTextElement(lastTag)) {
  51562. var textEnd = html.indexOf('<');
  51563. if (textEnd === 0) {
  51564. // Comment:
  51565. if (comment.test(html)) {
  51566. var commentEnd = html.indexOf('-->');
  51567. if (commentEnd >= 0) {
  51568. if (options.shouldKeepComment) {
  51569. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  51570. }
  51571. advance(commentEnd + 3);
  51572. continue
  51573. }
  51574. }
  51575. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  51576. if (conditionalComment.test(html)) {
  51577. var conditionalEnd = html.indexOf(']>');
  51578. if (conditionalEnd >= 0) {
  51579. advance(conditionalEnd + 2);
  51580. continue
  51581. }
  51582. }
  51583. // Doctype:
  51584. var doctypeMatch = html.match(doctype);
  51585. if (doctypeMatch) {
  51586. advance(doctypeMatch[0].length);
  51587. continue
  51588. }
  51589. // End tag:
  51590. var endTagMatch = html.match(endTag);
  51591. if (endTagMatch) {
  51592. var curIndex = index;
  51593. advance(endTagMatch[0].length);
  51594. parseEndTag(endTagMatch[1], curIndex, index);
  51595. continue
  51596. }
  51597. // Start tag:
  51598. var startTagMatch = parseStartTag();
  51599. if (startTagMatch) {
  51600. handleStartTag(startTagMatch);
  51601. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  51602. advance(1);
  51603. }
  51604. continue
  51605. }
  51606. }
  51607. var text = (void 0), rest = (void 0), next = (void 0);
  51608. if (textEnd >= 0) {
  51609. rest = html.slice(textEnd);
  51610. while (
  51611. !endTag.test(rest) &&
  51612. !startTagOpen.test(rest) &&
  51613. !comment.test(rest) &&
  51614. !conditionalComment.test(rest)
  51615. ) {
  51616. // < in plain text, be forgiving and treat it as text
  51617. next = rest.indexOf('<', 1);
  51618. if (next < 0) { break }
  51619. textEnd += next;
  51620. rest = html.slice(textEnd);
  51621. }
  51622. text = html.substring(0, textEnd);
  51623. }
  51624. if (textEnd < 0) {
  51625. text = html;
  51626. }
  51627. if (text) {
  51628. advance(text.length);
  51629. }
  51630. if (options.chars && text) {
  51631. options.chars(text, index - text.length, index);
  51632. }
  51633. } else {
  51634. var endTagLength = 0;
  51635. var stackedTag = lastTag.toLowerCase();
  51636. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  51637. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  51638. endTagLength = endTag.length;
  51639. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  51640. text = text
  51641. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  51642. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  51643. }
  51644. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  51645. text = text.slice(1);
  51646. }
  51647. if (options.chars) {
  51648. options.chars(text);
  51649. }
  51650. return ''
  51651. });
  51652. index += html.length - rest$1.length;
  51653. html = rest$1;
  51654. parseEndTag(stackedTag, index - endTagLength, index);
  51655. }
  51656. if (html === last) {
  51657. options.chars && options.chars(html);
  51658. if (!stack.length && options.warn) {
  51659. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  51660. }
  51661. break
  51662. }
  51663. }
  51664. // Clean up any remaining tags
  51665. parseEndTag();
  51666. function advance (n) {
  51667. index += n;
  51668. html = html.substring(n);
  51669. }
  51670. function parseStartTag () {
  51671. var start = html.match(startTagOpen);
  51672. if (start) {
  51673. var match = {
  51674. tagName: start[1],
  51675. attrs: [],
  51676. start: index
  51677. };
  51678. advance(start[0].length);
  51679. var end, attr;
  51680. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  51681. attr.start = index;
  51682. advance(attr[0].length);
  51683. attr.end = index;
  51684. match.attrs.push(attr);
  51685. }
  51686. if (end) {
  51687. match.unarySlash = end[1];
  51688. advance(end[0].length);
  51689. match.end = index;
  51690. return match
  51691. }
  51692. }
  51693. }
  51694. function handleStartTag (match) {
  51695. var tagName = match.tagName;
  51696. var unarySlash = match.unarySlash;
  51697. if (expectHTML) {
  51698. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  51699. parseEndTag(lastTag);
  51700. }
  51701. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  51702. parseEndTag(tagName);
  51703. }
  51704. }
  51705. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  51706. var l = match.attrs.length;
  51707. var attrs = new Array(l);
  51708. for (var i = 0; i < l; i++) {
  51709. var args = match.attrs[i];
  51710. var value = args[3] || args[4] || args[5] || '';
  51711. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  51712. ? options.shouldDecodeNewlinesForHref
  51713. : options.shouldDecodeNewlines;
  51714. attrs[i] = {
  51715. name: args[1],
  51716. value: decodeAttr(value, shouldDecodeNewlines)
  51717. };
  51718. if (options.outputSourceRange) {
  51719. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  51720. attrs[i].end = args.end;
  51721. }
  51722. }
  51723. if (!unary) {
  51724. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  51725. lastTag = tagName;
  51726. }
  51727. if (options.start) {
  51728. options.start(tagName, attrs, unary, match.start, match.end);
  51729. }
  51730. }
  51731. function parseEndTag (tagName, start, end) {
  51732. var pos, lowerCasedTagName;
  51733. if (start == null) { start = index; }
  51734. if (end == null) { end = index; }
  51735. // Find the closest opened tag of the same type
  51736. if (tagName) {
  51737. lowerCasedTagName = tagName.toLowerCase();
  51738. for (pos = stack.length - 1; pos >= 0; pos--) {
  51739. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  51740. break
  51741. }
  51742. }
  51743. } else {
  51744. // If no tag name is provided, clean shop
  51745. pos = 0;
  51746. }
  51747. if (pos >= 0) {
  51748. // Close all the open elements, up the stack
  51749. for (var i = stack.length - 1; i >= pos; i--) {
  51750. if (i > pos || !tagName &&
  51751. options.warn
  51752. ) {
  51753. options.warn(
  51754. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  51755. { start: stack[i].start, end: stack[i].end }
  51756. );
  51757. }
  51758. if (options.end) {
  51759. options.end(stack[i].tag, start, end);
  51760. }
  51761. }
  51762. // Remove the open elements from the stack
  51763. stack.length = pos;
  51764. lastTag = pos && stack[pos - 1].tag;
  51765. } else if (lowerCasedTagName === 'br') {
  51766. if (options.start) {
  51767. options.start(tagName, [], true, start, end);
  51768. }
  51769. } else if (lowerCasedTagName === 'p') {
  51770. if (options.start) {
  51771. options.start(tagName, [], false, start, end);
  51772. }
  51773. if (options.end) {
  51774. options.end(tagName, start, end);
  51775. }
  51776. }
  51777. }
  51778. }
  51779. /* */
  51780. var onRE = /^@|^v-on:/;
  51781. var dirRE = /^v-|^@|^:|^#/;
  51782. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  51783. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  51784. var stripParensRE = /^\(|\)$/g;
  51785. var dynamicArgRE = /^\[.*\]$/;
  51786. var argRE = /:(.*)$/;
  51787. var bindRE = /^:|^\.|^v-bind:/;
  51788. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  51789. var slotRE = /^v-slot(:|$)|^#/;
  51790. var lineBreakRE = /[\r\n]/;
  51791. var whitespaceRE$1 = /\s+/g;
  51792. var invalidAttributeRE = /[\s"'<>\/=]/;
  51793. var decodeHTMLCached = cached(he.decode);
  51794. var emptySlotScopeToken = "_empty_";
  51795. // configurable state
  51796. var warn$2;
  51797. var delimiters;
  51798. var transforms;
  51799. var preTransforms;
  51800. var postTransforms;
  51801. var platformIsPreTag;
  51802. var platformMustUseProp;
  51803. var platformGetTagNamespace;
  51804. var maybeComponent;
  51805. function createASTElement (
  51806. tag,
  51807. attrs,
  51808. parent
  51809. ) {
  51810. return {
  51811. type: 1,
  51812. tag: tag,
  51813. attrsList: attrs,
  51814. attrsMap: makeAttrsMap(attrs),
  51815. rawAttrsMap: {},
  51816. parent: parent,
  51817. children: []
  51818. }
  51819. }
  51820. /**
  51821. * Convert HTML string to AST.
  51822. */
  51823. function parse (
  51824. template,
  51825. options
  51826. ) {
  51827. warn$2 = options.warn || baseWarn;
  51828. platformIsPreTag = options.isPreTag || no;
  51829. platformMustUseProp = options.mustUseProp || no;
  51830. platformGetTagNamespace = options.getTagNamespace || no;
  51831. var isReservedTag = options.isReservedTag || no;
  51832. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  51833. transforms = pluckModuleFunction(options.modules, 'transformNode');
  51834. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  51835. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  51836. delimiters = options.delimiters;
  51837. var stack = [];
  51838. var preserveWhitespace = options.preserveWhitespace !== false;
  51839. var whitespaceOption = options.whitespace;
  51840. var root;
  51841. var currentParent;
  51842. var inVPre = false;
  51843. var inPre = false;
  51844. var warned = false;
  51845. function warnOnce (msg, range) {
  51846. if (!warned) {
  51847. warned = true;
  51848. warn$2(msg, range);
  51849. }
  51850. }
  51851. function closeElement (element) {
  51852. trimEndingWhitespace(element);
  51853. if (!inVPre && !element.processed) {
  51854. element = processElement(element, options);
  51855. }
  51856. // tree management
  51857. if (!stack.length && element !== root) {
  51858. // allow root elements with v-if, v-else-if and v-else
  51859. if (root.if && (element.elseif || element.else)) {
  51860. {
  51861. checkRootConstraints(element);
  51862. }
  51863. addIfCondition(root, {
  51864. exp: element.elseif,
  51865. block: element
  51866. });
  51867. } else {
  51868. warnOnce(
  51869. "Component template should contain exactly one root element. " +
  51870. "If you are using v-if on multiple elements, " +
  51871. "use v-else-if to chain them instead.",
  51872. { start: element.start }
  51873. );
  51874. }
  51875. }
  51876. if (currentParent && !element.forbidden) {
  51877. if (element.elseif || element.else) {
  51878. processIfConditions(element, currentParent);
  51879. } else {
  51880. if (element.slotScope) {
  51881. // scoped slot
  51882. // keep it in the children list so that v-else(-if) conditions can
  51883. // find it as the prev node.
  51884. var name = element.slotTarget || '"default"'
  51885. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  51886. }
  51887. currentParent.children.push(element);
  51888. element.parent = currentParent;
  51889. }
  51890. }
  51891. // final children cleanup
  51892. // filter out scoped slots
  51893. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  51894. // remove trailing whitespace node again
  51895. trimEndingWhitespace(element);
  51896. // check pre state
  51897. if (element.pre) {
  51898. inVPre = false;
  51899. }
  51900. if (platformIsPreTag(element.tag)) {
  51901. inPre = false;
  51902. }
  51903. // apply post-transforms
  51904. for (var i = 0; i < postTransforms.length; i++) {
  51905. postTransforms[i](element, options);
  51906. }
  51907. }
  51908. function trimEndingWhitespace (el) {
  51909. // remove trailing whitespace node
  51910. if (!inPre) {
  51911. var lastNode;
  51912. while (
  51913. (lastNode = el.children[el.children.length - 1]) &&
  51914. lastNode.type === 3 &&
  51915. lastNode.text === ' '
  51916. ) {
  51917. el.children.pop();
  51918. }
  51919. }
  51920. }
  51921. function checkRootConstraints (el) {
  51922. if (el.tag === 'slot' || el.tag === 'template') {
  51923. warnOnce(
  51924. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  51925. 'contain multiple nodes.',
  51926. { start: el.start }
  51927. );
  51928. }
  51929. if (el.attrsMap.hasOwnProperty('v-for')) {
  51930. warnOnce(
  51931. 'Cannot use v-for on stateful component root element because ' +
  51932. 'it renders multiple elements.',
  51933. el.rawAttrsMap['v-for']
  51934. );
  51935. }
  51936. }
  51937. parseHTML(template, {
  51938. warn: warn$2,
  51939. expectHTML: options.expectHTML,
  51940. isUnaryTag: options.isUnaryTag,
  51941. canBeLeftOpenTag: options.canBeLeftOpenTag,
  51942. shouldDecodeNewlines: options.shouldDecodeNewlines,
  51943. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  51944. shouldKeepComment: options.comments,
  51945. outputSourceRange: options.outputSourceRange,
  51946. start: function start (tag, attrs, unary, start$1, end) {
  51947. // check namespace.
  51948. // inherit parent ns if there is one
  51949. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  51950. // handle IE svg bug
  51951. /* istanbul ignore if */
  51952. if (isIE && ns === 'svg') {
  51953. attrs = guardIESVGBug(attrs);
  51954. }
  51955. var element = createASTElement(tag, attrs, currentParent);
  51956. if (ns) {
  51957. element.ns = ns;
  51958. }
  51959. {
  51960. if (options.outputSourceRange) {
  51961. element.start = start$1;
  51962. element.end = end;
  51963. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  51964. cumulated[attr.name] = attr;
  51965. return cumulated
  51966. }, {});
  51967. }
  51968. attrs.forEach(function (attr) {
  51969. if (invalidAttributeRE.test(attr.name)) {
  51970. warn$2(
  51971. "Invalid dynamic argument expression: attribute names cannot contain " +
  51972. "spaces, quotes, <, >, / or =.",
  51973. {
  51974. start: attr.start + attr.name.indexOf("["),
  51975. end: attr.start + attr.name.length
  51976. }
  51977. );
  51978. }
  51979. });
  51980. }
  51981. if (isForbiddenTag(element) && !isServerRendering()) {
  51982. element.forbidden = true;
  51983. warn$2(
  51984. 'Templates should only be responsible for mapping the state to the ' +
  51985. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  51986. "<" + tag + ">" + ', as they will not be parsed.',
  51987. { start: element.start }
  51988. );
  51989. }
  51990. // apply pre-transforms
  51991. for (var i = 0; i < preTransforms.length; i++) {
  51992. element = preTransforms[i](element, options) || element;
  51993. }
  51994. if (!inVPre) {
  51995. processPre(element);
  51996. if (element.pre) {
  51997. inVPre = true;
  51998. }
  51999. }
  52000. if (platformIsPreTag(element.tag)) {
  52001. inPre = true;
  52002. }
  52003. if (inVPre) {
  52004. processRawAttrs(element);
  52005. } else if (!element.processed) {
  52006. // structural directives
  52007. processFor(element);
  52008. processIf(element);
  52009. processOnce(element);
  52010. }
  52011. if (!root) {
  52012. root = element;
  52013. {
  52014. checkRootConstraints(root);
  52015. }
  52016. }
  52017. if (!unary) {
  52018. currentParent = element;
  52019. stack.push(element);
  52020. } else {
  52021. closeElement(element);
  52022. }
  52023. },
  52024. end: function end (tag, start, end$1) {
  52025. var element = stack[stack.length - 1];
  52026. // pop stack
  52027. stack.length -= 1;
  52028. currentParent = stack[stack.length - 1];
  52029. if (options.outputSourceRange) {
  52030. element.end = end$1;
  52031. }
  52032. closeElement(element);
  52033. },
  52034. chars: function chars (text, start, end) {
  52035. if (!currentParent) {
  52036. {
  52037. if (text === template) {
  52038. warnOnce(
  52039. 'Component template requires a root element, rather than just text.',
  52040. { start: start }
  52041. );
  52042. } else if ((text = text.trim())) {
  52043. warnOnce(
  52044. ("text \"" + text + "\" outside root element will be ignored."),
  52045. { start: start }
  52046. );
  52047. }
  52048. }
  52049. return
  52050. }
  52051. // IE textarea placeholder bug
  52052. /* istanbul ignore if */
  52053. if (isIE &&
  52054. currentParent.tag === 'textarea' &&
  52055. currentParent.attrsMap.placeholder === text
  52056. ) {
  52057. return
  52058. }
  52059. var children = currentParent.children;
  52060. if (inPre || text.trim()) {
  52061. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  52062. } else if (!children.length) {
  52063. // remove the whitespace-only node right after an opening tag
  52064. text = '';
  52065. } else if (whitespaceOption) {
  52066. if (whitespaceOption === 'condense') {
  52067. // in condense mode, remove the whitespace node if it contains
  52068. // line break, otherwise condense to a single space
  52069. text = lineBreakRE.test(text) ? '' : ' ';
  52070. } else {
  52071. text = ' ';
  52072. }
  52073. } else {
  52074. text = preserveWhitespace ? ' ' : '';
  52075. }
  52076. if (text) {
  52077. if (!inPre && whitespaceOption === 'condense') {
  52078. // condense consecutive whitespaces into single space
  52079. text = text.replace(whitespaceRE$1, ' ');
  52080. }
  52081. var res;
  52082. var child;
  52083. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  52084. child = {
  52085. type: 2,
  52086. expression: res.expression,
  52087. tokens: res.tokens,
  52088. text: text
  52089. };
  52090. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  52091. child = {
  52092. type: 3,
  52093. text: text
  52094. };
  52095. }
  52096. if (child) {
  52097. if (options.outputSourceRange) {
  52098. child.start = start;
  52099. child.end = end;
  52100. }
  52101. children.push(child);
  52102. }
  52103. }
  52104. },
  52105. comment: function comment (text, start, end) {
  52106. // adding anyting as a sibling to the root node is forbidden
  52107. // comments should still be allowed, but ignored
  52108. if (currentParent) {
  52109. var child = {
  52110. type: 3,
  52111. text: text,
  52112. isComment: true
  52113. };
  52114. if (options.outputSourceRange) {
  52115. child.start = start;
  52116. child.end = end;
  52117. }
  52118. currentParent.children.push(child);
  52119. }
  52120. }
  52121. });
  52122. return root
  52123. }
  52124. function processPre (el) {
  52125. if (getAndRemoveAttr(el, 'v-pre') != null) {
  52126. el.pre = true;
  52127. }
  52128. }
  52129. function processRawAttrs (el) {
  52130. var list = el.attrsList;
  52131. var len = list.length;
  52132. if (len) {
  52133. var attrs = el.attrs = new Array(len);
  52134. for (var i = 0; i < len; i++) {
  52135. attrs[i] = {
  52136. name: list[i].name,
  52137. value: JSON.stringify(list[i].value)
  52138. };
  52139. if (list[i].start != null) {
  52140. attrs[i].start = list[i].start;
  52141. attrs[i].end = list[i].end;
  52142. }
  52143. }
  52144. } else if (!el.pre) {
  52145. // non root node in pre blocks with no attributes
  52146. el.plain = true;
  52147. }
  52148. }
  52149. function processElement (
  52150. element,
  52151. options
  52152. ) {
  52153. processKey(element);
  52154. // determine whether this is a plain element after
  52155. // removing structural attributes
  52156. element.plain = (
  52157. !element.key &&
  52158. !element.scopedSlots &&
  52159. !element.attrsList.length
  52160. );
  52161. processRef(element);
  52162. processSlotContent(element);
  52163. processSlotOutlet(element);
  52164. processComponent(element);
  52165. for (var i = 0; i < transforms.length; i++) {
  52166. element = transforms[i](element, options) || element;
  52167. }
  52168. processAttrs(element);
  52169. return element
  52170. }
  52171. function processKey (el) {
  52172. var exp = getBindingAttr(el, 'key');
  52173. if (exp) {
  52174. {
  52175. if (el.tag === 'template') {
  52176. warn$2(
  52177. "<template> cannot be keyed. Place the key on real elements instead.",
  52178. getRawBindingAttr(el, 'key')
  52179. );
  52180. }
  52181. if (el.for) {
  52182. var iterator = el.iterator2 || el.iterator1;
  52183. var parent = el.parent;
  52184. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  52185. warn$2(
  52186. "Do not use v-for index as key on <transition-group> children, " +
  52187. "this is the same as not using keys.",
  52188. getRawBindingAttr(el, 'key'),
  52189. true /* tip */
  52190. );
  52191. }
  52192. }
  52193. }
  52194. el.key = exp;
  52195. }
  52196. }
  52197. function processRef (el) {
  52198. var ref = getBindingAttr(el, 'ref');
  52199. if (ref) {
  52200. el.ref = ref;
  52201. el.refInFor = checkInFor(el);
  52202. }
  52203. }
  52204. function processFor (el) {
  52205. var exp;
  52206. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  52207. var res = parseFor(exp);
  52208. if (res) {
  52209. extend(el, res);
  52210. } else {
  52211. warn$2(
  52212. ("Invalid v-for expression: " + exp),
  52213. el.rawAttrsMap['v-for']
  52214. );
  52215. }
  52216. }
  52217. }
  52218. function parseFor (exp) {
  52219. var inMatch = exp.match(forAliasRE);
  52220. if (!inMatch) { return }
  52221. var res = {};
  52222. res.for = inMatch[2].trim();
  52223. var alias = inMatch[1].trim().replace(stripParensRE, '');
  52224. var iteratorMatch = alias.match(forIteratorRE);
  52225. if (iteratorMatch) {
  52226. res.alias = alias.replace(forIteratorRE, '').trim();
  52227. res.iterator1 = iteratorMatch[1].trim();
  52228. if (iteratorMatch[2]) {
  52229. res.iterator2 = iteratorMatch[2].trim();
  52230. }
  52231. } else {
  52232. res.alias = alias;
  52233. }
  52234. return res
  52235. }
  52236. function processIf (el) {
  52237. var exp = getAndRemoveAttr(el, 'v-if');
  52238. if (exp) {
  52239. el.if = exp;
  52240. addIfCondition(el, {
  52241. exp: exp,
  52242. block: el
  52243. });
  52244. } else {
  52245. if (getAndRemoveAttr(el, 'v-else') != null) {
  52246. el.else = true;
  52247. }
  52248. var elseif = getAndRemoveAttr(el, 'v-else-if');
  52249. if (elseif) {
  52250. el.elseif = elseif;
  52251. }
  52252. }
  52253. }
  52254. function processIfConditions (el, parent) {
  52255. var prev = findPrevElement(parent.children);
  52256. if (prev && prev.if) {
  52257. addIfCondition(prev, {
  52258. exp: el.elseif,
  52259. block: el
  52260. });
  52261. } else {
  52262. warn$2(
  52263. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  52264. "used on element <" + (el.tag) + "> without corresponding v-if.",
  52265. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  52266. );
  52267. }
  52268. }
  52269. function findPrevElement (children) {
  52270. var i = children.length;
  52271. while (i--) {
  52272. if (children[i].type === 1) {
  52273. return children[i]
  52274. } else {
  52275. if (children[i].text !== ' ') {
  52276. warn$2(
  52277. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  52278. "will be ignored.",
  52279. children[i]
  52280. );
  52281. }
  52282. children.pop();
  52283. }
  52284. }
  52285. }
  52286. function addIfCondition (el, condition) {
  52287. if (!el.ifConditions) {
  52288. el.ifConditions = [];
  52289. }
  52290. el.ifConditions.push(condition);
  52291. }
  52292. function processOnce (el) {
  52293. var once$$1 = getAndRemoveAttr(el, 'v-once');
  52294. if (once$$1 != null) {
  52295. el.once = true;
  52296. }
  52297. }
  52298. // handle content being passed to a component as slot,
  52299. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  52300. function processSlotContent (el) {
  52301. var slotScope;
  52302. if (el.tag === 'template') {
  52303. slotScope = getAndRemoveAttr(el, 'scope');
  52304. /* istanbul ignore if */
  52305. if (slotScope) {
  52306. warn$2(
  52307. "the \"scope\" attribute for scoped slots have been deprecated and " +
  52308. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  52309. "can also be used on plain elements in addition to <template> to " +
  52310. "denote scoped slots.",
  52311. el.rawAttrsMap['scope'],
  52312. true
  52313. );
  52314. }
  52315. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  52316. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  52317. /* istanbul ignore if */
  52318. if (el.attrsMap['v-for']) {
  52319. warn$2(
  52320. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  52321. "(v-for takes higher priority). Use a wrapper <template> for the " +
  52322. "scoped slot to make it clearer.",
  52323. el.rawAttrsMap['slot-scope'],
  52324. true
  52325. );
  52326. }
  52327. el.slotScope = slotScope;
  52328. }
  52329. // slot="xxx"
  52330. var slotTarget = getBindingAttr(el, 'slot');
  52331. if (slotTarget) {
  52332. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  52333. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  52334. // preserve slot as an attribute for native shadow DOM compat
  52335. // only for non-scoped slots.
  52336. if (el.tag !== 'template' && !el.slotScope) {
  52337. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  52338. }
  52339. }
  52340. // 2.6 v-slot syntax
  52341. {
  52342. if (el.tag === 'template') {
  52343. // v-slot on <template>
  52344. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  52345. if (slotBinding) {
  52346. {
  52347. if (el.slotTarget || el.slotScope) {
  52348. warn$2(
  52349. "Unexpected mixed usage of different slot syntaxes.",
  52350. el
  52351. );
  52352. }
  52353. if (el.parent && !maybeComponent(el.parent)) {
  52354. warn$2(
  52355. "<template v-slot> can only appear at the root level inside " +
  52356. "the receiving component",
  52357. el
  52358. );
  52359. }
  52360. }
  52361. var ref = getSlotName(slotBinding);
  52362. var name = ref.name;
  52363. var dynamic = ref.dynamic;
  52364. el.slotTarget = name;
  52365. el.slotTargetDynamic = dynamic;
  52366. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  52367. }
  52368. } else {
  52369. // v-slot on component, denotes default slot
  52370. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  52371. if (slotBinding$1) {
  52372. {
  52373. if (!maybeComponent(el)) {
  52374. warn$2(
  52375. "v-slot can only be used on components or <template>.",
  52376. slotBinding$1
  52377. );
  52378. }
  52379. if (el.slotScope || el.slotTarget) {
  52380. warn$2(
  52381. "Unexpected mixed usage of different slot syntaxes.",
  52382. el
  52383. );
  52384. }
  52385. if (el.scopedSlots) {
  52386. warn$2(
  52387. "To avoid scope ambiguity, the default slot should also use " +
  52388. "<template> syntax when there are other named slots.",
  52389. slotBinding$1
  52390. );
  52391. }
  52392. }
  52393. // add the component's children to its default slot
  52394. var slots = el.scopedSlots || (el.scopedSlots = {});
  52395. var ref$1 = getSlotName(slotBinding$1);
  52396. var name$1 = ref$1.name;
  52397. var dynamic$1 = ref$1.dynamic;
  52398. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  52399. slotContainer.slotTarget = name$1;
  52400. slotContainer.slotTargetDynamic = dynamic$1;
  52401. slotContainer.children = el.children.filter(function (c) {
  52402. if (!c.slotScope) {
  52403. c.parent = slotContainer;
  52404. return true
  52405. }
  52406. });
  52407. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  52408. // remove children as they are returned from scopedSlots now
  52409. el.children = [];
  52410. // mark el non-plain so data gets generated
  52411. el.plain = false;
  52412. }
  52413. }
  52414. }
  52415. }
  52416. function getSlotName (binding) {
  52417. var name = binding.name.replace(slotRE, '');
  52418. if (!name) {
  52419. if (binding.name[0] !== '#') {
  52420. name = 'default';
  52421. } else {
  52422. warn$2(
  52423. "v-slot shorthand syntax requires a slot name.",
  52424. binding
  52425. );
  52426. }
  52427. }
  52428. return dynamicArgRE.test(name)
  52429. // dynamic [name]
  52430. ? { name: name.slice(1, -1), dynamic: true }
  52431. // static name
  52432. : { name: ("\"" + name + "\""), dynamic: false }
  52433. }
  52434. // handle <slot/> outlets
  52435. function processSlotOutlet (el) {
  52436. if (el.tag === 'slot') {
  52437. el.slotName = getBindingAttr(el, 'name');
  52438. if (el.key) {
  52439. warn$2(
  52440. "`key` does not work on <slot> because slots are abstract outlets " +
  52441. "and can possibly expand into multiple elements. " +
  52442. "Use the key on a wrapping element instead.",
  52443. getRawBindingAttr(el, 'key')
  52444. );
  52445. }
  52446. }
  52447. }
  52448. function processComponent (el) {
  52449. var binding;
  52450. if ((binding = getBindingAttr(el, 'is'))) {
  52451. el.component = binding;
  52452. }
  52453. if (getAndRemoveAttr(el, 'inline-template') != null) {
  52454. el.inlineTemplate = true;
  52455. }
  52456. }
  52457. function processAttrs (el) {
  52458. var list = el.attrsList;
  52459. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  52460. for (i = 0, l = list.length; i < l; i++) {
  52461. name = rawName = list[i].name;
  52462. value = list[i].value;
  52463. if (dirRE.test(name)) {
  52464. // mark element as dynamic
  52465. el.hasBindings = true;
  52466. // modifiers
  52467. modifiers = parseModifiers(name.replace(dirRE, ''));
  52468. // support .foo shorthand syntax for the .prop modifier
  52469. if (modifiers) {
  52470. name = name.replace(modifierRE, '');
  52471. }
  52472. if (bindRE.test(name)) { // v-bind
  52473. name = name.replace(bindRE, '');
  52474. value = parseFilters(value);
  52475. isDynamic = dynamicArgRE.test(name);
  52476. if (isDynamic) {
  52477. name = name.slice(1, -1);
  52478. }
  52479. if (
  52480. value.trim().length === 0
  52481. ) {
  52482. warn$2(
  52483. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  52484. );
  52485. }
  52486. if (modifiers) {
  52487. if (modifiers.prop && !isDynamic) {
  52488. name = camelize(name);
  52489. if (name === 'innerHtml') { name = 'innerHTML'; }
  52490. }
  52491. if (modifiers.camel && !isDynamic) {
  52492. name = camelize(name);
  52493. }
  52494. if (modifiers.sync) {
  52495. syncGen = genAssignmentCode(value, "$event");
  52496. if (!isDynamic) {
  52497. addHandler(
  52498. el,
  52499. ("update:" + (camelize(name))),
  52500. syncGen,
  52501. null,
  52502. false,
  52503. warn$2,
  52504. list[i]
  52505. );
  52506. if (hyphenate(name) !== camelize(name)) {
  52507. addHandler(
  52508. el,
  52509. ("update:" + (hyphenate(name))),
  52510. syncGen,
  52511. null,
  52512. false,
  52513. warn$2,
  52514. list[i]
  52515. );
  52516. }
  52517. } else {
  52518. // handler w/ dynamic event name
  52519. addHandler(
  52520. el,
  52521. ("\"update:\"+(" + name + ")"),
  52522. syncGen,
  52523. null,
  52524. false,
  52525. warn$2,
  52526. list[i],
  52527. true // dynamic
  52528. );
  52529. }
  52530. }
  52531. }
  52532. if ((modifiers && modifiers.prop) || (
  52533. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  52534. )) {
  52535. addProp(el, name, value, list[i], isDynamic);
  52536. } else {
  52537. addAttr(el, name, value, list[i], isDynamic);
  52538. }
  52539. } else if (onRE.test(name)) { // v-on
  52540. name = name.replace(onRE, '');
  52541. isDynamic = dynamicArgRE.test(name);
  52542. if (isDynamic) {
  52543. name = name.slice(1, -1);
  52544. }
  52545. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  52546. } else { // normal directives
  52547. name = name.replace(dirRE, '');
  52548. // parse arg
  52549. var argMatch = name.match(argRE);
  52550. var arg = argMatch && argMatch[1];
  52551. isDynamic = false;
  52552. if (arg) {
  52553. name = name.slice(0, -(arg.length + 1));
  52554. if (dynamicArgRE.test(arg)) {
  52555. arg = arg.slice(1, -1);
  52556. isDynamic = true;
  52557. }
  52558. }
  52559. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  52560. if (name === 'model') {
  52561. checkForAliasModel(el, value);
  52562. }
  52563. }
  52564. } else {
  52565. // literal attribute
  52566. {
  52567. var res = parseText(value, delimiters);
  52568. if (res) {
  52569. warn$2(
  52570. name + "=\"" + value + "\": " +
  52571. 'Interpolation inside attributes has been removed. ' +
  52572. 'Use v-bind or the colon shorthand instead. For example, ' +
  52573. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  52574. list[i]
  52575. );
  52576. }
  52577. }
  52578. addAttr(el, name, JSON.stringify(value), list[i]);
  52579. // #6887 firefox doesn't update muted state if set via attribute
  52580. // even immediately after element creation
  52581. if (!el.component &&
  52582. name === 'muted' &&
  52583. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  52584. addProp(el, name, 'true', list[i]);
  52585. }
  52586. }
  52587. }
  52588. }
  52589. function checkInFor (el) {
  52590. var parent = el;
  52591. while (parent) {
  52592. if (parent.for !== undefined) {
  52593. return true
  52594. }
  52595. parent = parent.parent;
  52596. }
  52597. return false
  52598. }
  52599. function parseModifiers (name) {
  52600. var match = name.match(modifierRE);
  52601. if (match) {
  52602. var ret = {};
  52603. match.forEach(function (m) { ret[m.slice(1)] = true; });
  52604. return ret
  52605. }
  52606. }
  52607. function makeAttrsMap (attrs) {
  52608. var map = {};
  52609. for (var i = 0, l = attrs.length; i < l; i++) {
  52610. if (
  52611. map[attrs[i].name] && !isIE && !isEdge
  52612. ) {
  52613. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  52614. }
  52615. map[attrs[i].name] = attrs[i].value;
  52616. }
  52617. return map
  52618. }
  52619. // for script (e.g. type="x/template") or style, do not decode content
  52620. function isTextTag (el) {
  52621. return el.tag === 'script' || el.tag === 'style'
  52622. }
  52623. function isForbiddenTag (el) {
  52624. return (
  52625. el.tag === 'style' ||
  52626. (el.tag === 'script' && (
  52627. !el.attrsMap.type ||
  52628. el.attrsMap.type === 'text/javascript'
  52629. ))
  52630. )
  52631. }
  52632. var ieNSBug = /^xmlns:NS\d+/;
  52633. var ieNSPrefix = /^NS\d+:/;
  52634. /* istanbul ignore next */
  52635. function guardIESVGBug (attrs) {
  52636. var res = [];
  52637. for (var i = 0; i < attrs.length; i++) {
  52638. var attr = attrs[i];
  52639. if (!ieNSBug.test(attr.name)) {
  52640. attr.name = attr.name.replace(ieNSPrefix, '');
  52641. res.push(attr);
  52642. }
  52643. }
  52644. return res
  52645. }
  52646. function checkForAliasModel (el, value) {
  52647. var _el = el;
  52648. while (_el) {
  52649. if (_el.for && _el.alias === value) {
  52650. warn$2(
  52651. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  52652. "You are binding v-model directly to a v-for iteration alias. " +
  52653. "This will not be able to modify the v-for source array because " +
  52654. "writing to the alias is like modifying a function local variable. " +
  52655. "Consider using an array of objects and use v-model on an object property instead.",
  52656. el.rawAttrsMap['v-model']
  52657. );
  52658. }
  52659. _el = _el.parent;
  52660. }
  52661. }
  52662. /* */
  52663. function preTransformNode (el, options) {
  52664. if (el.tag === 'input') {
  52665. var map = el.attrsMap;
  52666. if (!map['v-model']) {
  52667. return
  52668. }
  52669. var typeBinding;
  52670. if (map[':type'] || map['v-bind:type']) {
  52671. typeBinding = getBindingAttr(el, 'type');
  52672. }
  52673. if (!map.type && !typeBinding && map['v-bind']) {
  52674. typeBinding = "(" + (map['v-bind']) + ").type";
  52675. }
  52676. if (typeBinding) {
  52677. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  52678. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  52679. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  52680. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  52681. // 1. checkbox
  52682. var branch0 = cloneASTElement(el);
  52683. // process for on the main node
  52684. processFor(branch0);
  52685. addRawAttr(branch0, 'type', 'checkbox');
  52686. processElement(branch0, options);
  52687. branch0.processed = true; // prevent it from double-processed
  52688. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  52689. addIfCondition(branch0, {
  52690. exp: branch0.if,
  52691. block: branch0
  52692. });
  52693. // 2. add radio else-if condition
  52694. var branch1 = cloneASTElement(el);
  52695. getAndRemoveAttr(branch1, 'v-for', true);
  52696. addRawAttr(branch1, 'type', 'radio');
  52697. processElement(branch1, options);
  52698. addIfCondition(branch0, {
  52699. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  52700. block: branch1
  52701. });
  52702. // 3. other
  52703. var branch2 = cloneASTElement(el);
  52704. getAndRemoveAttr(branch2, 'v-for', true);
  52705. addRawAttr(branch2, ':type', typeBinding);
  52706. processElement(branch2, options);
  52707. addIfCondition(branch0, {
  52708. exp: ifCondition,
  52709. block: branch2
  52710. });
  52711. if (hasElse) {
  52712. branch0.else = true;
  52713. } else if (elseIfCondition) {
  52714. branch0.elseif = elseIfCondition;
  52715. }
  52716. return branch0
  52717. }
  52718. }
  52719. }
  52720. function cloneASTElement (el) {
  52721. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  52722. }
  52723. var model$1 = {
  52724. preTransformNode: preTransformNode
  52725. };
  52726. var modules$1 = [
  52727. klass$1,
  52728. style$1,
  52729. model$1
  52730. ];
  52731. /* */
  52732. function text (el, dir) {
  52733. if (dir.value) {
  52734. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  52735. }
  52736. }
  52737. /* */
  52738. function html (el, dir) {
  52739. if (dir.value) {
  52740. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  52741. }
  52742. }
  52743. var directives$1 = {
  52744. model: model,
  52745. text: text,
  52746. html: html
  52747. };
  52748. /* */
  52749. var baseOptions = {
  52750. expectHTML: true,
  52751. modules: modules$1,
  52752. directives: directives$1,
  52753. isPreTag: isPreTag,
  52754. isUnaryTag: isUnaryTag,
  52755. mustUseProp: mustUseProp,
  52756. canBeLeftOpenTag: canBeLeftOpenTag,
  52757. isReservedTag: isReservedTag,
  52758. getTagNamespace: getTagNamespace,
  52759. staticKeys: genStaticKeys(modules$1)
  52760. };
  52761. /* */
  52762. var isStaticKey;
  52763. var isPlatformReservedTag;
  52764. var genStaticKeysCached = cached(genStaticKeys$1);
  52765. /**
  52766. * Goal of the optimizer: walk the generated template AST tree
  52767. * and detect sub-trees that are purely static, i.e. parts of
  52768. * the DOM that never needs to change.
  52769. *
  52770. * Once we detect these sub-trees, we can:
  52771. *
  52772. * 1. Hoist them into constants, so that we no longer need to
  52773. * create fresh nodes for them on each re-render;
  52774. * 2. Completely skip them in the patching process.
  52775. */
  52776. function optimize (root, options) {
  52777. if (!root) { return }
  52778. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  52779. isPlatformReservedTag = options.isReservedTag || no;
  52780. // first pass: mark all non-static nodes.
  52781. markStatic$1(root);
  52782. // second pass: mark static roots.
  52783. markStaticRoots(root, false);
  52784. }
  52785. function genStaticKeys$1 (keys) {
  52786. return makeMap(
  52787. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  52788. (keys ? ',' + keys : '')
  52789. )
  52790. }
  52791. function markStatic$1 (node) {
  52792. node.static = isStatic(node);
  52793. if (node.type === 1) {
  52794. // do not make component slot content static. this avoids
  52795. // 1. components not able to mutate slot nodes
  52796. // 2. static slot content fails for hot-reloading
  52797. if (
  52798. !isPlatformReservedTag(node.tag) &&
  52799. node.tag !== 'slot' &&
  52800. node.attrsMap['inline-template'] == null
  52801. ) {
  52802. return
  52803. }
  52804. for (var i = 0, l = node.children.length; i < l; i++) {
  52805. var child = node.children[i];
  52806. markStatic$1(child);
  52807. if (!child.static) {
  52808. node.static = false;
  52809. }
  52810. }
  52811. if (node.ifConditions) {
  52812. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  52813. var block = node.ifConditions[i$1].block;
  52814. markStatic$1(block);
  52815. if (!block.static) {
  52816. node.static = false;
  52817. }
  52818. }
  52819. }
  52820. }
  52821. }
  52822. function markStaticRoots (node, isInFor) {
  52823. if (node.type === 1) {
  52824. if (node.static || node.once) {
  52825. node.staticInFor = isInFor;
  52826. }
  52827. // For a node to qualify as a static root, it should have children that
  52828. // are not just static text. Otherwise the cost of hoisting out will
  52829. // outweigh the benefits and it's better off to just always render it fresh.
  52830. if (node.static && node.children.length && !(
  52831. node.children.length === 1 &&
  52832. node.children[0].type === 3
  52833. )) {
  52834. node.staticRoot = true;
  52835. return
  52836. } else {
  52837. node.staticRoot = false;
  52838. }
  52839. if (node.children) {
  52840. for (var i = 0, l = node.children.length; i < l; i++) {
  52841. markStaticRoots(node.children[i], isInFor || !!node.for);
  52842. }
  52843. }
  52844. if (node.ifConditions) {
  52845. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  52846. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  52847. }
  52848. }
  52849. }
  52850. }
  52851. function isStatic (node) {
  52852. if (node.type === 2) { // expression
  52853. return false
  52854. }
  52855. if (node.type === 3) { // text
  52856. return true
  52857. }
  52858. return !!(node.pre || (
  52859. !node.hasBindings && // no dynamic bindings
  52860. !node.if && !node.for && // not v-if or v-for or v-else
  52861. !isBuiltInTag(node.tag) && // not a built-in
  52862. isPlatformReservedTag(node.tag) && // not a component
  52863. !isDirectChildOfTemplateFor(node) &&
  52864. Object.keys(node).every(isStaticKey)
  52865. ))
  52866. }
  52867. function isDirectChildOfTemplateFor (node) {
  52868. while (node.parent) {
  52869. node = node.parent;
  52870. if (node.tag !== 'template') {
  52871. return false
  52872. }
  52873. if (node.for) {
  52874. return true
  52875. }
  52876. }
  52877. return false
  52878. }
  52879. /* */
  52880. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  52881. var fnInvokeRE = /\([^)]*?\);*$/;
  52882. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  52883. // KeyboardEvent.keyCode aliases
  52884. var keyCodes = {
  52885. esc: 27,
  52886. tab: 9,
  52887. enter: 13,
  52888. space: 32,
  52889. up: 38,
  52890. left: 37,
  52891. right: 39,
  52892. down: 40,
  52893. 'delete': [8, 46]
  52894. };
  52895. // KeyboardEvent.key aliases
  52896. var keyNames = {
  52897. // #7880: IE11 and Edge use `Esc` for Escape key name.
  52898. esc: ['Esc', 'Escape'],
  52899. tab: 'Tab',
  52900. enter: 'Enter',
  52901. // #9112: IE11 uses `Spacebar` for Space key name.
  52902. space: [' ', 'Spacebar'],
  52903. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  52904. up: ['Up', 'ArrowUp'],
  52905. left: ['Left', 'ArrowLeft'],
  52906. right: ['Right', 'ArrowRight'],
  52907. down: ['Down', 'ArrowDown'],
  52908. // #9112: IE11 uses `Del` for Delete key name.
  52909. 'delete': ['Backspace', 'Delete', 'Del']
  52910. };
  52911. // #4868: modifiers that prevent the execution of the listener
  52912. // need to explicitly return null so that we can determine whether to remove
  52913. // the listener for .once
  52914. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  52915. var modifierCode = {
  52916. stop: '$event.stopPropagation();',
  52917. prevent: '$event.preventDefault();',
  52918. self: genGuard("$event.target !== $event.currentTarget"),
  52919. ctrl: genGuard("!$event.ctrlKey"),
  52920. shift: genGuard("!$event.shiftKey"),
  52921. alt: genGuard("!$event.altKey"),
  52922. meta: genGuard("!$event.metaKey"),
  52923. left: genGuard("'button' in $event && $event.button !== 0"),
  52924. middle: genGuard("'button' in $event && $event.button !== 1"),
  52925. right: genGuard("'button' in $event && $event.button !== 2")
  52926. };
  52927. function genHandlers (
  52928. events,
  52929. isNative
  52930. ) {
  52931. var prefix = isNative ? 'nativeOn:' : 'on:';
  52932. var staticHandlers = "";
  52933. var dynamicHandlers = "";
  52934. for (var name in events) {
  52935. var handlerCode = genHandler(events[name]);
  52936. if (events[name] && events[name].dynamic) {
  52937. dynamicHandlers += name + "," + handlerCode + ",";
  52938. } else {
  52939. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  52940. }
  52941. }
  52942. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  52943. if (dynamicHandlers) {
  52944. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  52945. } else {
  52946. return prefix + staticHandlers
  52947. }
  52948. }
  52949. function genHandler (handler) {
  52950. if (!handler) {
  52951. return 'function(){}'
  52952. }
  52953. if (Array.isArray(handler)) {
  52954. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  52955. }
  52956. var isMethodPath = simplePathRE.test(handler.value);
  52957. var isFunctionExpression = fnExpRE.test(handler.value);
  52958. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  52959. if (!handler.modifiers) {
  52960. if (isMethodPath || isFunctionExpression) {
  52961. return handler.value
  52962. }
  52963. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  52964. } else {
  52965. var code = '';
  52966. var genModifierCode = '';
  52967. var keys = [];
  52968. for (var key in handler.modifiers) {
  52969. if (modifierCode[key]) {
  52970. genModifierCode += modifierCode[key];
  52971. // left/right
  52972. if (keyCodes[key]) {
  52973. keys.push(key);
  52974. }
  52975. } else if (key === 'exact') {
  52976. var modifiers = (handler.modifiers);
  52977. genModifierCode += genGuard(
  52978. ['ctrl', 'shift', 'alt', 'meta']
  52979. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  52980. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  52981. .join('||')
  52982. );
  52983. } else {
  52984. keys.push(key);
  52985. }
  52986. }
  52987. if (keys.length) {
  52988. code += genKeyFilter(keys);
  52989. }
  52990. // Make sure modifiers like prevent and stop get executed after key filtering
  52991. if (genModifierCode) {
  52992. code += genModifierCode;
  52993. }
  52994. var handlerCode = isMethodPath
  52995. ? ("return " + (handler.value) + "($event)")
  52996. : isFunctionExpression
  52997. ? ("return (" + (handler.value) + ")($event)")
  52998. : isFunctionInvocation
  52999. ? ("return " + (handler.value))
  53000. : handler.value;
  53001. return ("function($event){" + code + handlerCode + "}")
  53002. }
  53003. }
  53004. function genKeyFilter (keys) {
  53005. return (
  53006. // make sure the key filters only apply to KeyboardEvents
  53007. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  53008. // key events that do not have keyCode property...
  53009. "if(!$event.type.indexOf('key')&&" +
  53010. (keys.map(genFilterCode).join('&&')) + ")return null;"
  53011. )
  53012. }
  53013. function genFilterCode (key) {
  53014. var keyVal = parseInt(key, 10);
  53015. if (keyVal) {
  53016. return ("$event.keyCode!==" + keyVal)
  53017. }
  53018. var keyCode = keyCodes[key];
  53019. var keyName = keyNames[key];
  53020. return (
  53021. "_k($event.keyCode," +
  53022. (JSON.stringify(key)) + "," +
  53023. (JSON.stringify(keyCode)) + "," +
  53024. "$event.key," +
  53025. "" + (JSON.stringify(keyName)) +
  53026. ")"
  53027. )
  53028. }
  53029. /* */
  53030. function on (el, dir) {
  53031. if (dir.modifiers) {
  53032. warn("v-on without argument does not support modifiers.");
  53033. }
  53034. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  53035. }
  53036. /* */
  53037. function bind$1 (el, dir) {
  53038. el.wrapData = function (code) {
  53039. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  53040. };
  53041. }
  53042. /* */
  53043. var baseDirectives = {
  53044. on: on,
  53045. bind: bind$1,
  53046. cloak: noop
  53047. };
  53048. /* */
  53049. var CodegenState = function CodegenState (options) {
  53050. this.options = options;
  53051. this.warn = options.warn || baseWarn;
  53052. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  53053. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  53054. this.directives = extend(extend({}, baseDirectives), options.directives);
  53055. var isReservedTag = options.isReservedTag || no;
  53056. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53057. this.onceId = 0;
  53058. this.staticRenderFns = [];
  53059. this.pre = false;
  53060. };
  53061. function generate (
  53062. ast,
  53063. options
  53064. ) {
  53065. var state = new CodegenState(options);
  53066. var code = ast ? genElement(ast, state) : '_c("div")';
  53067. return {
  53068. render: ("with(this){return " + code + "}"),
  53069. staticRenderFns: state.staticRenderFns
  53070. }
  53071. }
  53072. function genElement (el, state) {
  53073. if (el.parent) {
  53074. el.pre = el.pre || el.parent.pre;
  53075. }
  53076. if (el.staticRoot && !el.staticProcessed) {
  53077. return genStatic(el, state)
  53078. } else if (el.once && !el.onceProcessed) {
  53079. return genOnce(el, state)
  53080. } else if (el.for && !el.forProcessed) {
  53081. return genFor(el, state)
  53082. } else if (el.if && !el.ifProcessed) {
  53083. return genIf(el, state)
  53084. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  53085. return genChildren(el, state) || 'void 0'
  53086. } else if (el.tag === 'slot') {
  53087. return genSlot(el, state)
  53088. } else {
  53089. // component or element
  53090. var code;
  53091. if (el.component) {
  53092. code = genComponent(el.component, el, state);
  53093. } else {
  53094. var data;
  53095. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  53096. data = genData$2(el, state);
  53097. }
  53098. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53099. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  53100. }
  53101. // module transforms
  53102. for (var i = 0; i < state.transforms.length; i++) {
  53103. code = state.transforms[i](el, code);
  53104. }
  53105. return code
  53106. }
  53107. }
  53108. // hoist static sub-trees out
  53109. function genStatic (el, state) {
  53110. el.staticProcessed = true;
  53111. // Some elements (templates) need to behave differently inside of a v-pre
  53112. // node. All pre nodes are static roots, so we can use this as a location to
  53113. // wrap a state change and reset it upon exiting the pre node.
  53114. var originalPreState = state.pre;
  53115. if (el.pre) {
  53116. state.pre = el.pre;
  53117. }
  53118. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  53119. state.pre = originalPreState;
  53120. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  53121. }
  53122. // v-once
  53123. function genOnce (el, state) {
  53124. el.onceProcessed = true;
  53125. if (el.if && !el.ifProcessed) {
  53126. return genIf(el, state)
  53127. } else if (el.staticInFor) {
  53128. var key = '';
  53129. var parent = el.parent;
  53130. while (parent) {
  53131. if (parent.for) {
  53132. key = parent.key;
  53133. break
  53134. }
  53135. parent = parent.parent;
  53136. }
  53137. if (!key) {
  53138. state.warn(
  53139. "v-once can only be used inside v-for that is keyed. ",
  53140. el.rawAttrsMap['v-once']
  53141. );
  53142. return genElement(el, state)
  53143. }
  53144. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  53145. } else {
  53146. return genStatic(el, state)
  53147. }
  53148. }
  53149. function genIf (
  53150. el,
  53151. state,
  53152. altGen,
  53153. altEmpty
  53154. ) {
  53155. el.ifProcessed = true; // avoid recursion
  53156. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  53157. }
  53158. function genIfConditions (
  53159. conditions,
  53160. state,
  53161. altGen,
  53162. altEmpty
  53163. ) {
  53164. if (!conditions.length) {
  53165. return altEmpty || '_e()'
  53166. }
  53167. var condition = conditions.shift();
  53168. if (condition.exp) {
  53169. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  53170. } else {
  53171. return ("" + (genTernaryExp(condition.block)))
  53172. }
  53173. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  53174. function genTernaryExp (el) {
  53175. return altGen
  53176. ? altGen(el, state)
  53177. : el.once
  53178. ? genOnce(el, state)
  53179. : genElement(el, state)
  53180. }
  53181. }
  53182. function genFor (
  53183. el,
  53184. state,
  53185. altGen,
  53186. altHelper
  53187. ) {
  53188. var exp = el.for;
  53189. var alias = el.alias;
  53190. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  53191. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  53192. if (state.maybeComponent(el) &&
  53193. el.tag !== 'slot' &&
  53194. el.tag !== 'template' &&
  53195. !el.key
  53196. ) {
  53197. state.warn(
  53198. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  53199. "v-for should have explicit keys. " +
  53200. "See https://vuejs.org/guide/list.html#key for more info.",
  53201. el.rawAttrsMap['v-for'],
  53202. true /* tip */
  53203. );
  53204. }
  53205. el.forProcessed = true; // avoid recursion
  53206. return (altHelper || '_l') + "((" + exp + ")," +
  53207. "function(" + alias + iterator1 + iterator2 + "){" +
  53208. "return " + ((altGen || genElement)(el, state)) +
  53209. '})'
  53210. }
  53211. function genData$2 (el, state) {
  53212. var data = '{';
  53213. // directives first.
  53214. // directives may mutate the el's other properties before they are generated.
  53215. var dirs = genDirectives(el, state);
  53216. if (dirs) { data += dirs + ','; }
  53217. // key
  53218. if (el.key) {
  53219. data += "key:" + (el.key) + ",";
  53220. }
  53221. // ref
  53222. if (el.ref) {
  53223. data += "ref:" + (el.ref) + ",";
  53224. }
  53225. if (el.refInFor) {
  53226. data += "refInFor:true,";
  53227. }
  53228. // pre
  53229. if (el.pre) {
  53230. data += "pre:true,";
  53231. }
  53232. // record original tag name for components using "is" attribute
  53233. if (el.component) {
  53234. data += "tag:\"" + (el.tag) + "\",";
  53235. }
  53236. // module data generation functions
  53237. for (var i = 0; i < state.dataGenFns.length; i++) {
  53238. data += state.dataGenFns[i](el);
  53239. }
  53240. // attributes
  53241. if (el.attrs) {
  53242. data += "attrs:" + (genProps(el.attrs)) + ",";
  53243. }
  53244. // DOM props
  53245. if (el.props) {
  53246. data += "domProps:" + (genProps(el.props)) + ",";
  53247. }
  53248. // event handlers
  53249. if (el.events) {
  53250. data += (genHandlers(el.events, false)) + ",";
  53251. }
  53252. if (el.nativeEvents) {
  53253. data += (genHandlers(el.nativeEvents, true)) + ",";
  53254. }
  53255. // slot target
  53256. // only for non-scoped slots
  53257. if (el.slotTarget && !el.slotScope) {
  53258. data += "slot:" + (el.slotTarget) + ",";
  53259. }
  53260. // scoped slots
  53261. if (el.scopedSlots) {
  53262. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  53263. }
  53264. // component v-model
  53265. if (el.model) {
  53266. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  53267. }
  53268. // inline-template
  53269. if (el.inlineTemplate) {
  53270. var inlineTemplate = genInlineTemplate(el, state);
  53271. if (inlineTemplate) {
  53272. data += inlineTemplate + ",";
  53273. }
  53274. }
  53275. data = data.replace(/,$/, '') + '}';
  53276. // v-bind dynamic argument wrap
  53277. // v-bind with dynamic arguments must be applied using the same v-bind object
  53278. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  53279. if (el.dynamicAttrs) {
  53280. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  53281. }
  53282. // v-bind data wrap
  53283. if (el.wrapData) {
  53284. data = el.wrapData(data);
  53285. }
  53286. // v-on data wrap
  53287. if (el.wrapListeners) {
  53288. data = el.wrapListeners(data);
  53289. }
  53290. return data
  53291. }
  53292. function genDirectives (el, state) {
  53293. var dirs = el.directives;
  53294. if (!dirs) { return }
  53295. var res = 'directives:[';
  53296. var hasRuntime = false;
  53297. var i, l, dir, needRuntime;
  53298. for (i = 0, l = dirs.length; i < l; i++) {
  53299. dir = dirs[i];
  53300. needRuntime = true;
  53301. var gen = state.directives[dir.name];
  53302. if (gen) {
  53303. // compile-time directive that manipulates AST.
  53304. // returns true if it also needs a runtime counterpart.
  53305. needRuntime = !!gen(el, dir, state.warn);
  53306. }
  53307. if (needRuntime) {
  53308. hasRuntime = true;
  53309. 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))) : '') + "},";
  53310. }
  53311. }
  53312. if (hasRuntime) {
  53313. return res.slice(0, -1) + ']'
  53314. }
  53315. }
  53316. function genInlineTemplate (el, state) {
  53317. var ast = el.children[0];
  53318. if (el.children.length !== 1 || ast.type !== 1) {
  53319. state.warn(
  53320. 'Inline-template components must have exactly one child element.',
  53321. { start: el.start }
  53322. );
  53323. }
  53324. if (ast && ast.type === 1) {
  53325. var inlineRenderFns = generate(ast, state.options);
  53326. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  53327. }
  53328. }
  53329. function genScopedSlots (
  53330. el,
  53331. slots,
  53332. state
  53333. ) {
  53334. // by default scoped slots are considered "stable", this allows child
  53335. // components with only scoped slots to skip forced updates from parent.
  53336. // but in some cases we have to bail-out of this optimization
  53337. // for example if the slot contains dynamic names, has v-if or v-for on them...
  53338. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  53339. var slot = slots[key];
  53340. return (
  53341. slot.slotTargetDynamic ||
  53342. slot.if ||
  53343. slot.for ||
  53344. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  53345. )
  53346. });
  53347. // #9534: if a component with scoped slots is inside a conditional branch,
  53348. // it's possible for the same component to be reused but with different
  53349. // compiled slot content. To avoid that, we generate a unique key based on
  53350. // the generated code of all the slot contents.
  53351. var needsKey = !!el.if;
  53352. // OR when it is inside another scoped slot or v-for (the reactivity may be
  53353. // disconnected due to the intermediate scope variable)
  53354. // #9438, #9506
  53355. // TODO: this can be further optimized by properly analyzing in-scope bindings
  53356. // and skip force updating ones that do not actually use scope variables.
  53357. if (!needsForceUpdate) {
  53358. var parent = el.parent;
  53359. while (parent) {
  53360. if (
  53361. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  53362. parent.for
  53363. ) {
  53364. needsForceUpdate = true;
  53365. break
  53366. }
  53367. if (parent.if) {
  53368. needsKey = true;
  53369. }
  53370. parent = parent.parent;
  53371. }
  53372. }
  53373. var generatedSlots = Object.keys(slots)
  53374. .map(function (key) { return genScopedSlot(slots[key], state); })
  53375. .join(',');
  53376. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  53377. }
  53378. function hash(str) {
  53379. var hash = 5381;
  53380. var i = str.length;
  53381. while(i) {
  53382. hash = (hash * 33) ^ str.charCodeAt(--i);
  53383. }
  53384. return hash >>> 0
  53385. }
  53386. function containsSlotChild (el) {
  53387. if (el.type === 1) {
  53388. if (el.tag === 'slot') {
  53389. return true
  53390. }
  53391. return el.children.some(containsSlotChild)
  53392. }
  53393. return false
  53394. }
  53395. function genScopedSlot (
  53396. el,
  53397. state
  53398. ) {
  53399. var isLegacySyntax = el.attrsMap['slot-scope'];
  53400. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  53401. return genIf(el, state, genScopedSlot, "null")
  53402. }
  53403. if (el.for && !el.forProcessed) {
  53404. return genFor(el, state, genScopedSlot)
  53405. }
  53406. var slotScope = el.slotScope === emptySlotScopeToken
  53407. ? ""
  53408. : String(el.slotScope);
  53409. var fn = "function(" + slotScope + "){" +
  53410. "return " + (el.tag === 'template'
  53411. ? el.if && isLegacySyntax
  53412. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  53413. : genChildren(el, state) || 'undefined'
  53414. : genElement(el, state)) + "}";
  53415. // reverse proxy v-slot without scope on this.$slots
  53416. var reverseProxy = slotScope ? "" : ",proxy:true";
  53417. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  53418. }
  53419. function genChildren (
  53420. el,
  53421. state,
  53422. checkSkip,
  53423. altGenElement,
  53424. altGenNode
  53425. ) {
  53426. var children = el.children;
  53427. if (children.length) {
  53428. var el$1 = children[0];
  53429. // optimize single v-for
  53430. if (children.length === 1 &&
  53431. el$1.for &&
  53432. el$1.tag !== 'template' &&
  53433. el$1.tag !== 'slot'
  53434. ) {
  53435. var normalizationType = checkSkip
  53436. ? state.maybeComponent(el$1) ? ",1" : ",0"
  53437. : "";
  53438. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  53439. }
  53440. var normalizationType$1 = checkSkip
  53441. ? getNormalizationType(children, state.maybeComponent)
  53442. : 0;
  53443. var gen = altGenNode || genNode;
  53444. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  53445. }
  53446. }
  53447. // determine the normalization needed for the children array.
  53448. // 0: no normalization needed
  53449. // 1: simple normalization needed (possible 1-level deep nested array)
  53450. // 2: full normalization needed
  53451. function getNormalizationType (
  53452. children,
  53453. maybeComponent
  53454. ) {
  53455. var res = 0;
  53456. for (var i = 0; i < children.length; i++) {
  53457. var el = children[i];
  53458. if (el.type !== 1) {
  53459. continue
  53460. }
  53461. if (needsNormalization(el) ||
  53462. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  53463. res = 2;
  53464. break
  53465. }
  53466. if (maybeComponent(el) ||
  53467. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  53468. res = 1;
  53469. }
  53470. }
  53471. return res
  53472. }
  53473. function needsNormalization (el) {
  53474. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  53475. }
  53476. function genNode (node, state) {
  53477. if (node.type === 1) {
  53478. return genElement(node, state)
  53479. } else if (node.type === 3 && node.isComment) {
  53480. return genComment(node)
  53481. } else {
  53482. return genText(node)
  53483. }
  53484. }
  53485. function genText (text) {
  53486. return ("_v(" + (text.type === 2
  53487. ? text.expression // no need for () because already wrapped in _s()
  53488. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  53489. }
  53490. function genComment (comment) {
  53491. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  53492. }
  53493. function genSlot (el, state) {
  53494. var slotName = el.slotName || '"default"';
  53495. var children = genChildren(el, state);
  53496. var res = "_t(" + slotName + (children ? ("," + children) : '');
  53497. var attrs = el.attrs || el.dynamicAttrs
  53498. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  53499. // slot props are camelized
  53500. name: camelize(attr.name),
  53501. value: attr.value,
  53502. dynamic: attr.dynamic
  53503. }); }))
  53504. : null;
  53505. var bind$$1 = el.attrsMap['v-bind'];
  53506. if ((attrs || bind$$1) && !children) {
  53507. res += ",null";
  53508. }
  53509. if (attrs) {
  53510. res += "," + attrs;
  53511. }
  53512. if (bind$$1) {
  53513. res += (attrs ? '' : ',null') + "," + bind$$1;
  53514. }
  53515. return res + ')'
  53516. }
  53517. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  53518. function genComponent (
  53519. componentName,
  53520. el,
  53521. state
  53522. ) {
  53523. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53524. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  53525. }
  53526. function genProps (props) {
  53527. var staticProps = "";
  53528. var dynamicProps = "";
  53529. for (var i = 0; i < props.length; i++) {
  53530. var prop = props[i];
  53531. var value = transformSpecialNewlines(prop.value);
  53532. if (prop.dynamic) {
  53533. dynamicProps += (prop.name) + "," + value + ",";
  53534. } else {
  53535. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  53536. }
  53537. }
  53538. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  53539. if (dynamicProps) {
  53540. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  53541. } else {
  53542. return staticProps
  53543. }
  53544. }
  53545. // #3895, #4268
  53546. function transformSpecialNewlines (text) {
  53547. return text
  53548. .replace(/\u2028/g, '\\u2028')
  53549. .replace(/\u2029/g, '\\u2029')
  53550. }
  53551. /* */
  53552. // these keywords should not appear inside expressions, but operators like
  53553. // typeof, instanceof and in are allowed
  53554. var prohibitedKeywordRE = new RegExp('\\b' + (
  53555. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  53556. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  53557. 'extends,finally,continue,debugger,function,arguments'
  53558. ).split(',').join('\\b|\\b') + '\\b');
  53559. // these unary operators should not be used as property/method names
  53560. var unaryOperatorsRE = new RegExp('\\b' + (
  53561. 'delete,typeof,void'
  53562. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  53563. // strip strings in expressions
  53564. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  53565. // detect problematic expressions in a template
  53566. function detectErrors (ast, warn) {
  53567. if (ast) {
  53568. checkNode(ast, warn);
  53569. }
  53570. }
  53571. function checkNode (node, warn) {
  53572. if (node.type === 1) {
  53573. for (var name in node.attrsMap) {
  53574. if (dirRE.test(name)) {
  53575. var value = node.attrsMap[name];
  53576. if (value) {
  53577. var range = node.rawAttrsMap[name];
  53578. if (name === 'v-for') {
  53579. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  53580. } else if (name === 'v-slot' || name[0] === '#') {
  53581. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  53582. } else if (onRE.test(name)) {
  53583. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  53584. } else {
  53585. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  53586. }
  53587. }
  53588. }
  53589. }
  53590. if (node.children) {
  53591. for (var i = 0; i < node.children.length; i++) {
  53592. checkNode(node.children[i], warn);
  53593. }
  53594. }
  53595. } else if (node.type === 2) {
  53596. checkExpression(node.expression, node.text, warn, node);
  53597. }
  53598. }
  53599. function checkEvent (exp, text, warn, range) {
  53600. var stripped = exp.replace(stripStringRE, '');
  53601. var keywordMatch = stripped.match(unaryOperatorsRE);
  53602. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  53603. warn(
  53604. "avoid using JavaScript unary operator as property name: " +
  53605. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  53606. range
  53607. );
  53608. }
  53609. checkExpression(exp, text, warn, range);
  53610. }
  53611. function checkFor (node, text, warn, range) {
  53612. checkExpression(node.for || '', text, warn, range);
  53613. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  53614. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  53615. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  53616. }
  53617. function checkIdentifier (
  53618. ident,
  53619. type,
  53620. text,
  53621. warn,
  53622. range
  53623. ) {
  53624. if (typeof ident === 'string') {
  53625. try {
  53626. new Function(("var " + ident + "=_"));
  53627. } catch (e) {
  53628. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  53629. }
  53630. }
  53631. }
  53632. function checkExpression (exp, text, warn, range) {
  53633. try {
  53634. new Function(("return " + exp));
  53635. } catch (e) {
  53636. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  53637. if (keywordMatch) {
  53638. warn(
  53639. "avoid using JavaScript keyword as property name: " +
  53640. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  53641. range
  53642. );
  53643. } else {
  53644. warn(
  53645. "invalid expression: " + (e.message) + " in\n\n" +
  53646. " " + exp + "\n\n" +
  53647. " Raw expression: " + (text.trim()) + "\n",
  53648. range
  53649. );
  53650. }
  53651. }
  53652. }
  53653. function checkFunctionParameterExpression (exp, text, warn, range) {
  53654. try {
  53655. new Function(exp, '');
  53656. } catch (e) {
  53657. warn(
  53658. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  53659. " " + exp + "\n\n" +
  53660. " Raw expression: " + (text.trim()) + "\n",
  53661. range
  53662. );
  53663. }
  53664. }
  53665. /* */
  53666. var range = 2;
  53667. function generateCodeFrame (
  53668. source,
  53669. start,
  53670. end
  53671. ) {
  53672. if ( start === void 0 ) start = 0;
  53673. if ( end === void 0 ) end = source.length;
  53674. var lines = source.split(/\r?\n/);
  53675. var count = 0;
  53676. var res = [];
  53677. for (var i = 0; i < lines.length; i++) {
  53678. count += lines[i].length + 1;
  53679. if (count >= start) {
  53680. for (var j = i - range; j <= i + range || end > count; j++) {
  53681. if (j < 0 || j >= lines.length) { continue }
  53682. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  53683. var lineLength = lines[j].length;
  53684. if (j === i) {
  53685. // push underline
  53686. var pad = start - (count - lineLength) + 1;
  53687. var length = end > count ? lineLength - pad : end - start;
  53688. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  53689. } else if (j > i) {
  53690. if (end > count) {
  53691. var length$1 = Math.min(end - count, lineLength);
  53692. res.push(" | " + repeat$1("^", length$1));
  53693. }
  53694. count += lineLength + 1;
  53695. }
  53696. }
  53697. break
  53698. }
  53699. }
  53700. return res.join('\n')
  53701. }
  53702. function repeat$1 (str, n) {
  53703. var result = '';
  53704. if (n > 0) {
  53705. while (true) { // eslint-disable-line
  53706. if (n & 1) { result += str; }
  53707. n >>>= 1;
  53708. if (n <= 0) { break }
  53709. str += str;
  53710. }
  53711. }
  53712. return result
  53713. }
  53714. /* */
  53715. function createFunction (code, errors) {
  53716. try {
  53717. return new Function(code)
  53718. } catch (err) {
  53719. errors.push({ err: err, code: code });
  53720. return noop
  53721. }
  53722. }
  53723. function createCompileToFunctionFn (compile) {
  53724. var cache = Object.create(null);
  53725. return function compileToFunctions (
  53726. template,
  53727. options,
  53728. vm
  53729. ) {
  53730. options = extend({}, options);
  53731. var warn$$1 = options.warn || warn;
  53732. delete options.warn;
  53733. /* istanbul ignore if */
  53734. {
  53735. // detect possible CSP restriction
  53736. try {
  53737. new Function('return 1');
  53738. } catch (e) {
  53739. if (e.toString().match(/unsafe-eval|CSP/)) {
  53740. warn$$1(
  53741. 'It seems you are using the standalone build of Vue.js in an ' +
  53742. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  53743. 'The template compiler cannot work in this environment. Consider ' +
  53744. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  53745. 'templates into render functions.'
  53746. );
  53747. }
  53748. }
  53749. }
  53750. // check cache
  53751. var key = options.delimiters
  53752. ? String(options.delimiters) + template
  53753. : template;
  53754. if (cache[key]) {
  53755. return cache[key]
  53756. }
  53757. // compile
  53758. var compiled = compile(template, options);
  53759. // check compilation errors/tips
  53760. {
  53761. if (compiled.errors && compiled.errors.length) {
  53762. if (options.outputSourceRange) {
  53763. compiled.errors.forEach(function (e) {
  53764. warn$$1(
  53765. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  53766. generateCodeFrame(template, e.start, e.end),
  53767. vm
  53768. );
  53769. });
  53770. } else {
  53771. warn$$1(
  53772. "Error compiling template:\n\n" + template + "\n\n" +
  53773. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  53774. vm
  53775. );
  53776. }
  53777. }
  53778. if (compiled.tips && compiled.tips.length) {
  53779. if (options.outputSourceRange) {
  53780. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  53781. } else {
  53782. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  53783. }
  53784. }
  53785. }
  53786. // turn code into functions
  53787. var res = {};
  53788. var fnGenErrors = [];
  53789. res.render = createFunction(compiled.render, fnGenErrors);
  53790. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  53791. return createFunction(code, fnGenErrors)
  53792. });
  53793. // check function generation errors.
  53794. // this should only happen if there is a bug in the compiler itself.
  53795. // mostly for codegen development use
  53796. /* istanbul ignore if */
  53797. {
  53798. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  53799. warn$$1(
  53800. "Failed to generate render function:\n\n" +
  53801. fnGenErrors.map(function (ref) {
  53802. var err = ref.err;
  53803. var code = ref.code;
  53804. return ((err.toString()) + " in\n\n" + code + "\n");
  53805. }).join('\n'),
  53806. vm
  53807. );
  53808. }
  53809. }
  53810. return (cache[key] = res)
  53811. }
  53812. }
  53813. /* */
  53814. function createCompilerCreator (baseCompile) {
  53815. return function createCompiler (baseOptions) {
  53816. function compile (
  53817. template,
  53818. options
  53819. ) {
  53820. var finalOptions = Object.create(baseOptions);
  53821. var errors = [];
  53822. var tips = [];
  53823. var warn = function (msg, range, tip) {
  53824. (tip ? tips : errors).push(msg);
  53825. };
  53826. if (options) {
  53827. if (options.outputSourceRange) {
  53828. // $flow-disable-line
  53829. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  53830. warn = function (msg, range, tip) {
  53831. var data = { msg: msg };
  53832. if (range) {
  53833. if (range.start != null) {
  53834. data.start = range.start + leadingSpaceLength;
  53835. }
  53836. if (range.end != null) {
  53837. data.end = range.end + leadingSpaceLength;
  53838. }
  53839. }
  53840. (tip ? tips : errors).push(data);
  53841. };
  53842. }
  53843. // merge custom modules
  53844. if (options.modules) {
  53845. finalOptions.modules =
  53846. (baseOptions.modules || []).concat(options.modules);
  53847. }
  53848. // merge custom directives
  53849. if (options.directives) {
  53850. finalOptions.directives = extend(
  53851. Object.create(baseOptions.directives || null),
  53852. options.directives
  53853. );
  53854. }
  53855. // copy other options
  53856. for (var key in options) {
  53857. if (key !== 'modules' && key !== 'directives') {
  53858. finalOptions[key] = options[key];
  53859. }
  53860. }
  53861. }
  53862. finalOptions.warn = warn;
  53863. var compiled = baseCompile(template.trim(), finalOptions);
  53864. {
  53865. detectErrors(compiled.ast, warn);
  53866. }
  53867. compiled.errors = errors;
  53868. compiled.tips = tips;
  53869. return compiled
  53870. }
  53871. return {
  53872. compile: compile,
  53873. compileToFunctions: createCompileToFunctionFn(compile)
  53874. }
  53875. }
  53876. }
  53877. /* */
  53878. // `createCompilerCreator` allows creating compilers that use alternative
  53879. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  53880. // Here we just export a default compiler using the default parts.
  53881. var createCompiler = createCompilerCreator(function baseCompile (
  53882. template,
  53883. options
  53884. ) {
  53885. var ast = parse(template.trim(), options);
  53886. if (options.optimize !== false) {
  53887. optimize(ast, options);
  53888. }
  53889. var code = generate(ast, options);
  53890. return {
  53891. ast: ast,
  53892. render: code.render,
  53893. staticRenderFns: code.staticRenderFns
  53894. }
  53895. });
  53896. /* */
  53897. var ref$1 = createCompiler(baseOptions);
  53898. var compile = ref$1.compile;
  53899. var compileToFunctions = ref$1.compileToFunctions;
  53900. /* */
  53901. // check whether current browser encodes a char inside attribute values
  53902. var div;
  53903. function getShouldDecode (href) {
  53904. div = div || document.createElement('div');
  53905. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  53906. return div.innerHTML.indexOf('&#10;') > 0
  53907. }
  53908. // #3663: IE encodes newlines inside attribute values while other browsers don't
  53909. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  53910. // #6828: chrome encodes content in a[href]
  53911. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  53912. /* */
  53913. var idToTemplate = cached(function (id) {
  53914. var el = query(id);
  53915. return el && el.innerHTML
  53916. });
  53917. var mount = Vue.prototype.$mount;
  53918. Vue.prototype.$mount = function (
  53919. el,
  53920. hydrating
  53921. ) {
  53922. el = el && query(el);
  53923. /* istanbul ignore if */
  53924. if (el === document.body || el === document.documentElement) {
  53925. warn(
  53926. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  53927. );
  53928. return this
  53929. }
  53930. var options = this.$options;
  53931. // resolve template/el and convert to render function
  53932. if (!options.render) {
  53933. var template = options.template;
  53934. if (template) {
  53935. if (typeof template === 'string') {
  53936. if (template.charAt(0) === '#') {
  53937. template = idToTemplate(template);
  53938. /* istanbul ignore if */
  53939. if (!template) {
  53940. warn(
  53941. ("Template element not found or is empty: " + (options.template)),
  53942. this
  53943. );
  53944. }
  53945. }
  53946. } else if (template.nodeType) {
  53947. template = template.innerHTML;
  53948. } else {
  53949. {
  53950. warn('invalid template option:' + template, this);
  53951. }
  53952. return this
  53953. }
  53954. } else if (el) {
  53955. template = getOuterHTML(el);
  53956. }
  53957. if (template) {
  53958. /* istanbul ignore if */
  53959. if (config.performance && mark) {
  53960. mark('compile');
  53961. }
  53962. var ref = compileToFunctions(template, {
  53963. outputSourceRange: "development" !== 'production',
  53964. shouldDecodeNewlines: shouldDecodeNewlines,
  53965. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  53966. delimiters: options.delimiters,
  53967. comments: options.comments
  53968. }, this);
  53969. var render = ref.render;
  53970. var staticRenderFns = ref.staticRenderFns;
  53971. options.render = render;
  53972. options.staticRenderFns = staticRenderFns;
  53973. /* istanbul ignore if */
  53974. if (config.performance && mark) {
  53975. mark('compile end');
  53976. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  53977. }
  53978. }
  53979. }
  53980. return mount.call(this, el, hydrating)
  53981. };
  53982. /**
  53983. * Get outerHTML of elements, taking care
  53984. * of SVG elements in IE as well.
  53985. */
  53986. function getOuterHTML (el) {
  53987. if (el.outerHTML) {
  53988. return el.outerHTML
  53989. } else {
  53990. var container = document.createElement('div');
  53991. container.appendChild(el.cloneNode(true));
  53992. return container.innerHTML
  53993. }
  53994. }
  53995. Vue.compile = compileToFunctions;
  53996. module.exports = Vue;
  53997. /* 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))
  53998. /***/ }),
  53999. /***/ "./node_modules/vue/dist/vue.common.js":
  54000. /*!*********************************************!*\
  54001. !*** ./node_modules/vue/dist/vue.common.js ***!
  54002. \*********************************************/
  54003. /*! no static exports found */
  54004. /***/ (function(module, exports, __webpack_require__) {
  54005. if (false) {} else {
  54006. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  54007. }
  54008. /***/ }),
  54009. /***/ "./node_modules/webpack/buildin/global.js":
  54010. /*!***********************************!*\
  54011. !*** (webpack)/buildin/global.js ***!
  54012. \***********************************/
  54013. /*! no static exports found */
  54014. /***/ (function(module, exports) {
  54015. var g;
  54016. // This works in non-strict mode
  54017. g = (function() {
  54018. return this;
  54019. })();
  54020. try {
  54021. // This works if eval is allowed (see CSP)
  54022. g = g || new Function("return this")();
  54023. } catch (e) {
  54024. // This works if the window reference is available
  54025. if (typeof window === "object") g = window;
  54026. }
  54027. // g can still be undefined, but nothing to do about it...
  54028. // We return undefined, instead of nothing here, so it's
  54029. // easier to handle this case. if(!global) { ...}
  54030. module.exports = g;
  54031. /***/ }),
  54032. /***/ "./node_modules/webpack/buildin/module.js":
  54033. /*!***********************************!*\
  54034. !*** (webpack)/buildin/module.js ***!
  54035. \***********************************/
  54036. /*! no static exports found */
  54037. /***/ (function(module, exports) {
  54038. module.exports = function(module) {
  54039. if (!module.webpackPolyfill) {
  54040. module.deprecate = function() {};
  54041. module.paths = [];
  54042. // module.parent = undefined by default
  54043. if (!module.children) module.children = [];
  54044. Object.defineProperty(module, "loaded", {
  54045. enumerable: true,
  54046. get: function() {
  54047. return module.l;
  54048. }
  54049. });
  54050. Object.defineProperty(module, "id", {
  54051. enumerable: true,
  54052. get: function() {
  54053. return module.i;
  54054. }
  54055. });
  54056. module.webpackPolyfill = 1;
  54057. }
  54058. return module;
  54059. };
  54060. /***/ }),
  54061. /***/ "./resources/js/app.js":
  54062. /*!*****************************!*\
  54063. !*** ./resources/js/app.js ***!
  54064. \*****************************/
  54065. /*! no static exports found */
  54066. /***/ (function(module, exports, __webpack_require__) {
  54067. /**
  54068. * First we will load all of this project's JavaScript dependencies which
  54069. * includes Vue and other libraries. It is a great starting point when
  54070. * building robust, powerful web applications using Vue and Laravel.
  54071. */
  54072. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  54073. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  54074. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  54075. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  54076. /**
  54077. * The following block of code may be used to automatically register your
  54078. * Vue components. It will recursively scan this directory for the Vue
  54079. * components and automatically register them with their "basename".
  54080. *
  54081. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  54082. */
  54083. // const files = require.context('./', true, /\.vue$/i)
  54084. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  54085. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  54086. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  54087. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  54088. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  54089. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  54090. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  54091. /**
  54092. * Next, we will create a fresh Vue application instance and attach it to
  54093. * the page. Then, you may begin adding components to this application
  54094. * or customize the JavaScript scaffolding to fit your unique needs.
  54095. */
  54096. var app = new Vue({
  54097. el: '#app'
  54098. });
  54099. $(function () {
  54100. $('[data-toggle="tooltip"]').tooltip();
  54101. });
  54102. var clipboard = new Clipboard('.btn-clip');
  54103. clipboard.on('success', function (e) {
  54104. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  54105. position: "right",
  54106. className: 'success'
  54107. });
  54108. e.clearSelection();
  54109. });
  54110. /***/ }),
  54111. /***/ "./resources/js/bootstrap.js":
  54112. /*!***********************************!*\
  54113. !*** ./resources/js/bootstrap.js ***!
  54114. \***********************************/
  54115. /*! no exports provided */
  54116. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54117. "use strict";
  54118. __webpack_require__.r(__webpack_exports__);
  54119. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  54120. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  54121. /**
  54122. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  54123. * for JavaScript based Bootstrap features such as modals and tabs. This
  54124. * code may be modified to fit the specific needs of your application.
  54125. */
  54126. try {
  54127. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  54128. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  54129. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  54130. } catch (e) {}
  54131. /**
  54132. * We'll load the axios HTTP library which allows us to easily issue requests
  54133. * to our Laravel back-end. This library automatically handles sending the
  54134. * CSRF token as a header based on the value of the "XSRF" token cookie.
  54135. */
  54136. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  54137. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  54138. /**
  54139. * Echo exposes an expressive API for subscribing to channels and listening
  54140. * for events that are broadcast by Laravel. Echo and event broadcasting
  54141. * allows your team to easily build robust real-time web applications.
  54142. */
  54143. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  54144. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  54145. broadcaster: 'pusher',
  54146. key: "upccrt",
  54147. wsHost: window.location.hostname,
  54148. wsPort: 6001,
  54149. disableStats: true
  54150. });
  54151. /***/ }),
  54152. /***/ "./resources/js/components/ExampleComponent.vue":
  54153. /*!******************************************************!*\
  54154. !*** ./resources/js/components/ExampleComponent.vue ***!
  54155. \******************************************************/
  54156. /*! exports provided: default */
  54157. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54158. "use strict";
  54159. __webpack_require__.r(__webpack_exports__);
  54160. /* harmony import */ var _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  54161. /* harmony import */ var _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=script&lang=js& */ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  54162. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  54163. /* normalize component */
  54164. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54165. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54166. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  54167. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54168. false,
  54169. null,
  54170. null,
  54171. null
  54172. )
  54173. /* hot reload */
  54174. if (false) { var api; }
  54175. component.options.__file = "resources/js/components/ExampleComponent.vue"
  54176. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54177. /***/ }),
  54178. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  54179. /*!*******************************************************************************!*\
  54180. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  54181. \*******************************************************************************/
  54182. /*! exports provided: default */
  54183. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54184. "use strict";
  54185. __webpack_require__.r(__webpack_exports__);
  54186. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  54187. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  54188. /***/ }),
  54189. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  54190. /*!*************************************************************************************!*\
  54191. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  54192. \*************************************************************************************/
  54193. /*! exports provided: render, staticRenderFns */
  54194. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54195. "use strict";
  54196. __webpack_require__.r(__webpack_exports__);
  54197. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  54198. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  54199. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  54200. /***/ }),
  54201. /***/ "./resources/js/components/assetinfo.vue":
  54202. /*!***********************************************!*\
  54203. !*** ./resources/js/components/assetinfo.vue ***!
  54204. \***********************************************/
  54205. /*! exports provided: default */
  54206. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54207. "use strict";
  54208. __webpack_require__.r(__webpack_exports__);
  54209. /* harmony import */ var _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  54210. /* harmony import */ var _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assetinfo.vue?vue&type=script&lang=js& */ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&");
  54211. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  54212. /* normalize component */
  54213. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54214. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54215. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  54216. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54217. false,
  54218. null,
  54219. null,
  54220. null
  54221. )
  54222. /* hot reload */
  54223. if (false) { var api; }
  54224. component.options.__file = "resources/js/components/assetinfo.vue"
  54225. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54226. /***/ }),
  54227. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  54228. /*!************************************************************************!*\
  54229. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  54230. \************************************************************************/
  54231. /*! exports provided: default */
  54232. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54233. "use strict";
  54234. __webpack_require__.r(__webpack_exports__);
  54235. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./assetinfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&");
  54236. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  54237. /***/ }),
  54238. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  54239. /*!******************************************************************************!*\
  54240. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  54241. \******************************************************************************/
  54242. /*! exports provided: render, staticRenderFns */
  54243. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54244. "use strict";
  54245. __webpack_require__.r(__webpack_exports__);
  54246. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  54247. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  54248. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  54249. /***/ }),
  54250. /***/ "./resources/js/components/credential.vue":
  54251. /*!************************************************!*\
  54252. !*** ./resources/js/components/credential.vue ***!
  54253. \************************************************/
  54254. /*! exports provided: default */
  54255. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54256. "use strict";
  54257. __webpack_require__.r(__webpack_exports__);
  54258. /* harmony import */ var _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential.vue?vue&type=template&id=0f5cc562& */ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  54259. /* harmony import */ var _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential.vue?vue&type=script&lang=js& */ "./resources/js/components/credential.vue?vue&type=script&lang=js&");
  54260. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  54261. /* normalize component */
  54262. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54263. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54264. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  54265. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54266. false,
  54267. null,
  54268. null,
  54269. null
  54270. )
  54271. /* hot reload */
  54272. if (false) { var api; }
  54273. component.options.__file = "resources/js/components/credential.vue"
  54274. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54275. /***/ }),
  54276. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  54277. /*!*************************************************************************!*\
  54278. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  54279. \*************************************************************************/
  54280. /*! exports provided: default */
  54281. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54282. "use strict";
  54283. __webpack_require__.r(__webpack_exports__);
  54284. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&");
  54285. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  54286. /***/ }),
  54287. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  54288. /*!*******************************************************************************!*\
  54289. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  54290. \*******************************************************************************/
  54291. /*! exports provided: render, staticRenderFns */
  54292. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54293. "use strict";
  54294. __webpack_require__.r(__webpack_exports__);
  54295. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential.vue?vue&type=template&id=0f5cc562& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  54296. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  54297. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  54298. /***/ }),
  54299. /***/ "./resources/js/components/modal.vue":
  54300. /*!*******************************************!*\
  54301. !*** ./resources/js/components/modal.vue ***!
  54302. \*******************************************/
  54303. /*! exports provided: default */
  54304. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54305. "use strict";
  54306. __webpack_require__.r(__webpack_exports__);
  54307. /* harmony import */ var _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal.vue?vue&type=template&id=478d961c& */ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  54308. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  54309. var script = {}
  54310. /* normalize component */
  54311. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  54312. script,
  54313. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  54314. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54315. false,
  54316. null,
  54317. null,
  54318. null
  54319. )
  54320. /* hot reload */
  54321. if (false) { var api; }
  54322. component.options.__file = "resources/js/components/modal.vue"
  54323. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54324. /***/ }),
  54325. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  54326. /*!**************************************************************************!*\
  54327. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  54328. \**************************************************************************/
  54329. /*! exports provided: render, staticRenderFns */
  54330. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54331. "use strict";
  54332. __webpack_require__.r(__webpack_exports__);
  54333. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./modal.vue?vue&type=template&id=478d961c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  54334. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  54335. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  54336. /***/ }),
  54337. /***/ "./resources/js/components/notes.vue":
  54338. /*!*******************************************!*\
  54339. !*** ./resources/js/components/notes.vue ***!
  54340. \*******************************************/
  54341. /*! exports provided: default */
  54342. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54343. "use strict";
  54344. __webpack_require__.r(__webpack_exports__);
  54345. /* harmony import */ var _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./notes.vue?vue&type=template&id=73d141f4& */ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  54346. /* harmony import */ var _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./notes.vue?vue&type=script&lang=js& */ "./resources/js/components/notes.vue?vue&type=script&lang=js&");
  54347. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  54348. /* normalize component */
  54349. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54350. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54351. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  54352. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54353. false,
  54354. null,
  54355. null,
  54356. null
  54357. )
  54358. /* hot reload */
  54359. if (false) { var api; }
  54360. component.options.__file = "resources/js/components/notes.vue"
  54361. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54362. /***/ }),
  54363. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  54364. /*!********************************************************************!*\
  54365. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  54366. \********************************************************************/
  54367. /*! exports provided: default */
  54368. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54369. "use strict";
  54370. __webpack_require__.r(__webpack_exports__);
  54371. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./notes.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&");
  54372. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  54373. /***/ }),
  54374. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  54375. /*!**************************************************************************!*\
  54376. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  54377. \**************************************************************************/
  54378. /*! exports provided: render, staticRenderFns */
  54379. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54380. "use strict";
  54381. __webpack_require__.r(__webpack_exports__);
  54382. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./notes.vue?vue&type=template&id=73d141f4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  54383. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  54384. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  54385. /***/ }),
  54386. /***/ "./resources/js/components/woinfo.vue":
  54387. /*!********************************************!*\
  54388. !*** ./resources/js/components/woinfo.vue ***!
  54389. \********************************************/
  54390. /*! exports provided: default */
  54391. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54392. "use strict";
  54393. __webpack_require__.r(__webpack_exports__);
  54394. /* harmony import */ var _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo.vue?vue&type=template&id=33ce32de& */ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  54395. /* harmony import */ var _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  54396. /* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  54397. /* normalize component */
  54398. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54399. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54400. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  54401. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54402. false,
  54403. null,
  54404. null,
  54405. null
  54406. )
  54407. /* hot reload */
  54408. if (false) { var api; }
  54409. component.options.__file = "resources/js/components/woinfo.vue"
  54410. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54411. /***/ }),
  54412. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  54413. /*!*********************************************************************!*\
  54414. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  54415. \*********************************************************************/
  54416. /*! exports provided: default */
  54417. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54418. "use strict";
  54419. __webpack_require__.r(__webpack_exports__);
  54420. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  54421. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  54422. /***/ }),
  54423. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  54424. /*!***************************************************************************!*\
  54425. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  54426. \***************************************************************************/
  54427. /*! exports provided: render, staticRenderFns */
  54428. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54429. "use strict";
  54430. __webpack_require__.r(__webpack_exports__);
  54431. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./woinfo.vue?vue&type=template&id=33ce32de& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  54432. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  54433. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  54434. /***/ }),
  54435. /***/ "./resources/js/mixins/dateMixin.js":
  54436. /*!******************************************!*\
  54437. !*** ./resources/js/mixins/dateMixin.js ***!
  54438. \******************************************/
  54439. /*! exports provided: default */
  54440. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54441. "use strict";
  54442. __webpack_require__.r(__webpack_exports__);
  54443. /* harmony default export */ __webpack_exports__["default"] = ({
  54444. methods: {
  54445. treatAsUTC: function treatAsUTC(date) {
  54446. var result = new Date(date);
  54447. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  54448. return result;
  54449. },
  54450. daysSinceToday: function daysSinceToday(date) {
  54451. var currentDate = new Date();
  54452. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  54453. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  54454. },
  54455. getHRDate: function getHRDate(dateString) {
  54456. var date = new Date(dateString);
  54457. return date.toLocaleString('default', {
  54458. month: 'short',
  54459. day: 'numeric',
  54460. year: 'numeric',
  54461. hour: 'numeric',
  54462. minute: 'numeric'
  54463. });
  54464. },
  54465. isZero: function isZero(dateString) {
  54466. return dateString === '0000-00-00 00:00:00';
  54467. }
  54468. }
  54469. });
  54470. /***/ }),
  54471. /***/ "./resources/js/notify.min.js":
  54472. /*!************************************!*\
  54473. !*** ./resources/js/notify.min.js ***!
  54474. \************************************/
  54475. /*! no static exports found */
  54476. /***/ (function(module, exports, __webpack_require__) {
  54477. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  54478. (function (e) {
  54479. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  54480. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  54481. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  54482. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  54483. })(function (e) {
  54484. function A(t, n, i) {
  54485. typeof i == "string" && (i = {
  54486. className: i
  54487. }), this.options = E(w, e.isPlainObject(i) ? i : {}), this.loadHTML(), this.wrapper = e(h.html), this.options.clickToHide && this.wrapper.addClass(r + "-hidable"), this.wrapper.data(r, this), this.arrow = this.wrapper.find("." + r + "-arrow"), this.container = this.wrapper.find("." + r + "-container"), this.container.append(this.userContainer), t && t.length && (this.elementType = t.attr("type"), this.originalElement = t, this.elem = N(t), this.elem.data(r, this), this.elem.before(this.wrapper)), this.container.hide(), this.run(n);
  54488. }
  54489. var t = [].indexOf || function (e) {
  54490. for (var t = 0, n = this.length; t < n; t++) {
  54491. if (t in this && this[t] === e) return t;
  54492. }
  54493. return -1;
  54494. },
  54495. n = "notify",
  54496. r = n + "js",
  54497. i = n + "!blank",
  54498. s = {
  54499. t: "top",
  54500. m: "middle",
  54501. b: "bottom",
  54502. l: "left",
  54503. c: "center",
  54504. r: "right"
  54505. },
  54506. o = ["l", "c", "r"],
  54507. u = ["t", "m", "b"],
  54508. a = ["t", "b", "l", "r"],
  54509. f = {
  54510. t: "b",
  54511. m: null,
  54512. b: "t",
  54513. l: "r",
  54514. c: null,
  54515. r: "l"
  54516. },
  54517. l = function l(t) {
  54518. var n;
  54519. return n = [], e.each(t.split(/\W+/), function (e, t) {
  54520. var r;
  54521. r = t.toLowerCase().charAt(0);
  54522. if (s[r]) return n.push(r);
  54523. }), n;
  54524. },
  54525. c = {},
  54526. h = {
  54527. name: "core",
  54528. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  54529. css: "." + r + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + r + "-corner ." + r + "-wrapper,\n." + r + "-corner ." + r + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n." + r + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + r + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n}\n\n." + r + "-hidable {\n cursor: pointer;\n}\n\n[data-notify-text],[data-notify-html] {\n position: relative;\n}\n\n." + r + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
  54530. },
  54531. p = {
  54532. "border-radius": ["-webkit-", "-moz-"]
  54533. },
  54534. d = function d(e) {
  54535. return c[e];
  54536. },
  54537. v = function v(e) {
  54538. if (!e) throw "Missing Style name";
  54539. c[e] && delete c[e];
  54540. },
  54541. m = function m(t, i) {
  54542. if (!t) throw "Missing Style name";
  54543. if (!i) throw "Missing Style definition";
  54544. if (!i.html) throw "Missing Style HTML";
  54545. var s = c[t];
  54546. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  54547. var o = "";
  54548. i.classes && e.each(i.classes, function (t, n) {
  54549. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  54550. return p[t] && e.each(p[t], function (e, r) {
  54551. return o += " " + r + t + ": " + n + ";\n";
  54552. }), o += " " + t + ": " + n + ";\n";
  54553. }), o += "}\n";
  54554. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  54555. var u = {},
  54556. a = e(i.html);
  54557. y("html", a, u), y("text", a, u), i.fields = u;
  54558. },
  54559. g = function g(t) {
  54560. var n, r, i;
  54561. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  54562. try {
  54563. r.html(t);
  54564. } catch (s) {
  54565. r[0].styleSheet.cssText = t;
  54566. }
  54567. return r;
  54568. },
  54569. y = function y(t, n, r) {
  54570. var s;
  54571. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  54572. var n;
  54573. n = e(this).attr(s), n || (n = i), r[n] = t;
  54574. });
  54575. },
  54576. b = function b(e, t) {
  54577. return e.is(t) ? e : e.find(t);
  54578. },
  54579. w = {
  54580. clickToHide: !0,
  54581. autoHide: !0,
  54582. autoHideDelay: 5e3,
  54583. arrowShow: !0,
  54584. arrowSize: 5,
  54585. breakNewLines: !0,
  54586. elementPosition: "bottom",
  54587. globalPosition: "top right",
  54588. style: "bootstrap",
  54589. className: "error",
  54590. showAnimation: "slideDown",
  54591. showDuration: 400,
  54592. hideAnimation: "slideUp",
  54593. hideDuration: 200,
  54594. gap: 5
  54595. },
  54596. E = function E(t, n) {
  54597. var r;
  54598. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  54599. },
  54600. S = function S(t) {
  54601. return e.extend(w, t);
  54602. },
  54603. x = function x(t) {
  54604. return e("<" + t + "></" + t + ">");
  54605. },
  54606. T = {},
  54607. N = function N(t) {
  54608. var n;
  54609. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  54610. return e(r).attr("name") === t.attr("name");
  54611. }), t = n.first()), t;
  54612. },
  54613. C = function C(e, t, n) {
  54614. var r, i;
  54615. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  54616. if (isNaN(n)) return;
  54617. return r = s[f[t.charAt(0)]], i = t, e[r] !== undefined && (t = s[r.charAt(0)], n = -n), e[t] === undefined ? e[t] = n : e[t] += n, null;
  54618. },
  54619. k = function k(e, t, n) {
  54620. if (e === "l" || e === "t") return 0;
  54621. if (e === "c" || e === "m") return n / 2 - t / 2;
  54622. if (e === "r" || e === "b") return n - t;
  54623. throw "Invalid alignment";
  54624. },
  54625. L = function L(e) {
  54626. return L.e = L.e || x("div"), L.e.text(e).html();
  54627. };
  54628. A.prototype.loadHTML = function () {
  54629. var t;
  54630. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  54631. }, A.prototype.show = function (e, t) {
  54632. var n, r, i, s, o;
  54633. r = function (n) {
  54634. return function () {
  54635. !e && !n.elem && n.destroy();
  54636. if (t) return t();
  54637. };
  54638. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  54639. if (o && e) s = "show";else if (o && !e) s = "hide";else if (!o && e) s = this.options.showAnimation, n.push(this.options.showDuration);else {
  54640. if (!!o || !!e) return r();
  54641. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  54642. }
  54643. return n.push(r), i[s].apply(i, n);
  54644. }, A.prototype.setGlobalPosition = function () {
  54645. var t = this.getPosition(),
  54646. n = t[0],
  54647. i = t[1],
  54648. o = s[n],
  54649. u = s[i],
  54650. a = n + "|" + i,
  54651. f = T[a];
  54652. if (!f || !document.body.contains(f[0])) {
  54653. f = T[a] = x("div");
  54654. var l = {};
  54655. l[o] = 0, u === "middle" ? l.top = "45%" : u === "center" ? l.left = "45%" : l[u] = 0, f.css(l).addClass(r + "-corner"), e("body").append(f);
  54656. }
  54657. return f.prepend(this.wrapper);
  54658. }, A.prototype.setElementPosition = function () {
  54659. var n, r, i, l, c, h, p, d, v, m, g, y, b, w, E, S, x, T, N, L, A, O, M, _, D, P, H, B, j;
  54660. H = this.getPosition(), _ = H[0], O = H[1], M = H[2], g = this.elem.position(), d = this.elem.outerHeight(), y = this.elem.outerWidth(), v = this.elem.innerHeight(), m = this.elem.innerWidth(), j = this.wrapper.position(), c = this.container.height(), h = this.container.width(), T = s[_], L = f[_], A = s[L], p = {}, p[A] = _ === "b" ? d : _ === "r" ? y : 0, C(p, "top", g.top - j.top), C(p, "left", g.left - j.left), B = ["top", "left"];
  54661. for (w = 0, S = B.length; w < S; w++) {
  54662. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  54663. }
  54664. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  54665. if (!this.options.arrowShow) this.arrow.hide();else {
  54666. i = this.options.arrowSize, r = e.extend({}, p), n = this.userContainer.css("border-color") || this.userContainer.css("border-top-color") || this.userContainer.css("background-color") || "white";
  54667. for (E = 0, x = a.length; E < x; E++) {
  54668. D = a[E], P = s[D];
  54669. if (D === L) continue;
  54670. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  54671. }
  54672. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  54673. }
  54674. t.call(u, _) >= 0 ? (C(p, "left", k(O, h, y)), r && C(r, "left", k(O, i, m))) : t.call(o, _) >= 0 && (C(p, "top", k(O, c, d)), r && C(r, "top", k(O, i, v))), this.container.is(":visible") && (p.display = "block"), this.container.removeAttr("style").css(p);
  54675. if (r) return this.arrow.removeAttr("style").css(r);
  54676. }, A.prototype.getPosition = function () {
  54677. var e, n, r, i, s, f, c, h;
  54678. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  54679. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  54680. if (e.length === 1 || (r = e[0], t.call(u, r) >= 0) && (i = e[1], t.call(o, i) < 0) || (s = e[0], t.call(o, s) >= 0) && (f = e[1], t.call(u, f) < 0)) e[1] = (c = e[0], t.call(o, c) >= 0) ? "m" : "l";
  54681. return e.length === 2 && (e[2] = e[1]), e;
  54682. }, A.prototype.getStyle = function (e) {
  54683. var t;
  54684. e || (e = this.options.style), e || (e = "default"), t = c[e];
  54685. if (!t) throw "Missing style: " + e;
  54686. return t;
  54687. }, A.prototype.updateClasses = function () {
  54688. var t, n;
  54689. return t = ["base"], e.isArray(this.options.className) ? t = t.concat(this.options.className) : this.options.className && t.push(this.options.className), n = this.getStyle(), t = e.map(t, function (e) {
  54690. return r + "-" + n.name + "-" + e;
  54691. }).join(" "), this.userContainer.attr("class", t);
  54692. }, A.prototype.run = function (t, n) {
  54693. var r, s, o, u, a;
  54694. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  54695. if (this.container && !t) {
  54696. this.show(!1);
  54697. return;
  54698. }
  54699. if (!this.container && !t) return;
  54700. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  54701. for (o in s) {
  54702. r = s[o], u = this.userFields[o];
  54703. if (!u) continue;
  54704. u === "text" && (r = L(r), this.options.breakNewLines && (r = r.replace(/\n/g, "<br/>"))), a = o === i ? "" : "=" + o, b(this.userContainer, "[data-notify-" + u + a + "]").html(r);
  54705. }
  54706. this.updateClasses(), this.elem ? this.setElementPosition() : this.setGlobalPosition(), this.show(!0), this.options.autoHide && (clearTimeout(this.autohideTimer), this.autohideTimer = setTimeout(this.show.bind(this, !1), this.options.autoHideDelay));
  54707. }, A.prototype.destroy = function () {
  54708. this.wrapper.data(r, null), this.wrapper.remove();
  54709. }, e[n] = function (t, r, i) {
  54710. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  54711. }, e.fn[n] = function (t, n) {
  54712. return e(this).each(function () {
  54713. var i = N(e(this)).data(r);
  54714. i && i.destroy();
  54715. var s = new A(e(this), t, n);
  54716. }), this;
  54717. }, e.extend(e[n], {
  54718. defaults: S,
  54719. addStyle: m,
  54720. removeStyle: v,
  54721. pluginOptions: w,
  54722. getStyle: d,
  54723. insertCSS: g
  54724. }), m("bootstrap", {
  54725. html: "<div>\n<span data-notify-text></span>\n</div>",
  54726. classes: {
  54727. base: {
  54728. "font-weight": "bold",
  54729. padding: "8px 15px 8px 14px",
  54730. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  54731. "background-color": "#fcf8e3",
  54732. border: "1px solid #fbeed5",
  54733. "border-radius": "4px",
  54734. "white-space": "nowrap",
  54735. "padding-left": "25px",
  54736. "background-repeat": "no-repeat",
  54737. "background-position": "3px 7px"
  54738. },
  54739. error: {
  54740. color: "#B94A48",
  54741. "background-color": "#F2DEDE",
  54742. "border-color": "#EED3D7",
  54743. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=)"
  54744. },
  54745. success: {
  54746. color: "#468847",
  54747. "background-color": "#DFF0D8",
  54748. "border-color": "#D6E9C6",
  54749. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"
  54750. },
  54751. info: {
  54752. color: "#3A87AD",
  54753. "background-color": "#D9EDF7",
  54754. "border-color": "#BCE8F1",
  54755. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"
  54756. },
  54757. warn: {
  54758. color: "#C09853",
  54759. "background-color": "#FCF8E3",
  54760. "border-color": "#FBEED5",
  54761. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"
  54762. }
  54763. }
  54764. }), e(function () {
  54765. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  54766. e(this).trigger("notify-hide");
  54767. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  54768. var n = e(this).data(r);
  54769. n && n.show(!1);
  54770. });
  54771. });
  54772. });
  54773. /***/ }),
  54774. /***/ "./resources/sass/app.scss":
  54775. /*!*********************************!*\
  54776. !*** ./resources/sass/app.scss ***!
  54777. \*********************************/
  54778. /*! no static exports found */
  54779. /***/ (function(module, exports) {
  54780. // removed by extract-text-webpack-plugin
  54781. /***/ }),
  54782. /***/ 0:
  54783. /*!*************************************************************!*\
  54784. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  54785. \*************************************************************/
  54786. /*! no static exports found */
  54787. /***/ (function(module, exports, __webpack_require__) {
  54788. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  54789. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  54790. /***/ })
  54791. /******/ });