app.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609
  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. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('assets').listen('AssetUpdated', function (e) {
  1678. _this.data = JSON.parse(e.data);
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/asset/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.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/credential.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. //
  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. //
  1725. //
  1726. //
  1727. //
  1728. //
  1729. //
  1730. //
  1731. //
  1732. //
  1733. //
  1734. //
  1735. //
  1736. //
  1737. //
  1738. //
  1739. //
  1740. //
  1741. //
  1742. //
  1743. //
  1744. //
  1745. //
  1746. //
  1747. //
  1748. //
  1749. //
  1750. /* harmony default export */ __webpack_exports__["default"] = ({
  1751. props: ['credential'],
  1752. data: function data() {
  1753. return {
  1754. data: JSON.parse(this.credential)
  1755. };
  1756. },
  1757. mounted: function mounted() {
  1758. var _this = this;
  1759. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1760. _this.data = JSON.parse(e.data);
  1761. });
  1762. },
  1763. methods: {
  1764. rndStr: function rndStr(len) {
  1765. var text = "";
  1766. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1767. for (var i = 0; i < len; i++) {
  1768. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1769. }
  1770. return text;
  1771. },
  1772. getRandomPassword: function getRandomPassword() {
  1773. this.data.credpass = this.rndStr(16);
  1774. },
  1775. updateCredential: function updateCredential() {
  1776. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {})["catch"](function (error) {
  1777. console.error(error);
  1778. });
  1779. $('#credential' + this.data.credid + 'editModal').modal('hide');
  1780. }
  1781. }
  1782. });
  1783. /***/ }),
  1784. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  1785. /*!****************************************************************************************************************************************************************!*\
  1786. !*** ./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& ***!
  1787. \****************************************************************************************************************************************************************/
  1788. /*! exports provided: default */
  1789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1790. "use strict";
  1791. __webpack_require__.r(__webpack_exports__);
  1792. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1793. //
  1794. //
  1795. //
  1796. //
  1797. //
  1798. //
  1799. //
  1800. //
  1801. //
  1802. //
  1803. //
  1804. //
  1805. //
  1806. //
  1807. //
  1808. //
  1809. //
  1810. //
  1811. //
  1812. //
  1813. //
  1814. //
  1815. //
  1816. //
  1817. /* harmony default export */ __webpack_exports__["default"] = ({
  1818. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1819. props: ['initialnotes', 'authusername'],
  1820. data: function data() {
  1821. return {
  1822. notes: this.initialnotes
  1823. };
  1824. }
  1825. });
  1826. /***/ }),
  1827. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1828. /*!*****************************************************************************************************************************************************************!*\
  1829. !*** ./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& ***!
  1830. \*****************************************************************************************************************************************************************/
  1831. /*! exports provided: default */
  1832. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1833. "use strict";
  1834. __webpack_require__.r(__webpack_exports__);
  1835. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. //
  1856. //
  1857. //
  1858. //
  1859. //
  1860. //
  1861. //
  1862. //
  1863. //
  1864. //
  1865. //
  1866. //
  1867. //
  1868. //
  1869. //
  1870. //
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. /* harmony default export */ __webpack_exports__["default"] = ({
  1884. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1885. props: ['workOrder'],
  1886. data: function data() {
  1887. return {
  1888. data: JSON.parse(this.workOrder),
  1889. storeList: null
  1890. };
  1891. },
  1892. mounted: function mounted() {
  1893. var _this = this;
  1894. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  1895. _this.data = JSON.parse(e.data);
  1896. });
  1897. axios.get('/api/stores').then(function (response) {
  1898. _this.storeList = new Map();
  1899. response.data.map(function (val) {
  1900. _this.storeList.set(val.storeid, val);
  1901. });
  1902. })["catch"](function (error) {
  1903. console.error(error);
  1904. });
  1905. },
  1906. methods: {
  1907. updateWorkOrder: function updateWorkOrder() {
  1908. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {})["catch"](function (error) {});
  1909. $('#workordereditModal').modal('hide');
  1910. }
  1911. }
  1912. });
  1913. /***/ }),
  1914. /***/ "./node_modules/base64-js/index.js":
  1915. /*!*****************************************!*\
  1916. !*** ./node_modules/base64-js/index.js ***!
  1917. \*****************************************/
  1918. /*! no static exports found */
  1919. /***/ (function(module, exports, __webpack_require__) {
  1920. "use strict";
  1921. exports.byteLength = byteLength
  1922. exports.toByteArray = toByteArray
  1923. exports.fromByteArray = fromByteArray
  1924. var lookup = []
  1925. var revLookup = []
  1926. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  1927. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  1928. for (var i = 0, len = code.length; i < len; ++i) {
  1929. lookup[i] = code[i]
  1930. revLookup[code.charCodeAt(i)] = i
  1931. }
  1932. // Support decoding URL-safe base64 strings, as Node.js does.
  1933. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  1934. revLookup['-'.charCodeAt(0)] = 62
  1935. revLookup['_'.charCodeAt(0)] = 63
  1936. function getLens (b64) {
  1937. var len = b64.length
  1938. if (len % 4 > 0) {
  1939. throw new Error('Invalid string. Length must be a multiple of 4')
  1940. }
  1941. // Trim off extra bytes after placeholder bytes are found
  1942. // See: https://github.com/beatgammit/base64-js/issues/42
  1943. var validLen = b64.indexOf('=')
  1944. if (validLen === -1) validLen = len
  1945. var placeHoldersLen = validLen === len
  1946. ? 0
  1947. : 4 - (validLen % 4)
  1948. return [validLen, placeHoldersLen]
  1949. }
  1950. // base64 is 4/3 + up to two characters of the original data
  1951. function byteLength (b64) {
  1952. var lens = getLens(b64)
  1953. var validLen = lens[0]
  1954. var placeHoldersLen = lens[1]
  1955. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1956. }
  1957. function _byteLength (b64, validLen, placeHoldersLen) {
  1958. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1959. }
  1960. function toByteArray (b64) {
  1961. var tmp
  1962. var lens = getLens(b64)
  1963. var validLen = lens[0]
  1964. var placeHoldersLen = lens[1]
  1965. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  1966. var curByte = 0
  1967. // if there are placeholders, only get up to the last complete 4 chars
  1968. var len = placeHoldersLen > 0
  1969. ? validLen - 4
  1970. : validLen
  1971. var i
  1972. for (i = 0; i < len; i += 4) {
  1973. tmp =
  1974. (revLookup[b64.charCodeAt(i)] << 18) |
  1975. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  1976. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  1977. revLookup[b64.charCodeAt(i + 3)]
  1978. arr[curByte++] = (tmp >> 16) & 0xFF
  1979. arr[curByte++] = (tmp >> 8) & 0xFF
  1980. arr[curByte++] = tmp & 0xFF
  1981. }
  1982. if (placeHoldersLen === 2) {
  1983. tmp =
  1984. (revLookup[b64.charCodeAt(i)] << 2) |
  1985. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  1986. arr[curByte++] = tmp & 0xFF
  1987. }
  1988. if (placeHoldersLen === 1) {
  1989. tmp =
  1990. (revLookup[b64.charCodeAt(i)] << 10) |
  1991. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  1992. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  1993. arr[curByte++] = (tmp >> 8) & 0xFF
  1994. arr[curByte++] = tmp & 0xFF
  1995. }
  1996. return arr
  1997. }
  1998. function tripletToBase64 (num) {
  1999. return lookup[num >> 18 & 0x3F] +
  2000. lookup[num >> 12 & 0x3F] +
  2001. lookup[num >> 6 & 0x3F] +
  2002. lookup[num & 0x3F]
  2003. }
  2004. function encodeChunk (uint8, start, end) {
  2005. var tmp
  2006. var output = []
  2007. for (var i = start; i < end; i += 3) {
  2008. tmp =
  2009. ((uint8[i] << 16) & 0xFF0000) +
  2010. ((uint8[i + 1] << 8) & 0xFF00) +
  2011. (uint8[i + 2] & 0xFF)
  2012. output.push(tripletToBase64(tmp))
  2013. }
  2014. return output.join('')
  2015. }
  2016. function fromByteArray (uint8) {
  2017. var tmp
  2018. var len = uint8.length
  2019. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2020. var parts = []
  2021. var maxChunkLength = 16383 // must be multiple of 3
  2022. // go through the array every three bytes, we'll deal with trailing stuff later
  2023. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2024. parts.push(encodeChunk(
  2025. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2026. ))
  2027. }
  2028. // pad the end with zeros, but make sure to not forget the extra bytes
  2029. if (extraBytes === 1) {
  2030. tmp = uint8[len - 1]
  2031. parts.push(
  2032. lookup[tmp >> 2] +
  2033. lookup[(tmp << 4) & 0x3F] +
  2034. '=='
  2035. )
  2036. } else if (extraBytes === 2) {
  2037. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2038. parts.push(
  2039. lookup[tmp >> 10] +
  2040. lookup[(tmp >> 4) & 0x3F] +
  2041. lookup[(tmp << 2) & 0x3F] +
  2042. '='
  2043. )
  2044. }
  2045. return parts.join('')
  2046. }
  2047. /***/ }),
  2048. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2049. /*!*****************************************************!*\
  2050. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2051. \*****************************************************/
  2052. /*! no static exports found */
  2053. /***/ (function(module, exports, __webpack_require__) {
  2054. /*!
  2055. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2056. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2057. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2058. */
  2059. (function (global, factory) {
  2060. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2061. undefined;
  2062. }(this, (function (exports, $, Popper) { 'use strict';
  2063. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2064. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2065. function _defineProperties(target, props) {
  2066. for (var i = 0; i < props.length; i++) {
  2067. var descriptor = props[i];
  2068. descriptor.enumerable = descriptor.enumerable || false;
  2069. descriptor.configurable = true;
  2070. if ("value" in descriptor) descriptor.writable = true;
  2071. Object.defineProperty(target, descriptor.key, descriptor);
  2072. }
  2073. }
  2074. function _createClass(Constructor, protoProps, staticProps) {
  2075. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2076. if (staticProps) _defineProperties(Constructor, staticProps);
  2077. return Constructor;
  2078. }
  2079. function _defineProperty(obj, key, value) {
  2080. if (key in obj) {
  2081. Object.defineProperty(obj, key, {
  2082. value: value,
  2083. enumerable: true,
  2084. configurable: true,
  2085. writable: true
  2086. });
  2087. } else {
  2088. obj[key] = value;
  2089. }
  2090. return obj;
  2091. }
  2092. function ownKeys(object, enumerableOnly) {
  2093. var keys = Object.keys(object);
  2094. if (Object.getOwnPropertySymbols) {
  2095. var symbols = Object.getOwnPropertySymbols(object);
  2096. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2097. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2098. });
  2099. keys.push.apply(keys, symbols);
  2100. }
  2101. return keys;
  2102. }
  2103. function _objectSpread2(target) {
  2104. for (var i = 1; i < arguments.length; i++) {
  2105. var source = arguments[i] != null ? arguments[i] : {};
  2106. if (i % 2) {
  2107. ownKeys(Object(source), true).forEach(function (key) {
  2108. _defineProperty(target, key, source[key]);
  2109. });
  2110. } else if (Object.getOwnPropertyDescriptors) {
  2111. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2112. } else {
  2113. ownKeys(Object(source)).forEach(function (key) {
  2114. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2115. });
  2116. }
  2117. }
  2118. return target;
  2119. }
  2120. function _inheritsLoose(subClass, superClass) {
  2121. subClass.prototype = Object.create(superClass.prototype);
  2122. subClass.prototype.constructor = subClass;
  2123. subClass.__proto__ = superClass;
  2124. }
  2125. /**
  2126. * --------------------------------------------------------------------------
  2127. * Bootstrap (v4.4.1): util.js
  2128. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2129. * --------------------------------------------------------------------------
  2130. */
  2131. /**
  2132. * ------------------------------------------------------------------------
  2133. * Private TransitionEnd Helpers
  2134. * ------------------------------------------------------------------------
  2135. */
  2136. var TRANSITION_END = 'transitionend';
  2137. var MAX_UID = 1000000;
  2138. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2139. function toType(obj) {
  2140. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2141. }
  2142. function getSpecialTransitionEndEvent() {
  2143. return {
  2144. bindType: TRANSITION_END,
  2145. delegateType: TRANSITION_END,
  2146. handle: function handle(event) {
  2147. if ($(event.target).is(this)) {
  2148. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2149. }
  2150. return undefined; // eslint-disable-line no-undefined
  2151. }
  2152. };
  2153. }
  2154. function transitionEndEmulator(duration) {
  2155. var _this = this;
  2156. var called = false;
  2157. $(this).one(Util.TRANSITION_END, function () {
  2158. called = true;
  2159. });
  2160. setTimeout(function () {
  2161. if (!called) {
  2162. Util.triggerTransitionEnd(_this);
  2163. }
  2164. }, duration);
  2165. return this;
  2166. }
  2167. function setTransitionEndSupport() {
  2168. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2169. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2170. }
  2171. /**
  2172. * --------------------------------------------------------------------------
  2173. * Public Util Api
  2174. * --------------------------------------------------------------------------
  2175. */
  2176. var Util = {
  2177. TRANSITION_END: 'bsTransitionEnd',
  2178. getUID: function getUID(prefix) {
  2179. do {
  2180. // eslint-disable-next-line no-bitwise
  2181. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2182. } while (document.getElementById(prefix));
  2183. return prefix;
  2184. },
  2185. getSelectorFromElement: function getSelectorFromElement(element) {
  2186. var selector = element.getAttribute('data-target');
  2187. if (!selector || selector === '#') {
  2188. var hrefAttr = element.getAttribute('href');
  2189. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2190. }
  2191. try {
  2192. return document.querySelector(selector) ? selector : null;
  2193. } catch (err) {
  2194. return null;
  2195. }
  2196. },
  2197. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2198. if (!element) {
  2199. return 0;
  2200. } // Get transition-duration of the element
  2201. var transitionDuration = $(element).css('transition-duration');
  2202. var transitionDelay = $(element).css('transition-delay');
  2203. var floatTransitionDuration = parseFloat(transitionDuration);
  2204. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2205. if (!floatTransitionDuration && !floatTransitionDelay) {
  2206. return 0;
  2207. } // If multiple durations are defined, take the first
  2208. transitionDuration = transitionDuration.split(',')[0];
  2209. transitionDelay = transitionDelay.split(',')[0];
  2210. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2211. },
  2212. reflow: function reflow(element) {
  2213. return element.offsetHeight;
  2214. },
  2215. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2216. $(element).trigger(TRANSITION_END);
  2217. },
  2218. // TODO: Remove in v5
  2219. supportsTransitionEnd: function supportsTransitionEnd() {
  2220. return Boolean(TRANSITION_END);
  2221. },
  2222. isElement: function isElement(obj) {
  2223. return (obj[0] || obj).nodeType;
  2224. },
  2225. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2226. for (var property in configTypes) {
  2227. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2228. var expectedTypes = configTypes[property];
  2229. var value = config[property];
  2230. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2231. if (!new RegExp(expectedTypes).test(valueType)) {
  2232. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2233. }
  2234. }
  2235. }
  2236. },
  2237. findShadowRoot: function findShadowRoot(element) {
  2238. if (!document.documentElement.attachShadow) {
  2239. return null;
  2240. } // Can find the shadow root otherwise it'll return the document
  2241. if (typeof element.getRootNode === 'function') {
  2242. var root = element.getRootNode();
  2243. return root instanceof ShadowRoot ? root : null;
  2244. }
  2245. if (element instanceof ShadowRoot) {
  2246. return element;
  2247. } // when we don't find a shadow root
  2248. if (!element.parentNode) {
  2249. return null;
  2250. }
  2251. return Util.findShadowRoot(element.parentNode);
  2252. },
  2253. jQueryDetection: function jQueryDetection() {
  2254. if (typeof $ === 'undefined') {
  2255. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2256. }
  2257. var version = $.fn.jquery.split(' ')[0].split('.');
  2258. var minMajor = 1;
  2259. var ltMajor = 2;
  2260. var minMinor = 9;
  2261. var minPatch = 1;
  2262. var maxMajor = 4;
  2263. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2264. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2265. }
  2266. }
  2267. };
  2268. Util.jQueryDetection();
  2269. setTransitionEndSupport();
  2270. /**
  2271. * ------------------------------------------------------------------------
  2272. * Constants
  2273. * ------------------------------------------------------------------------
  2274. */
  2275. var NAME = 'alert';
  2276. var VERSION = '4.4.1';
  2277. var DATA_KEY = 'bs.alert';
  2278. var EVENT_KEY = "." + DATA_KEY;
  2279. var DATA_API_KEY = '.data-api';
  2280. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2281. var Selector = {
  2282. DISMISS: '[data-dismiss="alert"]'
  2283. };
  2284. var Event = {
  2285. CLOSE: "close" + EVENT_KEY,
  2286. CLOSED: "closed" + EVENT_KEY,
  2287. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2288. };
  2289. var ClassName = {
  2290. ALERT: 'alert',
  2291. FADE: 'fade',
  2292. SHOW: 'show'
  2293. };
  2294. /**
  2295. * ------------------------------------------------------------------------
  2296. * Class Definition
  2297. * ------------------------------------------------------------------------
  2298. */
  2299. var Alert =
  2300. /*#__PURE__*/
  2301. function () {
  2302. function Alert(element) {
  2303. this._element = element;
  2304. } // Getters
  2305. var _proto = Alert.prototype;
  2306. // Public
  2307. _proto.close = function close(element) {
  2308. var rootElement = this._element;
  2309. if (element) {
  2310. rootElement = this._getRootElement(element);
  2311. }
  2312. var customEvent = this._triggerCloseEvent(rootElement);
  2313. if (customEvent.isDefaultPrevented()) {
  2314. return;
  2315. }
  2316. this._removeElement(rootElement);
  2317. };
  2318. _proto.dispose = function dispose() {
  2319. $.removeData(this._element, DATA_KEY);
  2320. this._element = null;
  2321. } // Private
  2322. ;
  2323. _proto._getRootElement = function _getRootElement(element) {
  2324. var selector = Util.getSelectorFromElement(element);
  2325. var parent = false;
  2326. if (selector) {
  2327. parent = document.querySelector(selector);
  2328. }
  2329. if (!parent) {
  2330. parent = $(element).closest("." + ClassName.ALERT)[0];
  2331. }
  2332. return parent;
  2333. };
  2334. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2335. var closeEvent = $.Event(Event.CLOSE);
  2336. $(element).trigger(closeEvent);
  2337. return closeEvent;
  2338. };
  2339. _proto._removeElement = function _removeElement(element) {
  2340. var _this = this;
  2341. $(element).removeClass(ClassName.SHOW);
  2342. if (!$(element).hasClass(ClassName.FADE)) {
  2343. this._destroyElement(element);
  2344. return;
  2345. }
  2346. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2347. $(element).one(Util.TRANSITION_END, function (event) {
  2348. return _this._destroyElement(element, event);
  2349. }).emulateTransitionEnd(transitionDuration);
  2350. };
  2351. _proto._destroyElement = function _destroyElement(element) {
  2352. $(element).detach().trigger(Event.CLOSED).remove();
  2353. } // Static
  2354. ;
  2355. Alert._jQueryInterface = function _jQueryInterface(config) {
  2356. return this.each(function () {
  2357. var $element = $(this);
  2358. var data = $element.data(DATA_KEY);
  2359. if (!data) {
  2360. data = new Alert(this);
  2361. $element.data(DATA_KEY, data);
  2362. }
  2363. if (config === 'close') {
  2364. data[config](this);
  2365. }
  2366. });
  2367. };
  2368. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2369. return function (event) {
  2370. if (event) {
  2371. event.preventDefault();
  2372. }
  2373. alertInstance.close(this);
  2374. };
  2375. };
  2376. _createClass(Alert, null, [{
  2377. key: "VERSION",
  2378. get: function get() {
  2379. return VERSION;
  2380. }
  2381. }]);
  2382. return Alert;
  2383. }();
  2384. /**
  2385. * ------------------------------------------------------------------------
  2386. * Data Api implementation
  2387. * ------------------------------------------------------------------------
  2388. */
  2389. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2390. /**
  2391. * ------------------------------------------------------------------------
  2392. * jQuery
  2393. * ------------------------------------------------------------------------
  2394. */
  2395. $.fn[NAME] = Alert._jQueryInterface;
  2396. $.fn[NAME].Constructor = Alert;
  2397. $.fn[NAME].noConflict = function () {
  2398. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2399. return Alert._jQueryInterface;
  2400. };
  2401. /**
  2402. * ------------------------------------------------------------------------
  2403. * Constants
  2404. * ------------------------------------------------------------------------
  2405. */
  2406. var NAME$1 = 'button';
  2407. var VERSION$1 = '4.4.1';
  2408. var DATA_KEY$1 = 'bs.button';
  2409. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2410. var DATA_API_KEY$1 = '.data-api';
  2411. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2412. var ClassName$1 = {
  2413. ACTIVE: 'active',
  2414. BUTTON: 'btn',
  2415. FOCUS: 'focus'
  2416. };
  2417. var Selector$1 = {
  2418. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2419. DATA_TOGGLES: '[data-toggle="buttons"]',
  2420. DATA_TOGGLE: '[data-toggle="button"]',
  2421. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2422. INPUT: 'input:not([type="hidden"])',
  2423. ACTIVE: '.active',
  2424. BUTTON: '.btn'
  2425. };
  2426. var Event$1 = {
  2427. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2428. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2429. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2430. };
  2431. /**
  2432. * ------------------------------------------------------------------------
  2433. * Class Definition
  2434. * ------------------------------------------------------------------------
  2435. */
  2436. var Button =
  2437. /*#__PURE__*/
  2438. function () {
  2439. function Button(element) {
  2440. this._element = element;
  2441. } // Getters
  2442. var _proto = Button.prototype;
  2443. // Public
  2444. _proto.toggle = function toggle() {
  2445. var triggerChangeEvent = true;
  2446. var addAriaPressed = true;
  2447. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2448. if (rootElement) {
  2449. var input = this._element.querySelector(Selector$1.INPUT);
  2450. if (input) {
  2451. if (input.type === 'radio') {
  2452. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2453. triggerChangeEvent = false;
  2454. } else {
  2455. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2456. if (activeElement) {
  2457. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2458. }
  2459. }
  2460. } else if (input.type === 'checkbox') {
  2461. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2462. triggerChangeEvent = false;
  2463. }
  2464. } else {
  2465. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2466. triggerChangeEvent = false;
  2467. }
  2468. if (triggerChangeEvent) {
  2469. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2470. $(input).trigger('change');
  2471. }
  2472. input.focus();
  2473. addAriaPressed = false;
  2474. }
  2475. }
  2476. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2477. if (addAriaPressed) {
  2478. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2479. }
  2480. if (triggerChangeEvent) {
  2481. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2482. }
  2483. }
  2484. };
  2485. _proto.dispose = function dispose() {
  2486. $.removeData(this._element, DATA_KEY$1);
  2487. this._element = null;
  2488. } // Static
  2489. ;
  2490. Button._jQueryInterface = function _jQueryInterface(config) {
  2491. return this.each(function () {
  2492. var data = $(this).data(DATA_KEY$1);
  2493. if (!data) {
  2494. data = new Button(this);
  2495. $(this).data(DATA_KEY$1, data);
  2496. }
  2497. if (config === 'toggle') {
  2498. data[config]();
  2499. }
  2500. });
  2501. };
  2502. _createClass(Button, null, [{
  2503. key: "VERSION",
  2504. get: function get() {
  2505. return VERSION$1;
  2506. }
  2507. }]);
  2508. return Button;
  2509. }();
  2510. /**
  2511. * ------------------------------------------------------------------------
  2512. * Data Api implementation
  2513. * ------------------------------------------------------------------------
  2514. */
  2515. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2516. var button = event.target;
  2517. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2518. button = $(button).closest(Selector$1.BUTTON)[0];
  2519. }
  2520. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2521. event.preventDefault(); // work around Firefox bug #1540995
  2522. } else {
  2523. var inputBtn = button.querySelector(Selector$1.INPUT);
  2524. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2525. event.preventDefault(); // work around Firefox bug #1540995
  2526. return;
  2527. }
  2528. Button._jQueryInterface.call($(button), 'toggle');
  2529. }
  2530. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2531. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2532. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2533. });
  2534. $(window).on(Event$1.LOAD_DATA_API, function () {
  2535. // ensure correct active class is set to match the controls' actual values/states
  2536. // find all checkboxes/readio buttons inside data-toggle groups
  2537. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2538. for (var i = 0, len = buttons.length; i < len; i++) {
  2539. var button = buttons[i];
  2540. var input = button.querySelector(Selector$1.INPUT);
  2541. if (input.checked || input.hasAttribute('checked')) {
  2542. button.classList.add(ClassName$1.ACTIVE);
  2543. } else {
  2544. button.classList.remove(ClassName$1.ACTIVE);
  2545. }
  2546. } // find all button toggles
  2547. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2548. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2549. var _button = buttons[_i];
  2550. if (_button.getAttribute('aria-pressed') === 'true') {
  2551. _button.classList.add(ClassName$1.ACTIVE);
  2552. } else {
  2553. _button.classList.remove(ClassName$1.ACTIVE);
  2554. }
  2555. }
  2556. });
  2557. /**
  2558. * ------------------------------------------------------------------------
  2559. * jQuery
  2560. * ------------------------------------------------------------------------
  2561. */
  2562. $.fn[NAME$1] = Button._jQueryInterface;
  2563. $.fn[NAME$1].Constructor = Button;
  2564. $.fn[NAME$1].noConflict = function () {
  2565. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2566. return Button._jQueryInterface;
  2567. };
  2568. /**
  2569. * ------------------------------------------------------------------------
  2570. * Constants
  2571. * ------------------------------------------------------------------------
  2572. */
  2573. var NAME$2 = 'carousel';
  2574. var VERSION$2 = '4.4.1';
  2575. var DATA_KEY$2 = 'bs.carousel';
  2576. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2577. var DATA_API_KEY$2 = '.data-api';
  2578. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2579. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2580. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2581. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2582. var SWIPE_THRESHOLD = 40;
  2583. var Default = {
  2584. interval: 5000,
  2585. keyboard: true,
  2586. slide: false,
  2587. pause: 'hover',
  2588. wrap: true,
  2589. touch: true
  2590. };
  2591. var DefaultType = {
  2592. interval: '(number|boolean)',
  2593. keyboard: 'boolean',
  2594. slide: '(boolean|string)',
  2595. pause: '(string|boolean)',
  2596. wrap: 'boolean',
  2597. touch: 'boolean'
  2598. };
  2599. var Direction = {
  2600. NEXT: 'next',
  2601. PREV: 'prev',
  2602. LEFT: 'left',
  2603. RIGHT: 'right'
  2604. };
  2605. var Event$2 = {
  2606. SLIDE: "slide" + EVENT_KEY$2,
  2607. SLID: "slid" + EVENT_KEY$2,
  2608. KEYDOWN: "keydown" + EVENT_KEY$2,
  2609. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2610. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2611. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2612. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2613. TOUCHEND: "touchend" + EVENT_KEY$2,
  2614. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2615. POINTERUP: "pointerup" + EVENT_KEY$2,
  2616. DRAG_START: "dragstart" + EVENT_KEY$2,
  2617. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2618. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2619. };
  2620. var ClassName$2 = {
  2621. CAROUSEL: 'carousel',
  2622. ACTIVE: 'active',
  2623. SLIDE: 'slide',
  2624. RIGHT: 'carousel-item-right',
  2625. LEFT: 'carousel-item-left',
  2626. NEXT: 'carousel-item-next',
  2627. PREV: 'carousel-item-prev',
  2628. ITEM: 'carousel-item',
  2629. POINTER_EVENT: 'pointer-event'
  2630. };
  2631. var Selector$2 = {
  2632. ACTIVE: '.active',
  2633. ACTIVE_ITEM: '.active.carousel-item',
  2634. ITEM: '.carousel-item',
  2635. ITEM_IMG: '.carousel-item img',
  2636. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2637. INDICATORS: '.carousel-indicators',
  2638. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2639. DATA_RIDE: '[data-ride="carousel"]'
  2640. };
  2641. var PointerType = {
  2642. TOUCH: 'touch',
  2643. PEN: 'pen'
  2644. };
  2645. /**
  2646. * ------------------------------------------------------------------------
  2647. * Class Definition
  2648. * ------------------------------------------------------------------------
  2649. */
  2650. var Carousel =
  2651. /*#__PURE__*/
  2652. function () {
  2653. function Carousel(element, config) {
  2654. this._items = null;
  2655. this._interval = null;
  2656. this._activeElement = null;
  2657. this._isPaused = false;
  2658. this._isSliding = false;
  2659. this.touchTimeout = null;
  2660. this.touchStartX = 0;
  2661. this.touchDeltaX = 0;
  2662. this._config = this._getConfig(config);
  2663. this._element = element;
  2664. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2665. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2666. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2667. this._addEventListeners();
  2668. } // Getters
  2669. var _proto = Carousel.prototype;
  2670. // Public
  2671. _proto.next = function next() {
  2672. if (!this._isSliding) {
  2673. this._slide(Direction.NEXT);
  2674. }
  2675. };
  2676. _proto.nextWhenVisible = function nextWhenVisible() {
  2677. // Don't call next when the page isn't visible
  2678. // or the carousel or its parent isn't visible
  2679. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2680. this.next();
  2681. }
  2682. };
  2683. _proto.prev = function prev() {
  2684. if (!this._isSliding) {
  2685. this._slide(Direction.PREV);
  2686. }
  2687. };
  2688. _proto.pause = function pause(event) {
  2689. if (!event) {
  2690. this._isPaused = true;
  2691. }
  2692. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2693. Util.triggerTransitionEnd(this._element);
  2694. this.cycle(true);
  2695. }
  2696. clearInterval(this._interval);
  2697. this._interval = null;
  2698. };
  2699. _proto.cycle = function cycle(event) {
  2700. if (!event) {
  2701. this._isPaused = false;
  2702. }
  2703. if (this._interval) {
  2704. clearInterval(this._interval);
  2705. this._interval = null;
  2706. }
  2707. if (this._config.interval && !this._isPaused) {
  2708. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2709. }
  2710. };
  2711. _proto.to = function to(index) {
  2712. var _this = this;
  2713. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2714. var activeIndex = this._getItemIndex(this._activeElement);
  2715. if (index > this._items.length - 1 || index < 0) {
  2716. return;
  2717. }
  2718. if (this._isSliding) {
  2719. $(this._element).one(Event$2.SLID, function () {
  2720. return _this.to(index);
  2721. });
  2722. return;
  2723. }
  2724. if (activeIndex === index) {
  2725. this.pause();
  2726. this.cycle();
  2727. return;
  2728. }
  2729. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2730. this._slide(direction, this._items[index]);
  2731. };
  2732. _proto.dispose = function dispose() {
  2733. $(this._element).off(EVENT_KEY$2);
  2734. $.removeData(this._element, DATA_KEY$2);
  2735. this._items = null;
  2736. this._config = null;
  2737. this._element = null;
  2738. this._interval = null;
  2739. this._isPaused = null;
  2740. this._isSliding = null;
  2741. this._activeElement = null;
  2742. this._indicatorsElement = null;
  2743. } // Private
  2744. ;
  2745. _proto._getConfig = function _getConfig(config) {
  2746. config = _objectSpread2({}, Default, {}, config);
  2747. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2748. return config;
  2749. };
  2750. _proto._handleSwipe = function _handleSwipe() {
  2751. var absDeltax = Math.abs(this.touchDeltaX);
  2752. if (absDeltax <= SWIPE_THRESHOLD) {
  2753. return;
  2754. }
  2755. var direction = absDeltax / this.touchDeltaX;
  2756. this.touchDeltaX = 0; // swipe left
  2757. if (direction > 0) {
  2758. this.prev();
  2759. } // swipe right
  2760. if (direction < 0) {
  2761. this.next();
  2762. }
  2763. };
  2764. _proto._addEventListeners = function _addEventListeners() {
  2765. var _this2 = this;
  2766. if (this._config.keyboard) {
  2767. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2768. return _this2._keydown(event);
  2769. });
  2770. }
  2771. if (this._config.pause === 'hover') {
  2772. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2773. return _this2.pause(event);
  2774. }).on(Event$2.MOUSELEAVE, function (event) {
  2775. return _this2.cycle(event);
  2776. });
  2777. }
  2778. if (this._config.touch) {
  2779. this._addTouchEventListeners();
  2780. }
  2781. };
  2782. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2783. var _this3 = this;
  2784. if (!this._touchSupported) {
  2785. return;
  2786. }
  2787. var start = function start(event) {
  2788. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2789. _this3.touchStartX = event.originalEvent.clientX;
  2790. } else if (!_this3._pointerEvent) {
  2791. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2792. }
  2793. };
  2794. var move = function move(event) {
  2795. // ensure swiping with one touch and not pinching
  2796. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2797. _this3.touchDeltaX = 0;
  2798. } else {
  2799. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2800. }
  2801. };
  2802. var end = function end(event) {
  2803. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2804. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2805. }
  2806. _this3._handleSwipe();
  2807. if (_this3._config.pause === 'hover') {
  2808. // If it's a touch-enabled device, mouseenter/leave are fired as
  2809. // part of the mouse compatibility events on first tap - the carousel
  2810. // would stop cycling until user tapped out of it;
  2811. // here, we listen for touchend, explicitly pause the carousel
  2812. // (as if it's the second time we tap on it, mouseenter compat event
  2813. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2814. // events to fire) we explicitly restart cycling
  2815. _this3.pause();
  2816. if (_this3.touchTimeout) {
  2817. clearTimeout(_this3.touchTimeout);
  2818. }
  2819. _this3.touchTimeout = setTimeout(function (event) {
  2820. return _this3.cycle(event);
  2821. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2822. }
  2823. };
  2824. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2825. return e.preventDefault();
  2826. });
  2827. if (this._pointerEvent) {
  2828. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2829. return start(event);
  2830. });
  2831. $(this._element).on(Event$2.POINTERUP, function (event) {
  2832. return end(event);
  2833. });
  2834. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2835. } else {
  2836. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2837. return start(event);
  2838. });
  2839. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2840. return move(event);
  2841. });
  2842. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2843. return end(event);
  2844. });
  2845. }
  2846. };
  2847. _proto._keydown = function _keydown(event) {
  2848. if (/input|textarea/i.test(event.target.tagName)) {
  2849. return;
  2850. }
  2851. switch (event.which) {
  2852. case ARROW_LEFT_KEYCODE:
  2853. event.preventDefault();
  2854. this.prev();
  2855. break;
  2856. case ARROW_RIGHT_KEYCODE:
  2857. event.preventDefault();
  2858. this.next();
  2859. break;
  2860. }
  2861. };
  2862. _proto._getItemIndex = function _getItemIndex(element) {
  2863. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2864. return this._items.indexOf(element);
  2865. };
  2866. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2867. var isNextDirection = direction === Direction.NEXT;
  2868. var isPrevDirection = direction === Direction.PREV;
  2869. var activeIndex = this._getItemIndex(activeElement);
  2870. var lastItemIndex = this._items.length - 1;
  2871. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2872. if (isGoingToWrap && !this._config.wrap) {
  2873. return activeElement;
  2874. }
  2875. var delta = direction === Direction.PREV ? -1 : 1;
  2876. var itemIndex = (activeIndex + delta) % this._items.length;
  2877. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2878. };
  2879. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2880. var targetIndex = this._getItemIndex(relatedTarget);
  2881. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2882. var slideEvent = $.Event(Event$2.SLIDE, {
  2883. relatedTarget: relatedTarget,
  2884. direction: eventDirectionName,
  2885. from: fromIndex,
  2886. to: targetIndex
  2887. });
  2888. $(this._element).trigger(slideEvent);
  2889. return slideEvent;
  2890. };
  2891. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2892. if (this._indicatorsElement) {
  2893. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2894. $(indicators).removeClass(ClassName$2.ACTIVE);
  2895. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2896. if (nextIndicator) {
  2897. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2898. }
  2899. }
  2900. };
  2901. _proto._slide = function _slide(direction, element) {
  2902. var _this4 = this;
  2903. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2904. var activeElementIndex = this._getItemIndex(activeElement);
  2905. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2906. var nextElementIndex = this._getItemIndex(nextElement);
  2907. var isCycling = Boolean(this._interval);
  2908. var directionalClassName;
  2909. var orderClassName;
  2910. var eventDirectionName;
  2911. if (direction === Direction.NEXT) {
  2912. directionalClassName = ClassName$2.LEFT;
  2913. orderClassName = ClassName$2.NEXT;
  2914. eventDirectionName = Direction.LEFT;
  2915. } else {
  2916. directionalClassName = ClassName$2.RIGHT;
  2917. orderClassName = ClassName$2.PREV;
  2918. eventDirectionName = Direction.RIGHT;
  2919. }
  2920. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2921. this._isSliding = false;
  2922. return;
  2923. }
  2924. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2925. if (slideEvent.isDefaultPrevented()) {
  2926. return;
  2927. }
  2928. if (!activeElement || !nextElement) {
  2929. // Some weirdness is happening, so we bail
  2930. return;
  2931. }
  2932. this._isSliding = true;
  2933. if (isCycling) {
  2934. this.pause();
  2935. }
  2936. this._setActiveIndicatorElement(nextElement);
  2937. var slidEvent = $.Event(Event$2.SLID, {
  2938. relatedTarget: nextElement,
  2939. direction: eventDirectionName,
  2940. from: activeElementIndex,
  2941. to: nextElementIndex
  2942. });
  2943. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2944. $(nextElement).addClass(orderClassName);
  2945. Util.reflow(nextElement);
  2946. $(activeElement).addClass(directionalClassName);
  2947. $(nextElement).addClass(directionalClassName);
  2948. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2949. if (nextElementInterval) {
  2950. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2951. this._config.interval = nextElementInterval;
  2952. } else {
  2953. this._config.interval = this._config.defaultInterval || this._config.interval;
  2954. }
  2955. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2956. $(activeElement).one(Util.TRANSITION_END, function () {
  2957. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2958. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2959. _this4._isSliding = false;
  2960. setTimeout(function () {
  2961. return $(_this4._element).trigger(slidEvent);
  2962. }, 0);
  2963. }).emulateTransitionEnd(transitionDuration);
  2964. } else {
  2965. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2966. $(nextElement).addClass(ClassName$2.ACTIVE);
  2967. this._isSliding = false;
  2968. $(this._element).trigger(slidEvent);
  2969. }
  2970. if (isCycling) {
  2971. this.cycle();
  2972. }
  2973. } // Static
  2974. ;
  2975. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2976. return this.each(function () {
  2977. var data = $(this).data(DATA_KEY$2);
  2978. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2979. if (typeof config === 'object') {
  2980. _config = _objectSpread2({}, _config, {}, config);
  2981. }
  2982. var action = typeof config === 'string' ? config : _config.slide;
  2983. if (!data) {
  2984. data = new Carousel(this, _config);
  2985. $(this).data(DATA_KEY$2, data);
  2986. }
  2987. if (typeof config === 'number') {
  2988. data.to(config);
  2989. } else if (typeof action === 'string') {
  2990. if (typeof data[action] === 'undefined') {
  2991. throw new TypeError("No method named \"" + action + "\"");
  2992. }
  2993. data[action]();
  2994. } else if (_config.interval && _config.ride) {
  2995. data.pause();
  2996. data.cycle();
  2997. }
  2998. });
  2999. };
  3000. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3001. var selector = Util.getSelectorFromElement(this);
  3002. if (!selector) {
  3003. return;
  3004. }
  3005. var target = $(selector)[0];
  3006. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3007. return;
  3008. }
  3009. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3010. var slideIndex = this.getAttribute('data-slide-to');
  3011. if (slideIndex) {
  3012. config.interval = false;
  3013. }
  3014. Carousel._jQueryInterface.call($(target), config);
  3015. if (slideIndex) {
  3016. $(target).data(DATA_KEY$2).to(slideIndex);
  3017. }
  3018. event.preventDefault();
  3019. };
  3020. _createClass(Carousel, null, [{
  3021. key: "VERSION",
  3022. get: function get() {
  3023. return VERSION$2;
  3024. }
  3025. }, {
  3026. key: "Default",
  3027. get: function get() {
  3028. return Default;
  3029. }
  3030. }]);
  3031. return Carousel;
  3032. }();
  3033. /**
  3034. * ------------------------------------------------------------------------
  3035. * Data Api implementation
  3036. * ------------------------------------------------------------------------
  3037. */
  3038. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3039. $(window).on(Event$2.LOAD_DATA_API, function () {
  3040. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3041. for (var i = 0, len = carousels.length; i < len; i++) {
  3042. var $carousel = $(carousels[i]);
  3043. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3044. }
  3045. });
  3046. /**
  3047. * ------------------------------------------------------------------------
  3048. * jQuery
  3049. * ------------------------------------------------------------------------
  3050. */
  3051. $.fn[NAME$2] = Carousel._jQueryInterface;
  3052. $.fn[NAME$2].Constructor = Carousel;
  3053. $.fn[NAME$2].noConflict = function () {
  3054. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3055. return Carousel._jQueryInterface;
  3056. };
  3057. /**
  3058. * ------------------------------------------------------------------------
  3059. * Constants
  3060. * ------------------------------------------------------------------------
  3061. */
  3062. var NAME$3 = 'collapse';
  3063. var VERSION$3 = '4.4.1';
  3064. var DATA_KEY$3 = 'bs.collapse';
  3065. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3066. var DATA_API_KEY$3 = '.data-api';
  3067. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3068. var Default$1 = {
  3069. toggle: true,
  3070. parent: ''
  3071. };
  3072. var DefaultType$1 = {
  3073. toggle: 'boolean',
  3074. parent: '(string|element)'
  3075. };
  3076. var Event$3 = {
  3077. SHOW: "show" + EVENT_KEY$3,
  3078. SHOWN: "shown" + EVENT_KEY$3,
  3079. HIDE: "hide" + EVENT_KEY$3,
  3080. HIDDEN: "hidden" + EVENT_KEY$3,
  3081. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3082. };
  3083. var ClassName$3 = {
  3084. SHOW: 'show',
  3085. COLLAPSE: 'collapse',
  3086. COLLAPSING: 'collapsing',
  3087. COLLAPSED: 'collapsed'
  3088. };
  3089. var Dimension = {
  3090. WIDTH: 'width',
  3091. HEIGHT: 'height'
  3092. };
  3093. var Selector$3 = {
  3094. ACTIVES: '.show, .collapsing',
  3095. DATA_TOGGLE: '[data-toggle="collapse"]'
  3096. };
  3097. /**
  3098. * ------------------------------------------------------------------------
  3099. * Class Definition
  3100. * ------------------------------------------------------------------------
  3101. */
  3102. var Collapse =
  3103. /*#__PURE__*/
  3104. function () {
  3105. function Collapse(element, config) {
  3106. this._isTransitioning = false;
  3107. this._element = element;
  3108. this._config = this._getConfig(config);
  3109. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3110. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3111. for (var i = 0, len = toggleList.length; i < len; i++) {
  3112. var elem = toggleList[i];
  3113. var selector = Util.getSelectorFromElement(elem);
  3114. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3115. return foundElem === element;
  3116. });
  3117. if (selector !== null && filterElement.length > 0) {
  3118. this._selector = selector;
  3119. this._triggerArray.push(elem);
  3120. }
  3121. }
  3122. this._parent = this._config.parent ? this._getParent() : null;
  3123. if (!this._config.parent) {
  3124. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3125. }
  3126. if (this._config.toggle) {
  3127. this.toggle();
  3128. }
  3129. } // Getters
  3130. var _proto = Collapse.prototype;
  3131. // Public
  3132. _proto.toggle = function toggle() {
  3133. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3134. this.hide();
  3135. } else {
  3136. this.show();
  3137. }
  3138. };
  3139. _proto.show = function show() {
  3140. var _this = this;
  3141. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3142. return;
  3143. }
  3144. var actives;
  3145. var activesData;
  3146. if (this._parent) {
  3147. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3148. if (typeof _this._config.parent === 'string') {
  3149. return elem.getAttribute('data-parent') === _this._config.parent;
  3150. }
  3151. return elem.classList.contains(ClassName$3.COLLAPSE);
  3152. });
  3153. if (actives.length === 0) {
  3154. actives = null;
  3155. }
  3156. }
  3157. if (actives) {
  3158. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3159. if (activesData && activesData._isTransitioning) {
  3160. return;
  3161. }
  3162. }
  3163. var startEvent = $.Event(Event$3.SHOW);
  3164. $(this._element).trigger(startEvent);
  3165. if (startEvent.isDefaultPrevented()) {
  3166. return;
  3167. }
  3168. if (actives) {
  3169. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3170. if (!activesData) {
  3171. $(actives).data(DATA_KEY$3, null);
  3172. }
  3173. }
  3174. var dimension = this._getDimension();
  3175. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3176. this._element.style[dimension] = 0;
  3177. if (this._triggerArray.length) {
  3178. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3179. }
  3180. this.setTransitioning(true);
  3181. var complete = function complete() {
  3182. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3183. _this._element.style[dimension] = '';
  3184. _this.setTransitioning(false);
  3185. $(_this._element).trigger(Event$3.SHOWN);
  3186. };
  3187. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3188. var scrollSize = "scroll" + capitalizedDimension;
  3189. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3190. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3191. this._element.style[dimension] = this._element[scrollSize] + "px";
  3192. };
  3193. _proto.hide = function hide() {
  3194. var _this2 = this;
  3195. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3196. return;
  3197. }
  3198. var startEvent = $.Event(Event$3.HIDE);
  3199. $(this._element).trigger(startEvent);
  3200. if (startEvent.isDefaultPrevented()) {
  3201. return;
  3202. }
  3203. var dimension = this._getDimension();
  3204. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3205. Util.reflow(this._element);
  3206. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3207. var triggerArrayLength = this._triggerArray.length;
  3208. if (triggerArrayLength > 0) {
  3209. for (var i = 0; i < triggerArrayLength; i++) {
  3210. var trigger = this._triggerArray[i];
  3211. var selector = Util.getSelectorFromElement(trigger);
  3212. if (selector !== null) {
  3213. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3214. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3215. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3216. }
  3217. }
  3218. }
  3219. }
  3220. this.setTransitioning(true);
  3221. var complete = function complete() {
  3222. _this2.setTransitioning(false);
  3223. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3224. };
  3225. this._element.style[dimension] = '';
  3226. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3227. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3228. };
  3229. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3230. this._isTransitioning = isTransitioning;
  3231. };
  3232. _proto.dispose = function dispose() {
  3233. $.removeData(this._element, DATA_KEY$3);
  3234. this._config = null;
  3235. this._parent = null;
  3236. this._element = null;
  3237. this._triggerArray = null;
  3238. this._isTransitioning = null;
  3239. } // Private
  3240. ;
  3241. _proto._getConfig = function _getConfig(config) {
  3242. config = _objectSpread2({}, Default$1, {}, config);
  3243. config.toggle = Boolean(config.toggle); // Coerce string values
  3244. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3245. return config;
  3246. };
  3247. _proto._getDimension = function _getDimension() {
  3248. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3249. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3250. };
  3251. _proto._getParent = function _getParent() {
  3252. var _this3 = this;
  3253. var parent;
  3254. if (Util.isElement(this._config.parent)) {
  3255. parent = this._config.parent; // It's a jQuery object
  3256. if (typeof this._config.parent.jquery !== 'undefined') {
  3257. parent = this._config.parent[0];
  3258. }
  3259. } else {
  3260. parent = document.querySelector(this._config.parent);
  3261. }
  3262. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3263. var children = [].slice.call(parent.querySelectorAll(selector));
  3264. $(children).each(function (i, element) {
  3265. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3266. });
  3267. return parent;
  3268. };
  3269. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3270. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3271. if (triggerArray.length) {
  3272. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3273. }
  3274. } // Static
  3275. ;
  3276. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3277. var selector = Util.getSelectorFromElement(element);
  3278. return selector ? document.querySelector(selector) : null;
  3279. };
  3280. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3281. return this.each(function () {
  3282. var $this = $(this);
  3283. var data = $this.data(DATA_KEY$3);
  3284. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3285. if (!data && _config.toggle && /show|hide/.test(config)) {
  3286. _config.toggle = false;
  3287. }
  3288. if (!data) {
  3289. data = new Collapse(this, _config);
  3290. $this.data(DATA_KEY$3, data);
  3291. }
  3292. if (typeof config === 'string') {
  3293. if (typeof data[config] === 'undefined') {
  3294. throw new TypeError("No method named \"" + config + "\"");
  3295. }
  3296. data[config]();
  3297. }
  3298. });
  3299. };
  3300. _createClass(Collapse, null, [{
  3301. key: "VERSION",
  3302. get: function get() {
  3303. return VERSION$3;
  3304. }
  3305. }, {
  3306. key: "Default",
  3307. get: function get() {
  3308. return Default$1;
  3309. }
  3310. }]);
  3311. return Collapse;
  3312. }();
  3313. /**
  3314. * ------------------------------------------------------------------------
  3315. * Data Api implementation
  3316. * ------------------------------------------------------------------------
  3317. */
  3318. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3319. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3320. if (event.currentTarget.tagName === 'A') {
  3321. event.preventDefault();
  3322. }
  3323. var $trigger = $(this);
  3324. var selector = Util.getSelectorFromElement(this);
  3325. var selectors = [].slice.call(document.querySelectorAll(selector));
  3326. $(selectors).each(function () {
  3327. var $target = $(this);
  3328. var data = $target.data(DATA_KEY$3);
  3329. var config = data ? 'toggle' : $trigger.data();
  3330. Collapse._jQueryInterface.call($target, config);
  3331. });
  3332. });
  3333. /**
  3334. * ------------------------------------------------------------------------
  3335. * jQuery
  3336. * ------------------------------------------------------------------------
  3337. */
  3338. $.fn[NAME$3] = Collapse._jQueryInterface;
  3339. $.fn[NAME$3].Constructor = Collapse;
  3340. $.fn[NAME$3].noConflict = function () {
  3341. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3342. return Collapse._jQueryInterface;
  3343. };
  3344. /**
  3345. * ------------------------------------------------------------------------
  3346. * Constants
  3347. * ------------------------------------------------------------------------
  3348. */
  3349. var NAME$4 = 'dropdown';
  3350. var VERSION$4 = '4.4.1';
  3351. var DATA_KEY$4 = 'bs.dropdown';
  3352. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3353. var DATA_API_KEY$4 = '.data-api';
  3354. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3355. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3356. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3357. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3358. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3359. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3360. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3361. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3362. var Event$4 = {
  3363. HIDE: "hide" + EVENT_KEY$4,
  3364. HIDDEN: "hidden" + EVENT_KEY$4,
  3365. SHOW: "show" + EVENT_KEY$4,
  3366. SHOWN: "shown" + EVENT_KEY$4,
  3367. CLICK: "click" + EVENT_KEY$4,
  3368. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3369. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3370. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3371. };
  3372. var ClassName$4 = {
  3373. DISABLED: 'disabled',
  3374. SHOW: 'show',
  3375. DROPUP: 'dropup',
  3376. DROPRIGHT: 'dropright',
  3377. DROPLEFT: 'dropleft',
  3378. MENURIGHT: 'dropdown-menu-right',
  3379. MENULEFT: 'dropdown-menu-left',
  3380. POSITION_STATIC: 'position-static'
  3381. };
  3382. var Selector$4 = {
  3383. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3384. FORM_CHILD: '.dropdown form',
  3385. MENU: '.dropdown-menu',
  3386. NAVBAR_NAV: '.navbar-nav',
  3387. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3388. };
  3389. var AttachmentMap = {
  3390. TOP: 'top-start',
  3391. TOPEND: 'top-end',
  3392. BOTTOM: 'bottom-start',
  3393. BOTTOMEND: 'bottom-end',
  3394. RIGHT: 'right-start',
  3395. RIGHTEND: 'right-end',
  3396. LEFT: 'left-start',
  3397. LEFTEND: 'left-end'
  3398. };
  3399. var Default$2 = {
  3400. offset: 0,
  3401. flip: true,
  3402. boundary: 'scrollParent',
  3403. reference: 'toggle',
  3404. display: 'dynamic',
  3405. popperConfig: null
  3406. };
  3407. var DefaultType$2 = {
  3408. offset: '(number|string|function)',
  3409. flip: 'boolean',
  3410. boundary: '(string|element)',
  3411. reference: '(string|element)',
  3412. display: 'string',
  3413. popperConfig: '(null|object)'
  3414. };
  3415. /**
  3416. * ------------------------------------------------------------------------
  3417. * Class Definition
  3418. * ------------------------------------------------------------------------
  3419. */
  3420. var Dropdown =
  3421. /*#__PURE__*/
  3422. function () {
  3423. function Dropdown(element, config) {
  3424. this._element = element;
  3425. this._popper = null;
  3426. this._config = this._getConfig(config);
  3427. this._menu = this._getMenuElement();
  3428. this._inNavbar = this._detectNavbar();
  3429. this._addEventListeners();
  3430. } // Getters
  3431. var _proto = Dropdown.prototype;
  3432. // Public
  3433. _proto.toggle = function toggle() {
  3434. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3435. return;
  3436. }
  3437. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3438. Dropdown._clearMenus();
  3439. if (isActive) {
  3440. return;
  3441. }
  3442. this.show(true);
  3443. };
  3444. _proto.show = function show(usePopper) {
  3445. if (usePopper === void 0) {
  3446. usePopper = false;
  3447. }
  3448. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3449. return;
  3450. }
  3451. var relatedTarget = {
  3452. relatedTarget: this._element
  3453. };
  3454. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3455. var parent = Dropdown._getParentFromElement(this._element);
  3456. $(parent).trigger(showEvent);
  3457. if (showEvent.isDefaultPrevented()) {
  3458. return;
  3459. } // Disable totally Popper.js for Dropdown in Navbar
  3460. if (!this._inNavbar && usePopper) {
  3461. /**
  3462. * Check for Popper dependency
  3463. * Popper - https://popper.js.org
  3464. */
  3465. if (typeof Popper === 'undefined') {
  3466. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3467. }
  3468. var referenceElement = this._element;
  3469. if (this._config.reference === 'parent') {
  3470. referenceElement = parent;
  3471. } else if (Util.isElement(this._config.reference)) {
  3472. referenceElement = this._config.reference; // Check if it's jQuery element
  3473. if (typeof this._config.reference.jquery !== 'undefined') {
  3474. referenceElement = this._config.reference[0];
  3475. }
  3476. } // If boundary is not `scrollParent`, then set position to `static`
  3477. // to allow the menu to "escape" the scroll parent's boundaries
  3478. // https://github.com/twbs/bootstrap/issues/24251
  3479. if (this._config.boundary !== 'scrollParent') {
  3480. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3481. }
  3482. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3483. } // If this is a touch-enabled device we add extra
  3484. // empty mouseover listeners to the body's immediate children;
  3485. // only needed because of broken event delegation on iOS
  3486. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3487. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3488. $(document.body).children().on('mouseover', null, $.noop);
  3489. }
  3490. this._element.focus();
  3491. this._element.setAttribute('aria-expanded', true);
  3492. $(this._menu).toggleClass(ClassName$4.SHOW);
  3493. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3494. };
  3495. _proto.hide = function hide() {
  3496. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3497. return;
  3498. }
  3499. var relatedTarget = {
  3500. relatedTarget: this._element
  3501. };
  3502. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3503. var parent = Dropdown._getParentFromElement(this._element);
  3504. $(parent).trigger(hideEvent);
  3505. if (hideEvent.isDefaultPrevented()) {
  3506. return;
  3507. }
  3508. if (this._popper) {
  3509. this._popper.destroy();
  3510. }
  3511. $(this._menu).toggleClass(ClassName$4.SHOW);
  3512. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3513. };
  3514. _proto.dispose = function dispose() {
  3515. $.removeData(this._element, DATA_KEY$4);
  3516. $(this._element).off(EVENT_KEY$4);
  3517. this._element = null;
  3518. this._menu = null;
  3519. if (this._popper !== null) {
  3520. this._popper.destroy();
  3521. this._popper = null;
  3522. }
  3523. };
  3524. _proto.update = function update() {
  3525. this._inNavbar = this._detectNavbar();
  3526. if (this._popper !== null) {
  3527. this._popper.scheduleUpdate();
  3528. }
  3529. } // Private
  3530. ;
  3531. _proto._addEventListeners = function _addEventListeners() {
  3532. var _this = this;
  3533. $(this._element).on(Event$4.CLICK, function (event) {
  3534. event.preventDefault();
  3535. event.stopPropagation();
  3536. _this.toggle();
  3537. });
  3538. };
  3539. _proto._getConfig = function _getConfig(config) {
  3540. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3541. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3542. return config;
  3543. };
  3544. _proto._getMenuElement = function _getMenuElement() {
  3545. if (!this._menu) {
  3546. var parent = Dropdown._getParentFromElement(this._element);
  3547. if (parent) {
  3548. this._menu = parent.querySelector(Selector$4.MENU);
  3549. }
  3550. }
  3551. return this._menu;
  3552. };
  3553. _proto._getPlacement = function _getPlacement() {
  3554. var $parentDropdown = $(this._element.parentNode);
  3555. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3556. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3557. placement = AttachmentMap.TOP;
  3558. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3559. placement = AttachmentMap.TOPEND;
  3560. }
  3561. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3562. placement = AttachmentMap.RIGHT;
  3563. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3564. placement = AttachmentMap.LEFT;
  3565. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3566. placement = AttachmentMap.BOTTOMEND;
  3567. }
  3568. return placement;
  3569. };
  3570. _proto._detectNavbar = function _detectNavbar() {
  3571. return $(this._element).closest('.navbar').length > 0;
  3572. };
  3573. _proto._getOffset = function _getOffset() {
  3574. var _this2 = this;
  3575. var offset = {};
  3576. if (typeof this._config.offset === 'function') {
  3577. offset.fn = function (data) {
  3578. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3579. return data;
  3580. };
  3581. } else {
  3582. offset.offset = this._config.offset;
  3583. }
  3584. return offset;
  3585. };
  3586. _proto._getPopperConfig = function _getPopperConfig() {
  3587. var popperConfig = {
  3588. placement: this._getPlacement(),
  3589. modifiers: {
  3590. offset: this._getOffset(),
  3591. flip: {
  3592. enabled: this._config.flip
  3593. },
  3594. preventOverflow: {
  3595. boundariesElement: this._config.boundary
  3596. }
  3597. }
  3598. }; // Disable Popper.js if we have a static display
  3599. if (this._config.display === 'static') {
  3600. popperConfig.modifiers.applyStyle = {
  3601. enabled: false
  3602. };
  3603. }
  3604. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3605. } // Static
  3606. ;
  3607. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3608. return this.each(function () {
  3609. var data = $(this).data(DATA_KEY$4);
  3610. var _config = typeof config === 'object' ? config : null;
  3611. if (!data) {
  3612. data = new Dropdown(this, _config);
  3613. $(this).data(DATA_KEY$4, data);
  3614. }
  3615. if (typeof config === 'string') {
  3616. if (typeof data[config] === 'undefined') {
  3617. throw new TypeError("No method named \"" + config + "\"");
  3618. }
  3619. data[config]();
  3620. }
  3621. });
  3622. };
  3623. Dropdown._clearMenus = function _clearMenus(event) {
  3624. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3625. return;
  3626. }
  3627. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3628. for (var i = 0, len = toggles.length; i < len; i++) {
  3629. var parent = Dropdown._getParentFromElement(toggles[i]);
  3630. var context = $(toggles[i]).data(DATA_KEY$4);
  3631. var relatedTarget = {
  3632. relatedTarget: toggles[i]
  3633. };
  3634. if (event && event.type === 'click') {
  3635. relatedTarget.clickEvent = event;
  3636. }
  3637. if (!context) {
  3638. continue;
  3639. }
  3640. var dropdownMenu = context._menu;
  3641. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3642. continue;
  3643. }
  3644. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3645. continue;
  3646. }
  3647. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3648. $(parent).trigger(hideEvent);
  3649. if (hideEvent.isDefaultPrevented()) {
  3650. continue;
  3651. } // If this is a touch-enabled device we remove the extra
  3652. // empty mouseover listeners we added for iOS support
  3653. if ('ontouchstart' in document.documentElement) {
  3654. $(document.body).children().off('mouseover', null, $.noop);
  3655. }
  3656. toggles[i].setAttribute('aria-expanded', 'false');
  3657. if (context._popper) {
  3658. context._popper.destroy();
  3659. }
  3660. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3661. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3662. }
  3663. };
  3664. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3665. var parent;
  3666. var selector = Util.getSelectorFromElement(element);
  3667. if (selector) {
  3668. parent = document.querySelector(selector);
  3669. }
  3670. return parent || element.parentNode;
  3671. } // eslint-disable-next-line complexity
  3672. ;
  3673. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3674. // If not input/textarea:
  3675. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3676. // If input/textarea:
  3677. // - If space key => not a dropdown command
  3678. // - If key is other than escape
  3679. // - If key is not up or down => not a dropdown command
  3680. // - If trigger inside the menu => not a dropdown command
  3681. 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)) {
  3682. return;
  3683. }
  3684. event.preventDefault();
  3685. event.stopPropagation();
  3686. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3687. return;
  3688. }
  3689. var parent = Dropdown._getParentFromElement(this);
  3690. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3691. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3692. return;
  3693. }
  3694. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3695. if (event.which === ESCAPE_KEYCODE) {
  3696. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3697. $(toggle).trigger('focus');
  3698. }
  3699. $(this).trigger('click');
  3700. return;
  3701. }
  3702. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3703. return $(item).is(':visible');
  3704. });
  3705. if (items.length === 0) {
  3706. return;
  3707. }
  3708. var index = items.indexOf(event.target);
  3709. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3710. // Up
  3711. index--;
  3712. }
  3713. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3714. // Down
  3715. index++;
  3716. }
  3717. if (index < 0) {
  3718. index = 0;
  3719. }
  3720. items[index].focus();
  3721. };
  3722. _createClass(Dropdown, null, [{
  3723. key: "VERSION",
  3724. get: function get() {
  3725. return VERSION$4;
  3726. }
  3727. }, {
  3728. key: "Default",
  3729. get: function get() {
  3730. return Default$2;
  3731. }
  3732. }, {
  3733. key: "DefaultType",
  3734. get: function get() {
  3735. return DefaultType$2;
  3736. }
  3737. }]);
  3738. return Dropdown;
  3739. }();
  3740. /**
  3741. * ------------------------------------------------------------------------
  3742. * Data Api implementation
  3743. * ------------------------------------------------------------------------
  3744. */
  3745. $(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) {
  3746. event.preventDefault();
  3747. event.stopPropagation();
  3748. Dropdown._jQueryInterface.call($(this), 'toggle');
  3749. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3750. e.stopPropagation();
  3751. });
  3752. /**
  3753. * ------------------------------------------------------------------------
  3754. * jQuery
  3755. * ------------------------------------------------------------------------
  3756. */
  3757. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3758. $.fn[NAME$4].Constructor = Dropdown;
  3759. $.fn[NAME$4].noConflict = function () {
  3760. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3761. return Dropdown._jQueryInterface;
  3762. };
  3763. /**
  3764. * ------------------------------------------------------------------------
  3765. * Constants
  3766. * ------------------------------------------------------------------------
  3767. */
  3768. var NAME$5 = 'modal';
  3769. var VERSION$5 = '4.4.1';
  3770. var DATA_KEY$5 = 'bs.modal';
  3771. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3772. var DATA_API_KEY$5 = '.data-api';
  3773. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3774. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3775. var Default$3 = {
  3776. backdrop: true,
  3777. keyboard: true,
  3778. focus: true,
  3779. show: true
  3780. };
  3781. var DefaultType$3 = {
  3782. backdrop: '(boolean|string)',
  3783. keyboard: 'boolean',
  3784. focus: 'boolean',
  3785. show: 'boolean'
  3786. };
  3787. var Event$5 = {
  3788. HIDE: "hide" + EVENT_KEY$5,
  3789. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3790. HIDDEN: "hidden" + EVENT_KEY$5,
  3791. SHOW: "show" + EVENT_KEY$5,
  3792. SHOWN: "shown" + EVENT_KEY$5,
  3793. FOCUSIN: "focusin" + EVENT_KEY$5,
  3794. RESIZE: "resize" + EVENT_KEY$5,
  3795. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3796. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3797. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3798. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3799. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3800. };
  3801. var ClassName$5 = {
  3802. SCROLLABLE: 'modal-dialog-scrollable',
  3803. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3804. BACKDROP: 'modal-backdrop',
  3805. OPEN: 'modal-open',
  3806. FADE: 'fade',
  3807. SHOW: 'show',
  3808. STATIC: 'modal-static'
  3809. };
  3810. var Selector$5 = {
  3811. DIALOG: '.modal-dialog',
  3812. MODAL_BODY: '.modal-body',
  3813. DATA_TOGGLE: '[data-toggle="modal"]',
  3814. DATA_DISMISS: '[data-dismiss="modal"]',
  3815. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3816. STICKY_CONTENT: '.sticky-top'
  3817. };
  3818. /**
  3819. * ------------------------------------------------------------------------
  3820. * Class Definition
  3821. * ------------------------------------------------------------------------
  3822. */
  3823. var Modal =
  3824. /*#__PURE__*/
  3825. function () {
  3826. function Modal(element, config) {
  3827. this._config = this._getConfig(config);
  3828. this._element = element;
  3829. this._dialog = element.querySelector(Selector$5.DIALOG);
  3830. this._backdrop = null;
  3831. this._isShown = false;
  3832. this._isBodyOverflowing = false;
  3833. this._ignoreBackdropClick = false;
  3834. this._isTransitioning = false;
  3835. this._scrollbarWidth = 0;
  3836. } // Getters
  3837. var _proto = Modal.prototype;
  3838. // Public
  3839. _proto.toggle = function toggle(relatedTarget) {
  3840. return this._isShown ? this.hide() : this.show(relatedTarget);
  3841. };
  3842. _proto.show = function show(relatedTarget) {
  3843. var _this = this;
  3844. if (this._isShown || this._isTransitioning) {
  3845. return;
  3846. }
  3847. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3848. this._isTransitioning = true;
  3849. }
  3850. var showEvent = $.Event(Event$5.SHOW, {
  3851. relatedTarget: relatedTarget
  3852. });
  3853. $(this._element).trigger(showEvent);
  3854. if (this._isShown || showEvent.isDefaultPrevented()) {
  3855. return;
  3856. }
  3857. this._isShown = true;
  3858. this._checkScrollbar();
  3859. this._setScrollbar();
  3860. this._adjustDialog();
  3861. this._setEscapeEvent();
  3862. this._setResizeEvent();
  3863. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3864. return _this.hide(event);
  3865. });
  3866. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3867. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3868. if ($(event.target).is(_this._element)) {
  3869. _this._ignoreBackdropClick = true;
  3870. }
  3871. });
  3872. });
  3873. this._showBackdrop(function () {
  3874. return _this._showElement(relatedTarget);
  3875. });
  3876. };
  3877. _proto.hide = function hide(event) {
  3878. var _this2 = this;
  3879. if (event) {
  3880. event.preventDefault();
  3881. }
  3882. if (!this._isShown || this._isTransitioning) {
  3883. return;
  3884. }
  3885. var hideEvent = $.Event(Event$5.HIDE);
  3886. $(this._element).trigger(hideEvent);
  3887. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3888. return;
  3889. }
  3890. this._isShown = false;
  3891. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3892. if (transition) {
  3893. this._isTransitioning = true;
  3894. }
  3895. this._setEscapeEvent();
  3896. this._setResizeEvent();
  3897. $(document).off(Event$5.FOCUSIN);
  3898. $(this._element).removeClass(ClassName$5.SHOW);
  3899. $(this._element).off(Event$5.CLICK_DISMISS);
  3900. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3901. if (transition) {
  3902. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3903. $(this._element).one(Util.TRANSITION_END, function (event) {
  3904. return _this2._hideModal(event);
  3905. }).emulateTransitionEnd(transitionDuration);
  3906. } else {
  3907. this._hideModal();
  3908. }
  3909. };
  3910. _proto.dispose = function dispose() {
  3911. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3912. return $(htmlElement).off(EVENT_KEY$5);
  3913. });
  3914. /**
  3915. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3916. * Do not move `document` in `htmlElements` array
  3917. * It will remove `Event.CLICK_DATA_API` event that should remain
  3918. */
  3919. $(document).off(Event$5.FOCUSIN);
  3920. $.removeData(this._element, DATA_KEY$5);
  3921. this._config = null;
  3922. this._element = null;
  3923. this._dialog = null;
  3924. this._backdrop = null;
  3925. this._isShown = null;
  3926. this._isBodyOverflowing = null;
  3927. this._ignoreBackdropClick = null;
  3928. this._isTransitioning = null;
  3929. this._scrollbarWidth = null;
  3930. };
  3931. _proto.handleUpdate = function handleUpdate() {
  3932. this._adjustDialog();
  3933. } // Private
  3934. ;
  3935. _proto._getConfig = function _getConfig(config) {
  3936. config = _objectSpread2({}, Default$3, {}, config);
  3937. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3938. return config;
  3939. };
  3940. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3941. var _this3 = this;
  3942. if (this._config.backdrop === 'static') {
  3943. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3944. $(this._element).trigger(hideEventPrevented);
  3945. if (hideEventPrevented.defaultPrevented) {
  3946. return;
  3947. }
  3948. this._element.classList.add(ClassName$5.STATIC);
  3949. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3950. $(this._element).one(Util.TRANSITION_END, function () {
  3951. _this3._element.classList.remove(ClassName$5.STATIC);
  3952. }).emulateTransitionEnd(modalTransitionDuration);
  3953. this._element.focus();
  3954. } else {
  3955. this.hide();
  3956. }
  3957. };
  3958. _proto._showElement = function _showElement(relatedTarget) {
  3959. var _this4 = this;
  3960. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3961. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3962. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3963. // Don't move modal's DOM position
  3964. document.body.appendChild(this._element);
  3965. }
  3966. this._element.style.display = 'block';
  3967. this._element.removeAttribute('aria-hidden');
  3968. this._element.setAttribute('aria-modal', true);
  3969. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3970. modalBody.scrollTop = 0;
  3971. } else {
  3972. this._element.scrollTop = 0;
  3973. }
  3974. if (transition) {
  3975. Util.reflow(this._element);
  3976. }
  3977. $(this._element).addClass(ClassName$5.SHOW);
  3978. if (this._config.focus) {
  3979. this._enforceFocus();
  3980. }
  3981. var shownEvent = $.Event(Event$5.SHOWN, {
  3982. relatedTarget: relatedTarget
  3983. });
  3984. var transitionComplete = function transitionComplete() {
  3985. if (_this4._config.focus) {
  3986. _this4._element.focus();
  3987. }
  3988. _this4._isTransitioning = false;
  3989. $(_this4._element).trigger(shownEvent);
  3990. };
  3991. if (transition) {
  3992. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3993. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3994. } else {
  3995. transitionComplete();
  3996. }
  3997. };
  3998. _proto._enforceFocus = function _enforceFocus() {
  3999. var _this5 = this;
  4000. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4001. .on(Event$5.FOCUSIN, function (event) {
  4002. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4003. _this5._element.focus();
  4004. }
  4005. });
  4006. };
  4007. _proto._setEscapeEvent = function _setEscapeEvent() {
  4008. var _this6 = this;
  4009. if (this._isShown && this._config.keyboard) {
  4010. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4011. if (event.which === ESCAPE_KEYCODE$1) {
  4012. _this6._triggerBackdropTransition();
  4013. }
  4014. });
  4015. } else if (!this._isShown) {
  4016. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4017. }
  4018. };
  4019. _proto._setResizeEvent = function _setResizeEvent() {
  4020. var _this7 = this;
  4021. if (this._isShown) {
  4022. $(window).on(Event$5.RESIZE, function (event) {
  4023. return _this7.handleUpdate(event);
  4024. });
  4025. } else {
  4026. $(window).off(Event$5.RESIZE);
  4027. }
  4028. };
  4029. _proto._hideModal = function _hideModal() {
  4030. var _this8 = this;
  4031. this._element.style.display = 'none';
  4032. this._element.setAttribute('aria-hidden', true);
  4033. this._element.removeAttribute('aria-modal');
  4034. this._isTransitioning = false;
  4035. this._showBackdrop(function () {
  4036. $(document.body).removeClass(ClassName$5.OPEN);
  4037. _this8._resetAdjustments();
  4038. _this8._resetScrollbar();
  4039. $(_this8._element).trigger(Event$5.HIDDEN);
  4040. });
  4041. };
  4042. _proto._removeBackdrop = function _removeBackdrop() {
  4043. if (this._backdrop) {
  4044. $(this._backdrop).remove();
  4045. this._backdrop = null;
  4046. }
  4047. };
  4048. _proto._showBackdrop = function _showBackdrop(callback) {
  4049. var _this9 = this;
  4050. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4051. if (this._isShown && this._config.backdrop) {
  4052. this._backdrop = document.createElement('div');
  4053. this._backdrop.className = ClassName$5.BACKDROP;
  4054. if (animate) {
  4055. this._backdrop.classList.add(animate);
  4056. }
  4057. $(this._backdrop).appendTo(document.body);
  4058. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4059. if (_this9._ignoreBackdropClick) {
  4060. _this9._ignoreBackdropClick = false;
  4061. return;
  4062. }
  4063. if (event.target !== event.currentTarget) {
  4064. return;
  4065. }
  4066. _this9._triggerBackdropTransition();
  4067. });
  4068. if (animate) {
  4069. Util.reflow(this._backdrop);
  4070. }
  4071. $(this._backdrop).addClass(ClassName$5.SHOW);
  4072. if (!callback) {
  4073. return;
  4074. }
  4075. if (!animate) {
  4076. callback();
  4077. return;
  4078. }
  4079. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4080. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4081. } else if (!this._isShown && this._backdrop) {
  4082. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4083. var callbackRemove = function callbackRemove() {
  4084. _this9._removeBackdrop();
  4085. if (callback) {
  4086. callback();
  4087. }
  4088. };
  4089. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4090. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4091. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4092. } else {
  4093. callbackRemove();
  4094. }
  4095. } else if (callback) {
  4096. callback();
  4097. }
  4098. } // ----------------------------------------------------------------------
  4099. // the following methods are used to handle overflowing modals
  4100. // todo (fat): these should probably be refactored out of modal.js
  4101. // ----------------------------------------------------------------------
  4102. ;
  4103. _proto._adjustDialog = function _adjustDialog() {
  4104. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4105. if (!this._isBodyOverflowing && isModalOverflowing) {
  4106. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4107. }
  4108. if (this._isBodyOverflowing && !isModalOverflowing) {
  4109. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4110. }
  4111. };
  4112. _proto._resetAdjustments = function _resetAdjustments() {
  4113. this._element.style.paddingLeft = '';
  4114. this._element.style.paddingRight = '';
  4115. };
  4116. _proto._checkScrollbar = function _checkScrollbar() {
  4117. var rect = document.body.getBoundingClientRect();
  4118. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4119. this._scrollbarWidth = this._getScrollbarWidth();
  4120. };
  4121. _proto._setScrollbar = function _setScrollbar() {
  4122. var _this10 = this;
  4123. if (this._isBodyOverflowing) {
  4124. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4125. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4126. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4127. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4128. $(fixedContent).each(function (index, element) {
  4129. var actualPadding = element.style.paddingRight;
  4130. var calculatedPadding = $(element).css('padding-right');
  4131. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4132. }); // Adjust sticky content margin
  4133. $(stickyContent).each(function (index, element) {
  4134. var actualMargin = element.style.marginRight;
  4135. var calculatedMargin = $(element).css('margin-right');
  4136. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4137. }); // Adjust body padding
  4138. var actualPadding = document.body.style.paddingRight;
  4139. var calculatedPadding = $(document.body).css('padding-right');
  4140. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4141. }
  4142. $(document.body).addClass(ClassName$5.OPEN);
  4143. };
  4144. _proto._resetScrollbar = function _resetScrollbar() {
  4145. // Restore fixed content padding
  4146. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4147. $(fixedContent).each(function (index, element) {
  4148. var padding = $(element).data('padding-right');
  4149. $(element).removeData('padding-right');
  4150. element.style.paddingRight = padding ? padding : '';
  4151. }); // Restore sticky content
  4152. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4153. $(elements).each(function (index, element) {
  4154. var margin = $(element).data('margin-right');
  4155. if (typeof margin !== 'undefined') {
  4156. $(element).css('margin-right', margin).removeData('margin-right');
  4157. }
  4158. }); // Restore body padding
  4159. var padding = $(document.body).data('padding-right');
  4160. $(document.body).removeData('padding-right');
  4161. document.body.style.paddingRight = padding ? padding : '';
  4162. };
  4163. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4164. // thx d.walsh
  4165. var scrollDiv = document.createElement('div');
  4166. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4167. document.body.appendChild(scrollDiv);
  4168. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4169. document.body.removeChild(scrollDiv);
  4170. return scrollbarWidth;
  4171. } // Static
  4172. ;
  4173. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4174. return this.each(function () {
  4175. var data = $(this).data(DATA_KEY$5);
  4176. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4177. if (!data) {
  4178. data = new Modal(this, _config);
  4179. $(this).data(DATA_KEY$5, data);
  4180. }
  4181. if (typeof config === 'string') {
  4182. if (typeof data[config] === 'undefined') {
  4183. throw new TypeError("No method named \"" + config + "\"");
  4184. }
  4185. data[config](relatedTarget);
  4186. } else if (_config.show) {
  4187. data.show(relatedTarget);
  4188. }
  4189. });
  4190. };
  4191. _createClass(Modal, null, [{
  4192. key: "VERSION",
  4193. get: function get() {
  4194. return VERSION$5;
  4195. }
  4196. }, {
  4197. key: "Default",
  4198. get: function get() {
  4199. return Default$3;
  4200. }
  4201. }]);
  4202. return Modal;
  4203. }();
  4204. /**
  4205. * ------------------------------------------------------------------------
  4206. * Data Api implementation
  4207. * ------------------------------------------------------------------------
  4208. */
  4209. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4210. var _this11 = this;
  4211. var target;
  4212. var selector = Util.getSelectorFromElement(this);
  4213. if (selector) {
  4214. target = document.querySelector(selector);
  4215. }
  4216. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4217. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4218. event.preventDefault();
  4219. }
  4220. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4221. if (showEvent.isDefaultPrevented()) {
  4222. // Only register focus restorer if modal will actually get shown
  4223. return;
  4224. }
  4225. $target.one(Event$5.HIDDEN, function () {
  4226. if ($(_this11).is(':visible')) {
  4227. _this11.focus();
  4228. }
  4229. });
  4230. });
  4231. Modal._jQueryInterface.call($(target), config, this);
  4232. });
  4233. /**
  4234. * ------------------------------------------------------------------------
  4235. * jQuery
  4236. * ------------------------------------------------------------------------
  4237. */
  4238. $.fn[NAME$5] = Modal._jQueryInterface;
  4239. $.fn[NAME$5].Constructor = Modal;
  4240. $.fn[NAME$5].noConflict = function () {
  4241. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4242. return Modal._jQueryInterface;
  4243. };
  4244. /**
  4245. * --------------------------------------------------------------------------
  4246. * Bootstrap (v4.4.1): tools/sanitizer.js
  4247. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4248. * --------------------------------------------------------------------------
  4249. */
  4250. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4251. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4252. var DefaultWhitelist = {
  4253. // Global attributes allowed on any supplied element below.
  4254. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4255. a: ['target', 'href', 'title', 'rel'],
  4256. area: [],
  4257. b: [],
  4258. br: [],
  4259. col: [],
  4260. code: [],
  4261. div: [],
  4262. em: [],
  4263. hr: [],
  4264. h1: [],
  4265. h2: [],
  4266. h3: [],
  4267. h4: [],
  4268. h5: [],
  4269. h6: [],
  4270. i: [],
  4271. img: ['src', 'alt', 'title', 'width', 'height'],
  4272. li: [],
  4273. ol: [],
  4274. p: [],
  4275. pre: [],
  4276. s: [],
  4277. small: [],
  4278. span: [],
  4279. sub: [],
  4280. sup: [],
  4281. strong: [],
  4282. u: [],
  4283. ul: []
  4284. };
  4285. /**
  4286. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4287. *
  4288. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4289. */
  4290. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4291. /**
  4292. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4293. *
  4294. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4295. */
  4296. 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;
  4297. function allowedAttribute(attr, allowedAttributeList) {
  4298. var attrName = attr.nodeName.toLowerCase();
  4299. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4300. if (uriAttrs.indexOf(attrName) !== -1) {
  4301. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4302. }
  4303. return true;
  4304. }
  4305. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4306. return attrRegex instanceof RegExp;
  4307. }); // Check if a regular expression validates the attribute.
  4308. for (var i = 0, l = regExp.length; i < l; i++) {
  4309. if (attrName.match(regExp[i])) {
  4310. return true;
  4311. }
  4312. }
  4313. return false;
  4314. }
  4315. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4316. if (unsafeHtml.length === 0) {
  4317. return unsafeHtml;
  4318. }
  4319. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4320. return sanitizeFn(unsafeHtml);
  4321. }
  4322. var domParser = new window.DOMParser();
  4323. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4324. var whitelistKeys = Object.keys(whiteList);
  4325. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4326. var _loop = function _loop(i, len) {
  4327. var el = elements[i];
  4328. var elName = el.nodeName.toLowerCase();
  4329. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4330. el.parentNode.removeChild(el);
  4331. return "continue";
  4332. }
  4333. var attributeList = [].slice.call(el.attributes);
  4334. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4335. attributeList.forEach(function (attr) {
  4336. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4337. el.removeAttribute(attr.nodeName);
  4338. }
  4339. });
  4340. };
  4341. for (var i = 0, len = elements.length; i < len; i++) {
  4342. var _ret = _loop(i);
  4343. if (_ret === "continue") continue;
  4344. }
  4345. return createdDocument.body.innerHTML;
  4346. }
  4347. /**
  4348. * ------------------------------------------------------------------------
  4349. * Constants
  4350. * ------------------------------------------------------------------------
  4351. */
  4352. var NAME$6 = 'tooltip';
  4353. var VERSION$6 = '4.4.1';
  4354. var DATA_KEY$6 = 'bs.tooltip';
  4355. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4356. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4357. var CLASS_PREFIX = 'bs-tooltip';
  4358. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4359. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4360. var DefaultType$4 = {
  4361. animation: 'boolean',
  4362. template: 'string',
  4363. title: '(string|element|function)',
  4364. trigger: 'string',
  4365. delay: '(number|object)',
  4366. html: 'boolean',
  4367. selector: '(string|boolean)',
  4368. placement: '(string|function)',
  4369. offset: '(number|string|function)',
  4370. container: '(string|element|boolean)',
  4371. fallbackPlacement: '(string|array)',
  4372. boundary: '(string|element)',
  4373. sanitize: 'boolean',
  4374. sanitizeFn: '(null|function)',
  4375. whiteList: 'object',
  4376. popperConfig: '(null|object)'
  4377. };
  4378. var AttachmentMap$1 = {
  4379. AUTO: 'auto',
  4380. TOP: 'top',
  4381. RIGHT: 'right',
  4382. BOTTOM: 'bottom',
  4383. LEFT: 'left'
  4384. };
  4385. var Default$4 = {
  4386. animation: true,
  4387. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4388. trigger: 'hover focus',
  4389. title: '',
  4390. delay: 0,
  4391. html: false,
  4392. selector: false,
  4393. placement: 'top',
  4394. offset: 0,
  4395. container: false,
  4396. fallbackPlacement: 'flip',
  4397. boundary: 'scrollParent',
  4398. sanitize: true,
  4399. sanitizeFn: null,
  4400. whiteList: DefaultWhitelist,
  4401. popperConfig: null
  4402. };
  4403. var HoverState = {
  4404. SHOW: 'show',
  4405. OUT: 'out'
  4406. };
  4407. var Event$6 = {
  4408. HIDE: "hide" + EVENT_KEY$6,
  4409. HIDDEN: "hidden" + EVENT_KEY$6,
  4410. SHOW: "show" + EVENT_KEY$6,
  4411. SHOWN: "shown" + EVENT_KEY$6,
  4412. INSERTED: "inserted" + EVENT_KEY$6,
  4413. CLICK: "click" + EVENT_KEY$6,
  4414. FOCUSIN: "focusin" + EVENT_KEY$6,
  4415. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4416. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4417. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4418. };
  4419. var ClassName$6 = {
  4420. FADE: 'fade',
  4421. SHOW: 'show'
  4422. };
  4423. var Selector$6 = {
  4424. TOOLTIP: '.tooltip',
  4425. TOOLTIP_INNER: '.tooltip-inner',
  4426. ARROW: '.arrow'
  4427. };
  4428. var Trigger = {
  4429. HOVER: 'hover',
  4430. FOCUS: 'focus',
  4431. CLICK: 'click',
  4432. MANUAL: 'manual'
  4433. };
  4434. /**
  4435. * ------------------------------------------------------------------------
  4436. * Class Definition
  4437. * ------------------------------------------------------------------------
  4438. */
  4439. var Tooltip =
  4440. /*#__PURE__*/
  4441. function () {
  4442. function Tooltip(element, config) {
  4443. if (typeof Popper === 'undefined') {
  4444. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4445. } // private
  4446. this._isEnabled = true;
  4447. this._timeout = 0;
  4448. this._hoverState = '';
  4449. this._activeTrigger = {};
  4450. this._popper = null; // Protected
  4451. this.element = element;
  4452. this.config = this._getConfig(config);
  4453. this.tip = null;
  4454. this._setListeners();
  4455. } // Getters
  4456. var _proto = Tooltip.prototype;
  4457. // Public
  4458. _proto.enable = function enable() {
  4459. this._isEnabled = true;
  4460. };
  4461. _proto.disable = function disable() {
  4462. this._isEnabled = false;
  4463. };
  4464. _proto.toggleEnabled = function toggleEnabled() {
  4465. this._isEnabled = !this._isEnabled;
  4466. };
  4467. _proto.toggle = function toggle(event) {
  4468. if (!this._isEnabled) {
  4469. return;
  4470. }
  4471. if (event) {
  4472. var dataKey = this.constructor.DATA_KEY;
  4473. var context = $(event.currentTarget).data(dataKey);
  4474. if (!context) {
  4475. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4476. $(event.currentTarget).data(dataKey, context);
  4477. }
  4478. context._activeTrigger.click = !context._activeTrigger.click;
  4479. if (context._isWithActiveTrigger()) {
  4480. context._enter(null, context);
  4481. } else {
  4482. context._leave(null, context);
  4483. }
  4484. } else {
  4485. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4486. this._leave(null, this);
  4487. return;
  4488. }
  4489. this._enter(null, this);
  4490. }
  4491. };
  4492. _proto.dispose = function dispose() {
  4493. clearTimeout(this._timeout);
  4494. $.removeData(this.element, this.constructor.DATA_KEY);
  4495. $(this.element).off(this.constructor.EVENT_KEY);
  4496. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4497. if (this.tip) {
  4498. $(this.tip).remove();
  4499. }
  4500. this._isEnabled = null;
  4501. this._timeout = null;
  4502. this._hoverState = null;
  4503. this._activeTrigger = null;
  4504. if (this._popper) {
  4505. this._popper.destroy();
  4506. }
  4507. this._popper = null;
  4508. this.element = null;
  4509. this.config = null;
  4510. this.tip = null;
  4511. };
  4512. _proto.show = function show() {
  4513. var _this = this;
  4514. if ($(this.element).css('display') === 'none') {
  4515. throw new Error('Please use show on visible elements');
  4516. }
  4517. var showEvent = $.Event(this.constructor.Event.SHOW);
  4518. if (this.isWithContent() && this._isEnabled) {
  4519. $(this.element).trigger(showEvent);
  4520. var shadowRoot = Util.findShadowRoot(this.element);
  4521. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4522. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4523. return;
  4524. }
  4525. var tip = this.getTipElement();
  4526. var tipId = Util.getUID(this.constructor.NAME);
  4527. tip.setAttribute('id', tipId);
  4528. this.element.setAttribute('aria-describedby', tipId);
  4529. this.setContent();
  4530. if (this.config.animation) {
  4531. $(tip).addClass(ClassName$6.FADE);
  4532. }
  4533. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4534. var attachment = this._getAttachment(placement);
  4535. this.addAttachmentClass(attachment);
  4536. var container = this._getContainer();
  4537. $(tip).data(this.constructor.DATA_KEY, this);
  4538. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4539. $(tip).appendTo(container);
  4540. }
  4541. $(this.element).trigger(this.constructor.Event.INSERTED);
  4542. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4543. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4544. // empty mouseover listeners to the body's immediate children;
  4545. // only needed because of broken event delegation on iOS
  4546. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4547. if ('ontouchstart' in document.documentElement) {
  4548. $(document.body).children().on('mouseover', null, $.noop);
  4549. }
  4550. var complete = function complete() {
  4551. if (_this.config.animation) {
  4552. _this._fixTransition();
  4553. }
  4554. var prevHoverState = _this._hoverState;
  4555. _this._hoverState = null;
  4556. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4557. if (prevHoverState === HoverState.OUT) {
  4558. _this._leave(null, _this);
  4559. }
  4560. };
  4561. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4562. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4563. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4564. } else {
  4565. complete();
  4566. }
  4567. }
  4568. };
  4569. _proto.hide = function hide(callback) {
  4570. var _this2 = this;
  4571. var tip = this.getTipElement();
  4572. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4573. var complete = function complete() {
  4574. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4575. tip.parentNode.removeChild(tip);
  4576. }
  4577. _this2._cleanTipClass();
  4578. _this2.element.removeAttribute('aria-describedby');
  4579. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4580. if (_this2._popper !== null) {
  4581. _this2._popper.destroy();
  4582. }
  4583. if (callback) {
  4584. callback();
  4585. }
  4586. };
  4587. $(this.element).trigger(hideEvent);
  4588. if (hideEvent.isDefaultPrevented()) {
  4589. return;
  4590. }
  4591. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4592. // empty mouseover listeners we added for iOS support
  4593. if ('ontouchstart' in document.documentElement) {
  4594. $(document.body).children().off('mouseover', null, $.noop);
  4595. }
  4596. this._activeTrigger[Trigger.CLICK] = false;
  4597. this._activeTrigger[Trigger.FOCUS] = false;
  4598. this._activeTrigger[Trigger.HOVER] = false;
  4599. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4600. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4601. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4602. } else {
  4603. complete();
  4604. }
  4605. this._hoverState = '';
  4606. };
  4607. _proto.update = function update() {
  4608. if (this._popper !== null) {
  4609. this._popper.scheduleUpdate();
  4610. }
  4611. } // Protected
  4612. ;
  4613. _proto.isWithContent = function isWithContent() {
  4614. return Boolean(this.getTitle());
  4615. };
  4616. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4617. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4618. };
  4619. _proto.getTipElement = function getTipElement() {
  4620. this.tip = this.tip || $(this.config.template)[0];
  4621. return this.tip;
  4622. };
  4623. _proto.setContent = function setContent() {
  4624. var tip = this.getTipElement();
  4625. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4626. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4627. };
  4628. _proto.setElementContent = function setElementContent($element, content) {
  4629. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4630. // Content is a DOM node or a jQuery
  4631. if (this.config.html) {
  4632. if (!$(content).parent().is($element)) {
  4633. $element.empty().append(content);
  4634. }
  4635. } else {
  4636. $element.text($(content).text());
  4637. }
  4638. return;
  4639. }
  4640. if (this.config.html) {
  4641. if (this.config.sanitize) {
  4642. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4643. }
  4644. $element.html(content);
  4645. } else {
  4646. $element.text(content);
  4647. }
  4648. };
  4649. _proto.getTitle = function getTitle() {
  4650. var title = this.element.getAttribute('data-original-title');
  4651. if (!title) {
  4652. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4653. }
  4654. return title;
  4655. } // Private
  4656. ;
  4657. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4658. var _this3 = this;
  4659. var defaultBsConfig = {
  4660. placement: attachment,
  4661. modifiers: {
  4662. offset: this._getOffset(),
  4663. flip: {
  4664. behavior: this.config.fallbackPlacement
  4665. },
  4666. arrow: {
  4667. element: Selector$6.ARROW
  4668. },
  4669. preventOverflow: {
  4670. boundariesElement: this.config.boundary
  4671. }
  4672. },
  4673. onCreate: function onCreate(data) {
  4674. if (data.originalPlacement !== data.placement) {
  4675. _this3._handlePopperPlacementChange(data);
  4676. }
  4677. },
  4678. onUpdate: function onUpdate(data) {
  4679. return _this3._handlePopperPlacementChange(data);
  4680. }
  4681. };
  4682. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4683. };
  4684. _proto._getOffset = function _getOffset() {
  4685. var _this4 = this;
  4686. var offset = {};
  4687. if (typeof this.config.offset === 'function') {
  4688. offset.fn = function (data) {
  4689. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4690. return data;
  4691. };
  4692. } else {
  4693. offset.offset = this.config.offset;
  4694. }
  4695. return offset;
  4696. };
  4697. _proto._getContainer = function _getContainer() {
  4698. if (this.config.container === false) {
  4699. return document.body;
  4700. }
  4701. if (Util.isElement(this.config.container)) {
  4702. return $(this.config.container);
  4703. }
  4704. return $(document).find(this.config.container);
  4705. };
  4706. _proto._getAttachment = function _getAttachment(placement) {
  4707. return AttachmentMap$1[placement.toUpperCase()];
  4708. };
  4709. _proto._setListeners = function _setListeners() {
  4710. var _this5 = this;
  4711. var triggers = this.config.trigger.split(' ');
  4712. triggers.forEach(function (trigger) {
  4713. if (trigger === 'click') {
  4714. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4715. return _this5.toggle(event);
  4716. });
  4717. } else if (trigger !== Trigger.MANUAL) {
  4718. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4719. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4720. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4721. return _this5._enter(event);
  4722. }).on(eventOut, _this5.config.selector, function (event) {
  4723. return _this5._leave(event);
  4724. });
  4725. }
  4726. });
  4727. this._hideModalHandler = function () {
  4728. if (_this5.element) {
  4729. _this5.hide();
  4730. }
  4731. };
  4732. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4733. if (this.config.selector) {
  4734. this.config = _objectSpread2({}, this.config, {
  4735. trigger: 'manual',
  4736. selector: ''
  4737. });
  4738. } else {
  4739. this._fixTitle();
  4740. }
  4741. };
  4742. _proto._fixTitle = function _fixTitle() {
  4743. var titleType = typeof this.element.getAttribute('data-original-title');
  4744. if (this.element.getAttribute('title') || titleType !== 'string') {
  4745. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4746. this.element.setAttribute('title', '');
  4747. }
  4748. };
  4749. _proto._enter = function _enter(event, context) {
  4750. var dataKey = this.constructor.DATA_KEY;
  4751. context = context || $(event.currentTarget).data(dataKey);
  4752. if (!context) {
  4753. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4754. $(event.currentTarget).data(dataKey, context);
  4755. }
  4756. if (event) {
  4757. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4758. }
  4759. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4760. context._hoverState = HoverState.SHOW;
  4761. return;
  4762. }
  4763. clearTimeout(context._timeout);
  4764. context._hoverState = HoverState.SHOW;
  4765. if (!context.config.delay || !context.config.delay.show) {
  4766. context.show();
  4767. return;
  4768. }
  4769. context._timeout = setTimeout(function () {
  4770. if (context._hoverState === HoverState.SHOW) {
  4771. context.show();
  4772. }
  4773. }, context.config.delay.show);
  4774. };
  4775. _proto._leave = function _leave(event, context) {
  4776. var dataKey = this.constructor.DATA_KEY;
  4777. context = context || $(event.currentTarget).data(dataKey);
  4778. if (!context) {
  4779. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4780. $(event.currentTarget).data(dataKey, context);
  4781. }
  4782. if (event) {
  4783. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4784. }
  4785. if (context._isWithActiveTrigger()) {
  4786. return;
  4787. }
  4788. clearTimeout(context._timeout);
  4789. context._hoverState = HoverState.OUT;
  4790. if (!context.config.delay || !context.config.delay.hide) {
  4791. context.hide();
  4792. return;
  4793. }
  4794. context._timeout = setTimeout(function () {
  4795. if (context._hoverState === HoverState.OUT) {
  4796. context.hide();
  4797. }
  4798. }, context.config.delay.hide);
  4799. };
  4800. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4801. for (var trigger in this._activeTrigger) {
  4802. if (this._activeTrigger[trigger]) {
  4803. return true;
  4804. }
  4805. }
  4806. return false;
  4807. };
  4808. _proto._getConfig = function _getConfig(config) {
  4809. var dataAttributes = $(this.element).data();
  4810. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4811. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4812. delete dataAttributes[dataAttr];
  4813. }
  4814. });
  4815. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4816. if (typeof config.delay === 'number') {
  4817. config.delay = {
  4818. show: config.delay,
  4819. hide: config.delay
  4820. };
  4821. }
  4822. if (typeof config.title === 'number') {
  4823. config.title = config.title.toString();
  4824. }
  4825. if (typeof config.content === 'number') {
  4826. config.content = config.content.toString();
  4827. }
  4828. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4829. if (config.sanitize) {
  4830. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4831. }
  4832. return config;
  4833. };
  4834. _proto._getDelegateConfig = function _getDelegateConfig() {
  4835. var config = {};
  4836. if (this.config) {
  4837. for (var key in this.config) {
  4838. if (this.constructor.Default[key] !== this.config[key]) {
  4839. config[key] = this.config[key];
  4840. }
  4841. }
  4842. }
  4843. return config;
  4844. };
  4845. _proto._cleanTipClass = function _cleanTipClass() {
  4846. var $tip = $(this.getTipElement());
  4847. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4848. if (tabClass !== null && tabClass.length) {
  4849. $tip.removeClass(tabClass.join(''));
  4850. }
  4851. };
  4852. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4853. var popperInstance = popperData.instance;
  4854. this.tip = popperInstance.popper;
  4855. this._cleanTipClass();
  4856. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4857. };
  4858. _proto._fixTransition = function _fixTransition() {
  4859. var tip = this.getTipElement();
  4860. var initConfigAnimation = this.config.animation;
  4861. if (tip.getAttribute('x-placement') !== null) {
  4862. return;
  4863. }
  4864. $(tip).removeClass(ClassName$6.FADE);
  4865. this.config.animation = false;
  4866. this.hide();
  4867. this.show();
  4868. this.config.animation = initConfigAnimation;
  4869. } // Static
  4870. ;
  4871. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4872. return this.each(function () {
  4873. var data = $(this).data(DATA_KEY$6);
  4874. var _config = typeof config === 'object' && config;
  4875. if (!data && /dispose|hide/.test(config)) {
  4876. return;
  4877. }
  4878. if (!data) {
  4879. data = new Tooltip(this, _config);
  4880. $(this).data(DATA_KEY$6, data);
  4881. }
  4882. if (typeof config === 'string') {
  4883. if (typeof data[config] === 'undefined') {
  4884. throw new TypeError("No method named \"" + config + "\"");
  4885. }
  4886. data[config]();
  4887. }
  4888. });
  4889. };
  4890. _createClass(Tooltip, null, [{
  4891. key: "VERSION",
  4892. get: function get() {
  4893. return VERSION$6;
  4894. }
  4895. }, {
  4896. key: "Default",
  4897. get: function get() {
  4898. return Default$4;
  4899. }
  4900. }, {
  4901. key: "NAME",
  4902. get: function get() {
  4903. return NAME$6;
  4904. }
  4905. }, {
  4906. key: "DATA_KEY",
  4907. get: function get() {
  4908. return DATA_KEY$6;
  4909. }
  4910. }, {
  4911. key: "Event",
  4912. get: function get() {
  4913. return Event$6;
  4914. }
  4915. }, {
  4916. key: "EVENT_KEY",
  4917. get: function get() {
  4918. return EVENT_KEY$6;
  4919. }
  4920. }, {
  4921. key: "DefaultType",
  4922. get: function get() {
  4923. return DefaultType$4;
  4924. }
  4925. }]);
  4926. return Tooltip;
  4927. }();
  4928. /**
  4929. * ------------------------------------------------------------------------
  4930. * jQuery
  4931. * ------------------------------------------------------------------------
  4932. */
  4933. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4934. $.fn[NAME$6].Constructor = Tooltip;
  4935. $.fn[NAME$6].noConflict = function () {
  4936. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4937. return Tooltip._jQueryInterface;
  4938. };
  4939. /**
  4940. * ------------------------------------------------------------------------
  4941. * Constants
  4942. * ------------------------------------------------------------------------
  4943. */
  4944. var NAME$7 = 'popover';
  4945. var VERSION$7 = '4.4.1';
  4946. var DATA_KEY$7 = 'bs.popover';
  4947. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4948. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4949. var CLASS_PREFIX$1 = 'bs-popover';
  4950. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4951. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4952. placement: 'right',
  4953. trigger: 'click',
  4954. content: '',
  4955. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4956. });
  4957. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4958. content: '(string|element|function)'
  4959. });
  4960. var ClassName$7 = {
  4961. FADE: 'fade',
  4962. SHOW: 'show'
  4963. };
  4964. var Selector$7 = {
  4965. TITLE: '.popover-header',
  4966. CONTENT: '.popover-body'
  4967. };
  4968. var Event$7 = {
  4969. HIDE: "hide" + EVENT_KEY$7,
  4970. HIDDEN: "hidden" + EVENT_KEY$7,
  4971. SHOW: "show" + EVENT_KEY$7,
  4972. SHOWN: "shown" + EVENT_KEY$7,
  4973. INSERTED: "inserted" + EVENT_KEY$7,
  4974. CLICK: "click" + EVENT_KEY$7,
  4975. FOCUSIN: "focusin" + EVENT_KEY$7,
  4976. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4977. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4978. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4979. };
  4980. /**
  4981. * ------------------------------------------------------------------------
  4982. * Class Definition
  4983. * ------------------------------------------------------------------------
  4984. */
  4985. var Popover =
  4986. /*#__PURE__*/
  4987. function (_Tooltip) {
  4988. _inheritsLoose(Popover, _Tooltip);
  4989. function Popover() {
  4990. return _Tooltip.apply(this, arguments) || this;
  4991. }
  4992. var _proto = Popover.prototype;
  4993. // Overrides
  4994. _proto.isWithContent = function isWithContent() {
  4995. return this.getTitle() || this._getContent();
  4996. };
  4997. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4998. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4999. };
  5000. _proto.getTipElement = function getTipElement() {
  5001. this.tip = this.tip || $(this.config.template)[0];
  5002. return this.tip;
  5003. };
  5004. _proto.setContent = function setContent() {
  5005. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5006. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5007. var content = this._getContent();
  5008. if (typeof content === 'function') {
  5009. content = content.call(this.element);
  5010. }
  5011. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5012. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5013. } // Private
  5014. ;
  5015. _proto._getContent = function _getContent() {
  5016. return this.element.getAttribute('data-content') || this.config.content;
  5017. };
  5018. _proto._cleanTipClass = function _cleanTipClass() {
  5019. var $tip = $(this.getTipElement());
  5020. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5021. if (tabClass !== null && tabClass.length > 0) {
  5022. $tip.removeClass(tabClass.join(''));
  5023. }
  5024. } // Static
  5025. ;
  5026. Popover._jQueryInterface = function _jQueryInterface(config) {
  5027. return this.each(function () {
  5028. var data = $(this).data(DATA_KEY$7);
  5029. var _config = typeof config === 'object' ? config : null;
  5030. if (!data && /dispose|hide/.test(config)) {
  5031. return;
  5032. }
  5033. if (!data) {
  5034. data = new Popover(this, _config);
  5035. $(this).data(DATA_KEY$7, data);
  5036. }
  5037. if (typeof config === 'string') {
  5038. if (typeof data[config] === 'undefined') {
  5039. throw new TypeError("No method named \"" + config + "\"");
  5040. }
  5041. data[config]();
  5042. }
  5043. });
  5044. };
  5045. _createClass(Popover, null, [{
  5046. key: "VERSION",
  5047. // Getters
  5048. get: function get() {
  5049. return VERSION$7;
  5050. }
  5051. }, {
  5052. key: "Default",
  5053. get: function get() {
  5054. return Default$5;
  5055. }
  5056. }, {
  5057. key: "NAME",
  5058. get: function get() {
  5059. return NAME$7;
  5060. }
  5061. }, {
  5062. key: "DATA_KEY",
  5063. get: function get() {
  5064. return DATA_KEY$7;
  5065. }
  5066. }, {
  5067. key: "Event",
  5068. get: function get() {
  5069. return Event$7;
  5070. }
  5071. }, {
  5072. key: "EVENT_KEY",
  5073. get: function get() {
  5074. return EVENT_KEY$7;
  5075. }
  5076. }, {
  5077. key: "DefaultType",
  5078. get: function get() {
  5079. return DefaultType$5;
  5080. }
  5081. }]);
  5082. return Popover;
  5083. }(Tooltip);
  5084. /**
  5085. * ------------------------------------------------------------------------
  5086. * jQuery
  5087. * ------------------------------------------------------------------------
  5088. */
  5089. $.fn[NAME$7] = Popover._jQueryInterface;
  5090. $.fn[NAME$7].Constructor = Popover;
  5091. $.fn[NAME$7].noConflict = function () {
  5092. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5093. return Popover._jQueryInterface;
  5094. };
  5095. /**
  5096. * ------------------------------------------------------------------------
  5097. * Constants
  5098. * ------------------------------------------------------------------------
  5099. */
  5100. var NAME$8 = 'scrollspy';
  5101. var VERSION$8 = '4.4.1';
  5102. var DATA_KEY$8 = 'bs.scrollspy';
  5103. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5104. var DATA_API_KEY$6 = '.data-api';
  5105. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5106. var Default$6 = {
  5107. offset: 10,
  5108. method: 'auto',
  5109. target: ''
  5110. };
  5111. var DefaultType$6 = {
  5112. offset: 'number',
  5113. method: 'string',
  5114. target: '(string|element)'
  5115. };
  5116. var Event$8 = {
  5117. ACTIVATE: "activate" + EVENT_KEY$8,
  5118. SCROLL: "scroll" + EVENT_KEY$8,
  5119. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5120. };
  5121. var ClassName$8 = {
  5122. DROPDOWN_ITEM: 'dropdown-item',
  5123. DROPDOWN_MENU: 'dropdown-menu',
  5124. ACTIVE: 'active'
  5125. };
  5126. var Selector$8 = {
  5127. DATA_SPY: '[data-spy="scroll"]',
  5128. ACTIVE: '.active',
  5129. NAV_LIST_GROUP: '.nav, .list-group',
  5130. NAV_LINKS: '.nav-link',
  5131. NAV_ITEMS: '.nav-item',
  5132. LIST_ITEMS: '.list-group-item',
  5133. DROPDOWN: '.dropdown',
  5134. DROPDOWN_ITEMS: '.dropdown-item',
  5135. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5136. };
  5137. var OffsetMethod = {
  5138. OFFSET: 'offset',
  5139. POSITION: 'position'
  5140. };
  5141. /**
  5142. * ------------------------------------------------------------------------
  5143. * Class Definition
  5144. * ------------------------------------------------------------------------
  5145. */
  5146. var ScrollSpy =
  5147. /*#__PURE__*/
  5148. function () {
  5149. function ScrollSpy(element, config) {
  5150. var _this = this;
  5151. this._element = element;
  5152. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5153. this._config = this._getConfig(config);
  5154. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5155. this._offsets = [];
  5156. this._targets = [];
  5157. this._activeTarget = null;
  5158. this._scrollHeight = 0;
  5159. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5160. return _this._process(event);
  5161. });
  5162. this.refresh();
  5163. this._process();
  5164. } // Getters
  5165. var _proto = ScrollSpy.prototype;
  5166. // Public
  5167. _proto.refresh = function refresh() {
  5168. var _this2 = this;
  5169. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5170. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5171. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5172. this._offsets = [];
  5173. this._targets = [];
  5174. this._scrollHeight = this._getScrollHeight();
  5175. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5176. targets.map(function (element) {
  5177. var target;
  5178. var targetSelector = Util.getSelectorFromElement(element);
  5179. if (targetSelector) {
  5180. target = document.querySelector(targetSelector);
  5181. }
  5182. if (target) {
  5183. var targetBCR = target.getBoundingClientRect();
  5184. if (targetBCR.width || targetBCR.height) {
  5185. // TODO (fat): remove sketch reliance on jQuery position/offset
  5186. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5187. }
  5188. }
  5189. return null;
  5190. }).filter(function (item) {
  5191. return item;
  5192. }).sort(function (a, b) {
  5193. return a[0] - b[0];
  5194. }).forEach(function (item) {
  5195. _this2._offsets.push(item[0]);
  5196. _this2._targets.push(item[1]);
  5197. });
  5198. };
  5199. _proto.dispose = function dispose() {
  5200. $.removeData(this._element, DATA_KEY$8);
  5201. $(this._scrollElement).off(EVENT_KEY$8);
  5202. this._element = null;
  5203. this._scrollElement = null;
  5204. this._config = null;
  5205. this._selector = null;
  5206. this._offsets = null;
  5207. this._targets = null;
  5208. this._activeTarget = null;
  5209. this._scrollHeight = null;
  5210. } // Private
  5211. ;
  5212. _proto._getConfig = function _getConfig(config) {
  5213. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5214. if (typeof config.target !== 'string') {
  5215. var id = $(config.target).attr('id');
  5216. if (!id) {
  5217. id = Util.getUID(NAME$8);
  5218. $(config.target).attr('id', id);
  5219. }
  5220. config.target = "#" + id;
  5221. }
  5222. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5223. return config;
  5224. };
  5225. _proto._getScrollTop = function _getScrollTop() {
  5226. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5227. };
  5228. _proto._getScrollHeight = function _getScrollHeight() {
  5229. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5230. };
  5231. _proto._getOffsetHeight = function _getOffsetHeight() {
  5232. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5233. };
  5234. _proto._process = function _process() {
  5235. var scrollTop = this._getScrollTop() + this._config.offset;
  5236. var scrollHeight = this._getScrollHeight();
  5237. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5238. if (this._scrollHeight !== scrollHeight) {
  5239. this.refresh();
  5240. }
  5241. if (scrollTop >= maxScroll) {
  5242. var target = this._targets[this._targets.length - 1];
  5243. if (this._activeTarget !== target) {
  5244. this._activate(target);
  5245. }
  5246. return;
  5247. }
  5248. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5249. this._activeTarget = null;
  5250. this._clear();
  5251. return;
  5252. }
  5253. var offsetLength = this._offsets.length;
  5254. for (var i = offsetLength; i--;) {
  5255. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5256. if (isActiveTarget) {
  5257. this._activate(this._targets[i]);
  5258. }
  5259. }
  5260. };
  5261. _proto._activate = function _activate(target) {
  5262. this._activeTarget = target;
  5263. this._clear();
  5264. var queries = this._selector.split(',').map(function (selector) {
  5265. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5266. });
  5267. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5268. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5269. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5270. $link.addClass(ClassName$8.ACTIVE);
  5271. } else {
  5272. // Set triggered link as active
  5273. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5274. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5275. $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
  5276. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5277. }
  5278. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5279. relatedTarget: target
  5280. });
  5281. };
  5282. _proto._clear = function _clear() {
  5283. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5284. return node.classList.contains(ClassName$8.ACTIVE);
  5285. }).forEach(function (node) {
  5286. return node.classList.remove(ClassName$8.ACTIVE);
  5287. });
  5288. } // Static
  5289. ;
  5290. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5291. return this.each(function () {
  5292. var data = $(this).data(DATA_KEY$8);
  5293. var _config = typeof config === 'object' && config;
  5294. if (!data) {
  5295. data = new ScrollSpy(this, _config);
  5296. $(this).data(DATA_KEY$8, data);
  5297. }
  5298. if (typeof config === 'string') {
  5299. if (typeof data[config] === 'undefined') {
  5300. throw new TypeError("No method named \"" + config + "\"");
  5301. }
  5302. data[config]();
  5303. }
  5304. });
  5305. };
  5306. _createClass(ScrollSpy, null, [{
  5307. key: "VERSION",
  5308. get: function get() {
  5309. return VERSION$8;
  5310. }
  5311. }, {
  5312. key: "Default",
  5313. get: function get() {
  5314. return Default$6;
  5315. }
  5316. }]);
  5317. return ScrollSpy;
  5318. }();
  5319. /**
  5320. * ------------------------------------------------------------------------
  5321. * Data Api implementation
  5322. * ------------------------------------------------------------------------
  5323. */
  5324. $(window).on(Event$8.LOAD_DATA_API, function () {
  5325. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5326. var scrollSpysLength = scrollSpys.length;
  5327. for (var i = scrollSpysLength; i--;) {
  5328. var $spy = $(scrollSpys[i]);
  5329. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5330. }
  5331. });
  5332. /**
  5333. * ------------------------------------------------------------------------
  5334. * jQuery
  5335. * ------------------------------------------------------------------------
  5336. */
  5337. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5338. $.fn[NAME$8].Constructor = ScrollSpy;
  5339. $.fn[NAME$8].noConflict = function () {
  5340. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5341. return ScrollSpy._jQueryInterface;
  5342. };
  5343. /**
  5344. * ------------------------------------------------------------------------
  5345. * Constants
  5346. * ------------------------------------------------------------------------
  5347. */
  5348. var NAME$9 = 'tab';
  5349. var VERSION$9 = '4.4.1';
  5350. var DATA_KEY$9 = 'bs.tab';
  5351. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5352. var DATA_API_KEY$7 = '.data-api';
  5353. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5354. var Event$9 = {
  5355. HIDE: "hide" + EVENT_KEY$9,
  5356. HIDDEN: "hidden" + EVENT_KEY$9,
  5357. SHOW: "show" + EVENT_KEY$9,
  5358. SHOWN: "shown" + EVENT_KEY$9,
  5359. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5360. };
  5361. var ClassName$9 = {
  5362. DROPDOWN_MENU: 'dropdown-menu',
  5363. ACTIVE: 'active',
  5364. DISABLED: 'disabled',
  5365. FADE: 'fade',
  5366. SHOW: 'show'
  5367. };
  5368. var Selector$9 = {
  5369. DROPDOWN: '.dropdown',
  5370. NAV_LIST_GROUP: '.nav, .list-group',
  5371. ACTIVE: '.active',
  5372. ACTIVE_UL: '> li > .active',
  5373. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5374. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5375. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5376. };
  5377. /**
  5378. * ------------------------------------------------------------------------
  5379. * Class Definition
  5380. * ------------------------------------------------------------------------
  5381. */
  5382. var Tab =
  5383. /*#__PURE__*/
  5384. function () {
  5385. function Tab(element) {
  5386. this._element = element;
  5387. } // Getters
  5388. var _proto = Tab.prototype;
  5389. // Public
  5390. _proto.show = function show() {
  5391. var _this = this;
  5392. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5393. return;
  5394. }
  5395. var target;
  5396. var previous;
  5397. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5398. var selector = Util.getSelectorFromElement(this._element);
  5399. if (listElement) {
  5400. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5401. previous = $.makeArray($(listElement).find(itemSelector));
  5402. previous = previous[previous.length - 1];
  5403. }
  5404. var hideEvent = $.Event(Event$9.HIDE, {
  5405. relatedTarget: this._element
  5406. });
  5407. var showEvent = $.Event(Event$9.SHOW, {
  5408. relatedTarget: previous
  5409. });
  5410. if (previous) {
  5411. $(previous).trigger(hideEvent);
  5412. }
  5413. $(this._element).trigger(showEvent);
  5414. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5415. return;
  5416. }
  5417. if (selector) {
  5418. target = document.querySelector(selector);
  5419. }
  5420. this._activate(this._element, listElement);
  5421. var complete = function complete() {
  5422. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5423. relatedTarget: _this._element
  5424. });
  5425. var shownEvent = $.Event(Event$9.SHOWN, {
  5426. relatedTarget: previous
  5427. });
  5428. $(previous).trigger(hiddenEvent);
  5429. $(_this._element).trigger(shownEvent);
  5430. };
  5431. if (target) {
  5432. this._activate(target, target.parentNode, complete);
  5433. } else {
  5434. complete();
  5435. }
  5436. };
  5437. _proto.dispose = function dispose() {
  5438. $.removeData(this._element, DATA_KEY$9);
  5439. this._element = null;
  5440. } // Private
  5441. ;
  5442. _proto._activate = function _activate(element, container, callback) {
  5443. var _this2 = this;
  5444. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5445. var active = activeElements[0];
  5446. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5447. var complete = function complete() {
  5448. return _this2._transitionComplete(element, active, callback);
  5449. };
  5450. if (active && isTransitioning) {
  5451. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5452. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5453. } else {
  5454. complete();
  5455. }
  5456. };
  5457. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5458. if (active) {
  5459. $(active).removeClass(ClassName$9.ACTIVE);
  5460. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5461. if (dropdownChild) {
  5462. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5463. }
  5464. if (active.getAttribute('role') === 'tab') {
  5465. active.setAttribute('aria-selected', false);
  5466. }
  5467. }
  5468. $(element).addClass(ClassName$9.ACTIVE);
  5469. if (element.getAttribute('role') === 'tab') {
  5470. element.setAttribute('aria-selected', true);
  5471. }
  5472. Util.reflow(element);
  5473. if (element.classList.contains(ClassName$9.FADE)) {
  5474. element.classList.add(ClassName$9.SHOW);
  5475. }
  5476. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5477. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5478. if (dropdownElement) {
  5479. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5480. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5481. }
  5482. element.setAttribute('aria-expanded', true);
  5483. }
  5484. if (callback) {
  5485. callback();
  5486. }
  5487. } // Static
  5488. ;
  5489. Tab._jQueryInterface = function _jQueryInterface(config) {
  5490. return this.each(function () {
  5491. var $this = $(this);
  5492. var data = $this.data(DATA_KEY$9);
  5493. if (!data) {
  5494. data = new Tab(this);
  5495. $this.data(DATA_KEY$9, data);
  5496. }
  5497. if (typeof config === 'string') {
  5498. if (typeof data[config] === 'undefined') {
  5499. throw new TypeError("No method named \"" + config + "\"");
  5500. }
  5501. data[config]();
  5502. }
  5503. });
  5504. };
  5505. _createClass(Tab, null, [{
  5506. key: "VERSION",
  5507. get: function get() {
  5508. return VERSION$9;
  5509. }
  5510. }]);
  5511. return Tab;
  5512. }();
  5513. /**
  5514. * ------------------------------------------------------------------------
  5515. * Data Api implementation
  5516. * ------------------------------------------------------------------------
  5517. */
  5518. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5519. event.preventDefault();
  5520. Tab._jQueryInterface.call($(this), 'show');
  5521. });
  5522. /**
  5523. * ------------------------------------------------------------------------
  5524. * jQuery
  5525. * ------------------------------------------------------------------------
  5526. */
  5527. $.fn[NAME$9] = Tab._jQueryInterface;
  5528. $.fn[NAME$9].Constructor = Tab;
  5529. $.fn[NAME$9].noConflict = function () {
  5530. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5531. return Tab._jQueryInterface;
  5532. };
  5533. /**
  5534. * ------------------------------------------------------------------------
  5535. * Constants
  5536. * ------------------------------------------------------------------------
  5537. */
  5538. var NAME$a = 'toast';
  5539. var VERSION$a = '4.4.1';
  5540. var DATA_KEY$a = 'bs.toast';
  5541. var EVENT_KEY$a = "." + DATA_KEY$a;
  5542. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5543. var Event$a = {
  5544. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5545. HIDE: "hide" + EVENT_KEY$a,
  5546. HIDDEN: "hidden" + EVENT_KEY$a,
  5547. SHOW: "show" + EVENT_KEY$a,
  5548. SHOWN: "shown" + EVENT_KEY$a
  5549. };
  5550. var ClassName$a = {
  5551. FADE: 'fade',
  5552. HIDE: 'hide',
  5553. SHOW: 'show',
  5554. SHOWING: 'showing'
  5555. };
  5556. var DefaultType$7 = {
  5557. animation: 'boolean',
  5558. autohide: 'boolean',
  5559. delay: 'number'
  5560. };
  5561. var Default$7 = {
  5562. animation: true,
  5563. autohide: true,
  5564. delay: 500
  5565. };
  5566. var Selector$a = {
  5567. DATA_DISMISS: '[data-dismiss="toast"]'
  5568. };
  5569. /**
  5570. * ------------------------------------------------------------------------
  5571. * Class Definition
  5572. * ------------------------------------------------------------------------
  5573. */
  5574. var Toast =
  5575. /*#__PURE__*/
  5576. function () {
  5577. function Toast(element, config) {
  5578. this._element = element;
  5579. this._config = this._getConfig(config);
  5580. this._timeout = null;
  5581. this._setListeners();
  5582. } // Getters
  5583. var _proto = Toast.prototype;
  5584. // Public
  5585. _proto.show = function show() {
  5586. var _this = this;
  5587. var showEvent = $.Event(Event$a.SHOW);
  5588. $(this._element).trigger(showEvent);
  5589. if (showEvent.isDefaultPrevented()) {
  5590. return;
  5591. }
  5592. if (this._config.animation) {
  5593. this._element.classList.add(ClassName$a.FADE);
  5594. }
  5595. var complete = function complete() {
  5596. _this._element.classList.remove(ClassName$a.SHOWING);
  5597. _this._element.classList.add(ClassName$a.SHOW);
  5598. $(_this._element).trigger(Event$a.SHOWN);
  5599. if (_this._config.autohide) {
  5600. _this._timeout = setTimeout(function () {
  5601. _this.hide();
  5602. }, _this._config.delay);
  5603. }
  5604. };
  5605. this._element.classList.remove(ClassName$a.HIDE);
  5606. Util.reflow(this._element);
  5607. this._element.classList.add(ClassName$a.SHOWING);
  5608. if (this._config.animation) {
  5609. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5610. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5611. } else {
  5612. complete();
  5613. }
  5614. };
  5615. _proto.hide = function hide() {
  5616. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5617. return;
  5618. }
  5619. var hideEvent = $.Event(Event$a.HIDE);
  5620. $(this._element).trigger(hideEvent);
  5621. if (hideEvent.isDefaultPrevented()) {
  5622. return;
  5623. }
  5624. this._close();
  5625. };
  5626. _proto.dispose = function dispose() {
  5627. clearTimeout(this._timeout);
  5628. this._timeout = null;
  5629. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5630. this._element.classList.remove(ClassName$a.SHOW);
  5631. }
  5632. $(this._element).off(Event$a.CLICK_DISMISS);
  5633. $.removeData(this._element, DATA_KEY$a);
  5634. this._element = null;
  5635. this._config = null;
  5636. } // Private
  5637. ;
  5638. _proto._getConfig = function _getConfig(config) {
  5639. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5640. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5641. return config;
  5642. };
  5643. _proto._setListeners = function _setListeners() {
  5644. var _this2 = this;
  5645. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5646. return _this2.hide();
  5647. });
  5648. };
  5649. _proto._close = function _close() {
  5650. var _this3 = this;
  5651. var complete = function complete() {
  5652. _this3._element.classList.add(ClassName$a.HIDE);
  5653. $(_this3._element).trigger(Event$a.HIDDEN);
  5654. };
  5655. this._element.classList.remove(ClassName$a.SHOW);
  5656. if (this._config.animation) {
  5657. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5658. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5659. } else {
  5660. complete();
  5661. }
  5662. } // Static
  5663. ;
  5664. Toast._jQueryInterface = function _jQueryInterface(config) {
  5665. return this.each(function () {
  5666. var $element = $(this);
  5667. var data = $element.data(DATA_KEY$a);
  5668. var _config = typeof config === 'object' && config;
  5669. if (!data) {
  5670. data = new Toast(this, _config);
  5671. $element.data(DATA_KEY$a, data);
  5672. }
  5673. if (typeof config === 'string') {
  5674. if (typeof data[config] === 'undefined') {
  5675. throw new TypeError("No method named \"" + config + "\"");
  5676. }
  5677. data[config](this);
  5678. }
  5679. });
  5680. };
  5681. _createClass(Toast, null, [{
  5682. key: "VERSION",
  5683. get: function get() {
  5684. return VERSION$a;
  5685. }
  5686. }, {
  5687. key: "DefaultType",
  5688. get: function get() {
  5689. return DefaultType$7;
  5690. }
  5691. }, {
  5692. key: "Default",
  5693. get: function get() {
  5694. return Default$7;
  5695. }
  5696. }]);
  5697. return Toast;
  5698. }();
  5699. /**
  5700. * ------------------------------------------------------------------------
  5701. * jQuery
  5702. * ------------------------------------------------------------------------
  5703. */
  5704. $.fn[NAME$a] = Toast._jQueryInterface;
  5705. $.fn[NAME$a].Constructor = Toast;
  5706. $.fn[NAME$a].noConflict = function () {
  5707. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5708. return Toast._jQueryInterface;
  5709. };
  5710. exports.Alert = Alert;
  5711. exports.Button = Button;
  5712. exports.Carousel = Carousel;
  5713. exports.Collapse = Collapse;
  5714. exports.Dropdown = Dropdown;
  5715. exports.Modal = Modal;
  5716. exports.Popover = Popover;
  5717. exports.Scrollspy = ScrollSpy;
  5718. exports.Tab = Tab;
  5719. exports.Toast = Toast;
  5720. exports.Tooltip = Tooltip;
  5721. exports.Util = Util;
  5722. Object.defineProperty(exports, '__esModule', { value: true });
  5723. })));
  5724. //# sourceMappingURL=bootstrap.js.map
  5725. /***/ }),
  5726. /***/ "./node_modules/buffer/index.js":
  5727. /*!**************************************!*\
  5728. !*** ./node_modules/buffer/index.js ***!
  5729. \**************************************/
  5730. /*! no static exports found */
  5731. /***/ (function(module, exports, __webpack_require__) {
  5732. "use strict";
  5733. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5734. * The buffer module from node.js, for the browser.
  5735. *
  5736. * @author Feross Aboukhadijeh <http://feross.org>
  5737. * @license MIT
  5738. */
  5739. /* eslint-disable no-proto */
  5740. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5741. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5742. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5743. exports.Buffer = Buffer
  5744. exports.SlowBuffer = SlowBuffer
  5745. exports.INSPECT_MAX_BYTES = 50
  5746. /**
  5747. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5748. * === true Use Uint8Array implementation (fastest)
  5749. * === false Use Object implementation (most compatible, even IE6)
  5750. *
  5751. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5752. * Opera 11.6+, iOS 4.2+.
  5753. *
  5754. * Due to various browser bugs, sometimes the Object implementation will be used even
  5755. * when the browser supports typed arrays.
  5756. *
  5757. * Note:
  5758. *
  5759. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5760. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5761. *
  5762. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5763. *
  5764. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5765. * incorrect length in some situations.
  5766. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5767. * get the Object implementation, which is slower but behaves correctly.
  5768. */
  5769. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5770. ? global.TYPED_ARRAY_SUPPORT
  5771. : typedArraySupport()
  5772. /*
  5773. * Export kMaxLength after typed array support is determined.
  5774. */
  5775. exports.kMaxLength = kMaxLength()
  5776. function typedArraySupport () {
  5777. try {
  5778. var arr = new Uint8Array(1)
  5779. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5780. return arr.foo() === 42 && // typed array instances can be augmented
  5781. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5782. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5783. } catch (e) {
  5784. return false
  5785. }
  5786. }
  5787. function kMaxLength () {
  5788. return Buffer.TYPED_ARRAY_SUPPORT
  5789. ? 0x7fffffff
  5790. : 0x3fffffff
  5791. }
  5792. function createBuffer (that, length) {
  5793. if (kMaxLength() < length) {
  5794. throw new RangeError('Invalid typed array length')
  5795. }
  5796. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5797. // Return an augmented `Uint8Array` instance, for best performance
  5798. that = new Uint8Array(length)
  5799. that.__proto__ = Buffer.prototype
  5800. } else {
  5801. // Fallback: Return an object instance of the Buffer class
  5802. if (that === null) {
  5803. that = new Buffer(length)
  5804. }
  5805. that.length = length
  5806. }
  5807. return that
  5808. }
  5809. /**
  5810. * The Buffer constructor returns instances of `Uint8Array` that have their
  5811. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5812. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5813. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5814. * returns a single octet.
  5815. *
  5816. * The `Uint8Array` prototype remains unmodified.
  5817. */
  5818. function Buffer (arg, encodingOrOffset, length) {
  5819. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5820. return new Buffer(arg, encodingOrOffset, length)
  5821. }
  5822. // Common case.
  5823. if (typeof arg === 'number') {
  5824. if (typeof encodingOrOffset === 'string') {
  5825. throw new Error(
  5826. 'If encoding is specified then the first argument must be a string'
  5827. )
  5828. }
  5829. return allocUnsafe(this, arg)
  5830. }
  5831. return from(this, arg, encodingOrOffset, length)
  5832. }
  5833. Buffer.poolSize = 8192 // not used by this implementation
  5834. // TODO: Legacy, not needed anymore. Remove in next major version.
  5835. Buffer._augment = function (arr) {
  5836. arr.__proto__ = Buffer.prototype
  5837. return arr
  5838. }
  5839. function from (that, value, encodingOrOffset, length) {
  5840. if (typeof value === 'number') {
  5841. throw new TypeError('"value" argument must not be a number')
  5842. }
  5843. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5844. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5845. }
  5846. if (typeof value === 'string') {
  5847. return fromString(that, value, encodingOrOffset)
  5848. }
  5849. return fromObject(that, value)
  5850. }
  5851. /**
  5852. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5853. * if value is a number.
  5854. * Buffer.from(str[, encoding])
  5855. * Buffer.from(array)
  5856. * Buffer.from(buffer)
  5857. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5858. **/
  5859. Buffer.from = function (value, encodingOrOffset, length) {
  5860. return from(null, value, encodingOrOffset, length)
  5861. }
  5862. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5863. Buffer.prototype.__proto__ = Uint8Array.prototype
  5864. Buffer.__proto__ = Uint8Array
  5865. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5866. Buffer[Symbol.species] === Buffer) {
  5867. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5868. Object.defineProperty(Buffer, Symbol.species, {
  5869. value: null,
  5870. configurable: true
  5871. })
  5872. }
  5873. }
  5874. function assertSize (size) {
  5875. if (typeof size !== 'number') {
  5876. throw new TypeError('"size" argument must be a number')
  5877. } else if (size < 0) {
  5878. throw new RangeError('"size" argument must not be negative')
  5879. }
  5880. }
  5881. function alloc (that, size, fill, encoding) {
  5882. assertSize(size)
  5883. if (size <= 0) {
  5884. return createBuffer(that, size)
  5885. }
  5886. if (fill !== undefined) {
  5887. // Only pay attention to encoding if it's a string. This
  5888. // prevents accidentally sending in a number that would
  5889. // be interpretted as a start offset.
  5890. return typeof encoding === 'string'
  5891. ? createBuffer(that, size).fill(fill, encoding)
  5892. : createBuffer(that, size).fill(fill)
  5893. }
  5894. return createBuffer(that, size)
  5895. }
  5896. /**
  5897. * Creates a new filled Buffer instance.
  5898. * alloc(size[, fill[, encoding]])
  5899. **/
  5900. Buffer.alloc = function (size, fill, encoding) {
  5901. return alloc(null, size, fill, encoding)
  5902. }
  5903. function allocUnsafe (that, size) {
  5904. assertSize(size)
  5905. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5906. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5907. for (var i = 0; i < size; ++i) {
  5908. that[i] = 0
  5909. }
  5910. }
  5911. return that
  5912. }
  5913. /**
  5914. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  5915. * */
  5916. Buffer.allocUnsafe = function (size) {
  5917. return allocUnsafe(null, size)
  5918. }
  5919. /**
  5920. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  5921. */
  5922. Buffer.allocUnsafeSlow = function (size) {
  5923. return allocUnsafe(null, size)
  5924. }
  5925. function fromString (that, string, encoding) {
  5926. if (typeof encoding !== 'string' || encoding === '') {
  5927. encoding = 'utf8'
  5928. }
  5929. if (!Buffer.isEncoding(encoding)) {
  5930. throw new TypeError('"encoding" must be a valid string encoding')
  5931. }
  5932. var length = byteLength(string, encoding) | 0
  5933. that = createBuffer(that, length)
  5934. var actual = that.write(string, encoding)
  5935. if (actual !== length) {
  5936. // Writing a hex string, for example, that contains invalid characters will
  5937. // cause everything after the first invalid character to be ignored. (e.g.
  5938. // 'abxxcd' will be treated as 'ab')
  5939. that = that.slice(0, actual)
  5940. }
  5941. return that
  5942. }
  5943. function fromArrayLike (that, array) {
  5944. var length = array.length < 0 ? 0 : checked(array.length) | 0
  5945. that = createBuffer(that, length)
  5946. for (var i = 0; i < length; i += 1) {
  5947. that[i] = array[i] & 255
  5948. }
  5949. return that
  5950. }
  5951. function fromArrayBuffer (that, array, byteOffset, length) {
  5952. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  5953. if (byteOffset < 0 || array.byteLength < byteOffset) {
  5954. throw new RangeError('\'offset\' is out of bounds')
  5955. }
  5956. if (array.byteLength < byteOffset + (length || 0)) {
  5957. throw new RangeError('\'length\' is out of bounds')
  5958. }
  5959. if (byteOffset === undefined && length === undefined) {
  5960. array = new Uint8Array(array)
  5961. } else if (length === undefined) {
  5962. array = new Uint8Array(array, byteOffset)
  5963. } else {
  5964. array = new Uint8Array(array, byteOffset, length)
  5965. }
  5966. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5967. // Return an augmented `Uint8Array` instance, for best performance
  5968. that = array
  5969. that.__proto__ = Buffer.prototype
  5970. } else {
  5971. // Fallback: Return an object instance of the Buffer class
  5972. that = fromArrayLike(that, array)
  5973. }
  5974. return that
  5975. }
  5976. function fromObject (that, obj) {
  5977. if (Buffer.isBuffer(obj)) {
  5978. var len = checked(obj.length) | 0
  5979. that = createBuffer(that, len)
  5980. if (that.length === 0) {
  5981. return that
  5982. }
  5983. obj.copy(that, 0, 0, len)
  5984. return that
  5985. }
  5986. if (obj) {
  5987. if ((typeof ArrayBuffer !== 'undefined' &&
  5988. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  5989. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  5990. return createBuffer(that, 0)
  5991. }
  5992. return fromArrayLike(that, obj)
  5993. }
  5994. if (obj.type === 'Buffer' && isArray(obj.data)) {
  5995. return fromArrayLike(that, obj.data)
  5996. }
  5997. }
  5998. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  5999. }
  6000. function checked (length) {
  6001. // Note: cannot use `length < kMaxLength()` here because that fails when
  6002. // length is NaN (which is otherwise coerced to zero.)
  6003. if (length >= kMaxLength()) {
  6004. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6005. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6006. }
  6007. return length | 0
  6008. }
  6009. function SlowBuffer (length) {
  6010. if (+length != length) { // eslint-disable-line eqeqeq
  6011. length = 0
  6012. }
  6013. return Buffer.alloc(+length)
  6014. }
  6015. Buffer.isBuffer = function isBuffer (b) {
  6016. return !!(b != null && b._isBuffer)
  6017. }
  6018. Buffer.compare = function compare (a, b) {
  6019. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6020. throw new TypeError('Arguments must be Buffers')
  6021. }
  6022. if (a === b) return 0
  6023. var x = a.length
  6024. var y = b.length
  6025. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6026. if (a[i] !== b[i]) {
  6027. x = a[i]
  6028. y = b[i]
  6029. break
  6030. }
  6031. }
  6032. if (x < y) return -1
  6033. if (y < x) return 1
  6034. return 0
  6035. }
  6036. Buffer.isEncoding = function isEncoding (encoding) {
  6037. switch (String(encoding).toLowerCase()) {
  6038. case 'hex':
  6039. case 'utf8':
  6040. case 'utf-8':
  6041. case 'ascii':
  6042. case 'latin1':
  6043. case 'binary':
  6044. case 'base64':
  6045. case 'ucs2':
  6046. case 'ucs-2':
  6047. case 'utf16le':
  6048. case 'utf-16le':
  6049. return true
  6050. default:
  6051. return false
  6052. }
  6053. }
  6054. Buffer.concat = function concat (list, length) {
  6055. if (!isArray(list)) {
  6056. throw new TypeError('"list" argument must be an Array of Buffers')
  6057. }
  6058. if (list.length === 0) {
  6059. return Buffer.alloc(0)
  6060. }
  6061. var i
  6062. if (length === undefined) {
  6063. length = 0
  6064. for (i = 0; i < list.length; ++i) {
  6065. length += list[i].length
  6066. }
  6067. }
  6068. var buffer = Buffer.allocUnsafe(length)
  6069. var pos = 0
  6070. for (i = 0; i < list.length; ++i) {
  6071. var buf = list[i]
  6072. if (!Buffer.isBuffer(buf)) {
  6073. throw new TypeError('"list" argument must be an Array of Buffers')
  6074. }
  6075. buf.copy(buffer, pos)
  6076. pos += buf.length
  6077. }
  6078. return buffer
  6079. }
  6080. function byteLength (string, encoding) {
  6081. if (Buffer.isBuffer(string)) {
  6082. return string.length
  6083. }
  6084. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6085. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6086. return string.byteLength
  6087. }
  6088. if (typeof string !== 'string') {
  6089. string = '' + string
  6090. }
  6091. var len = string.length
  6092. if (len === 0) return 0
  6093. // Use a for loop to avoid recursion
  6094. var loweredCase = false
  6095. for (;;) {
  6096. switch (encoding) {
  6097. case 'ascii':
  6098. case 'latin1':
  6099. case 'binary':
  6100. return len
  6101. case 'utf8':
  6102. case 'utf-8':
  6103. case undefined:
  6104. return utf8ToBytes(string).length
  6105. case 'ucs2':
  6106. case 'ucs-2':
  6107. case 'utf16le':
  6108. case 'utf-16le':
  6109. return len * 2
  6110. case 'hex':
  6111. return len >>> 1
  6112. case 'base64':
  6113. return base64ToBytes(string).length
  6114. default:
  6115. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6116. encoding = ('' + encoding).toLowerCase()
  6117. loweredCase = true
  6118. }
  6119. }
  6120. }
  6121. Buffer.byteLength = byteLength
  6122. function slowToString (encoding, start, end) {
  6123. var loweredCase = false
  6124. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6125. // property of a typed array.
  6126. // This behaves neither like String nor Uint8Array in that we set start/end
  6127. // to their upper/lower bounds if the value passed is out of range.
  6128. // undefined is handled specially as per ECMA-262 6th Edition,
  6129. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6130. if (start === undefined || start < 0) {
  6131. start = 0
  6132. }
  6133. // Return early if start > this.length. Done here to prevent potential uint32
  6134. // coercion fail below.
  6135. if (start > this.length) {
  6136. return ''
  6137. }
  6138. if (end === undefined || end > this.length) {
  6139. end = this.length
  6140. }
  6141. if (end <= 0) {
  6142. return ''
  6143. }
  6144. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6145. end >>>= 0
  6146. start >>>= 0
  6147. if (end <= start) {
  6148. return ''
  6149. }
  6150. if (!encoding) encoding = 'utf8'
  6151. while (true) {
  6152. switch (encoding) {
  6153. case 'hex':
  6154. return hexSlice(this, start, end)
  6155. case 'utf8':
  6156. case 'utf-8':
  6157. return utf8Slice(this, start, end)
  6158. case 'ascii':
  6159. return asciiSlice(this, start, end)
  6160. case 'latin1':
  6161. case 'binary':
  6162. return latin1Slice(this, start, end)
  6163. case 'base64':
  6164. return base64Slice(this, start, end)
  6165. case 'ucs2':
  6166. case 'ucs-2':
  6167. case 'utf16le':
  6168. case 'utf-16le':
  6169. return utf16leSlice(this, start, end)
  6170. default:
  6171. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6172. encoding = (encoding + '').toLowerCase()
  6173. loweredCase = true
  6174. }
  6175. }
  6176. }
  6177. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6178. // Buffer instances.
  6179. Buffer.prototype._isBuffer = true
  6180. function swap (b, n, m) {
  6181. var i = b[n]
  6182. b[n] = b[m]
  6183. b[m] = i
  6184. }
  6185. Buffer.prototype.swap16 = function swap16 () {
  6186. var len = this.length
  6187. if (len % 2 !== 0) {
  6188. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6189. }
  6190. for (var i = 0; i < len; i += 2) {
  6191. swap(this, i, i + 1)
  6192. }
  6193. return this
  6194. }
  6195. Buffer.prototype.swap32 = function swap32 () {
  6196. var len = this.length
  6197. if (len % 4 !== 0) {
  6198. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6199. }
  6200. for (var i = 0; i < len; i += 4) {
  6201. swap(this, i, i + 3)
  6202. swap(this, i + 1, i + 2)
  6203. }
  6204. return this
  6205. }
  6206. Buffer.prototype.swap64 = function swap64 () {
  6207. var len = this.length
  6208. if (len % 8 !== 0) {
  6209. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6210. }
  6211. for (var i = 0; i < len; i += 8) {
  6212. swap(this, i, i + 7)
  6213. swap(this, i + 1, i + 6)
  6214. swap(this, i + 2, i + 5)
  6215. swap(this, i + 3, i + 4)
  6216. }
  6217. return this
  6218. }
  6219. Buffer.prototype.toString = function toString () {
  6220. var length = this.length | 0
  6221. if (length === 0) return ''
  6222. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6223. return slowToString.apply(this, arguments)
  6224. }
  6225. Buffer.prototype.equals = function equals (b) {
  6226. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6227. if (this === b) return true
  6228. return Buffer.compare(this, b) === 0
  6229. }
  6230. Buffer.prototype.inspect = function inspect () {
  6231. var str = ''
  6232. var max = exports.INSPECT_MAX_BYTES
  6233. if (this.length > 0) {
  6234. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6235. if (this.length > max) str += ' ... '
  6236. }
  6237. return '<Buffer ' + str + '>'
  6238. }
  6239. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6240. if (!Buffer.isBuffer(target)) {
  6241. throw new TypeError('Argument must be a Buffer')
  6242. }
  6243. if (start === undefined) {
  6244. start = 0
  6245. }
  6246. if (end === undefined) {
  6247. end = target ? target.length : 0
  6248. }
  6249. if (thisStart === undefined) {
  6250. thisStart = 0
  6251. }
  6252. if (thisEnd === undefined) {
  6253. thisEnd = this.length
  6254. }
  6255. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6256. throw new RangeError('out of range index')
  6257. }
  6258. if (thisStart >= thisEnd && start >= end) {
  6259. return 0
  6260. }
  6261. if (thisStart >= thisEnd) {
  6262. return -1
  6263. }
  6264. if (start >= end) {
  6265. return 1
  6266. }
  6267. start >>>= 0
  6268. end >>>= 0
  6269. thisStart >>>= 0
  6270. thisEnd >>>= 0
  6271. if (this === target) return 0
  6272. var x = thisEnd - thisStart
  6273. var y = end - start
  6274. var len = Math.min(x, y)
  6275. var thisCopy = this.slice(thisStart, thisEnd)
  6276. var targetCopy = target.slice(start, end)
  6277. for (var i = 0; i < len; ++i) {
  6278. if (thisCopy[i] !== targetCopy[i]) {
  6279. x = thisCopy[i]
  6280. y = targetCopy[i]
  6281. break
  6282. }
  6283. }
  6284. if (x < y) return -1
  6285. if (y < x) return 1
  6286. return 0
  6287. }
  6288. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6289. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6290. //
  6291. // Arguments:
  6292. // - buffer - a Buffer to search
  6293. // - val - a string, Buffer, or number
  6294. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6295. // - encoding - an optional encoding, relevant is val is a string
  6296. // - dir - true for indexOf, false for lastIndexOf
  6297. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6298. // Empty buffer means no match
  6299. if (buffer.length === 0) return -1
  6300. // Normalize byteOffset
  6301. if (typeof byteOffset === 'string') {
  6302. encoding = byteOffset
  6303. byteOffset = 0
  6304. } else if (byteOffset > 0x7fffffff) {
  6305. byteOffset = 0x7fffffff
  6306. } else if (byteOffset < -0x80000000) {
  6307. byteOffset = -0x80000000
  6308. }
  6309. byteOffset = +byteOffset // Coerce to Number.
  6310. if (isNaN(byteOffset)) {
  6311. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6312. byteOffset = dir ? 0 : (buffer.length - 1)
  6313. }
  6314. // Normalize byteOffset: negative offsets start from the end of the buffer
  6315. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6316. if (byteOffset >= buffer.length) {
  6317. if (dir) return -1
  6318. else byteOffset = buffer.length - 1
  6319. } else if (byteOffset < 0) {
  6320. if (dir) byteOffset = 0
  6321. else return -1
  6322. }
  6323. // Normalize val
  6324. if (typeof val === 'string') {
  6325. val = Buffer.from(val, encoding)
  6326. }
  6327. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6328. if (Buffer.isBuffer(val)) {
  6329. // Special case: looking for empty string/buffer always fails
  6330. if (val.length === 0) {
  6331. return -1
  6332. }
  6333. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6334. } else if (typeof val === 'number') {
  6335. val = val & 0xFF // Search for a byte value [0-255]
  6336. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6337. typeof Uint8Array.prototype.indexOf === 'function') {
  6338. if (dir) {
  6339. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6340. } else {
  6341. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6342. }
  6343. }
  6344. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6345. }
  6346. throw new TypeError('val must be string, number or Buffer')
  6347. }
  6348. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6349. var indexSize = 1
  6350. var arrLength = arr.length
  6351. var valLength = val.length
  6352. if (encoding !== undefined) {
  6353. encoding = String(encoding).toLowerCase()
  6354. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6355. encoding === 'utf16le' || encoding === 'utf-16le') {
  6356. if (arr.length < 2 || val.length < 2) {
  6357. return -1
  6358. }
  6359. indexSize = 2
  6360. arrLength /= 2
  6361. valLength /= 2
  6362. byteOffset /= 2
  6363. }
  6364. }
  6365. function read (buf, i) {
  6366. if (indexSize === 1) {
  6367. return buf[i]
  6368. } else {
  6369. return buf.readUInt16BE(i * indexSize)
  6370. }
  6371. }
  6372. var i
  6373. if (dir) {
  6374. var foundIndex = -1
  6375. for (i = byteOffset; i < arrLength; i++) {
  6376. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6377. if (foundIndex === -1) foundIndex = i
  6378. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6379. } else {
  6380. if (foundIndex !== -1) i -= i - foundIndex
  6381. foundIndex = -1
  6382. }
  6383. }
  6384. } else {
  6385. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6386. for (i = byteOffset; i >= 0; i--) {
  6387. var found = true
  6388. for (var j = 0; j < valLength; j++) {
  6389. if (read(arr, i + j) !== read(val, j)) {
  6390. found = false
  6391. break
  6392. }
  6393. }
  6394. if (found) return i
  6395. }
  6396. }
  6397. return -1
  6398. }
  6399. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6400. return this.indexOf(val, byteOffset, encoding) !== -1
  6401. }
  6402. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6403. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6404. }
  6405. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6406. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6407. }
  6408. function hexWrite (buf, string, offset, length) {
  6409. offset = Number(offset) || 0
  6410. var remaining = buf.length - offset
  6411. if (!length) {
  6412. length = remaining
  6413. } else {
  6414. length = Number(length)
  6415. if (length > remaining) {
  6416. length = remaining
  6417. }
  6418. }
  6419. // must be an even number of digits
  6420. var strLen = string.length
  6421. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6422. if (length > strLen / 2) {
  6423. length = strLen / 2
  6424. }
  6425. for (var i = 0; i < length; ++i) {
  6426. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6427. if (isNaN(parsed)) return i
  6428. buf[offset + i] = parsed
  6429. }
  6430. return i
  6431. }
  6432. function utf8Write (buf, string, offset, length) {
  6433. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6434. }
  6435. function asciiWrite (buf, string, offset, length) {
  6436. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6437. }
  6438. function latin1Write (buf, string, offset, length) {
  6439. return asciiWrite(buf, string, offset, length)
  6440. }
  6441. function base64Write (buf, string, offset, length) {
  6442. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6443. }
  6444. function ucs2Write (buf, string, offset, length) {
  6445. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6446. }
  6447. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6448. // Buffer#write(string)
  6449. if (offset === undefined) {
  6450. encoding = 'utf8'
  6451. length = this.length
  6452. offset = 0
  6453. // Buffer#write(string, encoding)
  6454. } else if (length === undefined && typeof offset === 'string') {
  6455. encoding = offset
  6456. length = this.length
  6457. offset = 0
  6458. // Buffer#write(string, offset[, length][, encoding])
  6459. } else if (isFinite(offset)) {
  6460. offset = offset | 0
  6461. if (isFinite(length)) {
  6462. length = length | 0
  6463. if (encoding === undefined) encoding = 'utf8'
  6464. } else {
  6465. encoding = length
  6466. length = undefined
  6467. }
  6468. // legacy write(string, encoding, offset, length) - remove in v0.13
  6469. } else {
  6470. throw new Error(
  6471. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6472. )
  6473. }
  6474. var remaining = this.length - offset
  6475. if (length === undefined || length > remaining) length = remaining
  6476. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6477. throw new RangeError('Attempt to write outside buffer bounds')
  6478. }
  6479. if (!encoding) encoding = 'utf8'
  6480. var loweredCase = false
  6481. for (;;) {
  6482. switch (encoding) {
  6483. case 'hex':
  6484. return hexWrite(this, string, offset, length)
  6485. case 'utf8':
  6486. case 'utf-8':
  6487. return utf8Write(this, string, offset, length)
  6488. case 'ascii':
  6489. return asciiWrite(this, string, offset, length)
  6490. case 'latin1':
  6491. case 'binary':
  6492. return latin1Write(this, string, offset, length)
  6493. case 'base64':
  6494. // Warning: maxLength not taken into account in base64Write
  6495. return base64Write(this, string, offset, length)
  6496. case 'ucs2':
  6497. case 'ucs-2':
  6498. case 'utf16le':
  6499. case 'utf-16le':
  6500. return ucs2Write(this, string, offset, length)
  6501. default:
  6502. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6503. encoding = ('' + encoding).toLowerCase()
  6504. loweredCase = true
  6505. }
  6506. }
  6507. }
  6508. Buffer.prototype.toJSON = function toJSON () {
  6509. return {
  6510. type: 'Buffer',
  6511. data: Array.prototype.slice.call(this._arr || this, 0)
  6512. }
  6513. }
  6514. function base64Slice (buf, start, end) {
  6515. if (start === 0 && end === buf.length) {
  6516. return base64.fromByteArray(buf)
  6517. } else {
  6518. return base64.fromByteArray(buf.slice(start, end))
  6519. }
  6520. }
  6521. function utf8Slice (buf, start, end) {
  6522. end = Math.min(buf.length, end)
  6523. var res = []
  6524. var i = start
  6525. while (i < end) {
  6526. var firstByte = buf[i]
  6527. var codePoint = null
  6528. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6529. : (firstByte > 0xDF) ? 3
  6530. : (firstByte > 0xBF) ? 2
  6531. : 1
  6532. if (i + bytesPerSequence <= end) {
  6533. var secondByte, thirdByte, fourthByte, tempCodePoint
  6534. switch (bytesPerSequence) {
  6535. case 1:
  6536. if (firstByte < 0x80) {
  6537. codePoint = firstByte
  6538. }
  6539. break
  6540. case 2:
  6541. secondByte = buf[i + 1]
  6542. if ((secondByte & 0xC0) === 0x80) {
  6543. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6544. if (tempCodePoint > 0x7F) {
  6545. codePoint = tempCodePoint
  6546. }
  6547. }
  6548. break
  6549. case 3:
  6550. secondByte = buf[i + 1]
  6551. thirdByte = buf[i + 2]
  6552. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6553. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6554. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6555. codePoint = tempCodePoint
  6556. }
  6557. }
  6558. break
  6559. case 4:
  6560. secondByte = buf[i + 1]
  6561. thirdByte = buf[i + 2]
  6562. fourthByte = buf[i + 3]
  6563. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6564. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6565. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6566. codePoint = tempCodePoint
  6567. }
  6568. }
  6569. }
  6570. }
  6571. if (codePoint === null) {
  6572. // we did not generate a valid codePoint so insert a
  6573. // replacement char (U+FFFD) and advance only 1 byte
  6574. codePoint = 0xFFFD
  6575. bytesPerSequence = 1
  6576. } else if (codePoint > 0xFFFF) {
  6577. // encode to utf16 (surrogate pair dance)
  6578. codePoint -= 0x10000
  6579. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6580. codePoint = 0xDC00 | codePoint & 0x3FF
  6581. }
  6582. res.push(codePoint)
  6583. i += bytesPerSequence
  6584. }
  6585. return decodeCodePointsArray(res)
  6586. }
  6587. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6588. // the lowest limit is Chrome, with 0x10000 args.
  6589. // We go 1 magnitude less, for safety
  6590. var MAX_ARGUMENTS_LENGTH = 0x1000
  6591. function decodeCodePointsArray (codePoints) {
  6592. var len = codePoints.length
  6593. if (len <= MAX_ARGUMENTS_LENGTH) {
  6594. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6595. }
  6596. // Decode in chunks to avoid "call stack size exceeded".
  6597. var res = ''
  6598. var i = 0
  6599. while (i < len) {
  6600. res += String.fromCharCode.apply(
  6601. String,
  6602. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6603. )
  6604. }
  6605. return res
  6606. }
  6607. function asciiSlice (buf, start, end) {
  6608. var ret = ''
  6609. end = Math.min(buf.length, end)
  6610. for (var i = start; i < end; ++i) {
  6611. ret += String.fromCharCode(buf[i] & 0x7F)
  6612. }
  6613. return ret
  6614. }
  6615. function latin1Slice (buf, start, end) {
  6616. var ret = ''
  6617. end = Math.min(buf.length, end)
  6618. for (var i = start; i < end; ++i) {
  6619. ret += String.fromCharCode(buf[i])
  6620. }
  6621. return ret
  6622. }
  6623. function hexSlice (buf, start, end) {
  6624. var len = buf.length
  6625. if (!start || start < 0) start = 0
  6626. if (!end || end < 0 || end > len) end = len
  6627. var out = ''
  6628. for (var i = start; i < end; ++i) {
  6629. out += toHex(buf[i])
  6630. }
  6631. return out
  6632. }
  6633. function utf16leSlice (buf, start, end) {
  6634. var bytes = buf.slice(start, end)
  6635. var res = ''
  6636. for (var i = 0; i < bytes.length; i += 2) {
  6637. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6638. }
  6639. return res
  6640. }
  6641. Buffer.prototype.slice = function slice (start, end) {
  6642. var len = this.length
  6643. start = ~~start
  6644. end = end === undefined ? len : ~~end
  6645. if (start < 0) {
  6646. start += len
  6647. if (start < 0) start = 0
  6648. } else if (start > len) {
  6649. start = len
  6650. }
  6651. if (end < 0) {
  6652. end += len
  6653. if (end < 0) end = 0
  6654. } else if (end > len) {
  6655. end = len
  6656. }
  6657. if (end < start) end = start
  6658. var newBuf
  6659. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6660. newBuf = this.subarray(start, end)
  6661. newBuf.__proto__ = Buffer.prototype
  6662. } else {
  6663. var sliceLen = end - start
  6664. newBuf = new Buffer(sliceLen, undefined)
  6665. for (var i = 0; i < sliceLen; ++i) {
  6666. newBuf[i] = this[i + start]
  6667. }
  6668. }
  6669. return newBuf
  6670. }
  6671. /*
  6672. * Need to make sure that buffer isn't trying to write out of bounds.
  6673. */
  6674. function checkOffset (offset, ext, length) {
  6675. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6676. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6677. }
  6678. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6679. offset = offset | 0
  6680. byteLength = byteLength | 0
  6681. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6682. var val = this[offset]
  6683. var mul = 1
  6684. var i = 0
  6685. while (++i < byteLength && (mul *= 0x100)) {
  6686. val += this[offset + i] * mul
  6687. }
  6688. return val
  6689. }
  6690. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6691. offset = offset | 0
  6692. byteLength = byteLength | 0
  6693. if (!noAssert) {
  6694. checkOffset(offset, byteLength, this.length)
  6695. }
  6696. var val = this[offset + --byteLength]
  6697. var mul = 1
  6698. while (byteLength > 0 && (mul *= 0x100)) {
  6699. val += this[offset + --byteLength] * mul
  6700. }
  6701. return val
  6702. }
  6703. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6704. if (!noAssert) checkOffset(offset, 1, this.length)
  6705. return this[offset]
  6706. }
  6707. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6708. if (!noAssert) checkOffset(offset, 2, this.length)
  6709. return this[offset] | (this[offset + 1] << 8)
  6710. }
  6711. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6712. if (!noAssert) checkOffset(offset, 2, this.length)
  6713. return (this[offset] << 8) | this[offset + 1]
  6714. }
  6715. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6716. if (!noAssert) checkOffset(offset, 4, this.length)
  6717. return ((this[offset]) |
  6718. (this[offset + 1] << 8) |
  6719. (this[offset + 2] << 16)) +
  6720. (this[offset + 3] * 0x1000000)
  6721. }
  6722. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6723. if (!noAssert) checkOffset(offset, 4, this.length)
  6724. return (this[offset] * 0x1000000) +
  6725. ((this[offset + 1] << 16) |
  6726. (this[offset + 2] << 8) |
  6727. this[offset + 3])
  6728. }
  6729. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6730. offset = offset | 0
  6731. byteLength = byteLength | 0
  6732. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6733. var val = this[offset]
  6734. var mul = 1
  6735. var i = 0
  6736. while (++i < byteLength && (mul *= 0x100)) {
  6737. val += this[offset + i] * mul
  6738. }
  6739. mul *= 0x80
  6740. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6741. return val
  6742. }
  6743. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6744. offset = offset | 0
  6745. byteLength = byteLength | 0
  6746. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6747. var i = byteLength
  6748. var mul = 1
  6749. var val = this[offset + --i]
  6750. while (i > 0 && (mul *= 0x100)) {
  6751. val += this[offset + --i] * mul
  6752. }
  6753. mul *= 0x80
  6754. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6755. return val
  6756. }
  6757. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6758. if (!noAssert) checkOffset(offset, 1, this.length)
  6759. if (!(this[offset] & 0x80)) return (this[offset])
  6760. return ((0xff - this[offset] + 1) * -1)
  6761. }
  6762. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6763. if (!noAssert) checkOffset(offset, 2, this.length)
  6764. var val = this[offset] | (this[offset + 1] << 8)
  6765. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6766. }
  6767. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6768. if (!noAssert) checkOffset(offset, 2, this.length)
  6769. var val = this[offset + 1] | (this[offset] << 8)
  6770. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6771. }
  6772. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6773. if (!noAssert) checkOffset(offset, 4, this.length)
  6774. return (this[offset]) |
  6775. (this[offset + 1] << 8) |
  6776. (this[offset + 2] << 16) |
  6777. (this[offset + 3] << 24)
  6778. }
  6779. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6780. if (!noAssert) checkOffset(offset, 4, this.length)
  6781. return (this[offset] << 24) |
  6782. (this[offset + 1] << 16) |
  6783. (this[offset + 2] << 8) |
  6784. (this[offset + 3])
  6785. }
  6786. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6787. if (!noAssert) checkOffset(offset, 4, this.length)
  6788. return ieee754.read(this, offset, true, 23, 4)
  6789. }
  6790. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6791. if (!noAssert) checkOffset(offset, 4, this.length)
  6792. return ieee754.read(this, offset, false, 23, 4)
  6793. }
  6794. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6795. if (!noAssert) checkOffset(offset, 8, this.length)
  6796. return ieee754.read(this, offset, true, 52, 8)
  6797. }
  6798. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6799. if (!noAssert) checkOffset(offset, 8, this.length)
  6800. return ieee754.read(this, offset, false, 52, 8)
  6801. }
  6802. function checkInt (buf, value, offset, ext, max, min) {
  6803. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6804. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6805. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6806. }
  6807. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6808. value = +value
  6809. offset = offset | 0
  6810. byteLength = byteLength | 0
  6811. if (!noAssert) {
  6812. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6813. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6814. }
  6815. var mul = 1
  6816. var i = 0
  6817. this[offset] = value & 0xFF
  6818. while (++i < byteLength && (mul *= 0x100)) {
  6819. this[offset + i] = (value / mul) & 0xFF
  6820. }
  6821. return offset + byteLength
  6822. }
  6823. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6824. value = +value
  6825. offset = offset | 0
  6826. byteLength = byteLength | 0
  6827. if (!noAssert) {
  6828. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6829. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6830. }
  6831. var i = byteLength - 1
  6832. var mul = 1
  6833. this[offset + i] = value & 0xFF
  6834. while (--i >= 0 && (mul *= 0x100)) {
  6835. this[offset + i] = (value / mul) & 0xFF
  6836. }
  6837. return offset + byteLength
  6838. }
  6839. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6840. value = +value
  6841. offset = offset | 0
  6842. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6843. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6844. this[offset] = (value & 0xff)
  6845. return offset + 1
  6846. }
  6847. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6848. if (value < 0) value = 0xffff + value + 1
  6849. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6850. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6851. (littleEndian ? i : 1 - i) * 8
  6852. }
  6853. }
  6854. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6855. value = +value
  6856. offset = offset | 0
  6857. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6858. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6859. this[offset] = (value & 0xff)
  6860. this[offset + 1] = (value >>> 8)
  6861. } else {
  6862. objectWriteUInt16(this, value, offset, true)
  6863. }
  6864. return offset + 2
  6865. }
  6866. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6867. value = +value
  6868. offset = offset | 0
  6869. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6870. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6871. this[offset] = (value >>> 8)
  6872. this[offset + 1] = (value & 0xff)
  6873. } else {
  6874. objectWriteUInt16(this, value, offset, false)
  6875. }
  6876. return offset + 2
  6877. }
  6878. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6879. if (value < 0) value = 0xffffffff + value + 1
  6880. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6881. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6882. }
  6883. }
  6884. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6885. value = +value
  6886. offset = offset | 0
  6887. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6888. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6889. this[offset + 3] = (value >>> 24)
  6890. this[offset + 2] = (value >>> 16)
  6891. this[offset + 1] = (value >>> 8)
  6892. this[offset] = (value & 0xff)
  6893. } else {
  6894. objectWriteUInt32(this, value, offset, true)
  6895. }
  6896. return offset + 4
  6897. }
  6898. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6899. value = +value
  6900. offset = offset | 0
  6901. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6902. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6903. this[offset] = (value >>> 24)
  6904. this[offset + 1] = (value >>> 16)
  6905. this[offset + 2] = (value >>> 8)
  6906. this[offset + 3] = (value & 0xff)
  6907. } else {
  6908. objectWriteUInt32(this, value, offset, false)
  6909. }
  6910. return offset + 4
  6911. }
  6912. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  6913. value = +value
  6914. offset = offset | 0
  6915. if (!noAssert) {
  6916. var limit = Math.pow(2, 8 * byteLength - 1)
  6917. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6918. }
  6919. var i = 0
  6920. var mul = 1
  6921. var sub = 0
  6922. this[offset] = value & 0xFF
  6923. while (++i < byteLength && (mul *= 0x100)) {
  6924. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  6925. sub = 1
  6926. }
  6927. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6928. }
  6929. return offset + byteLength
  6930. }
  6931. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  6932. value = +value
  6933. offset = offset | 0
  6934. if (!noAssert) {
  6935. var limit = Math.pow(2, 8 * byteLength - 1)
  6936. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6937. }
  6938. var i = byteLength - 1
  6939. var mul = 1
  6940. var sub = 0
  6941. this[offset + i] = value & 0xFF
  6942. while (--i >= 0 && (mul *= 0x100)) {
  6943. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  6944. sub = 1
  6945. }
  6946. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6947. }
  6948. return offset + byteLength
  6949. }
  6950. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  6951. value = +value
  6952. offset = offset | 0
  6953. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  6954. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6955. if (value < 0) value = 0xff + value + 1
  6956. this[offset] = (value & 0xff)
  6957. return offset + 1
  6958. }
  6959. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  6960. value = +value
  6961. offset = offset | 0
  6962. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6963. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6964. this[offset] = (value & 0xff)
  6965. this[offset + 1] = (value >>> 8)
  6966. } else {
  6967. objectWriteUInt16(this, value, offset, true)
  6968. }
  6969. return offset + 2
  6970. }
  6971. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  6972. value = +value
  6973. offset = offset | 0
  6974. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6975. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6976. this[offset] = (value >>> 8)
  6977. this[offset + 1] = (value & 0xff)
  6978. } else {
  6979. objectWriteUInt16(this, value, offset, false)
  6980. }
  6981. return offset + 2
  6982. }
  6983. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  6984. value = +value
  6985. offset = offset | 0
  6986. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6987. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6988. this[offset] = (value & 0xff)
  6989. this[offset + 1] = (value >>> 8)
  6990. this[offset + 2] = (value >>> 16)
  6991. this[offset + 3] = (value >>> 24)
  6992. } else {
  6993. objectWriteUInt32(this, value, offset, true)
  6994. }
  6995. return offset + 4
  6996. }
  6997. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  6998. value = +value
  6999. offset = offset | 0
  7000. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7001. if (value < 0) value = 0xffffffff + value + 1
  7002. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7003. this[offset] = (value >>> 24)
  7004. this[offset + 1] = (value >>> 16)
  7005. this[offset + 2] = (value >>> 8)
  7006. this[offset + 3] = (value & 0xff)
  7007. } else {
  7008. objectWriteUInt32(this, value, offset, false)
  7009. }
  7010. return offset + 4
  7011. }
  7012. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7013. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7014. if (offset < 0) throw new RangeError('Index out of range')
  7015. }
  7016. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7017. if (!noAssert) {
  7018. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7019. }
  7020. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7021. return offset + 4
  7022. }
  7023. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7024. return writeFloat(this, value, offset, true, noAssert)
  7025. }
  7026. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7027. return writeFloat(this, value, offset, false, noAssert)
  7028. }
  7029. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7030. if (!noAssert) {
  7031. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7032. }
  7033. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7034. return offset + 8
  7035. }
  7036. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7037. return writeDouble(this, value, offset, true, noAssert)
  7038. }
  7039. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7040. return writeDouble(this, value, offset, false, noAssert)
  7041. }
  7042. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7043. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7044. if (!start) start = 0
  7045. if (!end && end !== 0) end = this.length
  7046. if (targetStart >= target.length) targetStart = target.length
  7047. if (!targetStart) targetStart = 0
  7048. if (end > 0 && end < start) end = start
  7049. // Copy 0 bytes; we're done
  7050. if (end === start) return 0
  7051. if (target.length === 0 || this.length === 0) return 0
  7052. // Fatal error conditions
  7053. if (targetStart < 0) {
  7054. throw new RangeError('targetStart out of bounds')
  7055. }
  7056. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7057. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7058. // Are we oob?
  7059. if (end > this.length) end = this.length
  7060. if (target.length - targetStart < end - start) {
  7061. end = target.length - targetStart + start
  7062. }
  7063. var len = end - start
  7064. var i
  7065. if (this === target && start < targetStart && targetStart < end) {
  7066. // descending copy from end
  7067. for (i = len - 1; i >= 0; --i) {
  7068. target[i + targetStart] = this[i + start]
  7069. }
  7070. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7071. // ascending copy from start
  7072. for (i = 0; i < len; ++i) {
  7073. target[i + targetStart] = this[i + start]
  7074. }
  7075. } else {
  7076. Uint8Array.prototype.set.call(
  7077. target,
  7078. this.subarray(start, start + len),
  7079. targetStart
  7080. )
  7081. }
  7082. return len
  7083. }
  7084. // Usage:
  7085. // buffer.fill(number[, offset[, end]])
  7086. // buffer.fill(buffer[, offset[, end]])
  7087. // buffer.fill(string[, offset[, end]][, encoding])
  7088. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7089. // Handle string cases:
  7090. if (typeof val === 'string') {
  7091. if (typeof start === 'string') {
  7092. encoding = start
  7093. start = 0
  7094. end = this.length
  7095. } else if (typeof end === 'string') {
  7096. encoding = end
  7097. end = this.length
  7098. }
  7099. if (val.length === 1) {
  7100. var code = val.charCodeAt(0)
  7101. if (code < 256) {
  7102. val = code
  7103. }
  7104. }
  7105. if (encoding !== undefined && typeof encoding !== 'string') {
  7106. throw new TypeError('encoding must be a string')
  7107. }
  7108. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7109. throw new TypeError('Unknown encoding: ' + encoding)
  7110. }
  7111. } else if (typeof val === 'number') {
  7112. val = val & 255
  7113. }
  7114. // Invalid ranges are not set to a default, so can range check early.
  7115. if (start < 0 || this.length < start || this.length < end) {
  7116. throw new RangeError('Out of range index')
  7117. }
  7118. if (end <= start) {
  7119. return this
  7120. }
  7121. start = start >>> 0
  7122. end = end === undefined ? this.length : end >>> 0
  7123. if (!val) val = 0
  7124. var i
  7125. if (typeof val === 'number') {
  7126. for (i = start; i < end; ++i) {
  7127. this[i] = val
  7128. }
  7129. } else {
  7130. var bytes = Buffer.isBuffer(val)
  7131. ? val
  7132. : utf8ToBytes(new Buffer(val, encoding).toString())
  7133. var len = bytes.length
  7134. for (i = 0; i < end - start; ++i) {
  7135. this[i + start] = bytes[i % len]
  7136. }
  7137. }
  7138. return this
  7139. }
  7140. // HELPER FUNCTIONS
  7141. // ================
  7142. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7143. function base64clean (str) {
  7144. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7145. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7146. // Node converts strings with length < 2 to ''
  7147. if (str.length < 2) return ''
  7148. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7149. while (str.length % 4 !== 0) {
  7150. str = str + '='
  7151. }
  7152. return str
  7153. }
  7154. function stringtrim (str) {
  7155. if (str.trim) return str.trim()
  7156. return str.replace(/^\s+|\s+$/g, '')
  7157. }
  7158. function toHex (n) {
  7159. if (n < 16) return '0' + n.toString(16)
  7160. return n.toString(16)
  7161. }
  7162. function utf8ToBytes (string, units) {
  7163. units = units || Infinity
  7164. var codePoint
  7165. var length = string.length
  7166. var leadSurrogate = null
  7167. var bytes = []
  7168. for (var i = 0; i < length; ++i) {
  7169. codePoint = string.charCodeAt(i)
  7170. // is surrogate component
  7171. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7172. // last char was a lead
  7173. if (!leadSurrogate) {
  7174. // no lead yet
  7175. if (codePoint > 0xDBFF) {
  7176. // unexpected trail
  7177. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7178. continue
  7179. } else if (i + 1 === length) {
  7180. // unpaired lead
  7181. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7182. continue
  7183. }
  7184. // valid lead
  7185. leadSurrogate = codePoint
  7186. continue
  7187. }
  7188. // 2 leads in a row
  7189. if (codePoint < 0xDC00) {
  7190. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7191. leadSurrogate = codePoint
  7192. continue
  7193. }
  7194. // valid surrogate pair
  7195. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7196. } else if (leadSurrogate) {
  7197. // valid bmp char, but last char was a lead
  7198. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7199. }
  7200. leadSurrogate = null
  7201. // encode utf8
  7202. if (codePoint < 0x80) {
  7203. if ((units -= 1) < 0) break
  7204. bytes.push(codePoint)
  7205. } else if (codePoint < 0x800) {
  7206. if ((units -= 2) < 0) break
  7207. bytes.push(
  7208. codePoint >> 0x6 | 0xC0,
  7209. codePoint & 0x3F | 0x80
  7210. )
  7211. } else if (codePoint < 0x10000) {
  7212. if ((units -= 3) < 0) break
  7213. bytes.push(
  7214. codePoint >> 0xC | 0xE0,
  7215. codePoint >> 0x6 & 0x3F | 0x80,
  7216. codePoint & 0x3F | 0x80
  7217. )
  7218. } else if (codePoint < 0x110000) {
  7219. if ((units -= 4) < 0) break
  7220. bytes.push(
  7221. codePoint >> 0x12 | 0xF0,
  7222. codePoint >> 0xC & 0x3F | 0x80,
  7223. codePoint >> 0x6 & 0x3F | 0x80,
  7224. codePoint & 0x3F | 0x80
  7225. )
  7226. } else {
  7227. throw new Error('Invalid code point')
  7228. }
  7229. }
  7230. return bytes
  7231. }
  7232. function asciiToBytes (str) {
  7233. var byteArray = []
  7234. for (var i = 0; i < str.length; ++i) {
  7235. // Node's code seems to be doing this and not & 0x7F..
  7236. byteArray.push(str.charCodeAt(i) & 0xFF)
  7237. }
  7238. return byteArray
  7239. }
  7240. function utf16leToBytes (str, units) {
  7241. var c, hi, lo
  7242. var byteArray = []
  7243. for (var i = 0; i < str.length; ++i) {
  7244. if ((units -= 2) < 0) break
  7245. c = str.charCodeAt(i)
  7246. hi = c >> 8
  7247. lo = c % 256
  7248. byteArray.push(lo)
  7249. byteArray.push(hi)
  7250. }
  7251. return byteArray
  7252. }
  7253. function base64ToBytes (str) {
  7254. return base64.toByteArray(base64clean(str))
  7255. }
  7256. function blitBuffer (src, dst, offset, length) {
  7257. for (var i = 0; i < length; ++i) {
  7258. if ((i + offset >= dst.length) || (i >= src.length)) break
  7259. dst[i + offset] = src[i]
  7260. }
  7261. return i
  7262. }
  7263. function isnan (val) {
  7264. return val !== val // eslint-disable-line no-self-compare
  7265. }
  7266. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7267. /***/ }),
  7268. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7269. /*!**************************************************!*\
  7270. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7271. \**************************************************/
  7272. /*! no static exports found */
  7273. /***/ (function(module, exports, __webpack_require__) {
  7274. /*!
  7275. * clipboard.js v2.0.4
  7276. * https://zenorocha.github.io/clipboard.js
  7277. *
  7278. * Licensed MIT © Zeno Rocha
  7279. */
  7280. (function webpackUniversalModuleDefinition(root, factory) {
  7281. if(true)
  7282. module.exports = factory();
  7283. else {}
  7284. })(this, function() {
  7285. return /******/ (function(modules) { // webpackBootstrap
  7286. /******/ // The module cache
  7287. /******/ var installedModules = {};
  7288. /******/
  7289. /******/ // The require function
  7290. /******/ function __webpack_require__(moduleId) {
  7291. /******/
  7292. /******/ // Check if module is in cache
  7293. /******/ if(installedModules[moduleId]) {
  7294. /******/ return installedModules[moduleId].exports;
  7295. /******/ }
  7296. /******/ // Create a new module (and put it into the cache)
  7297. /******/ var module = installedModules[moduleId] = {
  7298. /******/ i: moduleId,
  7299. /******/ l: false,
  7300. /******/ exports: {}
  7301. /******/ };
  7302. /******/
  7303. /******/ // Execute the module function
  7304. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7305. /******/
  7306. /******/ // Flag the module as loaded
  7307. /******/ module.l = true;
  7308. /******/
  7309. /******/ // Return the exports of the module
  7310. /******/ return module.exports;
  7311. /******/ }
  7312. /******/
  7313. /******/
  7314. /******/ // expose the modules object (__webpack_modules__)
  7315. /******/ __webpack_require__.m = modules;
  7316. /******/
  7317. /******/ // expose the module cache
  7318. /******/ __webpack_require__.c = installedModules;
  7319. /******/
  7320. /******/ // define getter function for harmony exports
  7321. /******/ __webpack_require__.d = function(exports, name, getter) {
  7322. /******/ if(!__webpack_require__.o(exports, name)) {
  7323. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7324. /******/ }
  7325. /******/ };
  7326. /******/
  7327. /******/ // define __esModule on exports
  7328. /******/ __webpack_require__.r = function(exports) {
  7329. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7330. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7331. /******/ }
  7332. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7333. /******/ };
  7334. /******/
  7335. /******/ // create a fake namespace object
  7336. /******/ // mode & 1: value is a module id, require it
  7337. /******/ // mode & 2: merge all properties of value into the ns
  7338. /******/ // mode & 4: return value when already ns object
  7339. /******/ // mode & 8|1: behave like require
  7340. /******/ __webpack_require__.t = function(value, mode) {
  7341. /******/ if(mode & 1) value = __webpack_require__(value);
  7342. /******/ if(mode & 8) return value;
  7343. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7344. /******/ var ns = Object.create(null);
  7345. /******/ __webpack_require__.r(ns);
  7346. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7347. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7348. /******/ return ns;
  7349. /******/ };
  7350. /******/
  7351. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7352. /******/ __webpack_require__.n = function(module) {
  7353. /******/ var getter = module && module.__esModule ?
  7354. /******/ function getDefault() { return module['default']; } :
  7355. /******/ function getModuleExports() { return module; };
  7356. /******/ __webpack_require__.d(getter, 'a', getter);
  7357. /******/ return getter;
  7358. /******/ };
  7359. /******/
  7360. /******/ // Object.prototype.hasOwnProperty.call
  7361. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7362. /******/
  7363. /******/ // __webpack_public_path__
  7364. /******/ __webpack_require__.p = "";
  7365. /******/
  7366. /******/
  7367. /******/ // Load entry module and return exports
  7368. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7369. /******/ })
  7370. /************************************************************************/
  7371. /******/ ([
  7372. /* 0 */
  7373. /***/ (function(module, exports, __webpack_require__) {
  7374. "use strict";
  7375. 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; };
  7376. 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; }; }();
  7377. var _clipboardAction = __webpack_require__(1);
  7378. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7379. var _tinyEmitter = __webpack_require__(3);
  7380. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7381. var _goodListener = __webpack_require__(4);
  7382. var _goodListener2 = _interopRequireDefault(_goodListener);
  7383. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7384. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7385. 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; }
  7386. 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; }
  7387. /**
  7388. * Base class which takes one or more elements, adds event listeners to them,
  7389. * and instantiates a new `ClipboardAction` on each click.
  7390. */
  7391. var Clipboard = function (_Emitter) {
  7392. _inherits(Clipboard, _Emitter);
  7393. /**
  7394. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7395. * @param {Object} options
  7396. */
  7397. function Clipboard(trigger, options) {
  7398. _classCallCheck(this, Clipboard);
  7399. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7400. _this.resolveOptions(options);
  7401. _this.listenClick(trigger);
  7402. return _this;
  7403. }
  7404. /**
  7405. * Defines if attributes would be resolved using internal setter functions
  7406. * or custom functions that were passed in the constructor.
  7407. * @param {Object} options
  7408. */
  7409. _createClass(Clipboard, [{
  7410. key: 'resolveOptions',
  7411. value: function resolveOptions() {
  7412. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7413. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7414. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7415. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7416. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7417. }
  7418. /**
  7419. * Adds a click event listener to the passed trigger.
  7420. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7421. */
  7422. }, {
  7423. key: 'listenClick',
  7424. value: function listenClick(trigger) {
  7425. var _this2 = this;
  7426. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7427. return _this2.onClick(e);
  7428. });
  7429. }
  7430. /**
  7431. * Defines a new `ClipboardAction` on each click event.
  7432. * @param {Event} e
  7433. */
  7434. }, {
  7435. key: 'onClick',
  7436. value: function onClick(e) {
  7437. var trigger = e.delegateTarget || e.currentTarget;
  7438. if (this.clipboardAction) {
  7439. this.clipboardAction = null;
  7440. }
  7441. this.clipboardAction = new _clipboardAction2.default({
  7442. action: this.action(trigger),
  7443. target: this.target(trigger),
  7444. text: this.text(trigger),
  7445. container: this.container,
  7446. trigger: trigger,
  7447. emitter: this
  7448. });
  7449. }
  7450. /**
  7451. * Default `action` lookup function.
  7452. * @param {Element} trigger
  7453. */
  7454. }, {
  7455. key: 'defaultAction',
  7456. value: function defaultAction(trigger) {
  7457. return getAttributeValue('action', trigger);
  7458. }
  7459. /**
  7460. * Default `target` lookup function.
  7461. * @param {Element} trigger
  7462. */
  7463. }, {
  7464. key: 'defaultTarget',
  7465. value: function defaultTarget(trigger) {
  7466. var selector = getAttributeValue('target', trigger);
  7467. if (selector) {
  7468. return document.querySelector(selector);
  7469. }
  7470. }
  7471. /**
  7472. * Returns the support of the given action, or all actions if no action is
  7473. * given.
  7474. * @param {String} [action]
  7475. */
  7476. }, {
  7477. key: 'defaultText',
  7478. /**
  7479. * Default `text` lookup function.
  7480. * @param {Element} trigger
  7481. */
  7482. value: function defaultText(trigger) {
  7483. return getAttributeValue('text', trigger);
  7484. }
  7485. /**
  7486. * Destroy lifecycle.
  7487. */
  7488. }, {
  7489. key: 'destroy',
  7490. value: function destroy() {
  7491. this.listener.destroy();
  7492. if (this.clipboardAction) {
  7493. this.clipboardAction.destroy();
  7494. this.clipboardAction = null;
  7495. }
  7496. }
  7497. }], [{
  7498. key: 'isSupported',
  7499. value: function isSupported() {
  7500. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7501. var actions = typeof action === 'string' ? [action] : action;
  7502. var support = !!document.queryCommandSupported;
  7503. actions.forEach(function (action) {
  7504. support = support && !!document.queryCommandSupported(action);
  7505. });
  7506. return support;
  7507. }
  7508. }]);
  7509. return Clipboard;
  7510. }(_tinyEmitter2.default);
  7511. /**
  7512. * Helper function to retrieve attribute value.
  7513. * @param {String} suffix
  7514. * @param {Element} element
  7515. */
  7516. function getAttributeValue(suffix, element) {
  7517. var attribute = 'data-clipboard-' + suffix;
  7518. if (!element.hasAttribute(attribute)) {
  7519. return;
  7520. }
  7521. return element.getAttribute(attribute);
  7522. }
  7523. module.exports = Clipboard;
  7524. /***/ }),
  7525. /* 1 */
  7526. /***/ (function(module, exports, __webpack_require__) {
  7527. "use strict";
  7528. 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; };
  7529. 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; }; }();
  7530. var _select = __webpack_require__(2);
  7531. var _select2 = _interopRequireDefault(_select);
  7532. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7533. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7534. /**
  7535. * Inner class which performs selection from either `text` or `target`
  7536. * properties and then executes copy or cut operations.
  7537. */
  7538. var ClipboardAction = function () {
  7539. /**
  7540. * @param {Object} options
  7541. */
  7542. function ClipboardAction(options) {
  7543. _classCallCheck(this, ClipboardAction);
  7544. this.resolveOptions(options);
  7545. this.initSelection();
  7546. }
  7547. /**
  7548. * Defines base properties passed from constructor.
  7549. * @param {Object} options
  7550. */
  7551. _createClass(ClipboardAction, [{
  7552. key: 'resolveOptions',
  7553. value: function resolveOptions() {
  7554. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7555. this.action = options.action;
  7556. this.container = options.container;
  7557. this.emitter = options.emitter;
  7558. this.target = options.target;
  7559. this.text = options.text;
  7560. this.trigger = options.trigger;
  7561. this.selectedText = '';
  7562. }
  7563. /**
  7564. * Decides which selection strategy is going to be applied based
  7565. * on the existence of `text` and `target` properties.
  7566. */
  7567. }, {
  7568. key: 'initSelection',
  7569. value: function initSelection() {
  7570. if (this.text) {
  7571. this.selectFake();
  7572. } else if (this.target) {
  7573. this.selectTarget();
  7574. }
  7575. }
  7576. /**
  7577. * Creates a fake textarea element, sets its value from `text` property,
  7578. * and makes a selection on it.
  7579. */
  7580. }, {
  7581. key: 'selectFake',
  7582. value: function selectFake() {
  7583. var _this = this;
  7584. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7585. this.removeFake();
  7586. this.fakeHandlerCallback = function () {
  7587. return _this.removeFake();
  7588. };
  7589. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7590. this.fakeElem = document.createElement('textarea');
  7591. // Prevent zooming on iOS
  7592. this.fakeElem.style.fontSize = '12pt';
  7593. // Reset box model
  7594. this.fakeElem.style.border = '0';
  7595. this.fakeElem.style.padding = '0';
  7596. this.fakeElem.style.margin = '0';
  7597. // Move element out of screen horizontally
  7598. this.fakeElem.style.position = 'absolute';
  7599. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7600. // Move element to the same position vertically
  7601. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7602. this.fakeElem.style.top = yPosition + 'px';
  7603. this.fakeElem.setAttribute('readonly', '');
  7604. this.fakeElem.value = this.text;
  7605. this.container.appendChild(this.fakeElem);
  7606. this.selectedText = (0, _select2.default)(this.fakeElem);
  7607. this.copyText();
  7608. }
  7609. /**
  7610. * Only removes the fake element after another click event, that way
  7611. * a user can hit `Ctrl+C` to copy because selection still exists.
  7612. */
  7613. }, {
  7614. key: 'removeFake',
  7615. value: function removeFake() {
  7616. if (this.fakeHandler) {
  7617. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7618. this.fakeHandler = null;
  7619. this.fakeHandlerCallback = null;
  7620. }
  7621. if (this.fakeElem) {
  7622. this.container.removeChild(this.fakeElem);
  7623. this.fakeElem = null;
  7624. }
  7625. }
  7626. /**
  7627. * Selects the content from element passed on `target` property.
  7628. */
  7629. }, {
  7630. key: 'selectTarget',
  7631. value: function selectTarget() {
  7632. this.selectedText = (0, _select2.default)(this.target);
  7633. this.copyText();
  7634. }
  7635. /**
  7636. * Executes the copy operation based on the current selection.
  7637. */
  7638. }, {
  7639. key: 'copyText',
  7640. value: function copyText() {
  7641. var succeeded = void 0;
  7642. try {
  7643. succeeded = document.execCommand(this.action);
  7644. } catch (err) {
  7645. succeeded = false;
  7646. }
  7647. this.handleResult(succeeded);
  7648. }
  7649. /**
  7650. * Fires an event based on the copy operation result.
  7651. * @param {Boolean} succeeded
  7652. */
  7653. }, {
  7654. key: 'handleResult',
  7655. value: function handleResult(succeeded) {
  7656. this.emitter.emit(succeeded ? 'success' : 'error', {
  7657. action: this.action,
  7658. text: this.selectedText,
  7659. trigger: this.trigger,
  7660. clearSelection: this.clearSelection.bind(this)
  7661. });
  7662. }
  7663. /**
  7664. * Moves focus away from `target` and back to the trigger, removes current selection.
  7665. */
  7666. }, {
  7667. key: 'clearSelection',
  7668. value: function clearSelection() {
  7669. if (this.trigger) {
  7670. this.trigger.focus();
  7671. }
  7672. window.getSelection().removeAllRanges();
  7673. }
  7674. /**
  7675. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7676. * @param {String} action
  7677. */
  7678. }, {
  7679. key: 'destroy',
  7680. /**
  7681. * Destroy lifecycle.
  7682. */
  7683. value: function destroy() {
  7684. this.removeFake();
  7685. }
  7686. }, {
  7687. key: 'action',
  7688. set: function set() {
  7689. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7690. this._action = action;
  7691. if (this._action !== 'copy' && this._action !== 'cut') {
  7692. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7693. }
  7694. }
  7695. /**
  7696. * Gets the `action` property.
  7697. * @return {String}
  7698. */
  7699. ,
  7700. get: function get() {
  7701. return this._action;
  7702. }
  7703. /**
  7704. * Sets the `target` property using an element
  7705. * that will be have its content copied.
  7706. * @param {Element} target
  7707. */
  7708. }, {
  7709. key: 'target',
  7710. set: function set(target) {
  7711. if (target !== undefined) {
  7712. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7713. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7714. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7715. }
  7716. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7717. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7718. }
  7719. this._target = target;
  7720. } else {
  7721. throw new Error('Invalid "target" value, use a valid Element');
  7722. }
  7723. }
  7724. }
  7725. /**
  7726. * Gets the `target` property.
  7727. * @return {String|HTMLElement}
  7728. */
  7729. ,
  7730. get: function get() {
  7731. return this._target;
  7732. }
  7733. }]);
  7734. return ClipboardAction;
  7735. }();
  7736. module.exports = ClipboardAction;
  7737. /***/ }),
  7738. /* 2 */
  7739. /***/ (function(module, exports) {
  7740. function select(element) {
  7741. var selectedText;
  7742. if (element.nodeName === 'SELECT') {
  7743. element.focus();
  7744. selectedText = element.value;
  7745. }
  7746. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7747. var isReadOnly = element.hasAttribute('readonly');
  7748. if (!isReadOnly) {
  7749. element.setAttribute('readonly', '');
  7750. }
  7751. element.select();
  7752. element.setSelectionRange(0, element.value.length);
  7753. if (!isReadOnly) {
  7754. element.removeAttribute('readonly');
  7755. }
  7756. selectedText = element.value;
  7757. }
  7758. else {
  7759. if (element.hasAttribute('contenteditable')) {
  7760. element.focus();
  7761. }
  7762. var selection = window.getSelection();
  7763. var range = document.createRange();
  7764. range.selectNodeContents(element);
  7765. selection.removeAllRanges();
  7766. selection.addRange(range);
  7767. selectedText = selection.toString();
  7768. }
  7769. return selectedText;
  7770. }
  7771. module.exports = select;
  7772. /***/ }),
  7773. /* 3 */
  7774. /***/ (function(module, exports) {
  7775. function E () {
  7776. // Keep this empty so it's easier to inherit from
  7777. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7778. }
  7779. E.prototype = {
  7780. on: function (name, callback, ctx) {
  7781. var e = this.e || (this.e = {});
  7782. (e[name] || (e[name] = [])).push({
  7783. fn: callback,
  7784. ctx: ctx
  7785. });
  7786. return this;
  7787. },
  7788. once: function (name, callback, ctx) {
  7789. var self = this;
  7790. function listener () {
  7791. self.off(name, listener);
  7792. callback.apply(ctx, arguments);
  7793. };
  7794. listener._ = callback
  7795. return this.on(name, listener, ctx);
  7796. },
  7797. emit: function (name) {
  7798. var data = [].slice.call(arguments, 1);
  7799. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7800. var i = 0;
  7801. var len = evtArr.length;
  7802. for (i; i < len; i++) {
  7803. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7804. }
  7805. return this;
  7806. },
  7807. off: function (name, callback) {
  7808. var e = this.e || (this.e = {});
  7809. var evts = e[name];
  7810. var liveEvents = [];
  7811. if (evts && callback) {
  7812. for (var i = 0, len = evts.length; i < len; i++) {
  7813. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7814. liveEvents.push(evts[i]);
  7815. }
  7816. }
  7817. // Remove event from queue to prevent memory leak
  7818. // Suggested by https://github.com/lazd
  7819. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7820. (liveEvents.length)
  7821. ? e[name] = liveEvents
  7822. : delete e[name];
  7823. return this;
  7824. }
  7825. };
  7826. module.exports = E;
  7827. /***/ }),
  7828. /* 4 */
  7829. /***/ (function(module, exports, __webpack_require__) {
  7830. var is = __webpack_require__(5);
  7831. var delegate = __webpack_require__(6);
  7832. /**
  7833. * Validates all params and calls the right
  7834. * listener function based on its target type.
  7835. *
  7836. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7837. * @param {String} type
  7838. * @param {Function} callback
  7839. * @return {Object}
  7840. */
  7841. function listen(target, type, callback) {
  7842. if (!target && !type && !callback) {
  7843. throw new Error('Missing required arguments');
  7844. }
  7845. if (!is.string(type)) {
  7846. throw new TypeError('Second argument must be a String');
  7847. }
  7848. if (!is.fn(callback)) {
  7849. throw new TypeError('Third argument must be a Function');
  7850. }
  7851. if (is.node(target)) {
  7852. return listenNode(target, type, callback);
  7853. }
  7854. else if (is.nodeList(target)) {
  7855. return listenNodeList(target, type, callback);
  7856. }
  7857. else if (is.string(target)) {
  7858. return listenSelector(target, type, callback);
  7859. }
  7860. else {
  7861. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7862. }
  7863. }
  7864. /**
  7865. * Adds an event listener to a HTML element
  7866. * and returns a remove listener function.
  7867. *
  7868. * @param {HTMLElement} node
  7869. * @param {String} type
  7870. * @param {Function} callback
  7871. * @return {Object}
  7872. */
  7873. function listenNode(node, type, callback) {
  7874. node.addEventListener(type, callback);
  7875. return {
  7876. destroy: function() {
  7877. node.removeEventListener(type, callback);
  7878. }
  7879. }
  7880. }
  7881. /**
  7882. * Add an event listener to a list of HTML elements
  7883. * and returns a remove listener function.
  7884. *
  7885. * @param {NodeList|HTMLCollection} nodeList
  7886. * @param {String} type
  7887. * @param {Function} callback
  7888. * @return {Object}
  7889. */
  7890. function listenNodeList(nodeList, type, callback) {
  7891. Array.prototype.forEach.call(nodeList, function(node) {
  7892. node.addEventListener(type, callback);
  7893. });
  7894. return {
  7895. destroy: function() {
  7896. Array.prototype.forEach.call(nodeList, function(node) {
  7897. node.removeEventListener(type, callback);
  7898. });
  7899. }
  7900. }
  7901. }
  7902. /**
  7903. * Add an event listener to a selector
  7904. * and returns a remove listener function.
  7905. *
  7906. * @param {String} selector
  7907. * @param {String} type
  7908. * @param {Function} callback
  7909. * @return {Object}
  7910. */
  7911. function listenSelector(selector, type, callback) {
  7912. return delegate(document.body, selector, type, callback);
  7913. }
  7914. module.exports = listen;
  7915. /***/ }),
  7916. /* 5 */
  7917. /***/ (function(module, exports) {
  7918. /**
  7919. * Check if argument is a HTML element.
  7920. *
  7921. * @param {Object} value
  7922. * @return {Boolean}
  7923. */
  7924. exports.node = function(value) {
  7925. return value !== undefined
  7926. && value instanceof HTMLElement
  7927. && value.nodeType === 1;
  7928. };
  7929. /**
  7930. * Check if argument is a list of HTML elements.
  7931. *
  7932. * @param {Object} value
  7933. * @return {Boolean}
  7934. */
  7935. exports.nodeList = function(value) {
  7936. var type = Object.prototype.toString.call(value);
  7937. return value !== undefined
  7938. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  7939. && ('length' in value)
  7940. && (value.length === 0 || exports.node(value[0]));
  7941. };
  7942. /**
  7943. * Check if argument is a string.
  7944. *
  7945. * @param {Object} value
  7946. * @return {Boolean}
  7947. */
  7948. exports.string = function(value) {
  7949. return typeof value === 'string'
  7950. || value instanceof String;
  7951. };
  7952. /**
  7953. * Check if argument is a function.
  7954. *
  7955. * @param {Object} value
  7956. * @return {Boolean}
  7957. */
  7958. exports.fn = function(value) {
  7959. var type = Object.prototype.toString.call(value);
  7960. return type === '[object Function]';
  7961. };
  7962. /***/ }),
  7963. /* 6 */
  7964. /***/ (function(module, exports, __webpack_require__) {
  7965. var closest = __webpack_require__(7);
  7966. /**
  7967. * Delegates event to a selector.
  7968. *
  7969. * @param {Element} element
  7970. * @param {String} selector
  7971. * @param {String} type
  7972. * @param {Function} callback
  7973. * @param {Boolean} useCapture
  7974. * @return {Object}
  7975. */
  7976. function _delegate(element, selector, type, callback, useCapture) {
  7977. var listenerFn = listener.apply(this, arguments);
  7978. element.addEventListener(type, listenerFn, useCapture);
  7979. return {
  7980. destroy: function() {
  7981. element.removeEventListener(type, listenerFn, useCapture);
  7982. }
  7983. }
  7984. }
  7985. /**
  7986. * Delegates event to a selector.
  7987. *
  7988. * @param {Element|String|Array} [elements]
  7989. * @param {String} selector
  7990. * @param {String} type
  7991. * @param {Function} callback
  7992. * @param {Boolean} useCapture
  7993. * @return {Object}
  7994. */
  7995. function delegate(elements, selector, type, callback, useCapture) {
  7996. // Handle the regular Element usage
  7997. if (typeof elements.addEventListener === 'function') {
  7998. return _delegate.apply(null, arguments);
  7999. }
  8000. // Handle Element-less usage, it defaults to global delegation
  8001. if (typeof type === 'function') {
  8002. // Use `document` as the first parameter, then apply arguments
  8003. // This is a short way to .unshift `arguments` without running into deoptimizations
  8004. return _delegate.bind(null, document).apply(null, arguments);
  8005. }
  8006. // Handle Selector-based usage
  8007. if (typeof elements === 'string') {
  8008. elements = document.querySelectorAll(elements);
  8009. }
  8010. // Handle Array-like based usage
  8011. return Array.prototype.map.call(elements, function (element) {
  8012. return _delegate(element, selector, type, callback, useCapture);
  8013. });
  8014. }
  8015. /**
  8016. * Finds closest match and invokes callback.
  8017. *
  8018. * @param {Element} element
  8019. * @param {String} selector
  8020. * @param {String} type
  8021. * @param {Function} callback
  8022. * @return {Function}
  8023. */
  8024. function listener(element, selector, type, callback) {
  8025. return function(e) {
  8026. e.delegateTarget = closest(e.target, selector);
  8027. if (e.delegateTarget) {
  8028. callback.call(element, e);
  8029. }
  8030. }
  8031. }
  8032. module.exports = delegate;
  8033. /***/ }),
  8034. /* 7 */
  8035. /***/ (function(module, exports) {
  8036. var DOCUMENT_NODE_TYPE = 9;
  8037. /**
  8038. * A polyfill for Element.matches()
  8039. */
  8040. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8041. var proto = Element.prototype;
  8042. proto.matches = proto.matchesSelector ||
  8043. proto.mozMatchesSelector ||
  8044. proto.msMatchesSelector ||
  8045. proto.oMatchesSelector ||
  8046. proto.webkitMatchesSelector;
  8047. }
  8048. /**
  8049. * Finds the closest parent that matches a selector.
  8050. *
  8051. * @param {Element} element
  8052. * @param {String} selector
  8053. * @return {Function}
  8054. */
  8055. function closest (element, selector) {
  8056. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8057. if (typeof element.matches === 'function' &&
  8058. element.matches(selector)) {
  8059. return element;
  8060. }
  8061. element = element.parentNode;
  8062. }
  8063. }
  8064. module.exports = closest;
  8065. /***/ })
  8066. /******/ ]);
  8067. });
  8068. /***/ }),
  8069. /***/ "./node_modules/ieee754/index.js":
  8070. /*!***************************************!*\
  8071. !*** ./node_modules/ieee754/index.js ***!
  8072. \***************************************/
  8073. /*! no static exports found */
  8074. /***/ (function(module, exports) {
  8075. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8076. var e, m
  8077. var eLen = (nBytes * 8) - mLen - 1
  8078. var eMax = (1 << eLen) - 1
  8079. var eBias = eMax >> 1
  8080. var nBits = -7
  8081. var i = isLE ? (nBytes - 1) : 0
  8082. var d = isLE ? -1 : 1
  8083. var s = buffer[offset + i]
  8084. i += d
  8085. e = s & ((1 << (-nBits)) - 1)
  8086. s >>= (-nBits)
  8087. nBits += eLen
  8088. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8089. m = e & ((1 << (-nBits)) - 1)
  8090. e >>= (-nBits)
  8091. nBits += mLen
  8092. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8093. if (e === 0) {
  8094. e = 1 - eBias
  8095. } else if (e === eMax) {
  8096. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8097. } else {
  8098. m = m + Math.pow(2, mLen)
  8099. e = e - eBias
  8100. }
  8101. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8102. }
  8103. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8104. var e, m, c
  8105. var eLen = (nBytes * 8) - mLen - 1
  8106. var eMax = (1 << eLen) - 1
  8107. var eBias = eMax >> 1
  8108. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8109. var i = isLE ? 0 : (nBytes - 1)
  8110. var d = isLE ? 1 : -1
  8111. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8112. value = Math.abs(value)
  8113. if (isNaN(value) || value === Infinity) {
  8114. m = isNaN(value) ? 1 : 0
  8115. e = eMax
  8116. } else {
  8117. e = Math.floor(Math.log(value) / Math.LN2)
  8118. if (value * (c = Math.pow(2, -e)) < 1) {
  8119. e--
  8120. c *= 2
  8121. }
  8122. if (e + eBias >= 1) {
  8123. value += rt / c
  8124. } else {
  8125. value += rt * Math.pow(2, 1 - eBias)
  8126. }
  8127. if (value * c >= 2) {
  8128. e++
  8129. c /= 2
  8130. }
  8131. if (e + eBias >= eMax) {
  8132. m = 0
  8133. e = eMax
  8134. } else if (e + eBias >= 1) {
  8135. m = ((value * c) - 1) * Math.pow(2, mLen)
  8136. e = e + eBias
  8137. } else {
  8138. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8139. e = 0
  8140. }
  8141. }
  8142. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8143. e = (e << mLen) | m
  8144. eLen += mLen
  8145. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8146. buffer[offset + i - d] |= s * 128
  8147. }
  8148. /***/ }),
  8149. /***/ "./node_modules/isarray/index.js":
  8150. /*!***************************************!*\
  8151. !*** ./node_modules/isarray/index.js ***!
  8152. \***************************************/
  8153. /*! no static exports found */
  8154. /***/ (function(module, exports) {
  8155. var toString = {}.toString;
  8156. module.exports = Array.isArray || function (arr) {
  8157. return toString.call(arr) == '[object Array]';
  8158. };
  8159. /***/ }),
  8160. /***/ "./node_modules/jquery/dist/jquery.js":
  8161. /*!********************************************!*\
  8162. !*** ./node_modules/jquery/dist/jquery.js ***!
  8163. \********************************************/
  8164. /*! no static exports found */
  8165. /***/ (function(module, exports, __webpack_require__) {
  8166. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8167. * jQuery JavaScript Library v3.4.1
  8168. * https://jquery.com/
  8169. *
  8170. * Includes Sizzle.js
  8171. * https://sizzlejs.com/
  8172. *
  8173. * Copyright JS Foundation and other contributors
  8174. * Released under the MIT license
  8175. * https://jquery.org/license
  8176. *
  8177. * Date: 2019-05-01T21:04Z
  8178. */
  8179. ( function( global, factory ) {
  8180. "use strict";
  8181. if ( true && typeof module.exports === "object" ) {
  8182. // For CommonJS and CommonJS-like environments where a proper `window`
  8183. // is present, execute the factory and get jQuery.
  8184. // For environments that do not have a `window` with a `document`
  8185. // (such as Node.js), expose a factory as module.exports.
  8186. // This accentuates the need for the creation of a real `window`.
  8187. // e.g. var jQuery = require("jquery")(window);
  8188. // See ticket #14549 for more info.
  8189. module.exports = global.document ?
  8190. factory( global, true ) :
  8191. function( w ) {
  8192. if ( !w.document ) {
  8193. throw new Error( "jQuery requires a window with a document" );
  8194. }
  8195. return factory( w );
  8196. };
  8197. } else {
  8198. factory( global );
  8199. }
  8200. // Pass this if window is not defined yet
  8201. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8202. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8203. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8204. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8205. // enough that all such attempts are guarded in a try block.
  8206. "use strict";
  8207. var arr = [];
  8208. var document = window.document;
  8209. var getProto = Object.getPrototypeOf;
  8210. var slice = arr.slice;
  8211. var concat = arr.concat;
  8212. var push = arr.push;
  8213. var indexOf = arr.indexOf;
  8214. var class2type = {};
  8215. var toString = class2type.toString;
  8216. var hasOwn = class2type.hasOwnProperty;
  8217. var fnToString = hasOwn.toString;
  8218. var ObjectFunctionString = fnToString.call( Object );
  8219. var support = {};
  8220. var isFunction = function isFunction( obj ) {
  8221. // Support: Chrome <=57, Firefox <=52
  8222. // In some browsers, typeof returns "function" for HTML <object> elements
  8223. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8224. // We don't want to classify *any* DOM node as a function.
  8225. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8226. };
  8227. var isWindow = function isWindow( obj ) {
  8228. return obj != null && obj === obj.window;
  8229. };
  8230. var preservedScriptAttributes = {
  8231. type: true,
  8232. src: true,
  8233. nonce: true,
  8234. noModule: true
  8235. };
  8236. function DOMEval( code, node, doc ) {
  8237. doc = doc || document;
  8238. var i, val,
  8239. script = doc.createElement( "script" );
  8240. script.text = code;
  8241. if ( node ) {
  8242. for ( i in preservedScriptAttributes ) {
  8243. // Support: Firefox 64+, Edge 18+
  8244. // Some browsers don't support the "nonce" property on scripts.
  8245. // On the other hand, just using `getAttribute` is not enough as
  8246. // the `nonce` attribute is reset to an empty string whenever it
  8247. // becomes browsing-context connected.
  8248. // See https://github.com/whatwg/html/issues/2369
  8249. // See https://html.spec.whatwg.org/#nonce-attributes
  8250. // The `node.getAttribute` check was added for the sake of
  8251. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8252. // via an object.
  8253. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8254. if ( val ) {
  8255. script.setAttribute( i, val );
  8256. }
  8257. }
  8258. }
  8259. doc.head.appendChild( script ).parentNode.removeChild( script );
  8260. }
  8261. function toType( obj ) {
  8262. if ( obj == null ) {
  8263. return obj + "";
  8264. }
  8265. // Support: Android <=2.3 only (functionish RegExp)
  8266. return typeof obj === "object" || typeof obj === "function" ?
  8267. class2type[ toString.call( obj ) ] || "object" :
  8268. typeof obj;
  8269. }
  8270. /* global Symbol */
  8271. // Defining this global in .eslintrc.json would create a danger of using the global
  8272. // unguarded in another place, it seems safer to define global only for this module
  8273. var
  8274. version = "3.4.1",
  8275. // Define a local copy of jQuery
  8276. jQuery = function( selector, context ) {
  8277. // The jQuery object is actually just the init constructor 'enhanced'
  8278. // Need init if jQuery is called (just allow error to be thrown if not included)
  8279. return new jQuery.fn.init( selector, context );
  8280. },
  8281. // Support: Android <=4.0 only
  8282. // Make sure we trim BOM and NBSP
  8283. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8284. jQuery.fn = jQuery.prototype = {
  8285. // The current version of jQuery being used
  8286. jquery: version,
  8287. constructor: jQuery,
  8288. // The default length of a jQuery object is 0
  8289. length: 0,
  8290. toArray: function() {
  8291. return slice.call( this );
  8292. },
  8293. // Get the Nth element in the matched element set OR
  8294. // Get the whole matched element set as a clean array
  8295. get: function( num ) {
  8296. // Return all the elements in a clean array
  8297. if ( num == null ) {
  8298. return slice.call( this );
  8299. }
  8300. // Return just the one element from the set
  8301. return num < 0 ? this[ num + this.length ] : this[ num ];
  8302. },
  8303. // Take an array of elements and push it onto the stack
  8304. // (returning the new matched element set)
  8305. pushStack: function( elems ) {
  8306. // Build a new jQuery matched element set
  8307. var ret = jQuery.merge( this.constructor(), elems );
  8308. // Add the old object onto the stack (as a reference)
  8309. ret.prevObject = this;
  8310. // Return the newly-formed element set
  8311. return ret;
  8312. },
  8313. // Execute a callback for every element in the matched set.
  8314. each: function( callback ) {
  8315. return jQuery.each( this, callback );
  8316. },
  8317. map: function( callback ) {
  8318. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8319. return callback.call( elem, i, elem );
  8320. } ) );
  8321. },
  8322. slice: function() {
  8323. return this.pushStack( slice.apply( this, arguments ) );
  8324. },
  8325. first: function() {
  8326. return this.eq( 0 );
  8327. },
  8328. last: function() {
  8329. return this.eq( -1 );
  8330. },
  8331. eq: function( i ) {
  8332. var len = this.length,
  8333. j = +i + ( i < 0 ? len : 0 );
  8334. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8335. },
  8336. end: function() {
  8337. return this.prevObject || this.constructor();
  8338. },
  8339. // For internal use only.
  8340. // Behaves like an Array's method, not like a jQuery method.
  8341. push: push,
  8342. sort: arr.sort,
  8343. splice: arr.splice
  8344. };
  8345. jQuery.extend = jQuery.fn.extend = function() {
  8346. var options, name, src, copy, copyIsArray, clone,
  8347. target = arguments[ 0 ] || {},
  8348. i = 1,
  8349. length = arguments.length,
  8350. deep = false;
  8351. // Handle a deep copy situation
  8352. if ( typeof target === "boolean" ) {
  8353. deep = target;
  8354. // Skip the boolean and the target
  8355. target = arguments[ i ] || {};
  8356. i++;
  8357. }
  8358. // Handle case when target is a string or something (possible in deep copy)
  8359. if ( typeof target !== "object" && !isFunction( target ) ) {
  8360. target = {};
  8361. }
  8362. // Extend jQuery itself if only one argument is passed
  8363. if ( i === length ) {
  8364. target = this;
  8365. i--;
  8366. }
  8367. for ( ; i < length; i++ ) {
  8368. // Only deal with non-null/undefined values
  8369. if ( ( options = arguments[ i ] ) != null ) {
  8370. // Extend the base object
  8371. for ( name in options ) {
  8372. copy = options[ name ];
  8373. // Prevent Object.prototype pollution
  8374. // Prevent never-ending loop
  8375. if ( name === "__proto__" || target === copy ) {
  8376. continue;
  8377. }
  8378. // Recurse if we're merging plain objects or arrays
  8379. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8380. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8381. src = target[ name ];
  8382. // Ensure proper type for the source value
  8383. if ( copyIsArray && !Array.isArray( src ) ) {
  8384. clone = [];
  8385. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8386. clone = {};
  8387. } else {
  8388. clone = src;
  8389. }
  8390. copyIsArray = false;
  8391. // Never move original objects, clone them
  8392. target[ name ] = jQuery.extend( deep, clone, copy );
  8393. // Don't bring in undefined values
  8394. } else if ( copy !== undefined ) {
  8395. target[ name ] = copy;
  8396. }
  8397. }
  8398. }
  8399. }
  8400. // Return the modified object
  8401. return target;
  8402. };
  8403. jQuery.extend( {
  8404. // Unique for each copy of jQuery on the page
  8405. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8406. // Assume jQuery is ready without the ready module
  8407. isReady: true,
  8408. error: function( msg ) {
  8409. throw new Error( msg );
  8410. },
  8411. noop: function() {},
  8412. isPlainObject: function( obj ) {
  8413. var proto, Ctor;
  8414. // Detect obvious negatives
  8415. // Use toString instead of jQuery.type to catch host objects
  8416. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8417. return false;
  8418. }
  8419. proto = getProto( obj );
  8420. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8421. if ( !proto ) {
  8422. return true;
  8423. }
  8424. // Objects with prototype are plain iff they were constructed by a global Object function
  8425. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8426. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8427. },
  8428. isEmptyObject: function( obj ) {
  8429. var name;
  8430. for ( name in obj ) {
  8431. return false;
  8432. }
  8433. return true;
  8434. },
  8435. // Evaluates a script in a global context
  8436. globalEval: function( code, options ) {
  8437. DOMEval( code, { nonce: options && options.nonce } );
  8438. },
  8439. each: function( obj, callback ) {
  8440. var length, i = 0;
  8441. if ( isArrayLike( obj ) ) {
  8442. length = obj.length;
  8443. for ( ; i < length; i++ ) {
  8444. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8445. break;
  8446. }
  8447. }
  8448. } else {
  8449. for ( i in obj ) {
  8450. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8451. break;
  8452. }
  8453. }
  8454. }
  8455. return obj;
  8456. },
  8457. // Support: Android <=4.0 only
  8458. trim: function( text ) {
  8459. return text == null ?
  8460. "" :
  8461. ( text + "" ).replace( rtrim, "" );
  8462. },
  8463. // results is for internal usage only
  8464. makeArray: function( arr, results ) {
  8465. var ret = results || [];
  8466. if ( arr != null ) {
  8467. if ( isArrayLike( Object( arr ) ) ) {
  8468. jQuery.merge( ret,
  8469. typeof arr === "string" ?
  8470. [ arr ] : arr
  8471. );
  8472. } else {
  8473. push.call( ret, arr );
  8474. }
  8475. }
  8476. return ret;
  8477. },
  8478. inArray: function( elem, arr, i ) {
  8479. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8480. },
  8481. // Support: Android <=4.0 only, PhantomJS 1 only
  8482. // push.apply(_, arraylike) throws on ancient WebKit
  8483. merge: function( first, second ) {
  8484. var len = +second.length,
  8485. j = 0,
  8486. i = first.length;
  8487. for ( ; j < len; j++ ) {
  8488. first[ i++ ] = second[ j ];
  8489. }
  8490. first.length = i;
  8491. return first;
  8492. },
  8493. grep: function( elems, callback, invert ) {
  8494. var callbackInverse,
  8495. matches = [],
  8496. i = 0,
  8497. length = elems.length,
  8498. callbackExpect = !invert;
  8499. // Go through the array, only saving the items
  8500. // that pass the validator function
  8501. for ( ; i < length; i++ ) {
  8502. callbackInverse = !callback( elems[ i ], i );
  8503. if ( callbackInverse !== callbackExpect ) {
  8504. matches.push( elems[ i ] );
  8505. }
  8506. }
  8507. return matches;
  8508. },
  8509. // arg is for internal usage only
  8510. map: function( elems, callback, arg ) {
  8511. var length, value,
  8512. i = 0,
  8513. ret = [];
  8514. // Go through the array, translating each of the items to their new values
  8515. if ( isArrayLike( elems ) ) {
  8516. length = elems.length;
  8517. for ( ; i < length; i++ ) {
  8518. value = callback( elems[ i ], i, arg );
  8519. if ( value != null ) {
  8520. ret.push( value );
  8521. }
  8522. }
  8523. // Go through every key on the object,
  8524. } else {
  8525. for ( i in elems ) {
  8526. value = callback( elems[ i ], i, arg );
  8527. if ( value != null ) {
  8528. ret.push( value );
  8529. }
  8530. }
  8531. }
  8532. // Flatten any nested arrays
  8533. return concat.apply( [], ret );
  8534. },
  8535. // A global GUID counter for objects
  8536. guid: 1,
  8537. // jQuery.support is not used in Core but other projects attach their
  8538. // properties to it so it needs to exist.
  8539. support: support
  8540. } );
  8541. if ( typeof Symbol === "function" ) {
  8542. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8543. }
  8544. // Populate the class2type map
  8545. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8546. function( i, name ) {
  8547. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8548. } );
  8549. function isArrayLike( obj ) {
  8550. // Support: real iOS 8.2 only (not reproducible in simulator)
  8551. // `in` check used to prevent JIT error (gh-2145)
  8552. // hasOwn isn't used here due to false negatives
  8553. // regarding Nodelist length in IE
  8554. var length = !!obj && "length" in obj && obj.length,
  8555. type = toType( obj );
  8556. if ( isFunction( obj ) || isWindow( obj ) ) {
  8557. return false;
  8558. }
  8559. return type === "array" || length === 0 ||
  8560. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8561. }
  8562. var Sizzle =
  8563. /*!
  8564. * Sizzle CSS Selector Engine v2.3.4
  8565. * https://sizzlejs.com/
  8566. *
  8567. * Copyright JS Foundation and other contributors
  8568. * Released under the MIT license
  8569. * https://js.foundation/
  8570. *
  8571. * Date: 2019-04-08
  8572. */
  8573. (function( window ) {
  8574. var i,
  8575. support,
  8576. Expr,
  8577. getText,
  8578. isXML,
  8579. tokenize,
  8580. compile,
  8581. select,
  8582. outermostContext,
  8583. sortInput,
  8584. hasDuplicate,
  8585. // Local document vars
  8586. setDocument,
  8587. document,
  8588. docElem,
  8589. documentIsHTML,
  8590. rbuggyQSA,
  8591. rbuggyMatches,
  8592. matches,
  8593. contains,
  8594. // Instance-specific data
  8595. expando = "sizzle" + 1 * new Date(),
  8596. preferredDoc = window.document,
  8597. dirruns = 0,
  8598. done = 0,
  8599. classCache = createCache(),
  8600. tokenCache = createCache(),
  8601. compilerCache = createCache(),
  8602. nonnativeSelectorCache = createCache(),
  8603. sortOrder = function( a, b ) {
  8604. if ( a === b ) {
  8605. hasDuplicate = true;
  8606. }
  8607. return 0;
  8608. },
  8609. // Instance methods
  8610. hasOwn = ({}).hasOwnProperty,
  8611. arr = [],
  8612. pop = arr.pop,
  8613. push_native = arr.push,
  8614. push = arr.push,
  8615. slice = arr.slice,
  8616. // Use a stripped-down indexOf as it's faster than native
  8617. // https://jsperf.com/thor-indexof-vs-for/5
  8618. indexOf = function( list, elem ) {
  8619. var i = 0,
  8620. len = list.length;
  8621. for ( ; i < len; i++ ) {
  8622. if ( list[i] === elem ) {
  8623. return i;
  8624. }
  8625. }
  8626. return -1;
  8627. },
  8628. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8629. // Regular expressions
  8630. // http://www.w3.org/TR/css3-selectors/#whitespace
  8631. whitespace = "[\\x20\\t\\r\\n\\f]",
  8632. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8633. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8634. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8635. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8636. // Operator (capture 2)
  8637. "*([*^$|!~]?=)" + whitespace +
  8638. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8639. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8640. "*\\]",
  8641. pseudos = ":(" + identifier + ")(?:\\((" +
  8642. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8643. // 1. quoted (capture 3; capture 4 or capture 5)
  8644. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8645. // 2. simple (capture 6)
  8646. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8647. // 3. anything else (capture 2)
  8648. ".*" +
  8649. ")\\)|)",
  8650. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8651. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8652. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8653. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8654. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8655. rdescend = new RegExp( whitespace + "|>" ),
  8656. rpseudo = new RegExp( pseudos ),
  8657. ridentifier = new RegExp( "^" + identifier + "$" ),
  8658. matchExpr = {
  8659. "ID": new RegExp( "^#(" + identifier + ")" ),
  8660. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8661. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8662. "ATTR": new RegExp( "^" + attributes ),
  8663. "PSEUDO": new RegExp( "^" + pseudos ),
  8664. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8665. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8666. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8667. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8668. // For use in libraries implementing .is()
  8669. // We use this for POS matching in `select`
  8670. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8671. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8672. },
  8673. rhtml = /HTML$/i,
  8674. rinputs = /^(?:input|select|textarea|button)$/i,
  8675. rheader = /^h\d$/i,
  8676. rnative = /^[^{]+\{\s*\[native \w/,
  8677. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8678. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8679. rsibling = /[+~]/,
  8680. // CSS escapes
  8681. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8682. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8683. funescape = function( _, escaped, escapedWhitespace ) {
  8684. var high = "0x" + escaped - 0x10000;
  8685. // NaN means non-codepoint
  8686. // Support: Firefox<24
  8687. // Workaround erroneous numeric interpretation of +"0x"
  8688. return high !== high || escapedWhitespace ?
  8689. escaped :
  8690. high < 0 ?
  8691. // BMP codepoint
  8692. String.fromCharCode( high + 0x10000 ) :
  8693. // Supplemental Plane codepoint (surrogate pair)
  8694. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8695. },
  8696. // CSS string/identifier serialization
  8697. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8698. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8699. fcssescape = function( ch, asCodePoint ) {
  8700. if ( asCodePoint ) {
  8701. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8702. if ( ch === "\0" ) {
  8703. return "\uFFFD";
  8704. }
  8705. // Control characters and (dependent upon position) numbers get escaped as code points
  8706. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8707. }
  8708. // Other potentially-special ASCII characters get backslash-escaped
  8709. return "\\" + ch;
  8710. },
  8711. // Used for iframes
  8712. // See setDocument()
  8713. // Removing the function wrapper causes a "Permission Denied"
  8714. // error in IE
  8715. unloadHandler = function() {
  8716. setDocument();
  8717. },
  8718. inDisabledFieldset = addCombinator(
  8719. function( elem ) {
  8720. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8721. },
  8722. { dir: "parentNode", next: "legend" }
  8723. );
  8724. // Optimize for push.apply( _, NodeList )
  8725. try {
  8726. push.apply(
  8727. (arr = slice.call( preferredDoc.childNodes )),
  8728. preferredDoc.childNodes
  8729. );
  8730. // Support: Android<4.0
  8731. // Detect silently failing push.apply
  8732. arr[ preferredDoc.childNodes.length ].nodeType;
  8733. } catch ( e ) {
  8734. push = { apply: arr.length ?
  8735. // Leverage slice if possible
  8736. function( target, els ) {
  8737. push_native.apply( target, slice.call(els) );
  8738. } :
  8739. // Support: IE<9
  8740. // Otherwise append directly
  8741. function( target, els ) {
  8742. var j = target.length,
  8743. i = 0;
  8744. // Can't trust NodeList.length
  8745. while ( (target[j++] = els[i++]) ) {}
  8746. target.length = j - 1;
  8747. }
  8748. };
  8749. }
  8750. function Sizzle( selector, context, results, seed ) {
  8751. var m, i, elem, nid, match, groups, newSelector,
  8752. newContext = context && context.ownerDocument,
  8753. // nodeType defaults to 9, since context defaults to document
  8754. nodeType = context ? context.nodeType : 9;
  8755. results = results || [];
  8756. // Return early from calls with invalid selector or context
  8757. if ( typeof selector !== "string" || !selector ||
  8758. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8759. return results;
  8760. }
  8761. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8762. if ( !seed ) {
  8763. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8764. setDocument( context );
  8765. }
  8766. context = context || document;
  8767. if ( documentIsHTML ) {
  8768. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8769. // (excepting DocumentFragment context, where the methods don't exist)
  8770. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8771. // ID selector
  8772. if ( (m = match[1]) ) {
  8773. // Document context
  8774. if ( nodeType === 9 ) {
  8775. if ( (elem = context.getElementById( m )) ) {
  8776. // Support: IE, Opera, Webkit
  8777. // TODO: identify versions
  8778. // getElementById can match elements by name instead of ID
  8779. if ( elem.id === m ) {
  8780. results.push( elem );
  8781. return results;
  8782. }
  8783. } else {
  8784. return results;
  8785. }
  8786. // Element context
  8787. } else {
  8788. // Support: IE, Opera, Webkit
  8789. // TODO: identify versions
  8790. // getElementById can match elements by name instead of ID
  8791. if ( newContext && (elem = newContext.getElementById( m )) &&
  8792. contains( context, elem ) &&
  8793. elem.id === m ) {
  8794. results.push( elem );
  8795. return results;
  8796. }
  8797. }
  8798. // Type selector
  8799. } else if ( match[2] ) {
  8800. push.apply( results, context.getElementsByTagName( selector ) );
  8801. return results;
  8802. // Class selector
  8803. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8804. context.getElementsByClassName ) {
  8805. push.apply( results, context.getElementsByClassName( m ) );
  8806. return results;
  8807. }
  8808. }
  8809. // Take advantage of querySelectorAll
  8810. if ( support.qsa &&
  8811. !nonnativeSelectorCache[ selector + " " ] &&
  8812. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8813. // Support: IE 8 only
  8814. // Exclude object elements
  8815. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8816. newSelector = selector;
  8817. newContext = context;
  8818. // qSA considers elements outside a scoping root when evaluating child or
  8819. // descendant combinators, which is not what we want.
  8820. // In such cases, we work around the behavior by prefixing every selector in the
  8821. // list with an ID selector referencing the scope context.
  8822. // Thanks to Andrew Dupont for this technique.
  8823. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8824. // Capture the context ID, setting it first if necessary
  8825. if ( (nid = context.getAttribute( "id" )) ) {
  8826. nid = nid.replace( rcssescape, fcssescape );
  8827. } else {
  8828. context.setAttribute( "id", (nid = expando) );
  8829. }
  8830. // Prefix every selector in the list
  8831. groups = tokenize( selector );
  8832. i = groups.length;
  8833. while ( i-- ) {
  8834. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8835. }
  8836. newSelector = groups.join( "," );
  8837. // Expand context for sibling selectors
  8838. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8839. context;
  8840. }
  8841. try {
  8842. push.apply( results,
  8843. newContext.querySelectorAll( newSelector )
  8844. );
  8845. return results;
  8846. } catch ( qsaError ) {
  8847. nonnativeSelectorCache( selector, true );
  8848. } finally {
  8849. if ( nid === expando ) {
  8850. context.removeAttribute( "id" );
  8851. }
  8852. }
  8853. }
  8854. }
  8855. }
  8856. // All others
  8857. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8858. }
  8859. /**
  8860. * Create key-value caches of limited size
  8861. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8862. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8863. * deleting the oldest entry
  8864. */
  8865. function createCache() {
  8866. var keys = [];
  8867. function cache( key, value ) {
  8868. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8869. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8870. // Only keep the most recent entries
  8871. delete cache[ keys.shift() ];
  8872. }
  8873. return (cache[ key + " " ] = value);
  8874. }
  8875. return cache;
  8876. }
  8877. /**
  8878. * Mark a function for special use by Sizzle
  8879. * @param {Function} fn The function to mark
  8880. */
  8881. function markFunction( fn ) {
  8882. fn[ expando ] = true;
  8883. return fn;
  8884. }
  8885. /**
  8886. * Support testing using an element
  8887. * @param {Function} fn Passed the created element and returns a boolean result
  8888. */
  8889. function assert( fn ) {
  8890. var el = document.createElement("fieldset");
  8891. try {
  8892. return !!fn( el );
  8893. } catch (e) {
  8894. return false;
  8895. } finally {
  8896. // Remove from its parent by default
  8897. if ( el.parentNode ) {
  8898. el.parentNode.removeChild( el );
  8899. }
  8900. // release memory in IE
  8901. el = null;
  8902. }
  8903. }
  8904. /**
  8905. * Adds the same handler for all of the specified attrs
  8906. * @param {String} attrs Pipe-separated list of attributes
  8907. * @param {Function} handler The method that will be applied
  8908. */
  8909. function addHandle( attrs, handler ) {
  8910. var arr = attrs.split("|"),
  8911. i = arr.length;
  8912. while ( i-- ) {
  8913. Expr.attrHandle[ arr[i] ] = handler;
  8914. }
  8915. }
  8916. /**
  8917. * Checks document order of two siblings
  8918. * @param {Element} a
  8919. * @param {Element} b
  8920. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  8921. */
  8922. function siblingCheck( a, b ) {
  8923. var cur = b && a,
  8924. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  8925. a.sourceIndex - b.sourceIndex;
  8926. // Use IE sourceIndex if available on both nodes
  8927. if ( diff ) {
  8928. return diff;
  8929. }
  8930. // Check if b follows a
  8931. if ( cur ) {
  8932. while ( (cur = cur.nextSibling) ) {
  8933. if ( cur === b ) {
  8934. return -1;
  8935. }
  8936. }
  8937. }
  8938. return a ? 1 : -1;
  8939. }
  8940. /**
  8941. * Returns a function to use in pseudos for input types
  8942. * @param {String} type
  8943. */
  8944. function createInputPseudo( type ) {
  8945. return function( elem ) {
  8946. var name = elem.nodeName.toLowerCase();
  8947. return name === "input" && elem.type === type;
  8948. };
  8949. }
  8950. /**
  8951. * Returns a function to use in pseudos for buttons
  8952. * @param {String} type
  8953. */
  8954. function createButtonPseudo( type ) {
  8955. return function( elem ) {
  8956. var name = elem.nodeName.toLowerCase();
  8957. return (name === "input" || name === "button") && elem.type === type;
  8958. };
  8959. }
  8960. /**
  8961. * Returns a function to use in pseudos for :enabled/:disabled
  8962. * @param {Boolean} disabled true for :disabled; false for :enabled
  8963. */
  8964. function createDisabledPseudo( disabled ) {
  8965. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  8966. return function( elem ) {
  8967. // Only certain elements can match :enabled or :disabled
  8968. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  8969. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  8970. if ( "form" in elem ) {
  8971. // Check for inherited disabledness on relevant non-disabled elements:
  8972. // * listed form-associated elements in a disabled fieldset
  8973. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  8974. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  8975. // * option elements in a disabled optgroup
  8976. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  8977. // All such elements have a "form" property.
  8978. if ( elem.parentNode && elem.disabled === false ) {
  8979. // Option elements defer to a parent optgroup if present
  8980. if ( "label" in elem ) {
  8981. if ( "label" in elem.parentNode ) {
  8982. return elem.parentNode.disabled === disabled;
  8983. } else {
  8984. return elem.disabled === disabled;
  8985. }
  8986. }
  8987. // Support: IE 6 - 11
  8988. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  8989. return elem.isDisabled === disabled ||
  8990. // Where there is no isDisabled, check manually
  8991. /* jshint -W018 */
  8992. elem.isDisabled !== !disabled &&
  8993. inDisabledFieldset( elem ) === disabled;
  8994. }
  8995. return elem.disabled === disabled;
  8996. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  8997. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  8998. // even exist on them, let alone have a boolean value.
  8999. } else if ( "label" in elem ) {
  9000. return elem.disabled === disabled;
  9001. }
  9002. // Remaining elements are neither :enabled nor :disabled
  9003. return false;
  9004. };
  9005. }
  9006. /**
  9007. * Returns a function to use in pseudos for positionals
  9008. * @param {Function} fn
  9009. */
  9010. function createPositionalPseudo( fn ) {
  9011. return markFunction(function( argument ) {
  9012. argument = +argument;
  9013. return markFunction(function( seed, matches ) {
  9014. var j,
  9015. matchIndexes = fn( [], seed.length, argument ),
  9016. i = matchIndexes.length;
  9017. // Match elements found at the specified indexes
  9018. while ( i-- ) {
  9019. if ( seed[ (j = matchIndexes[i]) ] ) {
  9020. seed[j] = !(matches[j] = seed[j]);
  9021. }
  9022. }
  9023. });
  9024. });
  9025. }
  9026. /**
  9027. * Checks a node for validity as a Sizzle context
  9028. * @param {Element|Object=} context
  9029. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9030. */
  9031. function testContext( context ) {
  9032. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9033. }
  9034. // Expose support vars for convenience
  9035. support = Sizzle.support = {};
  9036. /**
  9037. * Detects XML nodes
  9038. * @param {Element|Object} elem An element or a document
  9039. * @returns {Boolean} True iff elem is a non-HTML XML node
  9040. */
  9041. isXML = Sizzle.isXML = function( elem ) {
  9042. var namespace = elem.namespaceURI,
  9043. docElem = (elem.ownerDocument || elem).documentElement;
  9044. // Support: IE <=8
  9045. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9046. // https://bugs.jquery.com/ticket/4833
  9047. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9048. };
  9049. /**
  9050. * Sets document-related variables once based on the current document
  9051. * @param {Element|Object} [doc] An element or document object to use to set the document
  9052. * @returns {Object} Returns the current document
  9053. */
  9054. setDocument = Sizzle.setDocument = function( node ) {
  9055. var hasCompare, subWindow,
  9056. doc = node ? node.ownerDocument || node : preferredDoc;
  9057. // Return early if doc is invalid or already selected
  9058. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9059. return document;
  9060. }
  9061. // Update global variables
  9062. document = doc;
  9063. docElem = document.documentElement;
  9064. documentIsHTML = !isXML( document );
  9065. // Support: IE 9-11, Edge
  9066. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9067. if ( preferredDoc !== document &&
  9068. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9069. // Support: IE 11, Edge
  9070. if ( subWindow.addEventListener ) {
  9071. subWindow.addEventListener( "unload", unloadHandler, false );
  9072. // Support: IE 9 - 10 only
  9073. } else if ( subWindow.attachEvent ) {
  9074. subWindow.attachEvent( "onunload", unloadHandler );
  9075. }
  9076. }
  9077. /* Attributes
  9078. ---------------------------------------------------------------------- */
  9079. // Support: IE<8
  9080. // Verify that getAttribute really returns attributes and not properties
  9081. // (excepting IE8 booleans)
  9082. support.attributes = assert(function( el ) {
  9083. el.className = "i";
  9084. return !el.getAttribute("className");
  9085. });
  9086. /* getElement(s)By*
  9087. ---------------------------------------------------------------------- */
  9088. // Check if getElementsByTagName("*") returns only elements
  9089. support.getElementsByTagName = assert(function( el ) {
  9090. el.appendChild( document.createComment("") );
  9091. return !el.getElementsByTagName("*").length;
  9092. });
  9093. // Support: IE<9
  9094. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9095. // Support: IE<10
  9096. // Check if getElementById returns elements by name
  9097. // The broken getElementById methods don't pick up programmatically-set names,
  9098. // so use a roundabout getElementsByName test
  9099. support.getById = assert(function( el ) {
  9100. docElem.appendChild( el ).id = expando;
  9101. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9102. });
  9103. // ID filter and find
  9104. if ( support.getById ) {
  9105. Expr.filter["ID"] = function( id ) {
  9106. var attrId = id.replace( runescape, funescape );
  9107. return function( elem ) {
  9108. return elem.getAttribute("id") === attrId;
  9109. };
  9110. };
  9111. Expr.find["ID"] = function( id, context ) {
  9112. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9113. var elem = context.getElementById( id );
  9114. return elem ? [ elem ] : [];
  9115. }
  9116. };
  9117. } else {
  9118. Expr.filter["ID"] = function( id ) {
  9119. var attrId = id.replace( runescape, funescape );
  9120. return function( elem ) {
  9121. var node = typeof elem.getAttributeNode !== "undefined" &&
  9122. elem.getAttributeNode("id");
  9123. return node && node.value === attrId;
  9124. };
  9125. };
  9126. // Support: IE 6 - 7 only
  9127. // getElementById is not reliable as a find shortcut
  9128. Expr.find["ID"] = function( id, context ) {
  9129. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9130. var node, i, elems,
  9131. elem = context.getElementById( id );
  9132. if ( elem ) {
  9133. // Verify the id attribute
  9134. node = elem.getAttributeNode("id");
  9135. if ( node && node.value === id ) {
  9136. return [ elem ];
  9137. }
  9138. // Fall back on getElementsByName
  9139. elems = context.getElementsByName( id );
  9140. i = 0;
  9141. while ( (elem = elems[i++]) ) {
  9142. node = elem.getAttributeNode("id");
  9143. if ( node && node.value === id ) {
  9144. return [ elem ];
  9145. }
  9146. }
  9147. }
  9148. return [];
  9149. }
  9150. };
  9151. }
  9152. // Tag
  9153. Expr.find["TAG"] = support.getElementsByTagName ?
  9154. function( tag, context ) {
  9155. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9156. return context.getElementsByTagName( tag );
  9157. // DocumentFragment nodes don't have gEBTN
  9158. } else if ( support.qsa ) {
  9159. return context.querySelectorAll( tag );
  9160. }
  9161. } :
  9162. function( tag, context ) {
  9163. var elem,
  9164. tmp = [],
  9165. i = 0,
  9166. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9167. results = context.getElementsByTagName( tag );
  9168. // Filter out possible comments
  9169. if ( tag === "*" ) {
  9170. while ( (elem = results[i++]) ) {
  9171. if ( elem.nodeType === 1 ) {
  9172. tmp.push( elem );
  9173. }
  9174. }
  9175. return tmp;
  9176. }
  9177. return results;
  9178. };
  9179. // Class
  9180. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9181. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9182. return context.getElementsByClassName( className );
  9183. }
  9184. };
  9185. /* QSA/matchesSelector
  9186. ---------------------------------------------------------------------- */
  9187. // QSA and matchesSelector support
  9188. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9189. rbuggyMatches = [];
  9190. // qSa(:focus) reports false when true (Chrome 21)
  9191. // We allow this because of a bug in IE8/9 that throws an error
  9192. // whenever `document.activeElement` is accessed on an iframe
  9193. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9194. // See https://bugs.jquery.com/ticket/13378
  9195. rbuggyQSA = [];
  9196. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9197. // Build QSA regex
  9198. // Regex strategy adopted from Diego Perini
  9199. assert(function( el ) {
  9200. // Select is set to empty string on purpose
  9201. // This is to test IE's treatment of not explicitly
  9202. // setting a boolean content attribute,
  9203. // since its presence should be enough
  9204. // https://bugs.jquery.com/ticket/12359
  9205. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9206. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9207. "<option selected=''></option></select>";
  9208. // Support: IE8, Opera 11-12.16
  9209. // Nothing should be selected when empty strings follow ^= or $= or *=
  9210. // The test attribute must be unknown in Opera but "safe" for WinRT
  9211. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9212. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9213. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9214. }
  9215. // Support: IE8
  9216. // Boolean attributes and "value" are not treated correctly
  9217. if ( !el.querySelectorAll("[selected]").length ) {
  9218. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9219. }
  9220. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9221. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9222. rbuggyQSA.push("~=");
  9223. }
  9224. // Webkit/Opera - :checked should return selected option elements
  9225. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9226. // IE8 throws error here and will not see later tests
  9227. if ( !el.querySelectorAll(":checked").length ) {
  9228. rbuggyQSA.push(":checked");
  9229. }
  9230. // Support: Safari 8+, iOS 8+
  9231. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9232. // In-page `selector#id sibling-combinator selector` fails
  9233. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9234. rbuggyQSA.push(".#.+[+~]");
  9235. }
  9236. });
  9237. assert(function( el ) {
  9238. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9239. "<select disabled='disabled'><option/></select>";
  9240. // Support: Windows 8 Native Apps
  9241. // The type and name attributes are restricted during .innerHTML assignment
  9242. var input = document.createElement("input");
  9243. input.setAttribute( "type", "hidden" );
  9244. el.appendChild( input ).setAttribute( "name", "D" );
  9245. // Support: IE8
  9246. // Enforce case-sensitivity of name attribute
  9247. if ( el.querySelectorAll("[name=d]").length ) {
  9248. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9249. }
  9250. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9251. // IE8 throws error here and will not see later tests
  9252. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9253. rbuggyQSA.push( ":enabled", ":disabled" );
  9254. }
  9255. // Support: IE9-11+
  9256. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9257. docElem.appendChild( el ).disabled = true;
  9258. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9259. rbuggyQSA.push( ":enabled", ":disabled" );
  9260. }
  9261. // Opera 10-11 does not throw on post-comma invalid pseudos
  9262. el.querySelectorAll("*,:x");
  9263. rbuggyQSA.push(",.*:");
  9264. });
  9265. }
  9266. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9267. docElem.webkitMatchesSelector ||
  9268. docElem.mozMatchesSelector ||
  9269. docElem.oMatchesSelector ||
  9270. docElem.msMatchesSelector) )) ) {
  9271. assert(function( el ) {
  9272. // Check to see if it's possible to do matchesSelector
  9273. // on a disconnected node (IE 9)
  9274. support.disconnectedMatch = matches.call( el, "*" );
  9275. // This should fail with an exception
  9276. // Gecko does not error, returns false instead
  9277. matches.call( el, "[s!='']:x" );
  9278. rbuggyMatches.push( "!=", pseudos );
  9279. });
  9280. }
  9281. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9282. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9283. /* Contains
  9284. ---------------------------------------------------------------------- */
  9285. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9286. // Element contains another
  9287. // Purposefully self-exclusive
  9288. // As in, an element does not contain itself
  9289. contains = hasCompare || rnative.test( docElem.contains ) ?
  9290. function( a, b ) {
  9291. var adown = a.nodeType === 9 ? a.documentElement : a,
  9292. bup = b && b.parentNode;
  9293. return a === bup || !!( bup && bup.nodeType === 1 && (
  9294. adown.contains ?
  9295. adown.contains( bup ) :
  9296. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9297. ));
  9298. } :
  9299. function( a, b ) {
  9300. if ( b ) {
  9301. while ( (b = b.parentNode) ) {
  9302. if ( b === a ) {
  9303. return true;
  9304. }
  9305. }
  9306. }
  9307. return false;
  9308. };
  9309. /* Sorting
  9310. ---------------------------------------------------------------------- */
  9311. // Document order sorting
  9312. sortOrder = hasCompare ?
  9313. function( a, b ) {
  9314. // Flag for duplicate removal
  9315. if ( a === b ) {
  9316. hasDuplicate = true;
  9317. return 0;
  9318. }
  9319. // Sort on method existence if only one input has compareDocumentPosition
  9320. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9321. if ( compare ) {
  9322. return compare;
  9323. }
  9324. // Calculate position if both inputs belong to the same document
  9325. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9326. a.compareDocumentPosition( b ) :
  9327. // Otherwise we know they are disconnected
  9328. 1;
  9329. // Disconnected nodes
  9330. if ( compare & 1 ||
  9331. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9332. // Choose the first element that is related to our preferred document
  9333. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9334. return -1;
  9335. }
  9336. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9337. return 1;
  9338. }
  9339. // Maintain original order
  9340. return sortInput ?
  9341. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9342. 0;
  9343. }
  9344. return compare & 4 ? -1 : 1;
  9345. } :
  9346. function( a, b ) {
  9347. // Exit early if the nodes are identical
  9348. if ( a === b ) {
  9349. hasDuplicate = true;
  9350. return 0;
  9351. }
  9352. var cur,
  9353. i = 0,
  9354. aup = a.parentNode,
  9355. bup = b.parentNode,
  9356. ap = [ a ],
  9357. bp = [ b ];
  9358. // Parentless nodes are either documents or disconnected
  9359. if ( !aup || !bup ) {
  9360. return a === document ? -1 :
  9361. b === document ? 1 :
  9362. aup ? -1 :
  9363. bup ? 1 :
  9364. sortInput ?
  9365. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9366. 0;
  9367. // If the nodes are siblings, we can do a quick check
  9368. } else if ( aup === bup ) {
  9369. return siblingCheck( a, b );
  9370. }
  9371. // Otherwise we need full lists of their ancestors for comparison
  9372. cur = a;
  9373. while ( (cur = cur.parentNode) ) {
  9374. ap.unshift( cur );
  9375. }
  9376. cur = b;
  9377. while ( (cur = cur.parentNode) ) {
  9378. bp.unshift( cur );
  9379. }
  9380. // Walk down the tree looking for a discrepancy
  9381. while ( ap[i] === bp[i] ) {
  9382. i++;
  9383. }
  9384. return i ?
  9385. // Do a sibling check if the nodes have a common ancestor
  9386. siblingCheck( ap[i], bp[i] ) :
  9387. // Otherwise nodes in our document sort first
  9388. ap[i] === preferredDoc ? -1 :
  9389. bp[i] === preferredDoc ? 1 :
  9390. 0;
  9391. };
  9392. return document;
  9393. };
  9394. Sizzle.matches = function( expr, elements ) {
  9395. return Sizzle( expr, null, null, elements );
  9396. };
  9397. Sizzle.matchesSelector = function( elem, expr ) {
  9398. // Set document vars if needed
  9399. if ( ( elem.ownerDocument || elem ) !== document ) {
  9400. setDocument( elem );
  9401. }
  9402. if ( support.matchesSelector && documentIsHTML &&
  9403. !nonnativeSelectorCache[ expr + " " ] &&
  9404. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9405. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9406. try {
  9407. var ret = matches.call( elem, expr );
  9408. // IE 9's matchesSelector returns false on disconnected nodes
  9409. if ( ret || support.disconnectedMatch ||
  9410. // As well, disconnected nodes are said to be in a document
  9411. // fragment in IE 9
  9412. elem.document && elem.document.nodeType !== 11 ) {
  9413. return ret;
  9414. }
  9415. } catch (e) {
  9416. nonnativeSelectorCache( expr, true );
  9417. }
  9418. }
  9419. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9420. };
  9421. Sizzle.contains = function( context, elem ) {
  9422. // Set document vars if needed
  9423. if ( ( context.ownerDocument || context ) !== document ) {
  9424. setDocument( context );
  9425. }
  9426. return contains( context, elem );
  9427. };
  9428. Sizzle.attr = function( elem, name ) {
  9429. // Set document vars if needed
  9430. if ( ( elem.ownerDocument || elem ) !== document ) {
  9431. setDocument( elem );
  9432. }
  9433. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9434. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9435. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9436. fn( elem, name, !documentIsHTML ) :
  9437. undefined;
  9438. return val !== undefined ?
  9439. val :
  9440. support.attributes || !documentIsHTML ?
  9441. elem.getAttribute( name ) :
  9442. (val = elem.getAttributeNode(name)) && val.specified ?
  9443. val.value :
  9444. null;
  9445. };
  9446. Sizzle.escape = function( sel ) {
  9447. return (sel + "").replace( rcssescape, fcssescape );
  9448. };
  9449. Sizzle.error = function( msg ) {
  9450. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9451. };
  9452. /**
  9453. * Document sorting and removing duplicates
  9454. * @param {ArrayLike} results
  9455. */
  9456. Sizzle.uniqueSort = function( results ) {
  9457. var elem,
  9458. duplicates = [],
  9459. j = 0,
  9460. i = 0;
  9461. // Unless we *know* we can detect duplicates, assume their presence
  9462. hasDuplicate = !support.detectDuplicates;
  9463. sortInput = !support.sortStable && results.slice( 0 );
  9464. results.sort( sortOrder );
  9465. if ( hasDuplicate ) {
  9466. while ( (elem = results[i++]) ) {
  9467. if ( elem === results[ i ] ) {
  9468. j = duplicates.push( i );
  9469. }
  9470. }
  9471. while ( j-- ) {
  9472. results.splice( duplicates[ j ], 1 );
  9473. }
  9474. }
  9475. // Clear input after sorting to release objects
  9476. // See https://github.com/jquery/sizzle/pull/225
  9477. sortInput = null;
  9478. return results;
  9479. };
  9480. /**
  9481. * Utility function for retrieving the text value of an array of DOM nodes
  9482. * @param {Array|Element} elem
  9483. */
  9484. getText = Sizzle.getText = function( elem ) {
  9485. var node,
  9486. ret = "",
  9487. i = 0,
  9488. nodeType = elem.nodeType;
  9489. if ( !nodeType ) {
  9490. // If no nodeType, this is expected to be an array
  9491. while ( (node = elem[i++]) ) {
  9492. // Do not traverse comment nodes
  9493. ret += getText( node );
  9494. }
  9495. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9496. // Use textContent for elements
  9497. // innerText usage removed for consistency of new lines (jQuery #11153)
  9498. if ( typeof elem.textContent === "string" ) {
  9499. return elem.textContent;
  9500. } else {
  9501. // Traverse its children
  9502. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9503. ret += getText( elem );
  9504. }
  9505. }
  9506. } else if ( nodeType === 3 || nodeType === 4 ) {
  9507. return elem.nodeValue;
  9508. }
  9509. // Do not include comment or processing instruction nodes
  9510. return ret;
  9511. };
  9512. Expr = Sizzle.selectors = {
  9513. // Can be adjusted by the user
  9514. cacheLength: 50,
  9515. createPseudo: markFunction,
  9516. match: matchExpr,
  9517. attrHandle: {},
  9518. find: {},
  9519. relative: {
  9520. ">": { dir: "parentNode", first: true },
  9521. " ": { dir: "parentNode" },
  9522. "+": { dir: "previousSibling", first: true },
  9523. "~": { dir: "previousSibling" }
  9524. },
  9525. preFilter: {
  9526. "ATTR": function( match ) {
  9527. match[1] = match[1].replace( runescape, funescape );
  9528. // Move the given value to match[3] whether quoted or unquoted
  9529. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9530. if ( match[2] === "~=" ) {
  9531. match[3] = " " + match[3] + " ";
  9532. }
  9533. return match.slice( 0, 4 );
  9534. },
  9535. "CHILD": function( match ) {
  9536. /* matches from matchExpr["CHILD"]
  9537. 1 type (only|nth|...)
  9538. 2 what (child|of-type)
  9539. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9540. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9541. 5 sign of xn-component
  9542. 6 x of xn-component
  9543. 7 sign of y-component
  9544. 8 y of y-component
  9545. */
  9546. match[1] = match[1].toLowerCase();
  9547. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9548. // nth-* requires argument
  9549. if ( !match[3] ) {
  9550. Sizzle.error( match[0] );
  9551. }
  9552. // numeric x and y parameters for Expr.filter.CHILD
  9553. // remember that false/true cast respectively to 0/1
  9554. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9555. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9556. // other types prohibit arguments
  9557. } else if ( match[3] ) {
  9558. Sizzle.error( match[0] );
  9559. }
  9560. return match;
  9561. },
  9562. "PSEUDO": function( match ) {
  9563. var excess,
  9564. unquoted = !match[6] && match[2];
  9565. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9566. return null;
  9567. }
  9568. // Accept quoted arguments as-is
  9569. if ( match[3] ) {
  9570. match[2] = match[4] || match[5] || "";
  9571. // Strip excess characters from unquoted arguments
  9572. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9573. // Get excess from tokenize (recursively)
  9574. (excess = tokenize( unquoted, true )) &&
  9575. // advance to the next closing parenthesis
  9576. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9577. // excess is a negative index
  9578. match[0] = match[0].slice( 0, excess );
  9579. match[2] = unquoted.slice( 0, excess );
  9580. }
  9581. // Return only captures needed by the pseudo filter method (type and argument)
  9582. return match.slice( 0, 3 );
  9583. }
  9584. },
  9585. filter: {
  9586. "TAG": function( nodeNameSelector ) {
  9587. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9588. return nodeNameSelector === "*" ?
  9589. function() { return true; } :
  9590. function( elem ) {
  9591. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9592. };
  9593. },
  9594. "CLASS": function( className ) {
  9595. var pattern = classCache[ className + " " ];
  9596. return pattern ||
  9597. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9598. classCache( className, function( elem ) {
  9599. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9600. });
  9601. },
  9602. "ATTR": function( name, operator, check ) {
  9603. return function( elem ) {
  9604. var result = Sizzle.attr( elem, name );
  9605. if ( result == null ) {
  9606. return operator === "!=";
  9607. }
  9608. if ( !operator ) {
  9609. return true;
  9610. }
  9611. result += "";
  9612. return operator === "=" ? result === check :
  9613. operator === "!=" ? result !== check :
  9614. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9615. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9616. operator === "$=" ? check && result.slice( -check.length ) === check :
  9617. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9618. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9619. false;
  9620. };
  9621. },
  9622. "CHILD": function( type, what, argument, first, last ) {
  9623. var simple = type.slice( 0, 3 ) !== "nth",
  9624. forward = type.slice( -4 ) !== "last",
  9625. ofType = what === "of-type";
  9626. return first === 1 && last === 0 ?
  9627. // Shortcut for :nth-*(n)
  9628. function( elem ) {
  9629. return !!elem.parentNode;
  9630. } :
  9631. function( elem, context, xml ) {
  9632. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9633. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9634. parent = elem.parentNode,
  9635. name = ofType && elem.nodeName.toLowerCase(),
  9636. useCache = !xml && !ofType,
  9637. diff = false;
  9638. if ( parent ) {
  9639. // :(first|last|only)-(child|of-type)
  9640. if ( simple ) {
  9641. while ( dir ) {
  9642. node = elem;
  9643. while ( (node = node[ dir ]) ) {
  9644. if ( ofType ?
  9645. node.nodeName.toLowerCase() === name :
  9646. node.nodeType === 1 ) {
  9647. return false;
  9648. }
  9649. }
  9650. // Reverse direction for :only-* (if we haven't yet done so)
  9651. start = dir = type === "only" && !start && "nextSibling";
  9652. }
  9653. return true;
  9654. }
  9655. start = [ forward ? parent.firstChild : parent.lastChild ];
  9656. // non-xml :nth-child(...) stores cache data on `parent`
  9657. if ( forward && useCache ) {
  9658. // Seek `elem` from a previously-cached index
  9659. // ...in a gzip-friendly way
  9660. node = parent;
  9661. outerCache = node[ expando ] || (node[ expando ] = {});
  9662. // Support: IE <9 only
  9663. // Defend against cloned attroperties (jQuery gh-1709)
  9664. uniqueCache = outerCache[ node.uniqueID ] ||
  9665. (outerCache[ node.uniqueID ] = {});
  9666. cache = uniqueCache[ type ] || [];
  9667. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9668. diff = nodeIndex && cache[ 2 ];
  9669. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9670. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9671. // Fallback to seeking `elem` from the start
  9672. (diff = nodeIndex = 0) || start.pop()) ) {
  9673. // When found, cache indexes on `parent` and break
  9674. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9675. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9676. break;
  9677. }
  9678. }
  9679. } else {
  9680. // Use previously-cached element index if available
  9681. if ( useCache ) {
  9682. // ...in a gzip-friendly way
  9683. node = elem;
  9684. outerCache = node[ expando ] || (node[ expando ] = {});
  9685. // Support: IE <9 only
  9686. // Defend against cloned attroperties (jQuery gh-1709)
  9687. uniqueCache = outerCache[ node.uniqueID ] ||
  9688. (outerCache[ node.uniqueID ] = {});
  9689. cache = uniqueCache[ type ] || [];
  9690. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9691. diff = nodeIndex;
  9692. }
  9693. // xml :nth-child(...)
  9694. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9695. if ( diff === false ) {
  9696. // Use the same loop as above to seek `elem` from the start
  9697. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9698. (diff = nodeIndex = 0) || start.pop()) ) {
  9699. if ( ( ofType ?
  9700. node.nodeName.toLowerCase() === name :
  9701. node.nodeType === 1 ) &&
  9702. ++diff ) {
  9703. // Cache the index of each encountered element
  9704. if ( useCache ) {
  9705. outerCache = node[ expando ] || (node[ expando ] = {});
  9706. // Support: IE <9 only
  9707. // Defend against cloned attroperties (jQuery gh-1709)
  9708. uniqueCache = outerCache[ node.uniqueID ] ||
  9709. (outerCache[ node.uniqueID ] = {});
  9710. uniqueCache[ type ] = [ dirruns, diff ];
  9711. }
  9712. if ( node === elem ) {
  9713. break;
  9714. }
  9715. }
  9716. }
  9717. }
  9718. }
  9719. // Incorporate the offset, then check against cycle size
  9720. diff -= last;
  9721. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9722. }
  9723. };
  9724. },
  9725. "PSEUDO": function( pseudo, argument ) {
  9726. // pseudo-class names are case-insensitive
  9727. // http://www.w3.org/TR/selectors/#pseudo-classes
  9728. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9729. // Remember that setFilters inherits from pseudos
  9730. var args,
  9731. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9732. Sizzle.error( "unsupported pseudo: " + pseudo );
  9733. // The user may use createPseudo to indicate that
  9734. // arguments are needed to create the filter function
  9735. // just as Sizzle does
  9736. if ( fn[ expando ] ) {
  9737. return fn( argument );
  9738. }
  9739. // But maintain support for old signatures
  9740. if ( fn.length > 1 ) {
  9741. args = [ pseudo, pseudo, "", argument ];
  9742. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9743. markFunction(function( seed, matches ) {
  9744. var idx,
  9745. matched = fn( seed, argument ),
  9746. i = matched.length;
  9747. while ( i-- ) {
  9748. idx = indexOf( seed, matched[i] );
  9749. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9750. }
  9751. }) :
  9752. function( elem ) {
  9753. return fn( elem, 0, args );
  9754. };
  9755. }
  9756. return fn;
  9757. }
  9758. },
  9759. pseudos: {
  9760. // Potentially complex pseudos
  9761. "not": markFunction(function( selector ) {
  9762. // Trim the selector passed to compile
  9763. // to avoid treating leading and trailing
  9764. // spaces as combinators
  9765. var input = [],
  9766. results = [],
  9767. matcher = compile( selector.replace( rtrim, "$1" ) );
  9768. return matcher[ expando ] ?
  9769. markFunction(function( seed, matches, context, xml ) {
  9770. var elem,
  9771. unmatched = matcher( seed, null, xml, [] ),
  9772. i = seed.length;
  9773. // Match elements unmatched by `matcher`
  9774. while ( i-- ) {
  9775. if ( (elem = unmatched[i]) ) {
  9776. seed[i] = !(matches[i] = elem);
  9777. }
  9778. }
  9779. }) :
  9780. function( elem, context, xml ) {
  9781. input[0] = elem;
  9782. matcher( input, null, xml, results );
  9783. // Don't keep the element (issue #299)
  9784. input[0] = null;
  9785. return !results.pop();
  9786. };
  9787. }),
  9788. "has": markFunction(function( selector ) {
  9789. return function( elem ) {
  9790. return Sizzle( selector, elem ).length > 0;
  9791. };
  9792. }),
  9793. "contains": markFunction(function( text ) {
  9794. text = text.replace( runescape, funescape );
  9795. return function( elem ) {
  9796. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9797. };
  9798. }),
  9799. // "Whether an element is represented by a :lang() selector
  9800. // is based solely on the element's language value
  9801. // being equal to the identifier C,
  9802. // or beginning with the identifier C immediately followed by "-".
  9803. // The matching of C against the element's language value is performed case-insensitively.
  9804. // The identifier C does not have to be a valid language name."
  9805. // http://www.w3.org/TR/selectors/#lang-pseudo
  9806. "lang": markFunction( function( lang ) {
  9807. // lang value must be a valid identifier
  9808. if ( !ridentifier.test(lang || "") ) {
  9809. Sizzle.error( "unsupported lang: " + lang );
  9810. }
  9811. lang = lang.replace( runescape, funescape ).toLowerCase();
  9812. return function( elem ) {
  9813. var elemLang;
  9814. do {
  9815. if ( (elemLang = documentIsHTML ?
  9816. elem.lang :
  9817. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9818. elemLang = elemLang.toLowerCase();
  9819. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9820. }
  9821. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9822. return false;
  9823. };
  9824. }),
  9825. // Miscellaneous
  9826. "target": function( elem ) {
  9827. var hash = window.location && window.location.hash;
  9828. return hash && hash.slice( 1 ) === elem.id;
  9829. },
  9830. "root": function( elem ) {
  9831. return elem === docElem;
  9832. },
  9833. "focus": function( elem ) {
  9834. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9835. },
  9836. // Boolean properties
  9837. "enabled": createDisabledPseudo( false ),
  9838. "disabled": createDisabledPseudo( true ),
  9839. "checked": function( elem ) {
  9840. // In CSS3, :checked should return both checked and selected elements
  9841. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9842. var nodeName = elem.nodeName.toLowerCase();
  9843. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9844. },
  9845. "selected": function( elem ) {
  9846. // Accessing this property makes selected-by-default
  9847. // options in Safari work properly
  9848. if ( elem.parentNode ) {
  9849. elem.parentNode.selectedIndex;
  9850. }
  9851. return elem.selected === true;
  9852. },
  9853. // Contents
  9854. "empty": function( elem ) {
  9855. // http://www.w3.org/TR/selectors/#empty-pseudo
  9856. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9857. // but not by others (comment: 8; processing instruction: 7; etc.)
  9858. // nodeType < 6 works because attributes (2) do not appear as children
  9859. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9860. if ( elem.nodeType < 6 ) {
  9861. return false;
  9862. }
  9863. }
  9864. return true;
  9865. },
  9866. "parent": function( elem ) {
  9867. return !Expr.pseudos["empty"]( elem );
  9868. },
  9869. // Element/input types
  9870. "header": function( elem ) {
  9871. return rheader.test( elem.nodeName );
  9872. },
  9873. "input": function( elem ) {
  9874. return rinputs.test( elem.nodeName );
  9875. },
  9876. "button": function( elem ) {
  9877. var name = elem.nodeName.toLowerCase();
  9878. return name === "input" && elem.type === "button" || name === "button";
  9879. },
  9880. "text": function( elem ) {
  9881. var attr;
  9882. return elem.nodeName.toLowerCase() === "input" &&
  9883. elem.type === "text" &&
  9884. // Support: IE<8
  9885. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9886. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9887. },
  9888. // Position-in-collection
  9889. "first": createPositionalPseudo(function() {
  9890. return [ 0 ];
  9891. }),
  9892. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9893. return [ length - 1 ];
  9894. }),
  9895. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9896. return [ argument < 0 ? argument + length : argument ];
  9897. }),
  9898. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9899. var i = 0;
  9900. for ( ; i < length; i += 2 ) {
  9901. matchIndexes.push( i );
  9902. }
  9903. return matchIndexes;
  9904. }),
  9905. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9906. var i = 1;
  9907. for ( ; i < length; i += 2 ) {
  9908. matchIndexes.push( i );
  9909. }
  9910. return matchIndexes;
  9911. }),
  9912. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9913. var i = argument < 0 ?
  9914. argument + length :
  9915. argument > length ?
  9916. length :
  9917. argument;
  9918. for ( ; --i >= 0; ) {
  9919. matchIndexes.push( i );
  9920. }
  9921. return matchIndexes;
  9922. }),
  9923. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9924. var i = argument < 0 ? argument + length : argument;
  9925. for ( ; ++i < length; ) {
  9926. matchIndexes.push( i );
  9927. }
  9928. return matchIndexes;
  9929. })
  9930. }
  9931. };
  9932. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  9933. // Add button/input type pseudos
  9934. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  9935. Expr.pseudos[ i ] = createInputPseudo( i );
  9936. }
  9937. for ( i in { submit: true, reset: true } ) {
  9938. Expr.pseudos[ i ] = createButtonPseudo( i );
  9939. }
  9940. // Easy API for creating new setFilters
  9941. function setFilters() {}
  9942. setFilters.prototype = Expr.filters = Expr.pseudos;
  9943. Expr.setFilters = new setFilters();
  9944. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  9945. var matched, match, tokens, type,
  9946. soFar, groups, preFilters,
  9947. cached = tokenCache[ selector + " " ];
  9948. if ( cached ) {
  9949. return parseOnly ? 0 : cached.slice( 0 );
  9950. }
  9951. soFar = selector;
  9952. groups = [];
  9953. preFilters = Expr.preFilter;
  9954. while ( soFar ) {
  9955. // Comma and first run
  9956. if ( !matched || (match = rcomma.exec( soFar )) ) {
  9957. if ( match ) {
  9958. // Don't consume trailing commas as valid
  9959. soFar = soFar.slice( match[0].length ) || soFar;
  9960. }
  9961. groups.push( (tokens = []) );
  9962. }
  9963. matched = false;
  9964. // Combinators
  9965. if ( (match = rcombinators.exec( soFar )) ) {
  9966. matched = match.shift();
  9967. tokens.push({
  9968. value: matched,
  9969. // Cast descendant combinators to space
  9970. type: match[0].replace( rtrim, " " )
  9971. });
  9972. soFar = soFar.slice( matched.length );
  9973. }
  9974. // Filters
  9975. for ( type in Expr.filter ) {
  9976. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  9977. (match = preFilters[ type ]( match ))) ) {
  9978. matched = match.shift();
  9979. tokens.push({
  9980. value: matched,
  9981. type: type,
  9982. matches: match
  9983. });
  9984. soFar = soFar.slice( matched.length );
  9985. }
  9986. }
  9987. if ( !matched ) {
  9988. break;
  9989. }
  9990. }
  9991. // Return the length of the invalid excess
  9992. // if we're just parsing
  9993. // Otherwise, throw an error or return tokens
  9994. return parseOnly ?
  9995. soFar.length :
  9996. soFar ?
  9997. Sizzle.error( selector ) :
  9998. // Cache the tokens
  9999. tokenCache( selector, groups ).slice( 0 );
  10000. };
  10001. function toSelector( tokens ) {
  10002. var i = 0,
  10003. len = tokens.length,
  10004. selector = "";
  10005. for ( ; i < len; i++ ) {
  10006. selector += tokens[i].value;
  10007. }
  10008. return selector;
  10009. }
  10010. function addCombinator( matcher, combinator, base ) {
  10011. var dir = combinator.dir,
  10012. skip = combinator.next,
  10013. key = skip || dir,
  10014. checkNonElements = base && key === "parentNode",
  10015. doneName = done++;
  10016. return combinator.first ?
  10017. // Check against closest ancestor/preceding element
  10018. function( elem, context, xml ) {
  10019. while ( (elem = elem[ dir ]) ) {
  10020. if ( elem.nodeType === 1 || checkNonElements ) {
  10021. return matcher( elem, context, xml );
  10022. }
  10023. }
  10024. return false;
  10025. } :
  10026. // Check against all ancestor/preceding elements
  10027. function( elem, context, xml ) {
  10028. var oldCache, uniqueCache, outerCache,
  10029. newCache = [ dirruns, doneName ];
  10030. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10031. if ( xml ) {
  10032. while ( (elem = elem[ dir ]) ) {
  10033. if ( elem.nodeType === 1 || checkNonElements ) {
  10034. if ( matcher( elem, context, xml ) ) {
  10035. return true;
  10036. }
  10037. }
  10038. }
  10039. } else {
  10040. while ( (elem = elem[ dir ]) ) {
  10041. if ( elem.nodeType === 1 || checkNonElements ) {
  10042. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10043. // Support: IE <9 only
  10044. // Defend against cloned attroperties (jQuery gh-1709)
  10045. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10046. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10047. elem = elem[ dir ] || elem;
  10048. } else if ( (oldCache = uniqueCache[ key ]) &&
  10049. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10050. // Assign to newCache so results back-propagate to previous elements
  10051. return (newCache[ 2 ] = oldCache[ 2 ]);
  10052. } else {
  10053. // Reuse newcache so results back-propagate to previous elements
  10054. uniqueCache[ key ] = newCache;
  10055. // A match means we're done; a fail means we have to keep checking
  10056. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10057. return true;
  10058. }
  10059. }
  10060. }
  10061. }
  10062. }
  10063. return false;
  10064. };
  10065. }
  10066. function elementMatcher( matchers ) {
  10067. return matchers.length > 1 ?
  10068. function( elem, context, xml ) {
  10069. var i = matchers.length;
  10070. while ( i-- ) {
  10071. if ( !matchers[i]( elem, context, xml ) ) {
  10072. return false;
  10073. }
  10074. }
  10075. return true;
  10076. } :
  10077. matchers[0];
  10078. }
  10079. function multipleContexts( selector, contexts, results ) {
  10080. var i = 0,
  10081. len = contexts.length;
  10082. for ( ; i < len; i++ ) {
  10083. Sizzle( selector, contexts[i], results );
  10084. }
  10085. return results;
  10086. }
  10087. function condense( unmatched, map, filter, context, xml ) {
  10088. var elem,
  10089. newUnmatched = [],
  10090. i = 0,
  10091. len = unmatched.length,
  10092. mapped = map != null;
  10093. for ( ; i < len; i++ ) {
  10094. if ( (elem = unmatched[i]) ) {
  10095. if ( !filter || filter( elem, context, xml ) ) {
  10096. newUnmatched.push( elem );
  10097. if ( mapped ) {
  10098. map.push( i );
  10099. }
  10100. }
  10101. }
  10102. }
  10103. return newUnmatched;
  10104. }
  10105. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10106. if ( postFilter && !postFilter[ expando ] ) {
  10107. postFilter = setMatcher( postFilter );
  10108. }
  10109. if ( postFinder && !postFinder[ expando ] ) {
  10110. postFinder = setMatcher( postFinder, postSelector );
  10111. }
  10112. return markFunction(function( seed, results, context, xml ) {
  10113. var temp, i, elem,
  10114. preMap = [],
  10115. postMap = [],
  10116. preexisting = results.length,
  10117. // Get initial elements from seed or context
  10118. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10119. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10120. matcherIn = preFilter && ( seed || !selector ) ?
  10121. condense( elems, preMap, preFilter, context, xml ) :
  10122. elems,
  10123. matcherOut = matcher ?
  10124. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10125. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10126. // ...intermediate processing is necessary
  10127. [] :
  10128. // ...otherwise use results directly
  10129. results :
  10130. matcherIn;
  10131. // Find primary matches
  10132. if ( matcher ) {
  10133. matcher( matcherIn, matcherOut, context, xml );
  10134. }
  10135. // Apply postFilter
  10136. if ( postFilter ) {
  10137. temp = condense( matcherOut, postMap );
  10138. postFilter( temp, [], context, xml );
  10139. // Un-match failing elements by moving them back to matcherIn
  10140. i = temp.length;
  10141. while ( i-- ) {
  10142. if ( (elem = temp[i]) ) {
  10143. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10144. }
  10145. }
  10146. }
  10147. if ( seed ) {
  10148. if ( postFinder || preFilter ) {
  10149. if ( postFinder ) {
  10150. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10151. temp = [];
  10152. i = matcherOut.length;
  10153. while ( i-- ) {
  10154. if ( (elem = matcherOut[i]) ) {
  10155. // Restore matcherIn since elem is not yet a final match
  10156. temp.push( (matcherIn[i] = elem) );
  10157. }
  10158. }
  10159. postFinder( null, (matcherOut = []), temp, xml );
  10160. }
  10161. // Move matched elements from seed to results to keep them synchronized
  10162. i = matcherOut.length;
  10163. while ( i-- ) {
  10164. if ( (elem = matcherOut[i]) &&
  10165. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10166. seed[temp] = !(results[temp] = elem);
  10167. }
  10168. }
  10169. }
  10170. // Add elements to results, through postFinder if defined
  10171. } else {
  10172. matcherOut = condense(
  10173. matcherOut === results ?
  10174. matcherOut.splice( preexisting, matcherOut.length ) :
  10175. matcherOut
  10176. );
  10177. if ( postFinder ) {
  10178. postFinder( null, results, matcherOut, xml );
  10179. } else {
  10180. push.apply( results, matcherOut );
  10181. }
  10182. }
  10183. });
  10184. }
  10185. function matcherFromTokens( tokens ) {
  10186. var checkContext, matcher, j,
  10187. len = tokens.length,
  10188. leadingRelative = Expr.relative[ tokens[0].type ],
  10189. implicitRelative = leadingRelative || Expr.relative[" "],
  10190. i = leadingRelative ? 1 : 0,
  10191. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10192. matchContext = addCombinator( function( elem ) {
  10193. return elem === checkContext;
  10194. }, implicitRelative, true ),
  10195. matchAnyContext = addCombinator( function( elem ) {
  10196. return indexOf( checkContext, elem ) > -1;
  10197. }, implicitRelative, true ),
  10198. matchers = [ function( elem, context, xml ) {
  10199. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10200. (checkContext = context).nodeType ?
  10201. matchContext( elem, context, xml ) :
  10202. matchAnyContext( elem, context, xml ) );
  10203. // Avoid hanging onto element (issue #299)
  10204. checkContext = null;
  10205. return ret;
  10206. } ];
  10207. for ( ; i < len; i++ ) {
  10208. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10209. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10210. } else {
  10211. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10212. // Return special upon seeing a positional matcher
  10213. if ( matcher[ expando ] ) {
  10214. // Find the next relative operator (if any) for proper handling
  10215. j = ++i;
  10216. for ( ; j < len; j++ ) {
  10217. if ( Expr.relative[ tokens[j].type ] ) {
  10218. break;
  10219. }
  10220. }
  10221. return setMatcher(
  10222. i > 1 && elementMatcher( matchers ),
  10223. i > 1 && toSelector(
  10224. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10225. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10226. ).replace( rtrim, "$1" ),
  10227. matcher,
  10228. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10229. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10230. j < len && toSelector( tokens )
  10231. );
  10232. }
  10233. matchers.push( matcher );
  10234. }
  10235. }
  10236. return elementMatcher( matchers );
  10237. }
  10238. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10239. var bySet = setMatchers.length > 0,
  10240. byElement = elementMatchers.length > 0,
  10241. superMatcher = function( seed, context, xml, results, outermost ) {
  10242. var elem, j, matcher,
  10243. matchedCount = 0,
  10244. i = "0",
  10245. unmatched = seed && [],
  10246. setMatched = [],
  10247. contextBackup = outermostContext,
  10248. // We must always have either seed elements or outermost context
  10249. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10250. // Use integer dirruns iff this is the outermost matcher
  10251. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10252. len = elems.length;
  10253. if ( outermost ) {
  10254. outermostContext = context === document || context || outermost;
  10255. }
  10256. // Add elements passing elementMatchers directly to results
  10257. // Support: IE<9, Safari
  10258. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10259. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10260. if ( byElement && elem ) {
  10261. j = 0;
  10262. if ( !context && elem.ownerDocument !== document ) {
  10263. setDocument( elem );
  10264. xml = !documentIsHTML;
  10265. }
  10266. while ( (matcher = elementMatchers[j++]) ) {
  10267. if ( matcher( elem, context || document, xml) ) {
  10268. results.push( elem );
  10269. break;
  10270. }
  10271. }
  10272. if ( outermost ) {
  10273. dirruns = dirrunsUnique;
  10274. }
  10275. }
  10276. // Track unmatched elements for set filters
  10277. if ( bySet ) {
  10278. // They will have gone through all possible matchers
  10279. if ( (elem = !matcher && elem) ) {
  10280. matchedCount--;
  10281. }
  10282. // Lengthen the array for every element, matched or not
  10283. if ( seed ) {
  10284. unmatched.push( elem );
  10285. }
  10286. }
  10287. }
  10288. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10289. // makes the latter nonnegative.
  10290. matchedCount += i;
  10291. // Apply set filters to unmatched elements
  10292. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10293. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10294. // no element matchers and no seed.
  10295. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10296. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10297. // numerically zero.
  10298. if ( bySet && i !== matchedCount ) {
  10299. j = 0;
  10300. while ( (matcher = setMatchers[j++]) ) {
  10301. matcher( unmatched, setMatched, context, xml );
  10302. }
  10303. if ( seed ) {
  10304. // Reintegrate element matches to eliminate the need for sorting
  10305. if ( matchedCount > 0 ) {
  10306. while ( i-- ) {
  10307. if ( !(unmatched[i] || setMatched[i]) ) {
  10308. setMatched[i] = pop.call( results );
  10309. }
  10310. }
  10311. }
  10312. // Discard index placeholder values to get only actual matches
  10313. setMatched = condense( setMatched );
  10314. }
  10315. // Add matches to results
  10316. push.apply( results, setMatched );
  10317. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10318. if ( outermost && !seed && setMatched.length > 0 &&
  10319. ( matchedCount + setMatchers.length ) > 1 ) {
  10320. Sizzle.uniqueSort( results );
  10321. }
  10322. }
  10323. // Override manipulation of globals by nested matchers
  10324. if ( outermost ) {
  10325. dirruns = dirrunsUnique;
  10326. outermostContext = contextBackup;
  10327. }
  10328. return unmatched;
  10329. };
  10330. return bySet ?
  10331. markFunction( superMatcher ) :
  10332. superMatcher;
  10333. }
  10334. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10335. var i,
  10336. setMatchers = [],
  10337. elementMatchers = [],
  10338. cached = compilerCache[ selector + " " ];
  10339. if ( !cached ) {
  10340. // Generate a function of recursive functions that can be used to check each element
  10341. if ( !match ) {
  10342. match = tokenize( selector );
  10343. }
  10344. i = match.length;
  10345. while ( i-- ) {
  10346. cached = matcherFromTokens( match[i] );
  10347. if ( cached[ expando ] ) {
  10348. setMatchers.push( cached );
  10349. } else {
  10350. elementMatchers.push( cached );
  10351. }
  10352. }
  10353. // Cache the compiled function
  10354. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10355. // Save selector and tokenization
  10356. cached.selector = selector;
  10357. }
  10358. return cached;
  10359. };
  10360. /**
  10361. * A low-level selection function that works with Sizzle's compiled
  10362. * selector functions
  10363. * @param {String|Function} selector A selector or a pre-compiled
  10364. * selector function built with Sizzle.compile
  10365. * @param {Element} context
  10366. * @param {Array} [results]
  10367. * @param {Array} [seed] A set of elements to match against
  10368. */
  10369. select = Sizzle.select = function( selector, context, results, seed ) {
  10370. var i, tokens, token, type, find,
  10371. compiled = typeof selector === "function" && selector,
  10372. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10373. results = results || [];
  10374. // Try to minimize operations if there is only one selector in the list and no seed
  10375. // (the latter of which guarantees us context)
  10376. if ( match.length === 1 ) {
  10377. // Reduce context if the leading compound selector is an ID
  10378. tokens = match[0] = match[0].slice( 0 );
  10379. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10380. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10381. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10382. if ( !context ) {
  10383. return results;
  10384. // Precompiled matchers will still verify ancestry, so step up a level
  10385. } else if ( compiled ) {
  10386. context = context.parentNode;
  10387. }
  10388. selector = selector.slice( tokens.shift().value.length );
  10389. }
  10390. // Fetch a seed set for right-to-left matching
  10391. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10392. while ( i-- ) {
  10393. token = tokens[i];
  10394. // Abort if we hit a combinator
  10395. if ( Expr.relative[ (type = token.type) ] ) {
  10396. break;
  10397. }
  10398. if ( (find = Expr.find[ type ]) ) {
  10399. // Search, expanding context for leading sibling combinators
  10400. if ( (seed = find(
  10401. token.matches[0].replace( runescape, funescape ),
  10402. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10403. )) ) {
  10404. // If seed is empty or no tokens remain, we can return early
  10405. tokens.splice( i, 1 );
  10406. selector = seed.length && toSelector( tokens );
  10407. if ( !selector ) {
  10408. push.apply( results, seed );
  10409. return results;
  10410. }
  10411. break;
  10412. }
  10413. }
  10414. }
  10415. }
  10416. // Compile and execute a filtering function if one is not provided
  10417. // Provide `match` to avoid retokenization if we modified the selector above
  10418. ( compiled || compile( selector, match ) )(
  10419. seed,
  10420. context,
  10421. !documentIsHTML,
  10422. results,
  10423. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10424. );
  10425. return results;
  10426. };
  10427. // One-time assignments
  10428. // Sort stability
  10429. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10430. // Support: Chrome 14-35+
  10431. // Always assume duplicates if they aren't passed to the comparison function
  10432. support.detectDuplicates = !!hasDuplicate;
  10433. // Initialize against the default document
  10434. setDocument();
  10435. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10436. // Detached nodes confoundingly follow *each other*
  10437. support.sortDetached = assert(function( el ) {
  10438. // Should return 1, but returns 4 (following)
  10439. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10440. });
  10441. // Support: IE<8
  10442. // Prevent attribute/property "interpolation"
  10443. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10444. if ( !assert(function( el ) {
  10445. el.innerHTML = "<a href='#'></a>";
  10446. return el.firstChild.getAttribute("href") === "#" ;
  10447. }) ) {
  10448. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10449. if ( !isXML ) {
  10450. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10451. }
  10452. });
  10453. }
  10454. // Support: IE<9
  10455. // Use defaultValue in place of getAttribute("value")
  10456. if ( !support.attributes || !assert(function( el ) {
  10457. el.innerHTML = "<input/>";
  10458. el.firstChild.setAttribute( "value", "" );
  10459. return el.firstChild.getAttribute( "value" ) === "";
  10460. }) ) {
  10461. addHandle( "value", function( elem, name, isXML ) {
  10462. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10463. return elem.defaultValue;
  10464. }
  10465. });
  10466. }
  10467. // Support: IE<9
  10468. // Use getAttributeNode to fetch booleans when getAttribute lies
  10469. if ( !assert(function( el ) {
  10470. return el.getAttribute("disabled") == null;
  10471. }) ) {
  10472. addHandle( booleans, function( elem, name, isXML ) {
  10473. var val;
  10474. if ( !isXML ) {
  10475. return elem[ name ] === true ? name.toLowerCase() :
  10476. (val = elem.getAttributeNode( name )) && val.specified ?
  10477. val.value :
  10478. null;
  10479. }
  10480. });
  10481. }
  10482. return Sizzle;
  10483. })( window );
  10484. jQuery.find = Sizzle;
  10485. jQuery.expr = Sizzle.selectors;
  10486. // Deprecated
  10487. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10488. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10489. jQuery.text = Sizzle.getText;
  10490. jQuery.isXMLDoc = Sizzle.isXML;
  10491. jQuery.contains = Sizzle.contains;
  10492. jQuery.escapeSelector = Sizzle.escape;
  10493. var dir = function( elem, dir, until ) {
  10494. var matched = [],
  10495. truncate = until !== undefined;
  10496. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10497. if ( elem.nodeType === 1 ) {
  10498. if ( truncate && jQuery( elem ).is( until ) ) {
  10499. break;
  10500. }
  10501. matched.push( elem );
  10502. }
  10503. }
  10504. return matched;
  10505. };
  10506. var siblings = function( n, elem ) {
  10507. var matched = [];
  10508. for ( ; n; n = n.nextSibling ) {
  10509. if ( n.nodeType === 1 && n !== elem ) {
  10510. matched.push( n );
  10511. }
  10512. }
  10513. return matched;
  10514. };
  10515. var rneedsContext = jQuery.expr.match.needsContext;
  10516. function nodeName( elem, name ) {
  10517. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10518. };
  10519. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10520. // Implement the identical functionality for filter and not
  10521. function winnow( elements, qualifier, not ) {
  10522. if ( isFunction( qualifier ) ) {
  10523. return jQuery.grep( elements, function( elem, i ) {
  10524. return !!qualifier.call( elem, i, elem ) !== not;
  10525. } );
  10526. }
  10527. // Single element
  10528. if ( qualifier.nodeType ) {
  10529. return jQuery.grep( elements, function( elem ) {
  10530. return ( elem === qualifier ) !== not;
  10531. } );
  10532. }
  10533. // Arraylike of elements (jQuery, arguments, Array)
  10534. if ( typeof qualifier !== "string" ) {
  10535. return jQuery.grep( elements, function( elem ) {
  10536. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10537. } );
  10538. }
  10539. // Filtered directly for both simple and complex selectors
  10540. return jQuery.filter( qualifier, elements, not );
  10541. }
  10542. jQuery.filter = function( expr, elems, not ) {
  10543. var elem = elems[ 0 ];
  10544. if ( not ) {
  10545. expr = ":not(" + expr + ")";
  10546. }
  10547. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10548. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10549. }
  10550. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10551. return elem.nodeType === 1;
  10552. } ) );
  10553. };
  10554. jQuery.fn.extend( {
  10555. find: function( selector ) {
  10556. var i, ret,
  10557. len = this.length,
  10558. self = this;
  10559. if ( typeof selector !== "string" ) {
  10560. return this.pushStack( jQuery( selector ).filter( function() {
  10561. for ( i = 0; i < len; i++ ) {
  10562. if ( jQuery.contains( self[ i ], this ) ) {
  10563. return true;
  10564. }
  10565. }
  10566. } ) );
  10567. }
  10568. ret = this.pushStack( [] );
  10569. for ( i = 0; i < len; i++ ) {
  10570. jQuery.find( selector, self[ i ], ret );
  10571. }
  10572. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10573. },
  10574. filter: function( selector ) {
  10575. return this.pushStack( winnow( this, selector || [], false ) );
  10576. },
  10577. not: function( selector ) {
  10578. return this.pushStack( winnow( this, selector || [], true ) );
  10579. },
  10580. is: function( selector ) {
  10581. return !!winnow(
  10582. this,
  10583. // If this is a positional/relative selector, check membership in the returned set
  10584. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10585. typeof selector === "string" && rneedsContext.test( selector ) ?
  10586. jQuery( selector ) :
  10587. selector || [],
  10588. false
  10589. ).length;
  10590. }
  10591. } );
  10592. // Initialize a jQuery object
  10593. // A central reference to the root jQuery(document)
  10594. var rootjQuery,
  10595. // A simple way to check for HTML strings
  10596. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10597. // Strict HTML recognition (#11290: must start with <)
  10598. // Shortcut simple #id case for speed
  10599. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10600. init = jQuery.fn.init = function( selector, context, root ) {
  10601. var match, elem;
  10602. // HANDLE: $(""), $(null), $(undefined), $(false)
  10603. if ( !selector ) {
  10604. return this;
  10605. }
  10606. // Method init() accepts an alternate rootjQuery
  10607. // so migrate can support jQuery.sub (gh-2101)
  10608. root = root || rootjQuery;
  10609. // Handle HTML strings
  10610. if ( typeof selector === "string" ) {
  10611. if ( selector[ 0 ] === "<" &&
  10612. selector[ selector.length - 1 ] === ">" &&
  10613. selector.length >= 3 ) {
  10614. // Assume that strings that start and end with <> are HTML and skip the regex check
  10615. match = [ null, selector, null ];
  10616. } else {
  10617. match = rquickExpr.exec( selector );
  10618. }
  10619. // Match html or make sure no context is specified for #id
  10620. if ( match && ( match[ 1 ] || !context ) ) {
  10621. // HANDLE: $(html) -> $(array)
  10622. if ( match[ 1 ] ) {
  10623. context = context instanceof jQuery ? context[ 0 ] : context;
  10624. // Option to run scripts is true for back-compat
  10625. // Intentionally let the error be thrown if parseHTML is not present
  10626. jQuery.merge( this, jQuery.parseHTML(
  10627. match[ 1 ],
  10628. context && context.nodeType ? context.ownerDocument || context : document,
  10629. true
  10630. ) );
  10631. // HANDLE: $(html, props)
  10632. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10633. for ( match in context ) {
  10634. // Properties of context are called as methods if possible
  10635. if ( isFunction( this[ match ] ) ) {
  10636. this[ match ]( context[ match ] );
  10637. // ...and otherwise set as attributes
  10638. } else {
  10639. this.attr( match, context[ match ] );
  10640. }
  10641. }
  10642. }
  10643. return this;
  10644. // HANDLE: $(#id)
  10645. } else {
  10646. elem = document.getElementById( match[ 2 ] );
  10647. if ( elem ) {
  10648. // Inject the element directly into the jQuery object
  10649. this[ 0 ] = elem;
  10650. this.length = 1;
  10651. }
  10652. return this;
  10653. }
  10654. // HANDLE: $(expr, $(...))
  10655. } else if ( !context || context.jquery ) {
  10656. return ( context || root ).find( selector );
  10657. // HANDLE: $(expr, context)
  10658. // (which is just equivalent to: $(context).find(expr)
  10659. } else {
  10660. return this.constructor( context ).find( selector );
  10661. }
  10662. // HANDLE: $(DOMElement)
  10663. } else if ( selector.nodeType ) {
  10664. this[ 0 ] = selector;
  10665. this.length = 1;
  10666. return this;
  10667. // HANDLE: $(function)
  10668. // Shortcut for document ready
  10669. } else if ( isFunction( selector ) ) {
  10670. return root.ready !== undefined ?
  10671. root.ready( selector ) :
  10672. // Execute immediately if ready is not present
  10673. selector( jQuery );
  10674. }
  10675. return jQuery.makeArray( selector, this );
  10676. };
  10677. // Give the init function the jQuery prototype for later instantiation
  10678. init.prototype = jQuery.fn;
  10679. // Initialize central reference
  10680. rootjQuery = jQuery( document );
  10681. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10682. // Methods guaranteed to produce a unique set when starting from a unique set
  10683. guaranteedUnique = {
  10684. children: true,
  10685. contents: true,
  10686. next: true,
  10687. prev: true
  10688. };
  10689. jQuery.fn.extend( {
  10690. has: function( target ) {
  10691. var targets = jQuery( target, this ),
  10692. l = targets.length;
  10693. return this.filter( function() {
  10694. var i = 0;
  10695. for ( ; i < l; i++ ) {
  10696. if ( jQuery.contains( this, targets[ i ] ) ) {
  10697. return true;
  10698. }
  10699. }
  10700. } );
  10701. },
  10702. closest: function( selectors, context ) {
  10703. var cur,
  10704. i = 0,
  10705. l = this.length,
  10706. matched = [],
  10707. targets = typeof selectors !== "string" && jQuery( selectors );
  10708. // Positional selectors never match, since there's no _selection_ context
  10709. if ( !rneedsContext.test( selectors ) ) {
  10710. for ( ; i < l; i++ ) {
  10711. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10712. // Always skip document fragments
  10713. if ( cur.nodeType < 11 && ( targets ?
  10714. targets.index( cur ) > -1 :
  10715. // Don't pass non-elements to Sizzle
  10716. cur.nodeType === 1 &&
  10717. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10718. matched.push( cur );
  10719. break;
  10720. }
  10721. }
  10722. }
  10723. }
  10724. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10725. },
  10726. // Determine the position of an element within the set
  10727. index: function( elem ) {
  10728. // No argument, return index in parent
  10729. if ( !elem ) {
  10730. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10731. }
  10732. // Index in selector
  10733. if ( typeof elem === "string" ) {
  10734. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10735. }
  10736. // Locate the position of the desired element
  10737. return indexOf.call( this,
  10738. // If it receives a jQuery object, the first element is used
  10739. elem.jquery ? elem[ 0 ] : elem
  10740. );
  10741. },
  10742. add: function( selector, context ) {
  10743. return this.pushStack(
  10744. jQuery.uniqueSort(
  10745. jQuery.merge( this.get(), jQuery( selector, context ) )
  10746. )
  10747. );
  10748. },
  10749. addBack: function( selector ) {
  10750. return this.add( selector == null ?
  10751. this.prevObject : this.prevObject.filter( selector )
  10752. );
  10753. }
  10754. } );
  10755. function sibling( cur, dir ) {
  10756. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10757. return cur;
  10758. }
  10759. jQuery.each( {
  10760. parent: function( elem ) {
  10761. var parent = elem.parentNode;
  10762. return parent && parent.nodeType !== 11 ? parent : null;
  10763. },
  10764. parents: function( elem ) {
  10765. return dir( elem, "parentNode" );
  10766. },
  10767. parentsUntil: function( elem, i, until ) {
  10768. return dir( elem, "parentNode", until );
  10769. },
  10770. next: function( elem ) {
  10771. return sibling( elem, "nextSibling" );
  10772. },
  10773. prev: function( elem ) {
  10774. return sibling( elem, "previousSibling" );
  10775. },
  10776. nextAll: function( elem ) {
  10777. return dir( elem, "nextSibling" );
  10778. },
  10779. prevAll: function( elem ) {
  10780. return dir( elem, "previousSibling" );
  10781. },
  10782. nextUntil: function( elem, i, until ) {
  10783. return dir( elem, "nextSibling", until );
  10784. },
  10785. prevUntil: function( elem, i, until ) {
  10786. return dir( elem, "previousSibling", until );
  10787. },
  10788. siblings: function( elem ) {
  10789. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10790. },
  10791. children: function( elem ) {
  10792. return siblings( elem.firstChild );
  10793. },
  10794. contents: function( elem ) {
  10795. if ( typeof elem.contentDocument !== "undefined" ) {
  10796. return elem.contentDocument;
  10797. }
  10798. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10799. // Treat the template element as a regular one in browsers that
  10800. // don't support it.
  10801. if ( nodeName( elem, "template" ) ) {
  10802. elem = elem.content || elem;
  10803. }
  10804. return jQuery.merge( [], elem.childNodes );
  10805. }
  10806. }, function( name, fn ) {
  10807. jQuery.fn[ name ] = function( until, selector ) {
  10808. var matched = jQuery.map( this, fn, until );
  10809. if ( name.slice( -5 ) !== "Until" ) {
  10810. selector = until;
  10811. }
  10812. if ( selector && typeof selector === "string" ) {
  10813. matched = jQuery.filter( selector, matched );
  10814. }
  10815. if ( this.length > 1 ) {
  10816. // Remove duplicates
  10817. if ( !guaranteedUnique[ name ] ) {
  10818. jQuery.uniqueSort( matched );
  10819. }
  10820. // Reverse order for parents* and prev-derivatives
  10821. if ( rparentsprev.test( name ) ) {
  10822. matched.reverse();
  10823. }
  10824. }
  10825. return this.pushStack( matched );
  10826. };
  10827. } );
  10828. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10829. // Convert String-formatted options into Object-formatted ones
  10830. function createOptions( options ) {
  10831. var object = {};
  10832. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10833. object[ flag ] = true;
  10834. } );
  10835. return object;
  10836. }
  10837. /*
  10838. * Create a callback list using the following parameters:
  10839. *
  10840. * options: an optional list of space-separated options that will change how
  10841. * the callback list behaves or a more traditional option object
  10842. *
  10843. * By default a callback list will act like an event callback list and can be
  10844. * "fired" multiple times.
  10845. *
  10846. * Possible options:
  10847. *
  10848. * once: will ensure the callback list can only be fired once (like a Deferred)
  10849. *
  10850. * memory: will keep track of previous values and will call any callback added
  10851. * after the list has been fired right away with the latest "memorized"
  10852. * values (like a Deferred)
  10853. *
  10854. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10855. *
  10856. * stopOnFalse: interrupt callings when a callback returns false
  10857. *
  10858. */
  10859. jQuery.Callbacks = function( options ) {
  10860. // Convert options from String-formatted to Object-formatted if needed
  10861. // (we check in cache first)
  10862. options = typeof options === "string" ?
  10863. createOptions( options ) :
  10864. jQuery.extend( {}, options );
  10865. var // Flag to know if list is currently firing
  10866. firing,
  10867. // Last fire value for non-forgettable lists
  10868. memory,
  10869. // Flag to know if list was already fired
  10870. fired,
  10871. // Flag to prevent firing
  10872. locked,
  10873. // Actual callback list
  10874. list = [],
  10875. // Queue of execution data for repeatable lists
  10876. queue = [],
  10877. // Index of currently firing callback (modified by add/remove as needed)
  10878. firingIndex = -1,
  10879. // Fire callbacks
  10880. fire = function() {
  10881. // Enforce single-firing
  10882. locked = locked || options.once;
  10883. // Execute callbacks for all pending executions,
  10884. // respecting firingIndex overrides and runtime changes
  10885. fired = firing = true;
  10886. for ( ; queue.length; firingIndex = -1 ) {
  10887. memory = queue.shift();
  10888. while ( ++firingIndex < list.length ) {
  10889. // Run callback and check for early termination
  10890. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10891. options.stopOnFalse ) {
  10892. // Jump to end and forget the data so .add doesn't re-fire
  10893. firingIndex = list.length;
  10894. memory = false;
  10895. }
  10896. }
  10897. }
  10898. // Forget the data if we're done with it
  10899. if ( !options.memory ) {
  10900. memory = false;
  10901. }
  10902. firing = false;
  10903. // Clean up if we're done firing for good
  10904. if ( locked ) {
  10905. // Keep an empty list if we have data for future add calls
  10906. if ( memory ) {
  10907. list = [];
  10908. // Otherwise, this object is spent
  10909. } else {
  10910. list = "";
  10911. }
  10912. }
  10913. },
  10914. // Actual Callbacks object
  10915. self = {
  10916. // Add a callback or a collection of callbacks to the list
  10917. add: function() {
  10918. if ( list ) {
  10919. // If we have memory from a past run, we should fire after adding
  10920. if ( memory && !firing ) {
  10921. firingIndex = list.length - 1;
  10922. queue.push( memory );
  10923. }
  10924. ( function add( args ) {
  10925. jQuery.each( args, function( _, arg ) {
  10926. if ( isFunction( arg ) ) {
  10927. if ( !options.unique || !self.has( arg ) ) {
  10928. list.push( arg );
  10929. }
  10930. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  10931. // Inspect recursively
  10932. add( arg );
  10933. }
  10934. } );
  10935. } )( arguments );
  10936. if ( memory && !firing ) {
  10937. fire();
  10938. }
  10939. }
  10940. return this;
  10941. },
  10942. // Remove a callback from the list
  10943. remove: function() {
  10944. jQuery.each( arguments, function( _, arg ) {
  10945. var index;
  10946. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  10947. list.splice( index, 1 );
  10948. // Handle firing indexes
  10949. if ( index <= firingIndex ) {
  10950. firingIndex--;
  10951. }
  10952. }
  10953. } );
  10954. return this;
  10955. },
  10956. // Check if a given callback is in the list.
  10957. // If no argument is given, return whether or not list has callbacks attached.
  10958. has: function( fn ) {
  10959. return fn ?
  10960. jQuery.inArray( fn, list ) > -1 :
  10961. list.length > 0;
  10962. },
  10963. // Remove all callbacks from the list
  10964. empty: function() {
  10965. if ( list ) {
  10966. list = [];
  10967. }
  10968. return this;
  10969. },
  10970. // Disable .fire and .add
  10971. // Abort any current/pending executions
  10972. // Clear all callbacks and values
  10973. disable: function() {
  10974. locked = queue = [];
  10975. list = memory = "";
  10976. return this;
  10977. },
  10978. disabled: function() {
  10979. return !list;
  10980. },
  10981. // Disable .fire
  10982. // Also disable .add unless we have memory (since it would have no effect)
  10983. // Abort any pending executions
  10984. lock: function() {
  10985. locked = queue = [];
  10986. if ( !memory && !firing ) {
  10987. list = memory = "";
  10988. }
  10989. return this;
  10990. },
  10991. locked: function() {
  10992. return !!locked;
  10993. },
  10994. // Call all callbacks with the given context and arguments
  10995. fireWith: function( context, args ) {
  10996. if ( !locked ) {
  10997. args = args || [];
  10998. args = [ context, args.slice ? args.slice() : args ];
  10999. queue.push( args );
  11000. if ( !firing ) {
  11001. fire();
  11002. }
  11003. }
  11004. return this;
  11005. },
  11006. // Call all the callbacks with the given arguments
  11007. fire: function() {
  11008. self.fireWith( this, arguments );
  11009. return this;
  11010. },
  11011. // To know if the callbacks have already been called at least once
  11012. fired: function() {
  11013. return !!fired;
  11014. }
  11015. };
  11016. return self;
  11017. };
  11018. function Identity( v ) {
  11019. return v;
  11020. }
  11021. function Thrower( ex ) {
  11022. throw ex;
  11023. }
  11024. function adoptValue( value, resolve, reject, noValue ) {
  11025. var method;
  11026. try {
  11027. // Check for promise aspect first to privilege synchronous behavior
  11028. if ( value && isFunction( ( method = value.promise ) ) ) {
  11029. method.call( value ).done( resolve ).fail( reject );
  11030. // Other thenables
  11031. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11032. method.call( value, resolve, reject );
  11033. // Other non-thenables
  11034. } else {
  11035. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11036. // * false: [ value ].slice( 0 ) => resolve( value )
  11037. // * true: [ value ].slice( 1 ) => resolve()
  11038. resolve.apply( undefined, [ value ].slice( noValue ) );
  11039. }
  11040. // For Promises/A+, convert exceptions into rejections
  11041. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11042. // Deferred#then to conditionally suppress rejection.
  11043. } catch ( value ) {
  11044. // Support: Android 4.0 only
  11045. // Strict mode functions invoked without .call/.apply get global-object context
  11046. reject.apply( undefined, [ value ] );
  11047. }
  11048. }
  11049. jQuery.extend( {
  11050. Deferred: function( func ) {
  11051. var tuples = [
  11052. // action, add listener, callbacks,
  11053. // ... .then handlers, argument index, [final state]
  11054. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11055. jQuery.Callbacks( "memory" ), 2 ],
  11056. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11057. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11058. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11059. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11060. ],
  11061. state = "pending",
  11062. promise = {
  11063. state: function() {
  11064. return state;
  11065. },
  11066. always: function() {
  11067. deferred.done( arguments ).fail( arguments );
  11068. return this;
  11069. },
  11070. "catch": function( fn ) {
  11071. return promise.then( null, fn );
  11072. },
  11073. // Keep pipe for back-compat
  11074. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11075. var fns = arguments;
  11076. return jQuery.Deferred( function( newDefer ) {
  11077. jQuery.each( tuples, function( i, tuple ) {
  11078. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11079. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11080. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11081. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11082. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11083. deferred[ tuple[ 1 ] ]( function() {
  11084. var returned = fn && fn.apply( this, arguments );
  11085. if ( returned && isFunction( returned.promise ) ) {
  11086. returned.promise()
  11087. .progress( newDefer.notify )
  11088. .done( newDefer.resolve )
  11089. .fail( newDefer.reject );
  11090. } else {
  11091. newDefer[ tuple[ 0 ] + "With" ](
  11092. this,
  11093. fn ? [ returned ] : arguments
  11094. );
  11095. }
  11096. } );
  11097. } );
  11098. fns = null;
  11099. } ).promise();
  11100. },
  11101. then: function( onFulfilled, onRejected, onProgress ) {
  11102. var maxDepth = 0;
  11103. function resolve( depth, deferred, handler, special ) {
  11104. return function() {
  11105. var that = this,
  11106. args = arguments,
  11107. mightThrow = function() {
  11108. var returned, then;
  11109. // Support: Promises/A+ section 2.3.3.3.3
  11110. // https://promisesaplus.com/#point-59
  11111. // Ignore double-resolution attempts
  11112. if ( depth < maxDepth ) {
  11113. return;
  11114. }
  11115. returned = handler.apply( that, args );
  11116. // Support: Promises/A+ section 2.3.1
  11117. // https://promisesaplus.com/#point-48
  11118. if ( returned === deferred.promise() ) {
  11119. throw new TypeError( "Thenable self-resolution" );
  11120. }
  11121. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11122. // https://promisesaplus.com/#point-54
  11123. // https://promisesaplus.com/#point-75
  11124. // Retrieve `then` only once
  11125. then = returned &&
  11126. // Support: Promises/A+ section 2.3.4
  11127. // https://promisesaplus.com/#point-64
  11128. // Only check objects and functions for thenability
  11129. ( typeof returned === "object" ||
  11130. typeof returned === "function" ) &&
  11131. returned.then;
  11132. // Handle a returned thenable
  11133. if ( isFunction( then ) ) {
  11134. // Special processors (notify) just wait for resolution
  11135. if ( special ) {
  11136. then.call(
  11137. returned,
  11138. resolve( maxDepth, deferred, Identity, special ),
  11139. resolve( maxDepth, deferred, Thrower, special )
  11140. );
  11141. // Normal processors (resolve) also hook into progress
  11142. } else {
  11143. // ...and disregard older resolution values
  11144. maxDepth++;
  11145. then.call(
  11146. returned,
  11147. resolve( maxDepth, deferred, Identity, special ),
  11148. resolve( maxDepth, deferred, Thrower, special ),
  11149. resolve( maxDepth, deferred, Identity,
  11150. deferred.notifyWith )
  11151. );
  11152. }
  11153. // Handle all other returned values
  11154. } else {
  11155. // Only substitute handlers pass on context
  11156. // and multiple values (non-spec behavior)
  11157. if ( handler !== Identity ) {
  11158. that = undefined;
  11159. args = [ returned ];
  11160. }
  11161. // Process the value(s)
  11162. // Default process is resolve
  11163. ( special || deferred.resolveWith )( that, args );
  11164. }
  11165. },
  11166. // Only normal processors (resolve) catch and reject exceptions
  11167. process = special ?
  11168. mightThrow :
  11169. function() {
  11170. try {
  11171. mightThrow();
  11172. } catch ( e ) {
  11173. if ( jQuery.Deferred.exceptionHook ) {
  11174. jQuery.Deferred.exceptionHook( e,
  11175. process.stackTrace );
  11176. }
  11177. // Support: Promises/A+ section 2.3.3.3.4.1
  11178. // https://promisesaplus.com/#point-61
  11179. // Ignore post-resolution exceptions
  11180. if ( depth + 1 >= maxDepth ) {
  11181. // Only substitute handlers pass on context
  11182. // and multiple values (non-spec behavior)
  11183. if ( handler !== Thrower ) {
  11184. that = undefined;
  11185. args = [ e ];
  11186. }
  11187. deferred.rejectWith( that, args );
  11188. }
  11189. }
  11190. };
  11191. // Support: Promises/A+ section 2.3.3.3.1
  11192. // https://promisesaplus.com/#point-57
  11193. // Re-resolve promises immediately to dodge false rejection from
  11194. // subsequent errors
  11195. if ( depth ) {
  11196. process();
  11197. } else {
  11198. // Call an optional hook to record the stack, in case of exception
  11199. // since it's otherwise lost when execution goes async
  11200. if ( jQuery.Deferred.getStackHook ) {
  11201. process.stackTrace = jQuery.Deferred.getStackHook();
  11202. }
  11203. window.setTimeout( process );
  11204. }
  11205. };
  11206. }
  11207. return jQuery.Deferred( function( newDefer ) {
  11208. // progress_handlers.add( ... )
  11209. tuples[ 0 ][ 3 ].add(
  11210. resolve(
  11211. 0,
  11212. newDefer,
  11213. isFunction( onProgress ) ?
  11214. onProgress :
  11215. Identity,
  11216. newDefer.notifyWith
  11217. )
  11218. );
  11219. // fulfilled_handlers.add( ... )
  11220. tuples[ 1 ][ 3 ].add(
  11221. resolve(
  11222. 0,
  11223. newDefer,
  11224. isFunction( onFulfilled ) ?
  11225. onFulfilled :
  11226. Identity
  11227. )
  11228. );
  11229. // rejected_handlers.add( ... )
  11230. tuples[ 2 ][ 3 ].add(
  11231. resolve(
  11232. 0,
  11233. newDefer,
  11234. isFunction( onRejected ) ?
  11235. onRejected :
  11236. Thrower
  11237. )
  11238. );
  11239. } ).promise();
  11240. },
  11241. // Get a promise for this deferred
  11242. // If obj is provided, the promise aspect is added to the object
  11243. promise: function( obj ) {
  11244. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11245. }
  11246. },
  11247. deferred = {};
  11248. // Add list-specific methods
  11249. jQuery.each( tuples, function( i, tuple ) {
  11250. var list = tuple[ 2 ],
  11251. stateString = tuple[ 5 ];
  11252. // promise.progress = list.add
  11253. // promise.done = list.add
  11254. // promise.fail = list.add
  11255. promise[ tuple[ 1 ] ] = list.add;
  11256. // Handle state
  11257. if ( stateString ) {
  11258. list.add(
  11259. function() {
  11260. // state = "resolved" (i.e., fulfilled)
  11261. // state = "rejected"
  11262. state = stateString;
  11263. },
  11264. // rejected_callbacks.disable
  11265. // fulfilled_callbacks.disable
  11266. tuples[ 3 - i ][ 2 ].disable,
  11267. // rejected_handlers.disable
  11268. // fulfilled_handlers.disable
  11269. tuples[ 3 - i ][ 3 ].disable,
  11270. // progress_callbacks.lock
  11271. tuples[ 0 ][ 2 ].lock,
  11272. // progress_handlers.lock
  11273. tuples[ 0 ][ 3 ].lock
  11274. );
  11275. }
  11276. // progress_handlers.fire
  11277. // fulfilled_handlers.fire
  11278. // rejected_handlers.fire
  11279. list.add( tuple[ 3 ].fire );
  11280. // deferred.notify = function() { deferred.notifyWith(...) }
  11281. // deferred.resolve = function() { deferred.resolveWith(...) }
  11282. // deferred.reject = function() { deferred.rejectWith(...) }
  11283. deferred[ tuple[ 0 ] ] = function() {
  11284. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11285. return this;
  11286. };
  11287. // deferred.notifyWith = list.fireWith
  11288. // deferred.resolveWith = list.fireWith
  11289. // deferred.rejectWith = list.fireWith
  11290. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11291. } );
  11292. // Make the deferred a promise
  11293. promise.promise( deferred );
  11294. // Call given func if any
  11295. if ( func ) {
  11296. func.call( deferred, deferred );
  11297. }
  11298. // All done!
  11299. return deferred;
  11300. },
  11301. // Deferred helper
  11302. when: function( singleValue ) {
  11303. var
  11304. // count of uncompleted subordinates
  11305. remaining = arguments.length,
  11306. // count of unprocessed arguments
  11307. i = remaining,
  11308. // subordinate fulfillment data
  11309. resolveContexts = Array( i ),
  11310. resolveValues = slice.call( arguments ),
  11311. // the master Deferred
  11312. master = jQuery.Deferred(),
  11313. // subordinate callback factory
  11314. updateFunc = function( i ) {
  11315. return function( value ) {
  11316. resolveContexts[ i ] = this;
  11317. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11318. if ( !( --remaining ) ) {
  11319. master.resolveWith( resolveContexts, resolveValues );
  11320. }
  11321. };
  11322. };
  11323. // Single- and empty arguments are adopted like Promise.resolve
  11324. if ( remaining <= 1 ) {
  11325. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11326. !remaining );
  11327. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11328. if ( master.state() === "pending" ||
  11329. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11330. return master.then();
  11331. }
  11332. }
  11333. // Multiple arguments are aggregated like Promise.all array elements
  11334. while ( i-- ) {
  11335. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11336. }
  11337. return master.promise();
  11338. }
  11339. } );
  11340. // These usually indicate a programmer mistake during development,
  11341. // warn about them ASAP rather than swallowing them by default.
  11342. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11343. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11344. // Support: IE 8 - 9 only
  11345. // Console exists when dev tools are open, which can happen at any time
  11346. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11347. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11348. }
  11349. };
  11350. jQuery.readyException = function( error ) {
  11351. window.setTimeout( function() {
  11352. throw error;
  11353. } );
  11354. };
  11355. // The deferred used on DOM ready
  11356. var readyList = jQuery.Deferred();
  11357. jQuery.fn.ready = function( fn ) {
  11358. readyList
  11359. .then( fn )
  11360. // Wrap jQuery.readyException in a function so that the lookup
  11361. // happens at the time of error handling instead of callback
  11362. // registration.
  11363. .catch( function( error ) {
  11364. jQuery.readyException( error );
  11365. } );
  11366. return this;
  11367. };
  11368. jQuery.extend( {
  11369. // Is the DOM ready to be used? Set to true once it occurs.
  11370. isReady: false,
  11371. // A counter to track how many items to wait for before
  11372. // the ready event fires. See #6781
  11373. readyWait: 1,
  11374. // Handle when the DOM is ready
  11375. ready: function( wait ) {
  11376. // Abort if there are pending holds or we're already ready
  11377. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11378. return;
  11379. }
  11380. // Remember that the DOM is ready
  11381. jQuery.isReady = true;
  11382. // If a normal DOM Ready event fired, decrement, and wait if need be
  11383. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11384. return;
  11385. }
  11386. // If there are functions bound, to execute
  11387. readyList.resolveWith( document, [ jQuery ] );
  11388. }
  11389. } );
  11390. jQuery.ready.then = readyList.then;
  11391. // The ready event handler and self cleanup method
  11392. function completed() {
  11393. document.removeEventListener( "DOMContentLoaded", completed );
  11394. window.removeEventListener( "load", completed );
  11395. jQuery.ready();
  11396. }
  11397. // Catch cases where $(document).ready() is called
  11398. // after the browser event has already occurred.
  11399. // Support: IE <=9 - 10 only
  11400. // Older IE sometimes signals "interactive" too soon
  11401. if ( document.readyState === "complete" ||
  11402. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11403. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11404. window.setTimeout( jQuery.ready );
  11405. } else {
  11406. // Use the handy event callback
  11407. document.addEventListener( "DOMContentLoaded", completed );
  11408. // A fallback to window.onload, that will always work
  11409. window.addEventListener( "load", completed );
  11410. }
  11411. // Multifunctional method to get and set values of a collection
  11412. // The value/s can optionally be executed if it's a function
  11413. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11414. var i = 0,
  11415. len = elems.length,
  11416. bulk = key == null;
  11417. // Sets many values
  11418. if ( toType( key ) === "object" ) {
  11419. chainable = true;
  11420. for ( i in key ) {
  11421. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11422. }
  11423. // Sets one value
  11424. } else if ( value !== undefined ) {
  11425. chainable = true;
  11426. if ( !isFunction( value ) ) {
  11427. raw = true;
  11428. }
  11429. if ( bulk ) {
  11430. // Bulk operations run against the entire set
  11431. if ( raw ) {
  11432. fn.call( elems, value );
  11433. fn = null;
  11434. // ...except when executing function values
  11435. } else {
  11436. bulk = fn;
  11437. fn = function( elem, key, value ) {
  11438. return bulk.call( jQuery( elem ), value );
  11439. };
  11440. }
  11441. }
  11442. if ( fn ) {
  11443. for ( ; i < len; i++ ) {
  11444. fn(
  11445. elems[ i ], key, raw ?
  11446. value :
  11447. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11448. );
  11449. }
  11450. }
  11451. }
  11452. if ( chainable ) {
  11453. return elems;
  11454. }
  11455. // Gets
  11456. if ( bulk ) {
  11457. return fn.call( elems );
  11458. }
  11459. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11460. };
  11461. // Matches dashed string for camelizing
  11462. var rmsPrefix = /^-ms-/,
  11463. rdashAlpha = /-([a-z])/g;
  11464. // Used by camelCase as callback to replace()
  11465. function fcamelCase( all, letter ) {
  11466. return letter.toUpperCase();
  11467. }
  11468. // Convert dashed to camelCase; used by the css and data modules
  11469. // Support: IE <=9 - 11, Edge 12 - 15
  11470. // Microsoft forgot to hump their vendor prefix (#9572)
  11471. function camelCase( string ) {
  11472. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11473. }
  11474. var acceptData = function( owner ) {
  11475. // Accepts only:
  11476. // - Node
  11477. // - Node.ELEMENT_NODE
  11478. // - Node.DOCUMENT_NODE
  11479. // - Object
  11480. // - Any
  11481. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11482. };
  11483. function Data() {
  11484. this.expando = jQuery.expando + Data.uid++;
  11485. }
  11486. Data.uid = 1;
  11487. Data.prototype = {
  11488. cache: function( owner ) {
  11489. // Check if the owner object already has a cache
  11490. var value = owner[ this.expando ];
  11491. // If not, create one
  11492. if ( !value ) {
  11493. value = {};
  11494. // We can accept data for non-element nodes in modern browsers,
  11495. // but we should not, see #8335.
  11496. // Always return an empty object.
  11497. if ( acceptData( owner ) ) {
  11498. // If it is a node unlikely to be stringify-ed or looped over
  11499. // use plain assignment
  11500. if ( owner.nodeType ) {
  11501. owner[ this.expando ] = value;
  11502. // Otherwise secure it in a non-enumerable property
  11503. // configurable must be true to allow the property to be
  11504. // deleted when data is removed
  11505. } else {
  11506. Object.defineProperty( owner, this.expando, {
  11507. value: value,
  11508. configurable: true
  11509. } );
  11510. }
  11511. }
  11512. }
  11513. return value;
  11514. },
  11515. set: function( owner, data, value ) {
  11516. var prop,
  11517. cache = this.cache( owner );
  11518. // Handle: [ owner, key, value ] args
  11519. // Always use camelCase key (gh-2257)
  11520. if ( typeof data === "string" ) {
  11521. cache[ camelCase( data ) ] = value;
  11522. // Handle: [ owner, { properties } ] args
  11523. } else {
  11524. // Copy the properties one-by-one to the cache object
  11525. for ( prop in data ) {
  11526. cache[ camelCase( prop ) ] = data[ prop ];
  11527. }
  11528. }
  11529. return cache;
  11530. },
  11531. get: function( owner, key ) {
  11532. return key === undefined ?
  11533. this.cache( owner ) :
  11534. // Always use camelCase key (gh-2257)
  11535. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11536. },
  11537. access: function( owner, key, value ) {
  11538. // In cases where either:
  11539. //
  11540. // 1. No key was specified
  11541. // 2. A string key was specified, but no value provided
  11542. //
  11543. // Take the "read" path and allow the get method to determine
  11544. // which value to return, respectively either:
  11545. //
  11546. // 1. The entire cache object
  11547. // 2. The data stored at the key
  11548. //
  11549. if ( key === undefined ||
  11550. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11551. return this.get( owner, key );
  11552. }
  11553. // When the key is not a string, or both a key and value
  11554. // are specified, set or extend (existing objects) with either:
  11555. //
  11556. // 1. An object of properties
  11557. // 2. A key and value
  11558. //
  11559. this.set( owner, key, value );
  11560. // Since the "set" path can have two possible entry points
  11561. // return the expected data based on which path was taken[*]
  11562. return value !== undefined ? value : key;
  11563. },
  11564. remove: function( owner, key ) {
  11565. var i,
  11566. cache = owner[ this.expando ];
  11567. if ( cache === undefined ) {
  11568. return;
  11569. }
  11570. if ( key !== undefined ) {
  11571. // Support array or space separated string of keys
  11572. if ( Array.isArray( key ) ) {
  11573. // If key is an array of keys...
  11574. // We always set camelCase keys, so remove that.
  11575. key = key.map( camelCase );
  11576. } else {
  11577. key = camelCase( key );
  11578. // If a key with the spaces exists, use it.
  11579. // Otherwise, create an array by matching non-whitespace
  11580. key = key in cache ?
  11581. [ key ] :
  11582. ( key.match( rnothtmlwhite ) || [] );
  11583. }
  11584. i = key.length;
  11585. while ( i-- ) {
  11586. delete cache[ key[ i ] ];
  11587. }
  11588. }
  11589. // Remove the expando if there's no more data
  11590. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11591. // Support: Chrome <=35 - 45
  11592. // Webkit & Blink performance suffers when deleting properties
  11593. // from DOM nodes, so set to undefined instead
  11594. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11595. if ( owner.nodeType ) {
  11596. owner[ this.expando ] = undefined;
  11597. } else {
  11598. delete owner[ this.expando ];
  11599. }
  11600. }
  11601. },
  11602. hasData: function( owner ) {
  11603. var cache = owner[ this.expando ];
  11604. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11605. }
  11606. };
  11607. var dataPriv = new Data();
  11608. var dataUser = new Data();
  11609. // Implementation Summary
  11610. //
  11611. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11612. // 2. Improve the module's maintainability by reducing the storage
  11613. // paths to a single mechanism.
  11614. // 3. Use the same single mechanism to support "private" and "user" data.
  11615. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11616. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11617. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11618. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11619. rmultiDash = /[A-Z]/g;
  11620. function getData( data ) {
  11621. if ( data === "true" ) {
  11622. return true;
  11623. }
  11624. if ( data === "false" ) {
  11625. return false;
  11626. }
  11627. if ( data === "null" ) {
  11628. return null;
  11629. }
  11630. // Only convert to a number if it doesn't change the string
  11631. if ( data === +data + "" ) {
  11632. return +data;
  11633. }
  11634. if ( rbrace.test( data ) ) {
  11635. return JSON.parse( data );
  11636. }
  11637. return data;
  11638. }
  11639. function dataAttr( elem, key, data ) {
  11640. var name;
  11641. // If nothing was found internally, try to fetch any
  11642. // data from the HTML5 data-* attribute
  11643. if ( data === undefined && elem.nodeType === 1 ) {
  11644. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11645. data = elem.getAttribute( name );
  11646. if ( typeof data === "string" ) {
  11647. try {
  11648. data = getData( data );
  11649. } catch ( e ) {}
  11650. // Make sure we set the data so it isn't changed later
  11651. dataUser.set( elem, key, data );
  11652. } else {
  11653. data = undefined;
  11654. }
  11655. }
  11656. return data;
  11657. }
  11658. jQuery.extend( {
  11659. hasData: function( elem ) {
  11660. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11661. },
  11662. data: function( elem, name, data ) {
  11663. return dataUser.access( elem, name, data );
  11664. },
  11665. removeData: function( elem, name ) {
  11666. dataUser.remove( elem, name );
  11667. },
  11668. // TODO: Now that all calls to _data and _removeData have been replaced
  11669. // with direct calls to dataPriv methods, these can be deprecated.
  11670. _data: function( elem, name, data ) {
  11671. return dataPriv.access( elem, name, data );
  11672. },
  11673. _removeData: function( elem, name ) {
  11674. dataPriv.remove( elem, name );
  11675. }
  11676. } );
  11677. jQuery.fn.extend( {
  11678. data: function( key, value ) {
  11679. var i, name, data,
  11680. elem = this[ 0 ],
  11681. attrs = elem && elem.attributes;
  11682. // Gets all values
  11683. if ( key === undefined ) {
  11684. if ( this.length ) {
  11685. data = dataUser.get( elem );
  11686. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11687. i = attrs.length;
  11688. while ( i-- ) {
  11689. // Support: IE 11 only
  11690. // The attrs elements can be null (#14894)
  11691. if ( attrs[ i ] ) {
  11692. name = attrs[ i ].name;
  11693. if ( name.indexOf( "data-" ) === 0 ) {
  11694. name = camelCase( name.slice( 5 ) );
  11695. dataAttr( elem, name, data[ name ] );
  11696. }
  11697. }
  11698. }
  11699. dataPriv.set( elem, "hasDataAttrs", true );
  11700. }
  11701. }
  11702. return data;
  11703. }
  11704. // Sets multiple values
  11705. if ( typeof key === "object" ) {
  11706. return this.each( function() {
  11707. dataUser.set( this, key );
  11708. } );
  11709. }
  11710. return access( this, function( value ) {
  11711. var data;
  11712. // The calling jQuery object (element matches) is not empty
  11713. // (and therefore has an element appears at this[ 0 ]) and the
  11714. // `value` parameter was not undefined. An empty jQuery object
  11715. // will result in `undefined` for elem = this[ 0 ] which will
  11716. // throw an exception if an attempt to read a data cache is made.
  11717. if ( elem && value === undefined ) {
  11718. // Attempt to get data from the cache
  11719. // The key will always be camelCased in Data
  11720. data = dataUser.get( elem, key );
  11721. if ( data !== undefined ) {
  11722. return data;
  11723. }
  11724. // Attempt to "discover" the data in
  11725. // HTML5 custom data-* attrs
  11726. data = dataAttr( elem, key );
  11727. if ( data !== undefined ) {
  11728. return data;
  11729. }
  11730. // We tried really hard, but the data doesn't exist.
  11731. return;
  11732. }
  11733. // Set the data...
  11734. this.each( function() {
  11735. // We always store the camelCased key
  11736. dataUser.set( this, key, value );
  11737. } );
  11738. }, null, value, arguments.length > 1, null, true );
  11739. },
  11740. removeData: function( key ) {
  11741. return this.each( function() {
  11742. dataUser.remove( this, key );
  11743. } );
  11744. }
  11745. } );
  11746. jQuery.extend( {
  11747. queue: function( elem, type, data ) {
  11748. var queue;
  11749. if ( elem ) {
  11750. type = ( type || "fx" ) + "queue";
  11751. queue = dataPriv.get( elem, type );
  11752. // Speed up dequeue by getting out quickly if this is just a lookup
  11753. if ( data ) {
  11754. if ( !queue || Array.isArray( data ) ) {
  11755. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11756. } else {
  11757. queue.push( data );
  11758. }
  11759. }
  11760. return queue || [];
  11761. }
  11762. },
  11763. dequeue: function( elem, type ) {
  11764. type = type || "fx";
  11765. var queue = jQuery.queue( elem, type ),
  11766. startLength = queue.length,
  11767. fn = queue.shift(),
  11768. hooks = jQuery._queueHooks( elem, type ),
  11769. next = function() {
  11770. jQuery.dequeue( elem, type );
  11771. };
  11772. // If the fx queue is dequeued, always remove the progress sentinel
  11773. if ( fn === "inprogress" ) {
  11774. fn = queue.shift();
  11775. startLength--;
  11776. }
  11777. if ( fn ) {
  11778. // Add a progress sentinel to prevent the fx queue from being
  11779. // automatically dequeued
  11780. if ( type === "fx" ) {
  11781. queue.unshift( "inprogress" );
  11782. }
  11783. // Clear up the last queue stop function
  11784. delete hooks.stop;
  11785. fn.call( elem, next, hooks );
  11786. }
  11787. if ( !startLength && hooks ) {
  11788. hooks.empty.fire();
  11789. }
  11790. },
  11791. // Not public - generate a queueHooks object, or return the current one
  11792. _queueHooks: function( elem, type ) {
  11793. var key = type + "queueHooks";
  11794. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11795. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11796. dataPriv.remove( elem, [ type + "queue", key ] );
  11797. } )
  11798. } );
  11799. }
  11800. } );
  11801. jQuery.fn.extend( {
  11802. queue: function( type, data ) {
  11803. var setter = 2;
  11804. if ( typeof type !== "string" ) {
  11805. data = type;
  11806. type = "fx";
  11807. setter--;
  11808. }
  11809. if ( arguments.length < setter ) {
  11810. return jQuery.queue( this[ 0 ], type );
  11811. }
  11812. return data === undefined ?
  11813. this :
  11814. this.each( function() {
  11815. var queue = jQuery.queue( this, type, data );
  11816. // Ensure a hooks for this queue
  11817. jQuery._queueHooks( this, type );
  11818. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11819. jQuery.dequeue( this, type );
  11820. }
  11821. } );
  11822. },
  11823. dequeue: function( type ) {
  11824. return this.each( function() {
  11825. jQuery.dequeue( this, type );
  11826. } );
  11827. },
  11828. clearQueue: function( type ) {
  11829. return this.queue( type || "fx", [] );
  11830. },
  11831. // Get a promise resolved when queues of a certain type
  11832. // are emptied (fx is the type by default)
  11833. promise: function( type, obj ) {
  11834. var tmp,
  11835. count = 1,
  11836. defer = jQuery.Deferred(),
  11837. elements = this,
  11838. i = this.length,
  11839. resolve = function() {
  11840. if ( !( --count ) ) {
  11841. defer.resolveWith( elements, [ elements ] );
  11842. }
  11843. };
  11844. if ( typeof type !== "string" ) {
  11845. obj = type;
  11846. type = undefined;
  11847. }
  11848. type = type || "fx";
  11849. while ( i-- ) {
  11850. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11851. if ( tmp && tmp.empty ) {
  11852. count++;
  11853. tmp.empty.add( resolve );
  11854. }
  11855. }
  11856. resolve();
  11857. return defer.promise( obj );
  11858. }
  11859. } );
  11860. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11861. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11862. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11863. var documentElement = document.documentElement;
  11864. var isAttached = function( elem ) {
  11865. return jQuery.contains( elem.ownerDocument, elem );
  11866. },
  11867. composed = { composed: true };
  11868. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11869. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11870. // Support: iOS 10.0-10.2 only
  11871. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11872. // leading to errors. We need to check for `getRootNode`.
  11873. if ( documentElement.getRootNode ) {
  11874. isAttached = function( elem ) {
  11875. return jQuery.contains( elem.ownerDocument, elem ) ||
  11876. elem.getRootNode( composed ) === elem.ownerDocument;
  11877. };
  11878. }
  11879. var isHiddenWithinTree = function( elem, el ) {
  11880. // isHiddenWithinTree might be called from jQuery#filter function;
  11881. // in that case, element will be second argument
  11882. elem = el || elem;
  11883. // Inline style trumps all
  11884. return elem.style.display === "none" ||
  11885. elem.style.display === "" &&
  11886. // Otherwise, check computed style
  11887. // Support: Firefox <=43 - 45
  11888. // Disconnected elements can have computed display: none, so first confirm that elem is
  11889. // in the document.
  11890. isAttached( elem ) &&
  11891. jQuery.css( elem, "display" ) === "none";
  11892. };
  11893. var swap = function( elem, options, callback, args ) {
  11894. var ret, name,
  11895. old = {};
  11896. // Remember the old values, and insert the new ones
  11897. for ( name in options ) {
  11898. old[ name ] = elem.style[ name ];
  11899. elem.style[ name ] = options[ name ];
  11900. }
  11901. ret = callback.apply( elem, args || [] );
  11902. // Revert the old values
  11903. for ( name in options ) {
  11904. elem.style[ name ] = old[ name ];
  11905. }
  11906. return ret;
  11907. };
  11908. function adjustCSS( elem, prop, valueParts, tween ) {
  11909. var adjusted, scale,
  11910. maxIterations = 20,
  11911. currentValue = tween ?
  11912. function() {
  11913. return tween.cur();
  11914. } :
  11915. function() {
  11916. return jQuery.css( elem, prop, "" );
  11917. },
  11918. initial = currentValue(),
  11919. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  11920. // Starting value computation is required for potential unit mismatches
  11921. initialInUnit = elem.nodeType &&
  11922. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  11923. rcssNum.exec( jQuery.css( elem, prop ) );
  11924. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  11925. // Support: Firefox <=54
  11926. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  11927. initial = initial / 2;
  11928. // Trust units reported by jQuery.css
  11929. unit = unit || initialInUnit[ 3 ];
  11930. // Iteratively approximate from a nonzero starting point
  11931. initialInUnit = +initial || 1;
  11932. while ( maxIterations-- ) {
  11933. // Evaluate and update our best guess (doubling guesses that zero out).
  11934. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  11935. jQuery.style( elem, prop, initialInUnit + unit );
  11936. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  11937. maxIterations = 0;
  11938. }
  11939. initialInUnit = initialInUnit / scale;
  11940. }
  11941. initialInUnit = initialInUnit * 2;
  11942. jQuery.style( elem, prop, initialInUnit + unit );
  11943. // Make sure we update the tween properties later on
  11944. valueParts = valueParts || [];
  11945. }
  11946. if ( valueParts ) {
  11947. initialInUnit = +initialInUnit || +initial || 0;
  11948. // Apply relative offset (+=/-=) if specified
  11949. adjusted = valueParts[ 1 ] ?
  11950. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  11951. +valueParts[ 2 ];
  11952. if ( tween ) {
  11953. tween.unit = unit;
  11954. tween.start = initialInUnit;
  11955. tween.end = adjusted;
  11956. }
  11957. }
  11958. return adjusted;
  11959. }
  11960. var defaultDisplayMap = {};
  11961. function getDefaultDisplay( elem ) {
  11962. var temp,
  11963. doc = elem.ownerDocument,
  11964. nodeName = elem.nodeName,
  11965. display = defaultDisplayMap[ nodeName ];
  11966. if ( display ) {
  11967. return display;
  11968. }
  11969. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  11970. display = jQuery.css( temp, "display" );
  11971. temp.parentNode.removeChild( temp );
  11972. if ( display === "none" ) {
  11973. display = "block";
  11974. }
  11975. defaultDisplayMap[ nodeName ] = display;
  11976. return display;
  11977. }
  11978. function showHide( elements, show ) {
  11979. var display, elem,
  11980. values = [],
  11981. index = 0,
  11982. length = elements.length;
  11983. // Determine new display value for elements that need to change
  11984. for ( ; index < length; index++ ) {
  11985. elem = elements[ index ];
  11986. if ( !elem.style ) {
  11987. continue;
  11988. }
  11989. display = elem.style.display;
  11990. if ( show ) {
  11991. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  11992. // check is required in this first loop unless we have a nonempty display value (either
  11993. // inline or about-to-be-restored)
  11994. if ( display === "none" ) {
  11995. values[ index ] = dataPriv.get( elem, "display" ) || null;
  11996. if ( !values[ index ] ) {
  11997. elem.style.display = "";
  11998. }
  11999. }
  12000. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12001. values[ index ] = getDefaultDisplay( elem );
  12002. }
  12003. } else {
  12004. if ( display !== "none" ) {
  12005. values[ index ] = "none";
  12006. // Remember what we're overwriting
  12007. dataPriv.set( elem, "display", display );
  12008. }
  12009. }
  12010. }
  12011. // Set the display of the elements in a second loop to avoid constant reflow
  12012. for ( index = 0; index < length; index++ ) {
  12013. if ( values[ index ] != null ) {
  12014. elements[ index ].style.display = values[ index ];
  12015. }
  12016. }
  12017. return elements;
  12018. }
  12019. jQuery.fn.extend( {
  12020. show: function() {
  12021. return showHide( this, true );
  12022. },
  12023. hide: function() {
  12024. return showHide( this );
  12025. },
  12026. toggle: function( state ) {
  12027. if ( typeof state === "boolean" ) {
  12028. return state ? this.show() : this.hide();
  12029. }
  12030. return this.each( function() {
  12031. if ( isHiddenWithinTree( this ) ) {
  12032. jQuery( this ).show();
  12033. } else {
  12034. jQuery( this ).hide();
  12035. }
  12036. } );
  12037. }
  12038. } );
  12039. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12040. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12041. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12042. // We have to close these tags to support XHTML (#13200)
  12043. var wrapMap = {
  12044. // Support: IE <=9 only
  12045. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12046. // XHTML parsers do not magically insert elements in the
  12047. // same way that tag soup parsers do. So we cannot shorten
  12048. // this by omitting <tbody> or other required elements.
  12049. thead: [ 1, "<table>", "</table>" ],
  12050. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12051. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12052. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12053. _default: [ 0, "", "" ]
  12054. };
  12055. // Support: IE <=9 only
  12056. wrapMap.optgroup = wrapMap.option;
  12057. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12058. wrapMap.th = wrapMap.td;
  12059. function getAll( context, tag ) {
  12060. // Support: IE <=9 - 11 only
  12061. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12062. var ret;
  12063. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12064. ret = context.getElementsByTagName( tag || "*" );
  12065. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12066. ret = context.querySelectorAll( tag || "*" );
  12067. } else {
  12068. ret = [];
  12069. }
  12070. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12071. return jQuery.merge( [ context ], ret );
  12072. }
  12073. return ret;
  12074. }
  12075. // Mark scripts as having already been evaluated
  12076. function setGlobalEval( elems, refElements ) {
  12077. var i = 0,
  12078. l = elems.length;
  12079. for ( ; i < l; i++ ) {
  12080. dataPriv.set(
  12081. elems[ i ],
  12082. "globalEval",
  12083. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12084. );
  12085. }
  12086. }
  12087. var rhtml = /<|&#?\w+;/;
  12088. function buildFragment( elems, context, scripts, selection, ignored ) {
  12089. var elem, tmp, tag, wrap, attached, j,
  12090. fragment = context.createDocumentFragment(),
  12091. nodes = [],
  12092. i = 0,
  12093. l = elems.length;
  12094. for ( ; i < l; i++ ) {
  12095. elem = elems[ i ];
  12096. if ( elem || elem === 0 ) {
  12097. // Add nodes directly
  12098. if ( toType( elem ) === "object" ) {
  12099. // Support: Android <=4.0 only, PhantomJS 1 only
  12100. // push.apply(_, arraylike) throws on ancient WebKit
  12101. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12102. // Convert non-html into a text node
  12103. } else if ( !rhtml.test( elem ) ) {
  12104. nodes.push( context.createTextNode( elem ) );
  12105. // Convert html into DOM nodes
  12106. } else {
  12107. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12108. // Deserialize a standard representation
  12109. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12110. wrap = wrapMap[ tag ] || wrapMap._default;
  12111. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12112. // Descend through wrappers to the right content
  12113. j = wrap[ 0 ];
  12114. while ( j-- ) {
  12115. tmp = tmp.lastChild;
  12116. }
  12117. // Support: Android <=4.0 only, PhantomJS 1 only
  12118. // push.apply(_, arraylike) throws on ancient WebKit
  12119. jQuery.merge( nodes, tmp.childNodes );
  12120. // Remember the top-level container
  12121. tmp = fragment.firstChild;
  12122. // Ensure the created nodes are orphaned (#12392)
  12123. tmp.textContent = "";
  12124. }
  12125. }
  12126. }
  12127. // Remove wrapper from fragment
  12128. fragment.textContent = "";
  12129. i = 0;
  12130. while ( ( elem = nodes[ i++ ] ) ) {
  12131. // Skip elements already in the context collection (trac-4087)
  12132. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12133. if ( ignored ) {
  12134. ignored.push( elem );
  12135. }
  12136. continue;
  12137. }
  12138. attached = isAttached( elem );
  12139. // Append to fragment
  12140. tmp = getAll( fragment.appendChild( elem ), "script" );
  12141. // Preserve script evaluation history
  12142. if ( attached ) {
  12143. setGlobalEval( tmp );
  12144. }
  12145. // Capture executables
  12146. if ( scripts ) {
  12147. j = 0;
  12148. while ( ( elem = tmp[ j++ ] ) ) {
  12149. if ( rscriptType.test( elem.type || "" ) ) {
  12150. scripts.push( elem );
  12151. }
  12152. }
  12153. }
  12154. }
  12155. return fragment;
  12156. }
  12157. ( function() {
  12158. var fragment = document.createDocumentFragment(),
  12159. div = fragment.appendChild( document.createElement( "div" ) ),
  12160. input = document.createElement( "input" );
  12161. // Support: Android 4.0 - 4.3 only
  12162. // Check state lost if the name is set (#11217)
  12163. // Support: Windows Web Apps (WWA)
  12164. // `name` and `type` must use .setAttribute for WWA (#14901)
  12165. input.setAttribute( "type", "radio" );
  12166. input.setAttribute( "checked", "checked" );
  12167. input.setAttribute( "name", "t" );
  12168. div.appendChild( input );
  12169. // Support: Android <=4.1 only
  12170. // Older WebKit doesn't clone checked state correctly in fragments
  12171. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12172. // Support: IE <=11 only
  12173. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12174. div.innerHTML = "<textarea>x</textarea>";
  12175. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12176. } )();
  12177. var
  12178. rkeyEvent = /^key/,
  12179. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12180. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12181. function returnTrue() {
  12182. return true;
  12183. }
  12184. function returnFalse() {
  12185. return false;
  12186. }
  12187. // Support: IE <=9 - 11+
  12188. // focus() and blur() are asynchronous, except when they are no-op.
  12189. // So expect focus to be synchronous when the element is already active,
  12190. // and blur to be synchronous when the element is not already active.
  12191. // (focus and blur are always synchronous in other supported browsers,
  12192. // this just defines when we can count on it).
  12193. function expectSync( elem, type ) {
  12194. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12195. }
  12196. // Support: IE <=9 only
  12197. // Accessing document.activeElement can throw unexpectedly
  12198. // https://bugs.jquery.com/ticket/13393
  12199. function safeActiveElement() {
  12200. try {
  12201. return document.activeElement;
  12202. } catch ( err ) { }
  12203. }
  12204. function on( elem, types, selector, data, fn, one ) {
  12205. var origFn, type;
  12206. // Types can be a map of types/handlers
  12207. if ( typeof types === "object" ) {
  12208. // ( types-Object, selector, data )
  12209. if ( typeof selector !== "string" ) {
  12210. // ( types-Object, data )
  12211. data = data || selector;
  12212. selector = undefined;
  12213. }
  12214. for ( type in types ) {
  12215. on( elem, type, selector, data, types[ type ], one );
  12216. }
  12217. return elem;
  12218. }
  12219. if ( data == null && fn == null ) {
  12220. // ( types, fn )
  12221. fn = selector;
  12222. data = selector = undefined;
  12223. } else if ( fn == null ) {
  12224. if ( typeof selector === "string" ) {
  12225. // ( types, selector, fn )
  12226. fn = data;
  12227. data = undefined;
  12228. } else {
  12229. // ( types, data, fn )
  12230. fn = data;
  12231. data = selector;
  12232. selector = undefined;
  12233. }
  12234. }
  12235. if ( fn === false ) {
  12236. fn = returnFalse;
  12237. } else if ( !fn ) {
  12238. return elem;
  12239. }
  12240. if ( one === 1 ) {
  12241. origFn = fn;
  12242. fn = function( event ) {
  12243. // Can use an empty set, since event contains the info
  12244. jQuery().off( event );
  12245. return origFn.apply( this, arguments );
  12246. };
  12247. // Use same guid so caller can remove using origFn
  12248. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12249. }
  12250. return elem.each( function() {
  12251. jQuery.event.add( this, types, fn, data, selector );
  12252. } );
  12253. }
  12254. /*
  12255. * Helper functions for managing events -- not part of the public interface.
  12256. * Props to Dean Edwards' addEvent library for many of the ideas.
  12257. */
  12258. jQuery.event = {
  12259. global: {},
  12260. add: function( elem, types, handler, data, selector ) {
  12261. var handleObjIn, eventHandle, tmp,
  12262. events, t, handleObj,
  12263. special, handlers, type, namespaces, origType,
  12264. elemData = dataPriv.get( elem );
  12265. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12266. if ( !elemData ) {
  12267. return;
  12268. }
  12269. // Caller can pass in an object of custom data in lieu of the handler
  12270. if ( handler.handler ) {
  12271. handleObjIn = handler;
  12272. handler = handleObjIn.handler;
  12273. selector = handleObjIn.selector;
  12274. }
  12275. // Ensure that invalid selectors throw exceptions at attach time
  12276. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12277. if ( selector ) {
  12278. jQuery.find.matchesSelector( documentElement, selector );
  12279. }
  12280. // Make sure that the handler has a unique ID, used to find/remove it later
  12281. if ( !handler.guid ) {
  12282. handler.guid = jQuery.guid++;
  12283. }
  12284. // Init the element's event structure and main handler, if this is the first
  12285. if ( !( events = elemData.events ) ) {
  12286. events = elemData.events = {};
  12287. }
  12288. if ( !( eventHandle = elemData.handle ) ) {
  12289. eventHandle = elemData.handle = function( e ) {
  12290. // Discard the second event of a jQuery.event.trigger() and
  12291. // when an event is called after a page has unloaded
  12292. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12293. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12294. };
  12295. }
  12296. // Handle multiple events separated by a space
  12297. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12298. t = types.length;
  12299. while ( t-- ) {
  12300. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12301. type = origType = tmp[ 1 ];
  12302. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12303. // There *must* be a type, no attaching namespace-only handlers
  12304. if ( !type ) {
  12305. continue;
  12306. }
  12307. // If event changes its type, use the special event handlers for the changed type
  12308. special = jQuery.event.special[ type ] || {};
  12309. // If selector defined, determine special event api type, otherwise given type
  12310. type = ( selector ? special.delegateType : special.bindType ) || type;
  12311. // Update special based on newly reset type
  12312. special = jQuery.event.special[ type ] || {};
  12313. // handleObj is passed to all event handlers
  12314. handleObj = jQuery.extend( {
  12315. type: type,
  12316. origType: origType,
  12317. data: data,
  12318. handler: handler,
  12319. guid: handler.guid,
  12320. selector: selector,
  12321. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12322. namespace: namespaces.join( "." )
  12323. }, handleObjIn );
  12324. // Init the event handler queue if we're the first
  12325. if ( !( handlers = events[ type ] ) ) {
  12326. handlers = events[ type ] = [];
  12327. handlers.delegateCount = 0;
  12328. // Only use addEventListener if the special events handler returns false
  12329. if ( !special.setup ||
  12330. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12331. if ( elem.addEventListener ) {
  12332. elem.addEventListener( type, eventHandle );
  12333. }
  12334. }
  12335. }
  12336. if ( special.add ) {
  12337. special.add.call( elem, handleObj );
  12338. if ( !handleObj.handler.guid ) {
  12339. handleObj.handler.guid = handler.guid;
  12340. }
  12341. }
  12342. // Add to the element's handler list, delegates in front
  12343. if ( selector ) {
  12344. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12345. } else {
  12346. handlers.push( handleObj );
  12347. }
  12348. // Keep track of which events have ever been used, for event optimization
  12349. jQuery.event.global[ type ] = true;
  12350. }
  12351. },
  12352. // Detach an event or set of events from an element
  12353. remove: function( elem, types, handler, selector, mappedTypes ) {
  12354. var j, origCount, tmp,
  12355. events, t, handleObj,
  12356. special, handlers, type, namespaces, origType,
  12357. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12358. if ( !elemData || !( events = elemData.events ) ) {
  12359. return;
  12360. }
  12361. // Once for each type.namespace in types; type may be omitted
  12362. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12363. t = types.length;
  12364. while ( t-- ) {
  12365. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12366. type = origType = tmp[ 1 ];
  12367. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12368. // Unbind all events (on this namespace, if provided) for the element
  12369. if ( !type ) {
  12370. for ( type in events ) {
  12371. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12372. }
  12373. continue;
  12374. }
  12375. special = jQuery.event.special[ type ] || {};
  12376. type = ( selector ? special.delegateType : special.bindType ) || type;
  12377. handlers = events[ type ] || [];
  12378. tmp = tmp[ 2 ] &&
  12379. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12380. // Remove matching events
  12381. origCount = j = handlers.length;
  12382. while ( j-- ) {
  12383. handleObj = handlers[ j ];
  12384. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12385. ( !handler || handler.guid === handleObj.guid ) &&
  12386. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12387. ( !selector || selector === handleObj.selector ||
  12388. selector === "**" && handleObj.selector ) ) {
  12389. handlers.splice( j, 1 );
  12390. if ( handleObj.selector ) {
  12391. handlers.delegateCount--;
  12392. }
  12393. if ( special.remove ) {
  12394. special.remove.call( elem, handleObj );
  12395. }
  12396. }
  12397. }
  12398. // Remove generic event handler if we removed something and no more handlers exist
  12399. // (avoids potential for endless recursion during removal of special event handlers)
  12400. if ( origCount && !handlers.length ) {
  12401. if ( !special.teardown ||
  12402. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12403. jQuery.removeEvent( elem, type, elemData.handle );
  12404. }
  12405. delete events[ type ];
  12406. }
  12407. }
  12408. // Remove data and the expando if it's no longer used
  12409. if ( jQuery.isEmptyObject( events ) ) {
  12410. dataPriv.remove( elem, "handle events" );
  12411. }
  12412. },
  12413. dispatch: function( nativeEvent ) {
  12414. // Make a writable jQuery.Event from the native event object
  12415. var event = jQuery.event.fix( nativeEvent );
  12416. var i, j, ret, matched, handleObj, handlerQueue,
  12417. args = new Array( arguments.length ),
  12418. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12419. special = jQuery.event.special[ event.type ] || {};
  12420. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12421. args[ 0 ] = event;
  12422. for ( i = 1; i < arguments.length; i++ ) {
  12423. args[ i ] = arguments[ i ];
  12424. }
  12425. event.delegateTarget = this;
  12426. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12427. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12428. return;
  12429. }
  12430. // Determine handlers
  12431. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12432. // Run delegates first; they may want to stop propagation beneath us
  12433. i = 0;
  12434. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12435. event.currentTarget = matched.elem;
  12436. j = 0;
  12437. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12438. !event.isImmediatePropagationStopped() ) {
  12439. // If the event is namespaced, then each handler is only invoked if it is
  12440. // specially universal or its namespaces are a superset of the event's.
  12441. if ( !event.rnamespace || handleObj.namespace === false ||
  12442. event.rnamespace.test( handleObj.namespace ) ) {
  12443. event.handleObj = handleObj;
  12444. event.data = handleObj.data;
  12445. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12446. handleObj.handler ).apply( matched.elem, args );
  12447. if ( ret !== undefined ) {
  12448. if ( ( event.result = ret ) === false ) {
  12449. event.preventDefault();
  12450. event.stopPropagation();
  12451. }
  12452. }
  12453. }
  12454. }
  12455. }
  12456. // Call the postDispatch hook for the mapped type
  12457. if ( special.postDispatch ) {
  12458. special.postDispatch.call( this, event );
  12459. }
  12460. return event.result;
  12461. },
  12462. handlers: function( event, handlers ) {
  12463. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12464. handlerQueue = [],
  12465. delegateCount = handlers.delegateCount,
  12466. cur = event.target;
  12467. // Find delegate handlers
  12468. if ( delegateCount &&
  12469. // Support: IE <=9
  12470. // Black-hole SVG <use> instance trees (trac-13180)
  12471. cur.nodeType &&
  12472. // Support: Firefox <=42
  12473. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12474. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12475. // Support: IE 11 only
  12476. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12477. !( event.type === "click" && event.button >= 1 ) ) {
  12478. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12479. // Don't check non-elements (#13208)
  12480. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12481. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12482. matchedHandlers = [];
  12483. matchedSelectors = {};
  12484. for ( i = 0; i < delegateCount; i++ ) {
  12485. handleObj = handlers[ i ];
  12486. // Don't conflict with Object.prototype properties (#13203)
  12487. sel = handleObj.selector + " ";
  12488. if ( matchedSelectors[ sel ] === undefined ) {
  12489. matchedSelectors[ sel ] = handleObj.needsContext ?
  12490. jQuery( sel, this ).index( cur ) > -1 :
  12491. jQuery.find( sel, this, null, [ cur ] ).length;
  12492. }
  12493. if ( matchedSelectors[ sel ] ) {
  12494. matchedHandlers.push( handleObj );
  12495. }
  12496. }
  12497. if ( matchedHandlers.length ) {
  12498. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12499. }
  12500. }
  12501. }
  12502. }
  12503. // Add the remaining (directly-bound) handlers
  12504. cur = this;
  12505. if ( delegateCount < handlers.length ) {
  12506. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12507. }
  12508. return handlerQueue;
  12509. },
  12510. addProp: function( name, hook ) {
  12511. Object.defineProperty( jQuery.Event.prototype, name, {
  12512. enumerable: true,
  12513. configurable: true,
  12514. get: isFunction( hook ) ?
  12515. function() {
  12516. if ( this.originalEvent ) {
  12517. return hook( this.originalEvent );
  12518. }
  12519. } :
  12520. function() {
  12521. if ( this.originalEvent ) {
  12522. return this.originalEvent[ name ];
  12523. }
  12524. },
  12525. set: function( value ) {
  12526. Object.defineProperty( this, name, {
  12527. enumerable: true,
  12528. configurable: true,
  12529. writable: true,
  12530. value: value
  12531. } );
  12532. }
  12533. } );
  12534. },
  12535. fix: function( originalEvent ) {
  12536. return originalEvent[ jQuery.expando ] ?
  12537. originalEvent :
  12538. new jQuery.Event( originalEvent );
  12539. },
  12540. special: {
  12541. load: {
  12542. // Prevent triggered image.load events from bubbling to window.load
  12543. noBubble: true
  12544. },
  12545. click: {
  12546. // Utilize native event to ensure correct state for checkable inputs
  12547. setup: function( data ) {
  12548. // For mutual compressibility with _default, replace `this` access with a local var.
  12549. // `|| data` is dead code meant only to preserve the variable through minification.
  12550. var el = this || data;
  12551. // Claim the first handler
  12552. if ( rcheckableType.test( el.type ) &&
  12553. el.click && nodeName( el, "input" ) ) {
  12554. // dataPriv.set( el, "click", ... )
  12555. leverageNative( el, "click", returnTrue );
  12556. }
  12557. // Return false to allow normal processing in the caller
  12558. return false;
  12559. },
  12560. trigger: function( data ) {
  12561. // For mutual compressibility with _default, replace `this` access with a local var.
  12562. // `|| data` is dead code meant only to preserve the variable through minification.
  12563. var el = this || data;
  12564. // Force setup before triggering a click
  12565. if ( rcheckableType.test( el.type ) &&
  12566. el.click && nodeName( el, "input" ) ) {
  12567. leverageNative( el, "click" );
  12568. }
  12569. // Return non-false to allow normal event-path propagation
  12570. return true;
  12571. },
  12572. // For cross-browser consistency, suppress native .click() on links
  12573. // Also prevent it if we're currently inside a leveraged native-event stack
  12574. _default: function( event ) {
  12575. var target = event.target;
  12576. return rcheckableType.test( target.type ) &&
  12577. target.click && nodeName( target, "input" ) &&
  12578. dataPriv.get( target, "click" ) ||
  12579. nodeName( target, "a" );
  12580. }
  12581. },
  12582. beforeunload: {
  12583. postDispatch: function( event ) {
  12584. // Support: Firefox 20+
  12585. // Firefox doesn't alert if the returnValue field is not set.
  12586. if ( event.result !== undefined && event.originalEvent ) {
  12587. event.originalEvent.returnValue = event.result;
  12588. }
  12589. }
  12590. }
  12591. }
  12592. };
  12593. // Ensure the presence of an event listener that handles manually-triggered
  12594. // synthetic events by interrupting progress until reinvoked in response to
  12595. // *native* events that it fires directly, ensuring that state changes have
  12596. // already occurred before other listeners are invoked.
  12597. function leverageNative( el, type, expectSync ) {
  12598. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12599. if ( !expectSync ) {
  12600. if ( dataPriv.get( el, type ) === undefined ) {
  12601. jQuery.event.add( el, type, returnTrue );
  12602. }
  12603. return;
  12604. }
  12605. // Register the controller as a special universal handler for all event namespaces
  12606. dataPriv.set( el, type, false );
  12607. jQuery.event.add( el, type, {
  12608. namespace: false,
  12609. handler: function( event ) {
  12610. var notAsync, result,
  12611. saved = dataPriv.get( this, type );
  12612. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12613. // Interrupt processing of the outer synthetic .trigger()ed event
  12614. // Saved data should be false in such cases, but might be a leftover capture object
  12615. // from an async native handler (gh-4350)
  12616. if ( !saved.length ) {
  12617. // Store arguments for use when handling the inner native event
  12618. // There will always be at least one argument (an event object), so this array
  12619. // will not be confused with a leftover capture object.
  12620. saved = slice.call( arguments );
  12621. dataPriv.set( this, type, saved );
  12622. // Trigger the native event and capture its result
  12623. // Support: IE <=9 - 11+
  12624. // focus() and blur() are asynchronous
  12625. notAsync = expectSync( this, type );
  12626. this[ type ]();
  12627. result = dataPriv.get( this, type );
  12628. if ( saved !== result || notAsync ) {
  12629. dataPriv.set( this, type, false );
  12630. } else {
  12631. result = {};
  12632. }
  12633. if ( saved !== result ) {
  12634. // Cancel the outer synthetic event
  12635. event.stopImmediatePropagation();
  12636. event.preventDefault();
  12637. return result.value;
  12638. }
  12639. // If this is an inner synthetic event for an event with a bubbling surrogate
  12640. // (focus or blur), assume that the surrogate already propagated from triggering the
  12641. // native event and prevent that from happening again here.
  12642. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12643. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12644. // less bad than duplication.
  12645. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12646. event.stopPropagation();
  12647. }
  12648. // If this is a native event triggered above, everything is now in order
  12649. // Fire an inner synthetic event with the original arguments
  12650. } else if ( saved.length ) {
  12651. // ...and capture the result
  12652. dataPriv.set( this, type, {
  12653. value: jQuery.event.trigger(
  12654. // Support: IE <=9 - 11+
  12655. // Extend with the prototype to reset the above stopImmediatePropagation()
  12656. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12657. saved.slice( 1 ),
  12658. this
  12659. )
  12660. } );
  12661. // Abort handling of the native event
  12662. event.stopImmediatePropagation();
  12663. }
  12664. }
  12665. } );
  12666. }
  12667. jQuery.removeEvent = function( elem, type, handle ) {
  12668. // This "if" is needed for plain objects
  12669. if ( elem.removeEventListener ) {
  12670. elem.removeEventListener( type, handle );
  12671. }
  12672. };
  12673. jQuery.Event = function( src, props ) {
  12674. // Allow instantiation without the 'new' keyword
  12675. if ( !( this instanceof jQuery.Event ) ) {
  12676. return new jQuery.Event( src, props );
  12677. }
  12678. // Event object
  12679. if ( src && src.type ) {
  12680. this.originalEvent = src;
  12681. this.type = src.type;
  12682. // Events bubbling up the document may have been marked as prevented
  12683. // by a handler lower down the tree; reflect the correct value.
  12684. this.isDefaultPrevented = src.defaultPrevented ||
  12685. src.defaultPrevented === undefined &&
  12686. // Support: Android <=2.3 only
  12687. src.returnValue === false ?
  12688. returnTrue :
  12689. returnFalse;
  12690. // Create target properties
  12691. // Support: Safari <=6 - 7 only
  12692. // Target should not be a text node (#504, #13143)
  12693. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12694. src.target.parentNode :
  12695. src.target;
  12696. this.currentTarget = src.currentTarget;
  12697. this.relatedTarget = src.relatedTarget;
  12698. // Event type
  12699. } else {
  12700. this.type = src;
  12701. }
  12702. // Put explicitly provided properties onto the event object
  12703. if ( props ) {
  12704. jQuery.extend( this, props );
  12705. }
  12706. // Create a timestamp if incoming event doesn't have one
  12707. this.timeStamp = src && src.timeStamp || Date.now();
  12708. // Mark it as fixed
  12709. this[ jQuery.expando ] = true;
  12710. };
  12711. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12712. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12713. jQuery.Event.prototype = {
  12714. constructor: jQuery.Event,
  12715. isDefaultPrevented: returnFalse,
  12716. isPropagationStopped: returnFalse,
  12717. isImmediatePropagationStopped: returnFalse,
  12718. isSimulated: false,
  12719. preventDefault: function() {
  12720. var e = this.originalEvent;
  12721. this.isDefaultPrevented = returnTrue;
  12722. if ( e && !this.isSimulated ) {
  12723. e.preventDefault();
  12724. }
  12725. },
  12726. stopPropagation: function() {
  12727. var e = this.originalEvent;
  12728. this.isPropagationStopped = returnTrue;
  12729. if ( e && !this.isSimulated ) {
  12730. e.stopPropagation();
  12731. }
  12732. },
  12733. stopImmediatePropagation: function() {
  12734. var e = this.originalEvent;
  12735. this.isImmediatePropagationStopped = returnTrue;
  12736. if ( e && !this.isSimulated ) {
  12737. e.stopImmediatePropagation();
  12738. }
  12739. this.stopPropagation();
  12740. }
  12741. };
  12742. // Includes all common event props including KeyEvent and MouseEvent specific props
  12743. jQuery.each( {
  12744. altKey: true,
  12745. bubbles: true,
  12746. cancelable: true,
  12747. changedTouches: true,
  12748. ctrlKey: true,
  12749. detail: true,
  12750. eventPhase: true,
  12751. metaKey: true,
  12752. pageX: true,
  12753. pageY: true,
  12754. shiftKey: true,
  12755. view: true,
  12756. "char": true,
  12757. code: true,
  12758. charCode: true,
  12759. key: true,
  12760. keyCode: true,
  12761. button: true,
  12762. buttons: true,
  12763. clientX: true,
  12764. clientY: true,
  12765. offsetX: true,
  12766. offsetY: true,
  12767. pointerId: true,
  12768. pointerType: true,
  12769. screenX: true,
  12770. screenY: true,
  12771. targetTouches: true,
  12772. toElement: true,
  12773. touches: true,
  12774. which: function( event ) {
  12775. var button = event.button;
  12776. // Add which for key events
  12777. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12778. return event.charCode != null ? event.charCode : event.keyCode;
  12779. }
  12780. // Add which for click: 1 === left; 2 === middle; 3 === right
  12781. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12782. if ( button & 1 ) {
  12783. return 1;
  12784. }
  12785. if ( button & 2 ) {
  12786. return 3;
  12787. }
  12788. if ( button & 4 ) {
  12789. return 2;
  12790. }
  12791. return 0;
  12792. }
  12793. return event.which;
  12794. }
  12795. }, jQuery.event.addProp );
  12796. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12797. jQuery.event.special[ type ] = {
  12798. // Utilize native event if possible so blur/focus sequence is correct
  12799. setup: function() {
  12800. // Claim the first handler
  12801. // dataPriv.set( this, "focus", ... )
  12802. // dataPriv.set( this, "blur", ... )
  12803. leverageNative( this, type, expectSync );
  12804. // Return false to allow normal processing in the caller
  12805. return false;
  12806. },
  12807. trigger: function() {
  12808. // Force setup before trigger
  12809. leverageNative( this, type );
  12810. // Return non-false to allow normal event-path propagation
  12811. return true;
  12812. },
  12813. delegateType: delegateType
  12814. };
  12815. } );
  12816. // Create mouseenter/leave events using mouseover/out and event-time checks
  12817. // so that event delegation works in jQuery.
  12818. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12819. //
  12820. // Support: Safari 7 only
  12821. // Safari sends mouseenter too often; see:
  12822. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12823. // for the description of the bug (it existed in older Chrome versions as well).
  12824. jQuery.each( {
  12825. mouseenter: "mouseover",
  12826. mouseleave: "mouseout",
  12827. pointerenter: "pointerover",
  12828. pointerleave: "pointerout"
  12829. }, function( orig, fix ) {
  12830. jQuery.event.special[ orig ] = {
  12831. delegateType: fix,
  12832. bindType: fix,
  12833. handle: function( event ) {
  12834. var ret,
  12835. target = this,
  12836. related = event.relatedTarget,
  12837. handleObj = event.handleObj;
  12838. // For mouseenter/leave call the handler if related is outside the target.
  12839. // NB: No relatedTarget if the mouse left/entered the browser window
  12840. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12841. event.type = handleObj.origType;
  12842. ret = handleObj.handler.apply( this, arguments );
  12843. event.type = fix;
  12844. }
  12845. return ret;
  12846. }
  12847. };
  12848. } );
  12849. jQuery.fn.extend( {
  12850. on: function( types, selector, data, fn ) {
  12851. return on( this, types, selector, data, fn );
  12852. },
  12853. one: function( types, selector, data, fn ) {
  12854. return on( this, types, selector, data, fn, 1 );
  12855. },
  12856. off: function( types, selector, fn ) {
  12857. var handleObj, type;
  12858. if ( types && types.preventDefault && types.handleObj ) {
  12859. // ( event ) dispatched jQuery.Event
  12860. handleObj = types.handleObj;
  12861. jQuery( types.delegateTarget ).off(
  12862. handleObj.namespace ?
  12863. handleObj.origType + "." + handleObj.namespace :
  12864. handleObj.origType,
  12865. handleObj.selector,
  12866. handleObj.handler
  12867. );
  12868. return this;
  12869. }
  12870. if ( typeof types === "object" ) {
  12871. // ( types-object [, selector] )
  12872. for ( type in types ) {
  12873. this.off( type, selector, types[ type ] );
  12874. }
  12875. return this;
  12876. }
  12877. if ( selector === false || typeof selector === "function" ) {
  12878. // ( types [, fn] )
  12879. fn = selector;
  12880. selector = undefined;
  12881. }
  12882. if ( fn === false ) {
  12883. fn = returnFalse;
  12884. }
  12885. return this.each( function() {
  12886. jQuery.event.remove( this, types, fn, selector );
  12887. } );
  12888. }
  12889. } );
  12890. var
  12891. /* eslint-disable max-len */
  12892. // See https://github.com/eslint/eslint/issues/3229
  12893. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12894. /* eslint-enable */
  12895. // Support: IE <=10 - 11, Edge 12 - 13 only
  12896. // In IE/Edge using regex groups here causes severe slowdowns.
  12897. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12898. rnoInnerhtml = /<script|<style|<link/i,
  12899. // checked="checked" or checked
  12900. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12901. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12902. // Prefer a tbody over its parent table for containing new rows
  12903. function manipulationTarget( elem, content ) {
  12904. if ( nodeName( elem, "table" ) &&
  12905. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12906. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12907. }
  12908. return elem;
  12909. }
  12910. // Replace/restore the type attribute of script elements for safe DOM manipulation
  12911. function disableScript( elem ) {
  12912. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  12913. return elem;
  12914. }
  12915. function restoreScript( elem ) {
  12916. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  12917. elem.type = elem.type.slice( 5 );
  12918. } else {
  12919. elem.removeAttribute( "type" );
  12920. }
  12921. return elem;
  12922. }
  12923. function cloneCopyEvent( src, dest ) {
  12924. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  12925. if ( dest.nodeType !== 1 ) {
  12926. return;
  12927. }
  12928. // 1. Copy private data: events, handlers, etc.
  12929. if ( dataPriv.hasData( src ) ) {
  12930. pdataOld = dataPriv.access( src );
  12931. pdataCur = dataPriv.set( dest, pdataOld );
  12932. events = pdataOld.events;
  12933. if ( events ) {
  12934. delete pdataCur.handle;
  12935. pdataCur.events = {};
  12936. for ( type in events ) {
  12937. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  12938. jQuery.event.add( dest, type, events[ type ][ i ] );
  12939. }
  12940. }
  12941. }
  12942. }
  12943. // 2. Copy user data
  12944. if ( dataUser.hasData( src ) ) {
  12945. udataOld = dataUser.access( src );
  12946. udataCur = jQuery.extend( {}, udataOld );
  12947. dataUser.set( dest, udataCur );
  12948. }
  12949. }
  12950. // Fix IE bugs, see support tests
  12951. function fixInput( src, dest ) {
  12952. var nodeName = dest.nodeName.toLowerCase();
  12953. // Fails to persist the checked state of a cloned checkbox or radio button.
  12954. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  12955. dest.checked = src.checked;
  12956. // Fails to return the selected option to the default selected state when cloning options
  12957. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  12958. dest.defaultValue = src.defaultValue;
  12959. }
  12960. }
  12961. function domManip( collection, args, callback, ignored ) {
  12962. // Flatten any nested arrays
  12963. args = concat.apply( [], args );
  12964. var fragment, first, scripts, hasScripts, node, doc,
  12965. i = 0,
  12966. l = collection.length,
  12967. iNoClone = l - 1,
  12968. value = args[ 0 ],
  12969. valueIsFunction = isFunction( value );
  12970. // We can't cloneNode fragments that contain checked, in WebKit
  12971. if ( valueIsFunction ||
  12972. ( l > 1 && typeof value === "string" &&
  12973. !support.checkClone && rchecked.test( value ) ) ) {
  12974. return collection.each( function( index ) {
  12975. var self = collection.eq( index );
  12976. if ( valueIsFunction ) {
  12977. args[ 0 ] = value.call( this, index, self.html() );
  12978. }
  12979. domManip( self, args, callback, ignored );
  12980. } );
  12981. }
  12982. if ( l ) {
  12983. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  12984. first = fragment.firstChild;
  12985. if ( fragment.childNodes.length === 1 ) {
  12986. fragment = first;
  12987. }
  12988. // Require either new content or an interest in ignored elements to invoke the callback
  12989. if ( first || ignored ) {
  12990. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  12991. hasScripts = scripts.length;
  12992. // Use the original fragment for the last item
  12993. // instead of the first because it can end up
  12994. // being emptied incorrectly in certain situations (#8070).
  12995. for ( ; i < l; i++ ) {
  12996. node = fragment;
  12997. if ( i !== iNoClone ) {
  12998. node = jQuery.clone( node, true, true );
  12999. // Keep references to cloned scripts for later restoration
  13000. if ( hasScripts ) {
  13001. // Support: Android <=4.0 only, PhantomJS 1 only
  13002. // push.apply(_, arraylike) throws on ancient WebKit
  13003. jQuery.merge( scripts, getAll( node, "script" ) );
  13004. }
  13005. }
  13006. callback.call( collection[ i ], node, i );
  13007. }
  13008. if ( hasScripts ) {
  13009. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13010. // Reenable scripts
  13011. jQuery.map( scripts, restoreScript );
  13012. // Evaluate executable scripts on first document insertion
  13013. for ( i = 0; i < hasScripts; i++ ) {
  13014. node = scripts[ i ];
  13015. if ( rscriptType.test( node.type || "" ) &&
  13016. !dataPriv.access( node, "globalEval" ) &&
  13017. jQuery.contains( doc, node ) ) {
  13018. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13019. // Optional AJAX dependency, but won't run scripts if not present
  13020. if ( jQuery._evalUrl && !node.noModule ) {
  13021. jQuery._evalUrl( node.src, {
  13022. nonce: node.nonce || node.getAttribute( "nonce" )
  13023. } );
  13024. }
  13025. } else {
  13026. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13027. }
  13028. }
  13029. }
  13030. }
  13031. }
  13032. }
  13033. return collection;
  13034. }
  13035. function remove( elem, selector, keepData ) {
  13036. var node,
  13037. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13038. i = 0;
  13039. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13040. if ( !keepData && node.nodeType === 1 ) {
  13041. jQuery.cleanData( getAll( node ) );
  13042. }
  13043. if ( node.parentNode ) {
  13044. if ( keepData && isAttached( node ) ) {
  13045. setGlobalEval( getAll( node, "script" ) );
  13046. }
  13047. node.parentNode.removeChild( node );
  13048. }
  13049. }
  13050. return elem;
  13051. }
  13052. jQuery.extend( {
  13053. htmlPrefilter: function( html ) {
  13054. return html.replace( rxhtmlTag, "<$1></$2>" );
  13055. },
  13056. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13057. var i, l, srcElements, destElements,
  13058. clone = elem.cloneNode( true ),
  13059. inPage = isAttached( elem );
  13060. // Fix IE cloning issues
  13061. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13062. !jQuery.isXMLDoc( elem ) ) {
  13063. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13064. destElements = getAll( clone );
  13065. srcElements = getAll( elem );
  13066. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13067. fixInput( srcElements[ i ], destElements[ i ] );
  13068. }
  13069. }
  13070. // Copy the events from the original to the clone
  13071. if ( dataAndEvents ) {
  13072. if ( deepDataAndEvents ) {
  13073. srcElements = srcElements || getAll( elem );
  13074. destElements = destElements || getAll( clone );
  13075. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13076. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13077. }
  13078. } else {
  13079. cloneCopyEvent( elem, clone );
  13080. }
  13081. }
  13082. // Preserve script evaluation history
  13083. destElements = getAll( clone, "script" );
  13084. if ( destElements.length > 0 ) {
  13085. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13086. }
  13087. // Return the cloned set
  13088. return clone;
  13089. },
  13090. cleanData: function( elems ) {
  13091. var data, elem, type,
  13092. special = jQuery.event.special,
  13093. i = 0;
  13094. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13095. if ( acceptData( elem ) ) {
  13096. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13097. if ( data.events ) {
  13098. for ( type in data.events ) {
  13099. if ( special[ type ] ) {
  13100. jQuery.event.remove( elem, type );
  13101. // This is a shortcut to avoid jQuery.event.remove's overhead
  13102. } else {
  13103. jQuery.removeEvent( elem, type, data.handle );
  13104. }
  13105. }
  13106. }
  13107. // Support: Chrome <=35 - 45+
  13108. // Assign undefined instead of using delete, see Data#remove
  13109. elem[ dataPriv.expando ] = undefined;
  13110. }
  13111. if ( elem[ dataUser.expando ] ) {
  13112. // Support: Chrome <=35 - 45+
  13113. // Assign undefined instead of using delete, see Data#remove
  13114. elem[ dataUser.expando ] = undefined;
  13115. }
  13116. }
  13117. }
  13118. }
  13119. } );
  13120. jQuery.fn.extend( {
  13121. detach: function( selector ) {
  13122. return remove( this, selector, true );
  13123. },
  13124. remove: function( selector ) {
  13125. return remove( this, selector );
  13126. },
  13127. text: function( value ) {
  13128. return access( this, function( value ) {
  13129. return value === undefined ?
  13130. jQuery.text( this ) :
  13131. this.empty().each( function() {
  13132. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13133. this.textContent = value;
  13134. }
  13135. } );
  13136. }, null, value, arguments.length );
  13137. },
  13138. append: function() {
  13139. return domManip( this, arguments, function( elem ) {
  13140. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13141. var target = manipulationTarget( this, elem );
  13142. target.appendChild( elem );
  13143. }
  13144. } );
  13145. },
  13146. prepend: function() {
  13147. return domManip( this, arguments, function( elem ) {
  13148. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13149. var target = manipulationTarget( this, elem );
  13150. target.insertBefore( elem, target.firstChild );
  13151. }
  13152. } );
  13153. },
  13154. before: function() {
  13155. return domManip( this, arguments, function( elem ) {
  13156. if ( this.parentNode ) {
  13157. this.parentNode.insertBefore( elem, this );
  13158. }
  13159. } );
  13160. },
  13161. after: function() {
  13162. return domManip( this, arguments, function( elem ) {
  13163. if ( this.parentNode ) {
  13164. this.parentNode.insertBefore( elem, this.nextSibling );
  13165. }
  13166. } );
  13167. },
  13168. empty: function() {
  13169. var elem,
  13170. i = 0;
  13171. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13172. if ( elem.nodeType === 1 ) {
  13173. // Prevent memory leaks
  13174. jQuery.cleanData( getAll( elem, false ) );
  13175. // Remove any remaining nodes
  13176. elem.textContent = "";
  13177. }
  13178. }
  13179. return this;
  13180. },
  13181. clone: function( dataAndEvents, deepDataAndEvents ) {
  13182. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13183. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13184. return this.map( function() {
  13185. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13186. } );
  13187. },
  13188. html: function( value ) {
  13189. return access( this, function( value ) {
  13190. var elem = this[ 0 ] || {},
  13191. i = 0,
  13192. l = this.length;
  13193. if ( value === undefined && elem.nodeType === 1 ) {
  13194. return elem.innerHTML;
  13195. }
  13196. // See if we can take a shortcut and just use innerHTML
  13197. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13198. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13199. value = jQuery.htmlPrefilter( value );
  13200. try {
  13201. for ( ; i < l; i++ ) {
  13202. elem = this[ i ] || {};
  13203. // Remove element nodes and prevent memory leaks
  13204. if ( elem.nodeType === 1 ) {
  13205. jQuery.cleanData( getAll( elem, false ) );
  13206. elem.innerHTML = value;
  13207. }
  13208. }
  13209. elem = 0;
  13210. // If using innerHTML throws an exception, use the fallback method
  13211. } catch ( e ) {}
  13212. }
  13213. if ( elem ) {
  13214. this.empty().append( value );
  13215. }
  13216. }, null, value, arguments.length );
  13217. },
  13218. replaceWith: function() {
  13219. var ignored = [];
  13220. // Make the changes, replacing each non-ignored context element with the new content
  13221. return domManip( this, arguments, function( elem ) {
  13222. var parent = this.parentNode;
  13223. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13224. jQuery.cleanData( getAll( this ) );
  13225. if ( parent ) {
  13226. parent.replaceChild( elem, this );
  13227. }
  13228. }
  13229. // Force callback invocation
  13230. }, ignored );
  13231. }
  13232. } );
  13233. jQuery.each( {
  13234. appendTo: "append",
  13235. prependTo: "prepend",
  13236. insertBefore: "before",
  13237. insertAfter: "after",
  13238. replaceAll: "replaceWith"
  13239. }, function( name, original ) {
  13240. jQuery.fn[ name ] = function( selector ) {
  13241. var elems,
  13242. ret = [],
  13243. insert = jQuery( selector ),
  13244. last = insert.length - 1,
  13245. i = 0;
  13246. for ( ; i <= last; i++ ) {
  13247. elems = i === last ? this : this.clone( true );
  13248. jQuery( insert[ i ] )[ original ]( elems );
  13249. // Support: Android <=4.0 only, PhantomJS 1 only
  13250. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13251. push.apply( ret, elems.get() );
  13252. }
  13253. return this.pushStack( ret );
  13254. };
  13255. } );
  13256. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13257. var getStyles = function( elem ) {
  13258. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13259. // IE throws on elements created in popups
  13260. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13261. var view = elem.ownerDocument.defaultView;
  13262. if ( !view || !view.opener ) {
  13263. view = window;
  13264. }
  13265. return view.getComputedStyle( elem );
  13266. };
  13267. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13268. ( function() {
  13269. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13270. // so they're executed at the same time to save the second computation.
  13271. function computeStyleTests() {
  13272. // This is a singleton, we need to execute it only once
  13273. if ( !div ) {
  13274. return;
  13275. }
  13276. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13277. "margin-top:1px;padding:0;border:0";
  13278. div.style.cssText =
  13279. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13280. "margin:auto;border:1px;padding:1px;" +
  13281. "width:60%;top:1%";
  13282. documentElement.appendChild( container ).appendChild( div );
  13283. var divStyle = window.getComputedStyle( div );
  13284. pixelPositionVal = divStyle.top !== "1%";
  13285. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13286. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13287. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13288. // Some styles come back with percentage values, even though they shouldn't
  13289. div.style.right = "60%";
  13290. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13291. // Support: IE 9 - 11 only
  13292. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13293. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13294. // Support: IE 9 only
  13295. // Detect overflow:scroll screwiness (gh-3699)
  13296. // Support: Chrome <=64
  13297. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13298. div.style.position = "absolute";
  13299. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13300. documentElement.removeChild( container );
  13301. // Nullify the div so it wouldn't be stored in the memory and
  13302. // it will also be a sign that checks already performed
  13303. div = null;
  13304. }
  13305. function roundPixelMeasures( measure ) {
  13306. return Math.round( parseFloat( measure ) );
  13307. }
  13308. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13309. reliableMarginLeftVal,
  13310. container = document.createElement( "div" ),
  13311. div = document.createElement( "div" );
  13312. // Finish early in limited (non-browser) environments
  13313. if ( !div.style ) {
  13314. return;
  13315. }
  13316. // Support: IE <=9 - 11 only
  13317. // Style of cloned element affects source element cloned (#8908)
  13318. div.style.backgroundClip = "content-box";
  13319. div.cloneNode( true ).style.backgroundClip = "";
  13320. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13321. jQuery.extend( support, {
  13322. boxSizingReliable: function() {
  13323. computeStyleTests();
  13324. return boxSizingReliableVal;
  13325. },
  13326. pixelBoxStyles: function() {
  13327. computeStyleTests();
  13328. return pixelBoxStylesVal;
  13329. },
  13330. pixelPosition: function() {
  13331. computeStyleTests();
  13332. return pixelPositionVal;
  13333. },
  13334. reliableMarginLeft: function() {
  13335. computeStyleTests();
  13336. return reliableMarginLeftVal;
  13337. },
  13338. scrollboxSize: function() {
  13339. computeStyleTests();
  13340. return scrollboxSizeVal;
  13341. }
  13342. } );
  13343. } )();
  13344. function curCSS( elem, name, computed ) {
  13345. var width, minWidth, maxWidth, ret,
  13346. // Support: Firefox 51+
  13347. // Retrieving style before computed somehow
  13348. // fixes an issue with getting wrong values
  13349. // on detached elements
  13350. style = elem.style;
  13351. computed = computed || getStyles( elem );
  13352. // getPropertyValue is needed for:
  13353. // .css('filter') (IE 9 only, #12537)
  13354. // .css('--customProperty) (#3144)
  13355. if ( computed ) {
  13356. ret = computed.getPropertyValue( name ) || computed[ name ];
  13357. if ( ret === "" && !isAttached( elem ) ) {
  13358. ret = jQuery.style( elem, name );
  13359. }
  13360. // A tribute to the "awesome hack by Dean Edwards"
  13361. // Android Browser returns percentage for some values,
  13362. // but width seems to be reliably pixels.
  13363. // This is against the CSSOM draft spec:
  13364. // https://drafts.csswg.org/cssom/#resolved-values
  13365. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13366. // Remember the original values
  13367. width = style.width;
  13368. minWidth = style.minWidth;
  13369. maxWidth = style.maxWidth;
  13370. // Put in the new values to get a computed value out
  13371. style.minWidth = style.maxWidth = style.width = ret;
  13372. ret = computed.width;
  13373. // Revert the changed values
  13374. style.width = width;
  13375. style.minWidth = minWidth;
  13376. style.maxWidth = maxWidth;
  13377. }
  13378. }
  13379. return ret !== undefined ?
  13380. // Support: IE <=9 - 11 only
  13381. // IE returns zIndex value as an integer.
  13382. ret + "" :
  13383. ret;
  13384. }
  13385. function addGetHookIf( conditionFn, hookFn ) {
  13386. // Define the hook, we'll check on the first run if it's really needed.
  13387. return {
  13388. get: function() {
  13389. if ( conditionFn() ) {
  13390. // Hook not needed (or it's not possible to use it due
  13391. // to missing dependency), remove it.
  13392. delete this.get;
  13393. return;
  13394. }
  13395. // Hook needed; redefine it so that the support test is not executed again.
  13396. return ( this.get = hookFn ).apply( this, arguments );
  13397. }
  13398. };
  13399. }
  13400. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13401. emptyStyle = document.createElement( "div" ).style,
  13402. vendorProps = {};
  13403. // Return a vendor-prefixed property or undefined
  13404. function vendorPropName( name ) {
  13405. // Check for vendor prefixed names
  13406. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13407. i = cssPrefixes.length;
  13408. while ( i-- ) {
  13409. name = cssPrefixes[ i ] + capName;
  13410. if ( name in emptyStyle ) {
  13411. return name;
  13412. }
  13413. }
  13414. }
  13415. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13416. function finalPropName( name ) {
  13417. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13418. if ( final ) {
  13419. return final;
  13420. }
  13421. if ( name in emptyStyle ) {
  13422. return name;
  13423. }
  13424. return vendorProps[ name ] = vendorPropName( name ) || name;
  13425. }
  13426. var
  13427. // Swappable if display is none or starts with table
  13428. // except "table", "table-cell", or "table-caption"
  13429. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13430. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13431. rcustomProp = /^--/,
  13432. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13433. cssNormalTransform = {
  13434. letterSpacing: "0",
  13435. fontWeight: "400"
  13436. };
  13437. function setPositiveNumber( elem, value, subtract ) {
  13438. // Any relative (+/-) values have already been
  13439. // normalized at this point
  13440. var matches = rcssNum.exec( value );
  13441. return matches ?
  13442. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13443. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13444. value;
  13445. }
  13446. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13447. var i = dimension === "width" ? 1 : 0,
  13448. extra = 0,
  13449. delta = 0;
  13450. // Adjustment may not be necessary
  13451. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13452. return 0;
  13453. }
  13454. for ( ; i < 4; i += 2 ) {
  13455. // Both box models exclude margin
  13456. if ( box === "margin" ) {
  13457. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13458. }
  13459. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13460. if ( !isBorderBox ) {
  13461. // Add padding
  13462. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13463. // For "border" or "margin", add border
  13464. if ( box !== "padding" ) {
  13465. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13466. // But still keep track of it otherwise
  13467. } else {
  13468. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13469. }
  13470. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13471. // "padding" or "margin"
  13472. } else {
  13473. // For "content", subtract padding
  13474. if ( box === "content" ) {
  13475. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13476. }
  13477. // For "content" or "padding", subtract border
  13478. if ( box !== "margin" ) {
  13479. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13480. }
  13481. }
  13482. }
  13483. // Account for positive content-box scroll gutter when requested by providing computedVal
  13484. if ( !isBorderBox && computedVal >= 0 ) {
  13485. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13486. // Assuming integer scroll gutter, subtract the rest and round down
  13487. delta += Math.max( 0, Math.ceil(
  13488. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13489. computedVal -
  13490. delta -
  13491. extra -
  13492. 0.5
  13493. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13494. // Use an explicit zero to avoid NaN (gh-3964)
  13495. ) ) || 0;
  13496. }
  13497. return delta;
  13498. }
  13499. function getWidthOrHeight( elem, dimension, extra ) {
  13500. // Start with computed style
  13501. var styles = getStyles( elem ),
  13502. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13503. // Fake content-box until we know it's needed to know the true value.
  13504. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13505. isBorderBox = boxSizingNeeded &&
  13506. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13507. valueIsBorderBox = isBorderBox,
  13508. val = curCSS( elem, dimension, styles ),
  13509. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13510. // Support: Firefox <=54
  13511. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13512. if ( rnumnonpx.test( val ) ) {
  13513. if ( !extra ) {
  13514. return val;
  13515. }
  13516. val = "auto";
  13517. }
  13518. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13519. // This happens for inline elements with no explicit setting (gh-3571)
  13520. // Support: Android <=4.1 - 4.3 only
  13521. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13522. // Support: IE 9-11 only
  13523. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13524. // We use getClientRects() to check for hidden/disconnected.
  13525. // In those cases, the computed value can be trusted to be border-box
  13526. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13527. val === "auto" ||
  13528. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13529. elem.getClientRects().length ) {
  13530. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13531. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13532. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13533. // retrieved value as a content box dimension.
  13534. valueIsBorderBox = offsetProp in elem;
  13535. if ( valueIsBorderBox ) {
  13536. val = elem[ offsetProp ];
  13537. }
  13538. }
  13539. // Normalize "" and auto
  13540. val = parseFloat( val ) || 0;
  13541. // Adjust for the element's box model
  13542. return ( val +
  13543. boxModelAdjustment(
  13544. elem,
  13545. dimension,
  13546. extra || ( isBorderBox ? "border" : "content" ),
  13547. valueIsBorderBox,
  13548. styles,
  13549. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13550. val
  13551. )
  13552. ) + "px";
  13553. }
  13554. jQuery.extend( {
  13555. // Add in style property hooks for overriding the default
  13556. // behavior of getting and setting a style property
  13557. cssHooks: {
  13558. opacity: {
  13559. get: function( elem, computed ) {
  13560. if ( computed ) {
  13561. // We should always get a number back from opacity
  13562. var ret = curCSS( elem, "opacity" );
  13563. return ret === "" ? "1" : ret;
  13564. }
  13565. }
  13566. }
  13567. },
  13568. // Don't automatically add "px" to these possibly-unitless properties
  13569. cssNumber: {
  13570. "animationIterationCount": true,
  13571. "columnCount": true,
  13572. "fillOpacity": true,
  13573. "flexGrow": true,
  13574. "flexShrink": true,
  13575. "fontWeight": true,
  13576. "gridArea": true,
  13577. "gridColumn": true,
  13578. "gridColumnEnd": true,
  13579. "gridColumnStart": true,
  13580. "gridRow": true,
  13581. "gridRowEnd": true,
  13582. "gridRowStart": true,
  13583. "lineHeight": true,
  13584. "opacity": true,
  13585. "order": true,
  13586. "orphans": true,
  13587. "widows": true,
  13588. "zIndex": true,
  13589. "zoom": true
  13590. },
  13591. // Add in properties whose names you wish to fix before
  13592. // setting or getting the value
  13593. cssProps: {},
  13594. // Get and set the style property on a DOM Node
  13595. style: function( elem, name, value, extra ) {
  13596. // Don't set styles on text and comment nodes
  13597. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13598. return;
  13599. }
  13600. // Make sure that we're working with the right name
  13601. var ret, type, hooks,
  13602. origName = camelCase( name ),
  13603. isCustomProp = rcustomProp.test( name ),
  13604. style = elem.style;
  13605. // Make sure that we're working with the right name. We don't
  13606. // want to query the value if it is a CSS custom property
  13607. // since they are user-defined.
  13608. if ( !isCustomProp ) {
  13609. name = finalPropName( origName );
  13610. }
  13611. // Gets hook for the prefixed version, then unprefixed version
  13612. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13613. // Check if we're setting a value
  13614. if ( value !== undefined ) {
  13615. type = typeof value;
  13616. // Convert "+=" or "-=" to relative numbers (#7345)
  13617. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13618. value = adjustCSS( elem, name, ret );
  13619. // Fixes bug #9237
  13620. type = "number";
  13621. }
  13622. // Make sure that null and NaN values aren't set (#7116)
  13623. if ( value == null || value !== value ) {
  13624. return;
  13625. }
  13626. // If a number was passed in, add the unit (except for certain CSS properties)
  13627. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13628. // "px" to a few hardcoded values.
  13629. if ( type === "number" && !isCustomProp ) {
  13630. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13631. }
  13632. // background-* props affect original clone's values
  13633. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13634. style[ name ] = "inherit";
  13635. }
  13636. // If a hook was provided, use that value, otherwise just set the specified value
  13637. if ( !hooks || !( "set" in hooks ) ||
  13638. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13639. if ( isCustomProp ) {
  13640. style.setProperty( name, value );
  13641. } else {
  13642. style[ name ] = value;
  13643. }
  13644. }
  13645. } else {
  13646. // If a hook was provided get the non-computed value from there
  13647. if ( hooks && "get" in hooks &&
  13648. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13649. return ret;
  13650. }
  13651. // Otherwise just get the value from the style object
  13652. return style[ name ];
  13653. }
  13654. },
  13655. css: function( elem, name, extra, styles ) {
  13656. var val, num, hooks,
  13657. origName = camelCase( name ),
  13658. isCustomProp = rcustomProp.test( name );
  13659. // Make sure that we're working with the right name. We don't
  13660. // want to modify the value if it is a CSS custom property
  13661. // since they are user-defined.
  13662. if ( !isCustomProp ) {
  13663. name = finalPropName( origName );
  13664. }
  13665. // Try prefixed name followed by the unprefixed name
  13666. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13667. // If a hook was provided get the computed value from there
  13668. if ( hooks && "get" in hooks ) {
  13669. val = hooks.get( elem, true, extra );
  13670. }
  13671. // Otherwise, if a way to get the computed value exists, use that
  13672. if ( val === undefined ) {
  13673. val = curCSS( elem, name, styles );
  13674. }
  13675. // Convert "normal" to computed value
  13676. if ( val === "normal" && name in cssNormalTransform ) {
  13677. val = cssNormalTransform[ name ];
  13678. }
  13679. // Make numeric if forced or a qualifier was provided and val looks numeric
  13680. if ( extra === "" || extra ) {
  13681. num = parseFloat( val );
  13682. return extra === true || isFinite( num ) ? num || 0 : val;
  13683. }
  13684. return val;
  13685. }
  13686. } );
  13687. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13688. jQuery.cssHooks[ dimension ] = {
  13689. get: function( elem, computed, extra ) {
  13690. if ( computed ) {
  13691. // Certain elements can have dimension info if we invisibly show them
  13692. // but it must have a current display style that would benefit
  13693. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13694. // Support: Safari 8+
  13695. // Table columns in Safari have non-zero offsetWidth & zero
  13696. // getBoundingClientRect().width unless display is changed.
  13697. // Support: IE <=11 only
  13698. // Running getBoundingClientRect on a disconnected node
  13699. // in IE throws an error.
  13700. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13701. swap( elem, cssShow, function() {
  13702. return getWidthOrHeight( elem, dimension, extra );
  13703. } ) :
  13704. getWidthOrHeight( elem, dimension, extra );
  13705. }
  13706. },
  13707. set: function( elem, value, extra ) {
  13708. var matches,
  13709. styles = getStyles( elem ),
  13710. // Only read styles.position if the test has a chance to fail
  13711. // to avoid forcing a reflow.
  13712. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13713. styles.position === "absolute",
  13714. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13715. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13716. isBorderBox = boxSizingNeeded &&
  13717. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13718. subtract = extra ?
  13719. boxModelAdjustment(
  13720. elem,
  13721. dimension,
  13722. extra,
  13723. isBorderBox,
  13724. styles
  13725. ) :
  13726. 0;
  13727. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13728. // faking a content-box to get border and padding (gh-3699)
  13729. if ( isBorderBox && scrollboxSizeBuggy ) {
  13730. subtract -= Math.ceil(
  13731. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13732. parseFloat( styles[ dimension ] ) -
  13733. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13734. 0.5
  13735. );
  13736. }
  13737. // Convert to pixels if value adjustment is needed
  13738. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13739. ( matches[ 3 ] || "px" ) !== "px" ) {
  13740. elem.style[ dimension ] = value;
  13741. value = jQuery.css( elem, dimension );
  13742. }
  13743. return setPositiveNumber( elem, value, subtract );
  13744. }
  13745. };
  13746. } );
  13747. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13748. function( elem, computed ) {
  13749. if ( computed ) {
  13750. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13751. elem.getBoundingClientRect().left -
  13752. swap( elem, { marginLeft: 0 }, function() {
  13753. return elem.getBoundingClientRect().left;
  13754. } )
  13755. ) + "px";
  13756. }
  13757. }
  13758. );
  13759. // These hooks are used by animate to expand properties
  13760. jQuery.each( {
  13761. margin: "",
  13762. padding: "",
  13763. border: "Width"
  13764. }, function( prefix, suffix ) {
  13765. jQuery.cssHooks[ prefix + suffix ] = {
  13766. expand: function( value ) {
  13767. var i = 0,
  13768. expanded = {},
  13769. // Assumes a single number if not a string
  13770. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13771. for ( ; i < 4; i++ ) {
  13772. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13773. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13774. }
  13775. return expanded;
  13776. }
  13777. };
  13778. if ( prefix !== "margin" ) {
  13779. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13780. }
  13781. } );
  13782. jQuery.fn.extend( {
  13783. css: function( name, value ) {
  13784. return access( this, function( elem, name, value ) {
  13785. var styles, len,
  13786. map = {},
  13787. i = 0;
  13788. if ( Array.isArray( name ) ) {
  13789. styles = getStyles( elem );
  13790. len = name.length;
  13791. for ( ; i < len; i++ ) {
  13792. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13793. }
  13794. return map;
  13795. }
  13796. return value !== undefined ?
  13797. jQuery.style( elem, name, value ) :
  13798. jQuery.css( elem, name );
  13799. }, name, value, arguments.length > 1 );
  13800. }
  13801. } );
  13802. function Tween( elem, options, prop, end, easing ) {
  13803. return new Tween.prototype.init( elem, options, prop, end, easing );
  13804. }
  13805. jQuery.Tween = Tween;
  13806. Tween.prototype = {
  13807. constructor: Tween,
  13808. init: function( elem, options, prop, end, easing, unit ) {
  13809. this.elem = elem;
  13810. this.prop = prop;
  13811. this.easing = easing || jQuery.easing._default;
  13812. this.options = options;
  13813. this.start = this.now = this.cur();
  13814. this.end = end;
  13815. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13816. },
  13817. cur: function() {
  13818. var hooks = Tween.propHooks[ this.prop ];
  13819. return hooks && hooks.get ?
  13820. hooks.get( this ) :
  13821. Tween.propHooks._default.get( this );
  13822. },
  13823. run: function( percent ) {
  13824. var eased,
  13825. hooks = Tween.propHooks[ this.prop ];
  13826. if ( this.options.duration ) {
  13827. this.pos = eased = jQuery.easing[ this.easing ](
  13828. percent, this.options.duration * percent, 0, 1, this.options.duration
  13829. );
  13830. } else {
  13831. this.pos = eased = percent;
  13832. }
  13833. this.now = ( this.end - this.start ) * eased + this.start;
  13834. if ( this.options.step ) {
  13835. this.options.step.call( this.elem, this.now, this );
  13836. }
  13837. if ( hooks && hooks.set ) {
  13838. hooks.set( this );
  13839. } else {
  13840. Tween.propHooks._default.set( this );
  13841. }
  13842. return this;
  13843. }
  13844. };
  13845. Tween.prototype.init.prototype = Tween.prototype;
  13846. Tween.propHooks = {
  13847. _default: {
  13848. get: function( tween ) {
  13849. var result;
  13850. // Use a property on the element directly when it is not a DOM element,
  13851. // or when there is no matching style property that exists.
  13852. if ( tween.elem.nodeType !== 1 ||
  13853. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13854. return tween.elem[ tween.prop ];
  13855. }
  13856. // Passing an empty string as a 3rd parameter to .css will automatically
  13857. // attempt a parseFloat and fallback to a string if the parse fails.
  13858. // Simple values such as "10px" are parsed to Float;
  13859. // complex values such as "rotate(1rad)" are returned as-is.
  13860. result = jQuery.css( tween.elem, tween.prop, "" );
  13861. // Empty strings, null, undefined and "auto" are converted to 0.
  13862. return !result || result === "auto" ? 0 : result;
  13863. },
  13864. set: function( tween ) {
  13865. // Use step hook for back compat.
  13866. // Use cssHook if its there.
  13867. // Use .style if available and use plain properties where available.
  13868. if ( jQuery.fx.step[ tween.prop ] ) {
  13869. jQuery.fx.step[ tween.prop ]( tween );
  13870. } else if ( tween.elem.nodeType === 1 && (
  13871. jQuery.cssHooks[ tween.prop ] ||
  13872. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13873. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13874. } else {
  13875. tween.elem[ tween.prop ] = tween.now;
  13876. }
  13877. }
  13878. }
  13879. };
  13880. // Support: IE <=9 only
  13881. // Panic based approach to setting things on disconnected nodes
  13882. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13883. set: function( tween ) {
  13884. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13885. tween.elem[ tween.prop ] = tween.now;
  13886. }
  13887. }
  13888. };
  13889. jQuery.easing = {
  13890. linear: function( p ) {
  13891. return p;
  13892. },
  13893. swing: function( p ) {
  13894. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13895. },
  13896. _default: "swing"
  13897. };
  13898. jQuery.fx = Tween.prototype.init;
  13899. // Back compat <1.8 extension point
  13900. jQuery.fx.step = {};
  13901. var
  13902. fxNow, inProgress,
  13903. rfxtypes = /^(?:toggle|show|hide)$/,
  13904. rrun = /queueHooks$/;
  13905. function schedule() {
  13906. if ( inProgress ) {
  13907. if ( document.hidden === false && window.requestAnimationFrame ) {
  13908. window.requestAnimationFrame( schedule );
  13909. } else {
  13910. window.setTimeout( schedule, jQuery.fx.interval );
  13911. }
  13912. jQuery.fx.tick();
  13913. }
  13914. }
  13915. // Animations created synchronously will run synchronously
  13916. function createFxNow() {
  13917. window.setTimeout( function() {
  13918. fxNow = undefined;
  13919. } );
  13920. return ( fxNow = Date.now() );
  13921. }
  13922. // Generate parameters to create a standard animation
  13923. function genFx( type, includeWidth ) {
  13924. var which,
  13925. i = 0,
  13926. attrs = { height: type };
  13927. // If we include width, step value is 1 to do all cssExpand values,
  13928. // otherwise step value is 2 to skip over Left and Right
  13929. includeWidth = includeWidth ? 1 : 0;
  13930. for ( ; i < 4; i += 2 - includeWidth ) {
  13931. which = cssExpand[ i ];
  13932. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  13933. }
  13934. if ( includeWidth ) {
  13935. attrs.opacity = attrs.width = type;
  13936. }
  13937. return attrs;
  13938. }
  13939. function createTween( value, prop, animation ) {
  13940. var tween,
  13941. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  13942. index = 0,
  13943. length = collection.length;
  13944. for ( ; index < length; index++ ) {
  13945. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  13946. // We're done with this property
  13947. return tween;
  13948. }
  13949. }
  13950. }
  13951. function defaultPrefilter( elem, props, opts ) {
  13952. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  13953. isBox = "width" in props || "height" in props,
  13954. anim = this,
  13955. orig = {},
  13956. style = elem.style,
  13957. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  13958. dataShow = dataPriv.get( elem, "fxshow" );
  13959. // Queue-skipping animations hijack the fx hooks
  13960. if ( !opts.queue ) {
  13961. hooks = jQuery._queueHooks( elem, "fx" );
  13962. if ( hooks.unqueued == null ) {
  13963. hooks.unqueued = 0;
  13964. oldfire = hooks.empty.fire;
  13965. hooks.empty.fire = function() {
  13966. if ( !hooks.unqueued ) {
  13967. oldfire();
  13968. }
  13969. };
  13970. }
  13971. hooks.unqueued++;
  13972. anim.always( function() {
  13973. // Ensure the complete handler is called before this completes
  13974. anim.always( function() {
  13975. hooks.unqueued--;
  13976. if ( !jQuery.queue( elem, "fx" ).length ) {
  13977. hooks.empty.fire();
  13978. }
  13979. } );
  13980. } );
  13981. }
  13982. // Detect show/hide animations
  13983. for ( prop in props ) {
  13984. value = props[ prop ];
  13985. if ( rfxtypes.test( value ) ) {
  13986. delete props[ prop ];
  13987. toggle = toggle || value === "toggle";
  13988. if ( value === ( hidden ? "hide" : "show" ) ) {
  13989. // Pretend to be hidden if this is a "show" and
  13990. // there is still data from a stopped show/hide
  13991. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  13992. hidden = true;
  13993. // Ignore all other no-op show/hide data
  13994. } else {
  13995. continue;
  13996. }
  13997. }
  13998. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  13999. }
  14000. }
  14001. // Bail out if this is a no-op like .hide().hide()
  14002. propTween = !jQuery.isEmptyObject( props );
  14003. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14004. return;
  14005. }
  14006. // Restrict "overflow" and "display" styles during box animations
  14007. if ( isBox && elem.nodeType === 1 ) {
  14008. // Support: IE <=9 - 11, Edge 12 - 15
  14009. // Record all 3 overflow attributes because IE does not infer the shorthand
  14010. // from identically-valued overflowX and overflowY and Edge just mirrors
  14011. // the overflowX value there.
  14012. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14013. // Identify a display type, preferring old show/hide data over the CSS cascade
  14014. restoreDisplay = dataShow && dataShow.display;
  14015. if ( restoreDisplay == null ) {
  14016. restoreDisplay = dataPriv.get( elem, "display" );
  14017. }
  14018. display = jQuery.css( elem, "display" );
  14019. if ( display === "none" ) {
  14020. if ( restoreDisplay ) {
  14021. display = restoreDisplay;
  14022. } else {
  14023. // Get nonempty value(s) by temporarily forcing visibility
  14024. showHide( [ elem ], true );
  14025. restoreDisplay = elem.style.display || restoreDisplay;
  14026. display = jQuery.css( elem, "display" );
  14027. showHide( [ elem ] );
  14028. }
  14029. }
  14030. // Animate inline elements as inline-block
  14031. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14032. if ( jQuery.css( elem, "float" ) === "none" ) {
  14033. // Restore the original display value at the end of pure show/hide animations
  14034. if ( !propTween ) {
  14035. anim.done( function() {
  14036. style.display = restoreDisplay;
  14037. } );
  14038. if ( restoreDisplay == null ) {
  14039. display = style.display;
  14040. restoreDisplay = display === "none" ? "" : display;
  14041. }
  14042. }
  14043. style.display = "inline-block";
  14044. }
  14045. }
  14046. }
  14047. if ( opts.overflow ) {
  14048. style.overflow = "hidden";
  14049. anim.always( function() {
  14050. style.overflow = opts.overflow[ 0 ];
  14051. style.overflowX = opts.overflow[ 1 ];
  14052. style.overflowY = opts.overflow[ 2 ];
  14053. } );
  14054. }
  14055. // Implement show/hide animations
  14056. propTween = false;
  14057. for ( prop in orig ) {
  14058. // General show/hide setup for this element animation
  14059. if ( !propTween ) {
  14060. if ( dataShow ) {
  14061. if ( "hidden" in dataShow ) {
  14062. hidden = dataShow.hidden;
  14063. }
  14064. } else {
  14065. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14066. }
  14067. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14068. if ( toggle ) {
  14069. dataShow.hidden = !hidden;
  14070. }
  14071. // Show elements before animating them
  14072. if ( hidden ) {
  14073. showHide( [ elem ], true );
  14074. }
  14075. /* eslint-disable no-loop-func */
  14076. anim.done( function() {
  14077. /* eslint-enable no-loop-func */
  14078. // The final step of a "hide" animation is actually hiding the element
  14079. if ( !hidden ) {
  14080. showHide( [ elem ] );
  14081. }
  14082. dataPriv.remove( elem, "fxshow" );
  14083. for ( prop in orig ) {
  14084. jQuery.style( elem, prop, orig[ prop ] );
  14085. }
  14086. } );
  14087. }
  14088. // Per-property setup
  14089. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14090. if ( !( prop in dataShow ) ) {
  14091. dataShow[ prop ] = propTween.start;
  14092. if ( hidden ) {
  14093. propTween.end = propTween.start;
  14094. propTween.start = 0;
  14095. }
  14096. }
  14097. }
  14098. }
  14099. function propFilter( props, specialEasing ) {
  14100. var index, name, easing, value, hooks;
  14101. // camelCase, specialEasing and expand cssHook pass
  14102. for ( index in props ) {
  14103. name = camelCase( index );
  14104. easing = specialEasing[ name ];
  14105. value = props[ index ];
  14106. if ( Array.isArray( value ) ) {
  14107. easing = value[ 1 ];
  14108. value = props[ index ] = value[ 0 ];
  14109. }
  14110. if ( index !== name ) {
  14111. props[ name ] = value;
  14112. delete props[ index ];
  14113. }
  14114. hooks = jQuery.cssHooks[ name ];
  14115. if ( hooks && "expand" in hooks ) {
  14116. value = hooks.expand( value );
  14117. delete props[ name ];
  14118. // Not quite $.extend, this won't overwrite existing keys.
  14119. // Reusing 'index' because we have the correct "name"
  14120. for ( index in value ) {
  14121. if ( !( index in props ) ) {
  14122. props[ index ] = value[ index ];
  14123. specialEasing[ index ] = easing;
  14124. }
  14125. }
  14126. } else {
  14127. specialEasing[ name ] = easing;
  14128. }
  14129. }
  14130. }
  14131. function Animation( elem, properties, options ) {
  14132. var result,
  14133. stopped,
  14134. index = 0,
  14135. length = Animation.prefilters.length,
  14136. deferred = jQuery.Deferred().always( function() {
  14137. // Don't match elem in the :animated selector
  14138. delete tick.elem;
  14139. } ),
  14140. tick = function() {
  14141. if ( stopped ) {
  14142. return false;
  14143. }
  14144. var currentTime = fxNow || createFxNow(),
  14145. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14146. // Support: Android 2.3 only
  14147. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14148. temp = remaining / animation.duration || 0,
  14149. percent = 1 - temp,
  14150. index = 0,
  14151. length = animation.tweens.length;
  14152. for ( ; index < length; index++ ) {
  14153. animation.tweens[ index ].run( percent );
  14154. }
  14155. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14156. // If there's more to do, yield
  14157. if ( percent < 1 && length ) {
  14158. return remaining;
  14159. }
  14160. // If this was an empty animation, synthesize a final progress notification
  14161. if ( !length ) {
  14162. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14163. }
  14164. // Resolve the animation and report its conclusion
  14165. deferred.resolveWith( elem, [ animation ] );
  14166. return false;
  14167. },
  14168. animation = deferred.promise( {
  14169. elem: elem,
  14170. props: jQuery.extend( {}, properties ),
  14171. opts: jQuery.extend( true, {
  14172. specialEasing: {},
  14173. easing: jQuery.easing._default
  14174. }, options ),
  14175. originalProperties: properties,
  14176. originalOptions: options,
  14177. startTime: fxNow || createFxNow(),
  14178. duration: options.duration,
  14179. tweens: [],
  14180. createTween: function( prop, end ) {
  14181. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14182. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14183. animation.tweens.push( tween );
  14184. return tween;
  14185. },
  14186. stop: function( gotoEnd ) {
  14187. var index = 0,
  14188. // If we are going to the end, we want to run all the tweens
  14189. // otherwise we skip this part
  14190. length = gotoEnd ? animation.tweens.length : 0;
  14191. if ( stopped ) {
  14192. return this;
  14193. }
  14194. stopped = true;
  14195. for ( ; index < length; index++ ) {
  14196. animation.tweens[ index ].run( 1 );
  14197. }
  14198. // Resolve when we played the last frame; otherwise, reject
  14199. if ( gotoEnd ) {
  14200. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14201. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14202. } else {
  14203. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14204. }
  14205. return this;
  14206. }
  14207. } ),
  14208. props = animation.props;
  14209. propFilter( props, animation.opts.specialEasing );
  14210. for ( ; index < length; index++ ) {
  14211. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14212. if ( result ) {
  14213. if ( isFunction( result.stop ) ) {
  14214. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14215. result.stop.bind( result );
  14216. }
  14217. return result;
  14218. }
  14219. }
  14220. jQuery.map( props, createTween, animation );
  14221. if ( isFunction( animation.opts.start ) ) {
  14222. animation.opts.start.call( elem, animation );
  14223. }
  14224. // Attach callbacks from options
  14225. animation
  14226. .progress( animation.opts.progress )
  14227. .done( animation.opts.done, animation.opts.complete )
  14228. .fail( animation.opts.fail )
  14229. .always( animation.opts.always );
  14230. jQuery.fx.timer(
  14231. jQuery.extend( tick, {
  14232. elem: elem,
  14233. anim: animation,
  14234. queue: animation.opts.queue
  14235. } )
  14236. );
  14237. return animation;
  14238. }
  14239. jQuery.Animation = jQuery.extend( Animation, {
  14240. tweeners: {
  14241. "*": [ function( prop, value ) {
  14242. var tween = this.createTween( prop, value );
  14243. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14244. return tween;
  14245. } ]
  14246. },
  14247. tweener: function( props, callback ) {
  14248. if ( isFunction( props ) ) {
  14249. callback = props;
  14250. props = [ "*" ];
  14251. } else {
  14252. props = props.match( rnothtmlwhite );
  14253. }
  14254. var prop,
  14255. index = 0,
  14256. length = props.length;
  14257. for ( ; index < length; index++ ) {
  14258. prop = props[ index ];
  14259. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14260. Animation.tweeners[ prop ].unshift( callback );
  14261. }
  14262. },
  14263. prefilters: [ defaultPrefilter ],
  14264. prefilter: function( callback, prepend ) {
  14265. if ( prepend ) {
  14266. Animation.prefilters.unshift( callback );
  14267. } else {
  14268. Animation.prefilters.push( callback );
  14269. }
  14270. }
  14271. } );
  14272. jQuery.speed = function( speed, easing, fn ) {
  14273. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14274. complete: fn || !fn && easing ||
  14275. isFunction( speed ) && speed,
  14276. duration: speed,
  14277. easing: fn && easing || easing && !isFunction( easing ) && easing
  14278. };
  14279. // Go to the end state if fx are off
  14280. if ( jQuery.fx.off ) {
  14281. opt.duration = 0;
  14282. } else {
  14283. if ( typeof opt.duration !== "number" ) {
  14284. if ( opt.duration in jQuery.fx.speeds ) {
  14285. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14286. } else {
  14287. opt.duration = jQuery.fx.speeds._default;
  14288. }
  14289. }
  14290. }
  14291. // Normalize opt.queue - true/undefined/null -> "fx"
  14292. if ( opt.queue == null || opt.queue === true ) {
  14293. opt.queue = "fx";
  14294. }
  14295. // Queueing
  14296. opt.old = opt.complete;
  14297. opt.complete = function() {
  14298. if ( isFunction( opt.old ) ) {
  14299. opt.old.call( this );
  14300. }
  14301. if ( opt.queue ) {
  14302. jQuery.dequeue( this, opt.queue );
  14303. }
  14304. };
  14305. return opt;
  14306. };
  14307. jQuery.fn.extend( {
  14308. fadeTo: function( speed, to, easing, callback ) {
  14309. // Show any hidden elements after setting opacity to 0
  14310. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14311. // Animate to the value specified
  14312. .end().animate( { opacity: to }, speed, easing, callback );
  14313. },
  14314. animate: function( prop, speed, easing, callback ) {
  14315. var empty = jQuery.isEmptyObject( prop ),
  14316. optall = jQuery.speed( speed, easing, callback ),
  14317. doAnimation = function() {
  14318. // Operate on a copy of prop so per-property easing won't be lost
  14319. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14320. // Empty animations, or finishing resolves immediately
  14321. if ( empty || dataPriv.get( this, "finish" ) ) {
  14322. anim.stop( true );
  14323. }
  14324. };
  14325. doAnimation.finish = doAnimation;
  14326. return empty || optall.queue === false ?
  14327. this.each( doAnimation ) :
  14328. this.queue( optall.queue, doAnimation );
  14329. },
  14330. stop: function( type, clearQueue, gotoEnd ) {
  14331. var stopQueue = function( hooks ) {
  14332. var stop = hooks.stop;
  14333. delete hooks.stop;
  14334. stop( gotoEnd );
  14335. };
  14336. if ( typeof type !== "string" ) {
  14337. gotoEnd = clearQueue;
  14338. clearQueue = type;
  14339. type = undefined;
  14340. }
  14341. if ( clearQueue && type !== false ) {
  14342. this.queue( type || "fx", [] );
  14343. }
  14344. return this.each( function() {
  14345. var dequeue = true,
  14346. index = type != null && type + "queueHooks",
  14347. timers = jQuery.timers,
  14348. data = dataPriv.get( this );
  14349. if ( index ) {
  14350. if ( data[ index ] && data[ index ].stop ) {
  14351. stopQueue( data[ index ] );
  14352. }
  14353. } else {
  14354. for ( index in data ) {
  14355. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14356. stopQueue( data[ index ] );
  14357. }
  14358. }
  14359. }
  14360. for ( index = timers.length; index--; ) {
  14361. if ( timers[ index ].elem === this &&
  14362. ( type == null || timers[ index ].queue === type ) ) {
  14363. timers[ index ].anim.stop( gotoEnd );
  14364. dequeue = false;
  14365. timers.splice( index, 1 );
  14366. }
  14367. }
  14368. // Start the next in the queue if the last step wasn't forced.
  14369. // Timers currently will call their complete callbacks, which
  14370. // will dequeue but only if they were gotoEnd.
  14371. if ( dequeue || !gotoEnd ) {
  14372. jQuery.dequeue( this, type );
  14373. }
  14374. } );
  14375. },
  14376. finish: function( type ) {
  14377. if ( type !== false ) {
  14378. type = type || "fx";
  14379. }
  14380. return this.each( function() {
  14381. var index,
  14382. data = dataPriv.get( this ),
  14383. queue = data[ type + "queue" ],
  14384. hooks = data[ type + "queueHooks" ],
  14385. timers = jQuery.timers,
  14386. length = queue ? queue.length : 0;
  14387. // Enable finishing flag on private data
  14388. data.finish = true;
  14389. // Empty the queue first
  14390. jQuery.queue( this, type, [] );
  14391. if ( hooks && hooks.stop ) {
  14392. hooks.stop.call( this, true );
  14393. }
  14394. // Look for any active animations, and finish them
  14395. for ( index = timers.length; index--; ) {
  14396. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14397. timers[ index ].anim.stop( true );
  14398. timers.splice( index, 1 );
  14399. }
  14400. }
  14401. // Look for any animations in the old queue and finish them
  14402. for ( index = 0; index < length; index++ ) {
  14403. if ( queue[ index ] && queue[ index ].finish ) {
  14404. queue[ index ].finish.call( this );
  14405. }
  14406. }
  14407. // Turn off finishing flag
  14408. delete data.finish;
  14409. } );
  14410. }
  14411. } );
  14412. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14413. var cssFn = jQuery.fn[ name ];
  14414. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14415. return speed == null || typeof speed === "boolean" ?
  14416. cssFn.apply( this, arguments ) :
  14417. this.animate( genFx( name, true ), speed, easing, callback );
  14418. };
  14419. } );
  14420. // Generate shortcuts for custom animations
  14421. jQuery.each( {
  14422. slideDown: genFx( "show" ),
  14423. slideUp: genFx( "hide" ),
  14424. slideToggle: genFx( "toggle" ),
  14425. fadeIn: { opacity: "show" },
  14426. fadeOut: { opacity: "hide" },
  14427. fadeToggle: { opacity: "toggle" }
  14428. }, function( name, props ) {
  14429. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14430. return this.animate( props, speed, easing, callback );
  14431. };
  14432. } );
  14433. jQuery.timers = [];
  14434. jQuery.fx.tick = function() {
  14435. var timer,
  14436. i = 0,
  14437. timers = jQuery.timers;
  14438. fxNow = Date.now();
  14439. for ( ; i < timers.length; i++ ) {
  14440. timer = timers[ i ];
  14441. // Run the timer and safely remove it when done (allowing for external removal)
  14442. if ( !timer() && timers[ i ] === timer ) {
  14443. timers.splice( i--, 1 );
  14444. }
  14445. }
  14446. if ( !timers.length ) {
  14447. jQuery.fx.stop();
  14448. }
  14449. fxNow = undefined;
  14450. };
  14451. jQuery.fx.timer = function( timer ) {
  14452. jQuery.timers.push( timer );
  14453. jQuery.fx.start();
  14454. };
  14455. jQuery.fx.interval = 13;
  14456. jQuery.fx.start = function() {
  14457. if ( inProgress ) {
  14458. return;
  14459. }
  14460. inProgress = true;
  14461. schedule();
  14462. };
  14463. jQuery.fx.stop = function() {
  14464. inProgress = null;
  14465. };
  14466. jQuery.fx.speeds = {
  14467. slow: 600,
  14468. fast: 200,
  14469. // Default speed
  14470. _default: 400
  14471. };
  14472. // Based off of the plugin by Clint Helfers, with permission.
  14473. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14474. jQuery.fn.delay = function( time, type ) {
  14475. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14476. type = type || "fx";
  14477. return this.queue( type, function( next, hooks ) {
  14478. var timeout = window.setTimeout( next, time );
  14479. hooks.stop = function() {
  14480. window.clearTimeout( timeout );
  14481. };
  14482. } );
  14483. };
  14484. ( function() {
  14485. var input = document.createElement( "input" ),
  14486. select = document.createElement( "select" ),
  14487. opt = select.appendChild( document.createElement( "option" ) );
  14488. input.type = "checkbox";
  14489. // Support: Android <=4.3 only
  14490. // Default value for a checkbox should be "on"
  14491. support.checkOn = input.value !== "";
  14492. // Support: IE <=11 only
  14493. // Must access selectedIndex to make default options select
  14494. support.optSelected = opt.selected;
  14495. // Support: IE <=11 only
  14496. // An input loses its value after becoming a radio
  14497. input = document.createElement( "input" );
  14498. input.value = "t";
  14499. input.type = "radio";
  14500. support.radioValue = input.value === "t";
  14501. } )();
  14502. var boolHook,
  14503. attrHandle = jQuery.expr.attrHandle;
  14504. jQuery.fn.extend( {
  14505. attr: function( name, value ) {
  14506. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14507. },
  14508. removeAttr: function( name ) {
  14509. return this.each( function() {
  14510. jQuery.removeAttr( this, name );
  14511. } );
  14512. }
  14513. } );
  14514. jQuery.extend( {
  14515. attr: function( elem, name, value ) {
  14516. var ret, hooks,
  14517. nType = elem.nodeType;
  14518. // Don't get/set attributes on text, comment and attribute nodes
  14519. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14520. return;
  14521. }
  14522. // Fallback to prop when attributes are not supported
  14523. if ( typeof elem.getAttribute === "undefined" ) {
  14524. return jQuery.prop( elem, name, value );
  14525. }
  14526. // Attribute hooks are determined by the lowercase version
  14527. // Grab necessary hook if one is defined
  14528. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14529. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14530. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14531. }
  14532. if ( value !== undefined ) {
  14533. if ( value === null ) {
  14534. jQuery.removeAttr( elem, name );
  14535. return;
  14536. }
  14537. if ( hooks && "set" in hooks &&
  14538. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14539. return ret;
  14540. }
  14541. elem.setAttribute( name, value + "" );
  14542. return value;
  14543. }
  14544. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14545. return ret;
  14546. }
  14547. ret = jQuery.find.attr( elem, name );
  14548. // Non-existent attributes return null, we normalize to undefined
  14549. return ret == null ? undefined : ret;
  14550. },
  14551. attrHooks: {
  14552. type: {
  14553. set: function( elem, value ) {
  14554. if ( !support.radioValue && value === "radio" &&
  14555. nodeName( elem, "input" ) ) {
  14556. var val = elem.value;
  14557. elem.setAttribute( "type", value );
  14558. if ( val ) {
  14559. elem.value = val;
  14560. }
  14561. return value;
  14562. }
  14563. }
  14564. }
  14565. },
  14566. removeAttr: function( elem, value ) {
  14567. var name,
  14568. i = 0,
  14569. // Attribute names can contain non-HTML whitespace characters
  14570. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14571. attrNames = value && value.match( rnothtmlwhite );
  14572. if ( attrNames && elem.nodeType === 1 ) {
  14573. while ( ( name = attrNames[ i++ ] ) ) {
  14574. elem.removeAttribute( name );
  14575. }
  14576. }
  14577. }
  14578. } );
  14579. // Hooks for boolean attributes
  14580. boolHook = {
  14581. set: function( elem, value, name ) {
  14582. if ( value === false ) {
  14583. // Remove boolean attributes when set to false
  14584. jQuery.removeAttr( elem, name );
  14585. } else {
  14586. elem.setAttribute( name, name );
  14587. }
  14588. return name;
  14589. }
  14590. };
  14591. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14592. var getter = attrHandle[ name ] || jQuery.find.attr;
  14593. attrHandle[ name ] = function( elem, name, isXML ) {
  14594. var ret, handle,
  14595. lowercaseName = name.toLowerCase();
  14596. if ( !isXML ) {
  14597. // Avoid an infinite loop by temporarily removing this function from the getter
  14598. handle = attrHandle[ lowercaseName ];
  14599. attrHandle[ lowercaseName ] = ret;
  14600. ret = getter( elem, name, isXML ) != null ?
  14601. lowercaseName :
  14602. null;
  14603. attrHandle[ lowercaseName ] = handle;
  14604. }
  14605. return ret;
  14606. };
  14607. } );
  14608. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14609. rclickable = /^(?:a|area)$/i;
  14610. jQuery.fn.extend( {
  14611. prop: function( name, value ) {
  14612. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14613. },
  14614. removeProp: function( name ) {
  14615. return this.each( function() {
  14616. delete this[ jQuery.propFix[ name ] || name ];
  14617. } );
  14618. }
  14619. } );
  14620. jQuery.extend( {
  14621. prop: function( elem, name, value ) {
  14622. var ret, hooks,
  14623. nType = elem.nodeType;
  14624. // Don't get/set properties on text, comment and attribute nodes
  14625. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14626. return;
  14627. }
  14628. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14629. // Fix name and attach hooks
  14630. name = jQuery.propFix[ name ] || name;
  14631. hooks = jQuery.propHooks[ name ];
  14632. }
  14633. if ( value !== undefined ) {
  14634. if ( hooks && "set" in hooks &&
  14635. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14636. return ret;
  14637. }
  14638. return ( elem[ name ] = value );
  14639. }
  14640. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14641. return ret;
  14642. }
  14643. return elem[ name ];
  14644. },
  14645. propHooks: {
  14646. tabIndex: {
  14647. get: function( elem ) {
  14648. // Support: IE <=9 - 11 only
  14649. // elem.tabIndex doesn't always return the
  14650. // correct value when it hasn't been explicitly set
  14651. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14652. // Use proper attribute retrieval(#12072)
  14653. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14654. if ( tabindex ) {
  14655. return parseInt( tabindex, 10 );
  14656. }
  14657. if (
  14658. rfocusable.test( elem.nodeName ) ||
  14659. rclickable.test( elem.nodeName ) &&
  14660. elem.href
  14661. ) {
  14662. return 0;
  14663. }
  14664. return -1;
  14665. }
  14666. }
  14667. },
  14668. propFix: {
  14669. "for": "htmlFor",
  14670. "class": "className"
  14671. }
  14672. } );
  14673. // Support: IE <=11 only
  14674. // Accessing the selectedIndex property
  14675. // forces the browser to respect setting selected
  14676. // on the option
  14677. // The getter ensures a default option is selected
  14678. // when in an optgroup
  14679. // eslint rule "no-unused-expressions" is disabled for this code
  14680. // since it considers such accessions noop
  14681. if ( !support.optSelected ) {
  14682. jQuery.propHooks.selected = {
  14683. get: function( elem ) {
  14684. /* eslint no-unused-expressions: "off" */
  14685. var parent = elem.parentNode;
  14686. if ( parent && parent.parentNode ) {
  14687. parent.parentNode.selectedIndex;
  14688. }
  14689. return null;
  14690. },
  14691. set: function( elem ) {
  14692. /* eslint no-unused-expressions: "off" */
  14693. var parent = elem.parentNode;
  14694. if ( parent ) {
  14695. parent.selectedIndex;
  14696. if ( parent.parentNode ) {
  14697. parent.parentNode.selectedIndex;
  14698. }
  14699. }
  14700. }
  14701. };
  14702. }
  14703. jQuery.each( [
  14704. "tabIndex",
  14705. "readOnly",
  14706. "maxLength",
  14707. "cellSpacing",
  14708. "cellPadding",
  14709. "rowSpan",
  14710. "colSpan",
  14711. "useMap",
  14712. "frameBorder",
  14713. "contentEditable"
  14714. ], function() {
  14715. jQuery.propFix[ this.toLowerCase() ] = this;
  14716. } );
  14717. // Strip and collapse whitespace according to HTML spec
  14718. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14719. function stripAndCollapse( value ) {
  14720. var tokens = value.match( rnothtmlwhite ) || [];
  14721. return tokens.join( " " );
  14722. }
  14723. function getClass( elem ) {
  14724. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14725. }
  14726. function classesToArray( value ) {
  14727. if ( Array.isArray( value ) ) {
  14728. return value;
  14729. }
  14730. if ( typeof value === "string" ) {
  14731. return value.match( rnothtmlwhite ) || [];
  14732. }
  14733. return [];
  14734. }
  14735. jQuery.fn.extend( {
  14736. addClass: function( value ) {
  14737. var classes, elem, cur, curValue, clazz, j, finalValue,
  14738. i = 0;
  14739. if ( isFunction( value ) ) {
  14740. return this.each( function( j ) {
  14741. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14742. } );
  14743. }
  14744. classes = classesToArray( value );
  14745. if ( classes.length ) {
  14746. while ( ( elem = this[ i++ ] ) ) {
  14747. curValue = getClass( elem );
  14748. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14749. if ( cur ) {
  14750. j = 0;
  14751. while ( ( clazz = classes[ j++ ] ) ) {
  14752. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14753. cur += clazz + " ";
  14754. }
  14755. }
  14756. // Only assign if different to avoid unneeded rendering.
  14757. finalValue = stripAndCollapse( cur );
  14758. if ( curValue !== finalValue ) {
  14759. elem.setAttribute( "class", finalValue );
  14760. }
  14761. }
  14762. }
  14763. }
  14764. return this;
  14765. },
  14766. removeClass: function( value ) {
  14767. var classes, elem, cur, curValue, clazz, j, finalValue,
  14768. i = 0;
  14769. if ( isFunction( value ) ) {
  14770. return this.each( function( j ) {
  14771. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14772. } );
  14773. }
  14774. if ( !arguments.length ) {
  14775. return this.attr( "class", "" );
  14776. }
  14777. classes = classesToArray( value );
  14778. if ( classes.length ) {
  14779. while ( ( elem = this[ i++ ] ) ) {
  14780. curValue = getClass( elem );
  14781. // This expression is here for better compressibility (see addClass)
  14782. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14783. if ( cur ) {
  14784. j = 0;
  14785. while ( ( clazz = classes[ j++ ] ) ) {
  14786. // Remove *all* instances
  14787. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14788. cur = cur.replace( " " + clazz + " ", " " );
  14789. }
  14790. }
  14791. // Only assign if different to avoid unneeded rendering.
  14792. finalValue = stripAndCollapse( cur );
  14793. if ( curValue !== finalValue ) {
  14794. elem.setAttribute( "class", finalValue );
  14795. }
  14796. }
  14797. }
  14798. }
  14799. return this;
  14800. },
  14801. toggleClass: function( value, stateVal ) {
  14802. var type = typeof value,
  14803. isValidValue = type === "string" || Array.isArray( value );
  14804. if ( typeof stateVal === "boolean" && isValidValue ) {
  14805. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14806. }
  14807. if ( isFunction( value ) ) {
  14808. return this.each( function( i ) {
  14809. jQuery( this ).toggleClass(
  14810. value.call( this, i, getClass( this ), stateVal ),
  14811. stateVal
  14812. );
  14813. } );
  14814. }
  14815. return this.each( function() {
  14816. var className, i, self, classNames;
  14817. if ( isValidValue ) {
  14818. // Toggle individual class names
  14819. i = 0;
  14820. self = jQuery( this );
  14821. classNames = classesToArray( value );
  14822. while ( ( className = classNames[ i++ ] ) ) {
  14823. // Check each className given, space separated list
  14824. if ( self.hasClass( className ) ) {
  14825. self.removeClass( className );
  14826. } else {
  14827. self.addClass( className );
  14828. }
  14829. }
  14830. // Toggle whole class name
  14831. } else if ( value === undefined || type === "boolean" ) {
  14832. className = getClass( this );
  14833. if ( className ) {
  14834. // Store className if set
  14835. dataPriv.set( this, "__className__", className );
  14836. }
  14837. // If the element has a class name or if we're passed `false`,
  14838. // then remove the whole classname (if there was one, the above saved it).
  14839. // Otherwise bring back whatever was previously saved (if anything),
  14840. // falling back to the empty string if nothing was stored.
  14841. if ( this.setAttribute ) {
  14842. this.setAttribute( "class",
  14843. className || value === false ?
  14844. "" :
  14845. dataPriv.get( this, "__className__" ) || ""
  14846. );
  14847. }
  14848. }
  14849. } );
  14850. },
  14851. hasClass: function( selector ) {
  14852. var className, elem,
  14853. i = 0;
  14854. className = " " + selector + " ";
  14855. while ( ( elem = this[ i++ ] ) ) {
  14856. if ( elem.nodeType === 1 &&
  14857. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14858. return true;
  14859. }
  14860. }
  14861. return false;
  14862. }
  14863. } );
  14864. var rreturn = /\r/g;
  14865. jQuery.fn.extend( {
  14866. val: function( value ) {
  14867. var hooks, ret, valueIsFunction,
  14868. elem = this[ 0 ];
  14869. if ( !arguments.length ) {
  14870. if ( elem ) {
  14871. hooks = jQuery.valHooks[ elem.type ] ||
  14872. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14873. if ( hooks &&
  14874. "get" in hooks &&
  14875. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14876. ) {
  14877. return ret;
  14878. }
  14879. ret = elem.value;
  14880. // Handle most common string cases
  14881. if ( typeof ret === "string" ) {
  14882. return ret.replace( rreturn, "" );
  14883. }
  14884. // Handle cases where value is null/undef or number
  14885. return ret == null ? "" : ret;
  14886. }
  14887. return;
  14888. }
  14889. valueIsFunction = isFunction( value );
  14890. return this.each( function( i ) {
  14891. var val;
  14892. if ( this.nodeType !== 1 ) {
  14893. return;
  14894. }
  14895. if ( valueIsFunction ) {
  14896. val = value.call( this, i, jQuery( this ).val() );
  14897. } else {
  14898. val = value;
  14899. }
  14900. // Treat null/undefined as ""; convert numbers to string
  14901. if ( val == null ) {
  14902. val = "";
  14903. } else if ( typeof val === "number" ) {
  14904. val += "";
  14905. } else if ( Array.isArray( val ) ) {
  14906. val = jQuery.map( val, function( value ) {
  14907. return value == null ? "" : value + "";
  14908. } );
  14909. }
  14910. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  14911. // If set returns undefined, fall back to normal setting
  14912. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  14913. this.value = val;
  14914. }
  14915. } );
  14916. }
  14917. } );
  14918. jQuery.extend( {
  14919. valHooks: {
  14920. option: {
  14921. get: function( elem ) {
  14922. var val = jQuery.find.attr( elem, "value" );
  14923. return val != null ?
  14924. val :
  14925. // Support: IE <=10 - 11 only
  14926. // option.text throws exceptions (#14686, #14858)
  14927. // Strip and collapse whitespace
  14928. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  14929. stripAndCollapse( jQuery.text( elem ) );
  14930. }
  14931. },
  14932. select: {
  14933. get: function( elem ) {
  14934. var value, option, i,
  14935. options = elem.options,
  14936. index = elem.selectedIndex,
  14937. one = elem.type === "select-one",
  14938. values = one ? null : [],
  14939. max = one ? index + 1 : options.length;
  14940. if ( index < 0 ) {
  14941. i = max;
  14942. } else {
  14943. i = one ? index : 0;
  14944. }
  14945. // Loop through all the selected options
  14946. for ( ; i < max; i++ ) {
  14947. option = options[ i ];
  14948. // Support: IE <=9 only
  14949. // IE8-9 doesn't update selected after form reset (#2551)
  14950. if ( ( option.selected || i === index ) &&
  14951. // Don't return options that are disabled or in a disabled optgroup
  14952. !option.disabled &&
  14953. ( !option.parentNode.disabled ||
  14954. !nodeName( option.parentNode, "optgroup" ) ) ) {
  14955. // Get the specific value for the option
  14956. value = jQuery( option ).val();
  14957. // We don't need an array for one selects
  14958. if ( one ) {
  14959. return value;
  14960. }
  14961. // Multi-Selects return an array
  14962. values.push( value );
  14963. }
  14964. }
  14965. return values;
  14966. },
  14967. set: function( elem, value ) {
  14968. var optionSet, option,
  14969. options = elem.options,
  14970. values = jQuery.makeArray( value ),
  14971. i = options.length;
  14972. while ( i-- ) {
  14973. option = options[ i ];
  14974. /* eslint-disable no-cond-assign */
  14975. if ( option.selected =
  14976. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  14977. ) {
  14978. optionSet = true;
  14979. }
  14980. /* eslint-enable no-cond-assign */
  14981. }
  14982. // Force browsers to behave consistently when non-matching value is set
  14983. if ( !optionSet ) {
  14984. elem.selectedIndex = -1;
  14985. }
  14986. return values;
  14987. }
  14988. }
  14989. }
  14990. } );
  14991. // Radios and checkboxes getter/setter
  14992. jQuery.each( [ "radio", "checkbox" ], function() {
  14993. jQuery.valHooks[ this ] = {
  14994. set: function( elem, value ) {
  14995. if ( Array.isArray( value ) ) {
  14996. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  14997. }
  14998. }
  14999. };
  15000. if ( !support.checkOn ) {
  15001. jQuery.valHooks[ this ].get = function( elem ) {
  15002. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15003. };
  15004. }
  15005. } );
  15006. // Return jQuery for attributes-only inclusion
  15007. support.focusin = "onfocusin" in window;
  15008. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15009. stopPropagationCallback = function( e ) {
  15010. e.stopPropagation();
  15011. };
  15012. jQuery.extend( jQuery.event, {
  15013. trigger: function( event, data, elem, onlyHandlers ) {
  15014. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15015. eventPath = [ elem || document ],
  15016. type = hasOwn.call( event, "type" ) ? event.type : event,
  15017. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15018. cur = lastElement = tmp = elem = elem || document;
  15019. // Don't do events on text and comment nodes
  15020. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15021. return;
  15022. }
  15023. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15024. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15025. return;
  15026. }
  15027. if ( type.indexOf( "." ) > -1 ) {
  15028. // Namespaced trigger; create a regexp to match event type in handle()
  15029. namespaces = type.split( "." );
  15030. type = namespaces.shift();
  15031. namespaces.sort();
  15032. }
  15033. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15034. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15035. event = event[ jQuery.expando ] ?
  15036. event :
  15037. new jQuery.Event( type, typeof event === "object" && event );
  15038. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15039. event.isTrigger = onlyHandlers ? 2 : 3;
  15040. event.namespace = namespaces.join( "." );
  15041. event.rnamespace = event.namespace ?
  15042. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15043. null;
  15044. // Clean up the event in case it is being reused
  15045. event.result = undefined;
  15046. if ( !event.target ) {
  15047. event.target = elem;
  15048. }
  15049. // Clone any incoming data and prepend the event, creating the handler arg list
  15050. data = data == null ?
  15051. [ event ] :
  15052. jQuery.makeArray( data, [ event ] );
  15053. // Allow special events to draw outside the lines
  15054. special = jQuery.event.special[ type ] || {};
  15055. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15056. return;
  15057. }
  15058. // Determine event propagation path in advance, per W3C events spec (#9951)
  15059. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15060. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15061. bubbleType = special.delegateType || type;
  15062. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15063. cur = cur.parentNode;
  15064. }
  15065. for ( ; cur; cur = cur.parentNode ) {
  15066. eventPath.push( cur );
  15067. tmp = cur;
  15068. }
  15069. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15070. if ( tmp === ( elem.ownerDocument || document ) ) {
  15071. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15072. }
  15073. }
  15074. // Fire handlers on the event path
  15075. i = 0;
  15076. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15077. lastElement = cur;
  15078. event.type = i > 1 ?
  15079. bubbleType :
  15080. special.bindType || type;
  15081. // jQuery handler
  15082. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15083. dataPriv.get( cur, "handle" );
  15084. if ( handle ) {
  15085. handle.apply( cur, data );
  15086. }
  15087. // Native handler
  15088. handle = ontype && cur[ ontype ];
  15089. if ( handle && handle.apply && acceptData( cur ) ) {
  15090. event.result = handle.apply( cur, data );
  15091. if ( event.result === false ) {
  15092. event.preventDefault();
  15093. }
  15094. }
  15095. }
  15096. event.type = type;
  15097. // If nobody prevented the default action, do it now
  15098. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15099. if ( ( !special._default ||
  15100. special._default.apply( eventPath.pop(), data ) === false ) &&
  15101. acceptData( elem ) ) {
  15102. // Call a native DOM method on the target with the same name as the event.
  15103. // Don't do default actions on window, that's where global variables be (#6170)
  15104. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15105. // Don't re-trigger an onFOO event when we call its FOO() method
  15106. tmp = elem[ ontype ];
  15107. if ( tmp ) {
  15108. elem[ ontype ] = null;
  15109. }
  15110. // Prevent re-triggering of the same event, since we already bubbled it above
  15111. jQuery.event.triggered = type;
  15112. if ( event.isPropagationStopped() ) {
  15113. lastElement.addEventListener( type, stopPropagationCallback );
  15114. }
  15115. elem[ type ]();
  15116. if ( event.isPropagationStopped() ) {
  15117. lastElement.removeEventListener( type, stopPropagationCallback );
  15118. }
  15119. jQuery.event.triggered = undefined;
  15120. if ( tmp ) {
  15121. elem[ ontype ] = tmp;
  15122. }
  15123. }
  15124. }
  15125. }
  15126. return event.result;
  15127. },
  15128. // Piggyback on a donor event to simulate a different one
  15129. // Used only for `focus(in | out)` events
  15130. simulate: function( type, elem, event ) {
  15131. var e = jQuery.extend(
  15132. new jQuery.Event(),
  15133. event,
  15134. {
  15135. type: type,
  15136. isSimulated: true
  15137. }
  15138. );
  15139. jQuery.event.trigger( e, null, elem );
  15140. }
  15141. } );
  15142. jQuery.fn.extend( {
  15143. trigger: function( type, data ) {
  15144. return this.each( function() {
  15145. jQuery.event.trigger( type, data, this );
  15146. } );
  15147. },
  15148. triggerHandler: function( type, data ) {
  15149. var elem = this[ 0 ];
  15150. if ( elem ) {
  15151. return jQuery.event.trigger( type, data, elem, true );
  15152. }
  15153. }
  15154. } );
  15155. // Support: Firefox <=44
  15156. // Firefox doesn't have focus(in | out) events
  15157. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15158. //
  15159. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15160. // focus(in | out) events fire after focus & blur events,
  15161. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15162. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15163. if ( !support.focusin ) {
  15164. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15165. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15166. var handler = function( event ) {
  15167. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15168. };
  15169. jQuery.event.special[ fix ] = {
  15170. setup: function() {
  15171. var doc = this.ownerDocument || this,
  15172. attaches = dataPriv.access( doc, fix );
  15173. if ( !attaches ) {
  15174. doc.addEventListener( orig, handler, true );
  15175. }
  15176. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15177. },
  15178. teardown: function() {
  15179. var doc = this.ownerDocument || this,
  15180. attaches = dataPriv.access( doc, fix ) - 1;
  15181. if ( !attaches ) {
  15182. doc.removeEventListener( orig, handler, true );
  15183. dataPriv.remove( doc, fix );
  15184. } else {
  15185. dataPriv.access( doc, fix, attaches );
  15186. }
  15187. }
  15188. };
  15189. } );
  15190. }
  15191. var location = window.location;
  15192. var nonce = Date.now();
  15193. var rquery = ( /\?/ );
  15194. // Cross-browser xml parsing
  15195. jQuery.parseXML = function( data ) {
  15196. var xml;
  15197. if ( !data || typeof data !== "string" ) {
  15198. return null;
  15199. }
  15200. // Support: IE 9 - 11 only
  15201. // IE throws on parseFromString with invalid input.
  15202. try {
  15203. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15204. } catch ( e ) {
  15205. xml = undefined;
  15206. }
  15207. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15208. jQuery.error( "Invalid XML: " + data );
  15209. }
  15210. return xml;
  15211. };
  15212. var
  15213. rbracket = /\[\]$/,
  15214. rCRLF = /\r?\n/g,
  15215. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15216. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15217. function buildParams( prefix, obj, traditional, add ) {
  15218. var name;
  15219. if ( Array.isArray( obj ) ) {
  15220. // Serialize array item.
  15221. jQuery.each( obj, function( i, v ) {
  15222. if ( traditional || rbracket.test( prefix ) ) {
  15223. // Treat each array item as a scalar.
  15224. add( prefix, v );
  15225. } else {
  15226. // Item is non-scalar (array or object), encode its numeric index.
  15227. buildParams(
  15228. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15229. v,
  15230. traditional,
  15231. add
  15232. );
  15233. }
  15234. } );
  15235. } else if ( !traditional && toType( obj ) === "object" ) {
  15236. // Serialize object item.
  15237. for ( name in obj ) {
  15238. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15239. }
  15240. } else {
  15241. // Serialize scalar item.
  15242. add( prefix, obj );
  15243. }
  15244. }
  15245. // Serialize an array of form elements or a set of
  15246. // key/values into a query string
  15247. jQuery.param = function( a, traditional ) {
  15248. var prefix,
  15249. s = [],
  15250. add = function( key, valueOrFunction ) {
  15251. // If value is a function, invoke it and use its return value
  15252. var value = isFunction( valueOrFunction ) ?
  15253. valueOrFunction() :
  15254. valueOrFunction;
  15255. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15256. encodeURIComponent( value == null ? "" : value );
  15257. };
  15258. if ( a == null ) {
  15259. return "";
  15260. }
  15261. // If an array was passed in, assume that it is an array of form elements.
  15262. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15263. // Serialize the form elements
  15264. jQuery.each( a, function() {
  15265. add( this.name, this.value );
  15266. } );
  15267. } else {
  15268. // If traditional, encode the "old" way (the way 1.3.2 or older
  15269. // did it), otherwise encode params recursively.
  15270. for ( prefix in a ) {
  15271. buildParams( prefix, a[ prefix ], traditional, add );
  15272. }
  15273. }
  15274. // Return the resulting serialization
  15275. return s.join( "&" );
  15276. };
  15277. jQuery.fn.extend( {
  15278. serialize: function() {
  15279. return jQuery.param( this.serializeArray() );
  15280. },
  15281. serializeArray: function() {
  15282. return this.map( function() {
  15283. // Can add propHook for "elements" to filter or add form elements
  15284. var elements = jQuery.prop( this, "elements" );
  15285. return elements ? jQuery.makeArray( elements ) : this;
  15286. } )
  15287. .filter( function() {
  15288. var type = this.type;
  15289. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15290. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15291. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15292. ( this.checked || !rcheckableType.test( type ) );
  15293. } )
  15294. .map( function( i, elem ) {
  15295. var val = jQuery( this ).val();
  15296. if ( val == null ) {
  15297. return null;
  15298. }
  15299. if ( Array.isArray( val ) ) {
  15300. return jQuery.map( val, function( val ) {
  15301. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15302. } );
  15303. }
  15304. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15305. } ).get();
  15306. }
  15307. } );
  15308. var
  15309. r20 = /%20/g,
  15310. rhash = /#.*$/,
  15311. rantiCache = /([?&])_=[^&]*/,
  15312. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15313. // #7653, #8125, #8152: local protocol detection
  15314. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15315. rnoContent = /^(?:GET|HEAD)$/,
  15316. rprotocol = /^\/\//,
  15317. /* Prefilters
  15318. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15319. * 2) These are called:
  15320. * - BEFORE asking for a transport
  15321. * - AFTER param serialization (s.data is a string if s.processData is true)
  15322. * 3) key is the dataType
  15323. * 4) the catchall symbol "*" can be used
  15324. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15325. */
  15326. prefilters = {},
  15327. /* Transports bindings
  15328. * 1) key is the dataType
  15329. * 2) the catchall symbol "*" can be used
  15330. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15331. */
  15332. transports = {},
  15333. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15334. allTypes = "*/".concat( "*" ),
  15335. // Anchor tag for parsing the document origin
  15336. originAnchor = document.createElement( "a" );
  15337. originAnchor.href = location.href;
  15338. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15339. function addToPrefiltersOrTransports( structure ) {
  15340. // dataTypeExpression is optional and defaults to "*"
  15341. return function( dataTypeExpression, func ) {
  15342. if ( typeof dataTypeExpression !== "string" ) {
  15343. func = dataTypeExpression;
  15344. dataTypeExpression = "*";
  15345. }
  15346. var dataType,
  15347. i = 0,
  15348. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15349. if ( isFunction( func ) ) {
  15350. // For each dataType in the dataTypeExpression
  15351. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15352. // Prepend if requested
  15353. if ( dataType[ 0 ] === "+" ) {
  15354. dataType = dataType.slice( 1 ) || "*";
  15355. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15356. // Otherwise append
  15357. } else {
  15358. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15359. }
  15360. }
  15361. }
  15362. };
  15363. }
  15364. // Base inspection function for prefilters and transports
  15365. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15366. var inspected = {},
  15367. seekingTransport = ( structure === transports );
  15368. function inspect( dataType ) {
  15369. var selected;
  15370. inspected[ dataType ] = true;
  15371. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15372. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15373. if ( typeof dataTypeOrTransport === "string" &&
  15374. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15375. options.dataTypes.unshift( dataTypeOrTransport );
  15376. inspect( dataTypeOrTransport );
  15377. return false;
  15378. } else if ( seekingTransport ) {
  15379. return !( selected = dataTypeOrTransport );
  15380. }
  15381. } );
  15382. return selected;
  15383. }
  15384. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15385. }
  15386. // A special extend for ajax options
  15387. // that takes "flat" options (not to be deep extended)
  15388. // Fixes #9887
  15389. function ajaxExtend( target, src ) {
  15390. var key, deep,
  15391. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15392. for ( key in src ) {
  15393. if ( src[ key ] !== undefined ) {
  15394. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15395. }
  15396. }
  15397. if ( deep ) {
  15398. jQuery.extend( true, target, deep );
  15399. }
  15400. return target;
  15401. }
  15402. /* Handles responses to an ajax request:
  15403. * - finds the right dataType (mediates between content-type and expected dataType)
  15404. * - returns the corresponding response
  15405. */
  15406. function ajaxHandleResponses( s, jqXHR, responses ) {
  15407. var ct, type, finalDataType, firstDataType,
  15408. contents = s.contents,
  15409. dataTypes = s.dataTypes;
  15410. // Remove auto dataType and get content-type in the process
  15411. while ( dataTypes[ 0 ] === "*" ) {
  15412. dataTypes.shift();
  15413. if ( ct === undefined ) {
  15414. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15415. }
  15416. }
  15417. // Check if we're dealing with a known content-type
  15418. if ( ct ) {
  15419. for ( type in contents ) {
  15420. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15421. dataTypes.unshift( type );
  15422. break;
  15423. }
  15424. }
  15425. }
  15426. // Check to see if we have a response for the expected dataType
  15427. if ( dataTypes[ 0 ] in responses ) {
  15428. finalDataType = dataTypes[ 0 ];
  15429. } else {
  15430. // Try convertible dataTypes
  15431. for ( type in responses ) {
  15432. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15433. finalDataType = type;
  15434. break;
  15435. }
  15436. if ( !firstDataType ) {
  15437. firstDataType = type;
  15438. }
  15439. }
  15440. // Or just use first one
  15441. finalDataType = finalDataType || firstDataType;
  15442. }
  15443. // If we found a dataType
  15444. // We add the dataType to the list if needed
  15445. // and return the corresponding response
  15446. if ( finalDataType ) {
  15447. if ( finalDataType !== dataTypes[ 0 ] ) {
  15448. dataTypes.unshift( finalDataType );
  15449. }
  15450. return responses[ finalDataType ];
  15451. }
  15452. }
  15453. /* Chain conversions given the request and the original response
  15454. * Also sets the responseXXX fields on the jqXHR instance
  15455. */
  15456. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15457. var conv2, current, conv, tmp, prev,
  15458. converters = {},
  15459. // Work with a copy of dataTypes in case we need to modify it for conversion
  15460. dataTypes = s.dataTypes.slice();
  15461. // Create converters map with lowercased keys
  15462. if ( dataTypes[ 1 ] ) {
  15463. for ( conv in s.converters ) {
  15464. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15465. }
  15466. }
  15467. current = dataTypes.shift();
  15468. // Convert to each sequential dataType
  15469. while ( current ) {
  15470. if ( s.responseFields[ current ] ) {
  15471. jqXHR[ s.responseFields[ current ] ] = response;
  15472. }
  15473. // Apply the dataFilter if provided
  15474. if ( !prev && isSuccess && s.dataFilter ) {
  15475. response = s.dataFilter( response, s.dataType );
  15476. }
  15477. prev = current;
  15478. current = dataTypes.shift();
  15479. if ( current ) {
  15480. // There's only work to do if current dataType is non-auto
  15481. if ( current === "*" ) {
  15482. current = prev;
  15483. // Convert response if prev dataType is non-auto and differs from current
  15484. } else if ( prev !== "*" && prev !== current ) {
  15485. // Seek a direct converter
  15486. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15487. // If none found, seek a pair
  15488. if ( !conv ) {
  15489. for ( conv2 in converters ) {
  15490. // If conv2 outputs current
  15491. tmp = conv2.split( " " );
  15492. if ( tmp[ 1 ] === current ) {
  15493. // If prev can be converted to accepted input
  15494. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15495. converters[ "* " + tmp[ 0 ] ];
  15496. if ( conv ) {
  15497. // Condense equivalence converters
  15498. if ( conv === true ) {
  15499. conv = converters[ conv2 ];
  15500. // Otherwise, insert the intermediate dataType
  15501. } else if ( converters[ conv2 ] !== true ) {
  15502. current = tmp[ 0 ];
  15503. dataTypes.unshift( tmp[ 1 ] );
  15504. }
  15505. break;
  15506. }
  15507. }
  15508. }
  15509. }
  15510. // Apply converter (if not an equivalence)
  15511. if ( conv !== true ) {
  15512. // Unless errors are allowed to bubble, catch and return them
  15513. if ( conv && s.throws ) {
  15514. response = conv( response );
  15515. } else {
  15516. try {
  15517. response = conv( response );
  15518. } catch ( e ) {
  15519. return {
  15520. state: "parsererror",
  15521. error: conv ? e : "No conversion from " + prev + " to " + current
  15522. };
  15523. }
  15524. }
  15525. }
  15526. }
  15527. }
  15528. }
  15529. return { state: "success", data: response };
  15530. }
  15531. jQuery.extend( {
  15532. // Counter for holding the number of active queries
  15533. active: 0,
  15534. // Last-Modified header cache for next request
  15535. lastModified: {},
  15536. etag: {},
  15537. ajaxSettings: {
  15538. url: location.href,
  15539. type: "GET",
  15540. isLocal: rlocalProtocol.test( location.protocol ),
  15541. global: true,
  15542. processData: true,
  15543. async: true,
  15544. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15545. /*
  15546. timeout: 0,
  15547. data: null,
  15548. dataType: null,
  15549. username: null,
  15550. password: null,
  15551. cache: null,
  15552. throws: false,
  15553. traditional: false,
  15554. headers: {},
  15555. */
  15556. accepts: {
  15557. "*": allTypes,
  15558. text: "text/plain",
  15559. html: "text/html",
  15560. xml: "application/xml, text/xml",
  15561. json: "application/json, text/javascript"
  15562. },
  15563. contents: {
  15564. xml: /\bxml\b/,
  15565. html: /\bhtml/,
  15566. json: /\bjson\b/
  15567. },
  15568. responseFields: {
  15569. xml: "responseXML",
  15570. text: "responseText",
  15571. json: "responseJSON"
  15572. },
  15573. // Data converters
  15574. // Keys separate source (or catchall "*") and destination types with a single space
  15575. converters: {
  15576. // Convert anything to text
  15577. "* text": String,
  15578. // Text to html (true = no transformation)
  15579. "text html": true,
  15580. // Evaluate text as a json expression
  15581. "text json": JSON.parse,
  15582. // Parse text as xml
  15583. "text xml": jQuery.parseXML
  15584. },
  15585. // For options that shouldn't be deep extended:
  15586. // you can add your own custom options here if
  15587. // and when you create one that shouldn't be
  15588. // deep extended (see ajaxExtend)
  15589. flatOptions: {
  15590. url: true,
  15591. context: true
  15592. }
  15593. },
  15594. // Creates a full fledged settings object into target
  15595. // with both ajaxSettings and settings fields.
  15596. // If target is omitted, writes into ajaxSettings.
  15597. ajaxSetup: function( target, settings ) {
  15598. return settings ?
  15599. // Building a settings object
  15600. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15601. // Extending ajaxSettings
  15602. ajaxExtend( jQuery.ajaxSettings, target );
  15603. },
  15604. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15605. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15606. // Main method
  15607. ajax: function( url, options ) {
  15608. // If url is an object, simulate pre-1.5 signature
  15609. if ( typeof url === "object" ) {
  15610. options = url;
  15611. url = undefined;
  15612. }
  15613. // Force options to be an object
  15614. options = options || {};
  15615. var transport,
  15616. // URL without anti-cache param
  15617. cacheURL,
  15618. // Response headers
  15619. responseHeadersString,
  15620. responseHeaders,
  15621. // timeout handle
  15622. timeoutTimer,
  15623. // Url cleanup var
  15624. urlAnchor,
  15625. // Request state (becomes false upon send and true upon completion)
  15626. completed,
  15627. // To know if global events are to be dispatched
  15628. fireGlobals,
  15629. // Loop variable
  15630. i,
  15631. // uncached part of the url
  15632. uncached,
  15633. // Create the final options object
  15634. s = jQuery.ajaxSetup( {}, options ),
  15635. // Callbacks context
  15636. callbackContext = s.context || s,
  15637. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15638. globalEventContext = s.context &&
  15639. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15640. jQuery( callbackContext ) :
  15641. jQuery.event,
  15642. // Deferreds
  15643. deferred = jQuery.Deferred(),
  15644. completeDeferred = jQuery.Callbacks( "once memory" ),
  15645. // Status-dependent callbacks
  15646. statusCode = s.statusCode || {},
  15647. // Headers (they are sent all at once)
  15648. requestHeaders = {},
  15649. requestHeadersNames = {},
  15650. // Default abort message
  15651. strAbort = "canceled",
  15652. // Fake xhr
  15653. jqXHR = {
  15654. readyState: 0,
  15655. // Builds headers hashtable if needed
  15656. getResponseHeader: function( key ) {
  15657. var match;
  15658. if ( completed ) {
  15659. if ( !responseHeaders ) {
  15660. responseHeaders = {};
  15661. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15662. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15663. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15664. .concat( match[ 2 ] );
  15665. }
  15666. }
  15667. match = responseHeaders[ key.toLowerCase() + " " ];
  15668. }
  15669. return match == null ? null : match.join( ", " );
  15670. },
  15671. // Raw string
  15672. getAllResponseHeaders: function() {
  15673. return completed ? responseHeadersString : null;
  15674. },
  15675. // Caches the header
  15676. setRequestHeader: function( name, value ) {
  15677. if ( completed == null ) {
  15678. name = requestHeadersNames[ name.toLowerCase() ] =
  15679. requestHeadersNames[ name.toLowerCase() ] || name;
  15680. requestHeaders[ name ] = value;
  15681. }
  15682. return this;
  15683. },
  15684. // Overrides response content-type header
  15685. overrideMimeType: function( type ) {
  15686. if ( completed == null ) {
  15687. s.mimeType = type;
  15688. }
  15689. return this;
  15690. },
  15691. // Status-dependent callbacks
  15692. statusCode: function( map ) {
  15693. var code;
  15694. if ( map ) {
  15695. if ( completed ) {
  15696. // Execute the appropriate callbacks
  15697. jqXHR.always( map[ jqXHR.status ] );
  15698. } else {
  15699. // Lazy-add the new callbacks in a way that preserves old ones
  15700. for ( code in map ) {
  15701. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15702. }
  15703. }
  15704. }
  15705. return this;
  15706. },
  15707. // Cancel the request
  15708. abort: function( statusText ) {
  15709. var finalText = statusText || strAbort;
  15710. if ( transport ) {
  15711. transport.abort( finalText );
  15712. }
  15713. done( 0, finalText );
  15714. return this;
  15715. }
  15716. };
  15717. // Attach deferreds
  15718. deferred.promise( jqXHR );
  15719. // Add protocol if not provided (prefilters might expect it)
  15720. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15721. // We also use the url parameter if available
  15722. s.url = ( ( url || s.url || location.href ) + "" )
  15723. .replace( rprotocol, location.protocol + "//" );
  15724. // Alias method option to type as per ticket #12004
  15725. s.type = options.method || options.type || s.method || s.type;
  15726. // Extract dataTypes list
  15727. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15728. // A cross-domain request is in order when the origin doesn't match the current origin.
  15729. if ( s.crossDomain == null ) {
  15730. urlAnchor = document.createElement( "a" );
  15731. // Support: IE <=8 - 11, Edge 12 - 15
  15732. // IE throws exception on accessing the href property if url is malformed,
  15733. // e.g. http://example.com:80x/
  15734. try {
  15735. urlAnchor.href = s.url;
  15736. // Support: IE <=8 - 11 only
  15737. // Anchor's host property isn't correctly set when s.url is relative
  15738. urlAnchor.href = urlAnchor.href;
  15739. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15740. urlAnchor.protocol + "//" + urlAnchor.host;
  15741. } catch ( e ) {
  15742. // If there is an error parsing the URL, assume it is crossDomain,
  15743. // it can be rejected by the transport if it is invalid
  15744. s.crossDomain = true;
  15745. }
  15746. }
  15747. // Convert data if not already a string
  15748. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15749. s.data = jQuery.param( s.data, s.traditional );
  15750. }
  15751. // Apply prefilters
  15752. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15753. // If request was aborted inside a prefilter, stop there
  15754. if ( completed ) {
  15755. return jqXHR;
  15756. }
  15757. // We can fire global events as of now if asked to
  15758. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15759. fireGlobals = jQuery.event && s.global;
  15760. // Watch for a new set of requests
  15761. if ( fireGlobals && jQuery.active++ === 0 ) {
  15762. jQuery.event.trigger( "ajaxStart" );
  15763. }
  15764. // Uppercase the type
  15765. s.type = s.type.toUpperCase();
  15766. // Determine if request has content
  15767. s.hasContent = !rnoContent.test( s.type );
  15768. // Save the URL in case we're toying with the If-Modified-Since
  15769. // and/or If-None-Match header later on
  15770. // Remove hash to simplify url manipulation
  15771. cacheURL = s.url.replace( rhash, "" );
  15772. // More options handling for requests with no content
  15773. if ( !s.hasContent ) {
  15774. // Remember the hash so we can put it back
  15775. uncached = s.url.slice( cacheURL.length );
  15776. // If data is available and should be processed, append data to url
  15777. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15778. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15779. // #9682: remove data so that it's not used in an eventual retry
  15780. delete s.data;
  15781. }
  15782. // Add or update anti-cache param if needed
  15783. if ( s.cache === false ) {
  15784. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15785. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15786. }
  15787. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15788. s.url = cacheURL + uncached;
  15789. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15790. } else if ( s.data && s.processData &&
  15791. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15792. s.data = s.data.replace( r20, "+" );
  15793. }
  15794. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15795. if ( s.ifModified ) {
  15796. if ( jQuery.lastModified[ cacheURL ] ) {
  15797. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15798. }
  15799. if ( jQuery.etag[ cacheURL ] ) {
  15800. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15801. }
  15802. }
  15803. // Set the correct header, if data is being sent
  15804. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15805. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15806. }
  15807. // Set the Accepts header for the server, depending on the dataType
  15808. jqXHR.setRequestHeader(
  15809. "Accept",
  15810. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15811. s.accepts[ s.dataTypes[ 0 ] ] +
  15812. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15813. s.accepts[ "*" ]
  15814. );
  15815. // Check for headers option
  15816. for ( i in s.headers ) {
  15817. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15818. }
  15819. // Allow custom headers/mimetypes and early abort
  15820. if ( s.beforeSend &&
  15821. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15822. // Abort if not done already and return
  15823. return jqXHR.abort();
  15824. }
  15825. // Aborting is no longer a cancellation
  15826. strAbort = "abort";
  15827. // Install callbacks on deferreds
  15828. completeDeferred.add( s.complete );
  15829. jqXHR.done( s.success );
  15830. jqXHR.fail( s.error );
  15831. // Get transport
  15832. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15833. // If no transport, we auto-abort
  15834. if ( !transport ) {
  15835. done( -1, "No Transport" );
  15836. } else {
  15837. jqXHR.readyState = 1;
  15838. // Send global event
  15839. if ( fireGlobals ) {
  15840. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15841. }
  15842. // If request was aborted inside ajaxSend, stop there
  15843. if ( completed ) {
  15844. return jqXHR;
  15845. }
  15846. // Timeout
  15847. if ( s.async && s.timeout > 0 ) {
  15848. timeoutTimer = window.setTimeout( function() {
  15849. jqXHR.abort( "timeout" );
  15850. }, s.timeout );
  15851. }
  15852. try {
  15853. completed = false;
  15854. transport.send( requestHeaders, done );
  15855. } catch ( e ) {
  15856. // Rethrow post-completion exceptions
  15857. if ( completed ) {
  15858. throw e;
  15859. }
  15860. // Propagate others as results
  15861. done( -1, e );
  15862. }
  15863. }
  15864. // Callback for when everything is done
  15865. function done( status, nativeStatusText, responses, headers ) {
  15866. var isSuccess, success, error, response, modified,
  15867. statusText = nativeStatusText;
  15868. // Ignore repeat invocations
  15869. if ( completed ) {
  15870. return;
  15871. }
  15872. completed = true;
  15873. // Clear timeout if it exists
  15874. if ( timeoutTimer ) {
  15875. window.clearTimeout( timeoutTimer );
  15876. }
  15877. // Dereference transport for early garbage collection
  15878. // (no matter how long the jqXHR object will be used)
  15879. transport = undefined;
  15880. // Cache response headers
  15881. responseHeadersString = headers || "";
  15882. // Set readyState
  15883. jqXHR.readyState = status > 0 ? 4 : 0;
  15884. // Determine if successful
  15885. isSuccess = status >= 200 && status < 300 || status === 304;
  15886. // Get response data
  15887. if ( responses ) {
  15888. response = ajaxHandleResponses( s, jqXHR, responses );
  15889. }
  15890. // Convert no matter what (that way responseXXX fields are always set)
  15891. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15892. // If successful, handle type chaining
  15893. if ( isSuccess ) {
  15894. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15895. if ( s.ifModified ) {
  15896. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15897. if ( modified ) {
  15898. jQuery.lastModified[ cacheURL ] = modified;
  15899. }
  15900. modified = jqXHR.getResponseHeader( "etag" );
  15901. if ( modified ) {
  15902. jQuery.etag[ cacheURL ] = modified;
  15903. }
  15904. }
  15905. // if no content
  15906. if ( status === 204 || s.type === "HEAD" ) {
  15907. statusText = "nocontent";
  15908. // if not modified
  15909. } else if ( status === 304 ) {
  15910. statusText = "notmodified";
  15911. // If we have data, let's convert it
  15912. } else {
  15913. statusText = response.state;
  15914. success = response.data;
  15915. error = response.error;
  15916. isSuccess = !error;
  15917. }
  15918. } else {
  15919. // Extract error from statusText and normalize for non-aborts
  15920. error = statusText;
  15921. if ( status || !statusText ) {
  15922. statusText = "error";
  15923. if ( status < 0 ) {
  15924. status = 0;
  15925. }
  15926. }
  15927. }
  15928. // Set data for the fake xhr object
  15929. jqXHR.status = status;
  15930. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  15931. // Success/Error
  15932. if ( isSuccess ) {
  15933. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  15934. } else {
  15935. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  15936. }
  15937. // Status-dependent callbacks
  15938. jqXHR.statusCode( statusCode );
  15939. statusCode = undefined;
  15940. if ( fireGlobals ) {
  15941. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  15942. [ jqXHR, s, isSuccess ? success : error ] );
  15943. }
  15944. // Complete
  15945. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  15946. if ( fireGlobals ) {
  15947. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  15948. // Handle the global AJAX counter
  15949. if ( !( --jQuery.active ) ) {
  15950. jQuery.event.trigger( "ajaxStop" );
  15951. }
  15952. }
  15953. }
  15954. return jqXHR;
  15955. },
  15956. getJSON: function( url, data, callback ) {
  15957. return jQuery.get( url, data, callback, "json" );
  15958. },
  15959. getScript: function( url, callback ) {
  15960. return jQuery.get( url, undefined, callback, "script" );
  15961. }
  15962. } );
  15963. jQuery.each( [ "get", "post" ], function( i, method ) {
  15964. jQuery[ method ] = function( url, data, callback, type ) {
  15965. // Shift arguments if data argument was omitted
  15966. if ( isFunction( data ) ) {
  15967. type = type || callback;
  15968. callback = data;
  15969. data = undefined;
  15970. }
  15971. // The url can be an options object (which then must have .url)
  15972. return jQuery.ajax( jQuery.extend( {
  15973. url: url,
  15974. type: method,
  15975. dataType: type,
  15976. data: data,
  15977. success: callback
  15978. }, jQuery.isPlainObject( url ) && url ) );
  15979. };
  15980. } );
  15981. jQuery._evalUrl = function( url, options ) {
  15982. return jQuery.ajax( {
  15983. url: url,
  15984. // Make this explicit, since user can override this through ajaxSetup (#11264)
  15985. type: "GET",
  15986. dataType: "script",
  15987. cache: true,
  15988. async: false,
  15989. global: false,
  15990. // Only evaluate the response if it is successful (gh-4126)
  15991. // dataFilter is not invoked for failure responses, so using it instead
  15992. // of the default converter is kludgy but it works.
  15993. converters: {
  15994. "text script": function() {}
  15995. },
  15996. dataFilter: function( response ) {
  15997. jQuery.globalEval( response, options );
  15998. }
  15999. } );
  16000. };
  16001. jQuery.fn.extend( {
  16002. wrapAll: function( html ) {
  16003. var wrap;
  16004. if ( this[ 0 ] ) {
  16005. if ( isFunction( html ) ) {
  16006. html = html.call( this[ 0 ] );
  16007. }
  16008. // The elements to wrap the target around
  16009. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16010. if ( this[ 0 ].parentNode ) {
  16011. wrap.insertBefore( this[ 0 ] );
  16012. }
  16013. wrap.map( function() {
  16014. var elem = this;
  16015. while ( elem.firstElementChild ) {
  16016. elem = elem.firstElementChild;
  16017. }
  16018. return elem;
  16019. } ).append( this );
  16020. }
  16021. return this;
  16022. },
  16023. wrapInner: function( html ) {
  16024. if ( isFunction( html ) ) {
  16025. return this.each( function( i ) {
  16026. jQuery( this ).wrapInner( html.call( this, i ) );
  16027. } );
  16028. }
  16029. return this.each( function() {
  16030. var self = jQuery( this ),
  16031. contents = self.contents();
  16032. if ( contents.length ) {
  16033. contents.wrapAll( html );
  16034. } else {
  16035. self.append( html );
  16036. }
  16037. } );
  16038. },
  16039. wrap: function( html ) {
  16040. var htmlIsFunction = isFunction( html );
  16041. return this.each( function( i ) {
  16042. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16043. } );
  16044. },
  16045. unwrap: function( selector ) {
  16046. this.parent( selector ).not( "body" ).each( function() {
  16047. jQuery( this ).replaceWith( this.childNodes );
  16048. } );
  16049. return this;
  16050. }
  16051. } );
  16052. jQuery.expr.pseudos.hidden = function( elem ) {
  16053. return !jQuery.expr.pseudos.visible( elem );
  16054. };
  16055. jQuery.expr.pseudos.visible = function( elem ) {
  16056. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16057. };
  16058. jQuery.ajaxSettings.xhr = function() {
  16059. try {
  16060. return new window.XMLHttpRequest();
  16061. } catch ( e ) {}
  16062. };
  16063. var xhrSuccessStatus = {
  16064. // File protocol always yields status code 0, assume 200
  16065. 0: 200,
  16066. // Support: IE <=9 only
  16067. // #1450: sometimes IE returns 1223 when it should be 204
  16068. 1223: 204
  16069. },
  16070. xhrSupported = jQuery.ajaxSettings.xhr();
  16071. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16072. support.ajax = xhrSupported = !!xhrSupported;
  16073. jQuery.ajaxTransport( function( options ) {
  16074. var callback, errorCallback;
  16075. // Cross domain only allowed if supported through XMLHttpRequest
  16076. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16077. return {
  16078. send: function( headers, complete ) {
  16079. var i,
  16080. xhr = options.xhr();
  16081. xhr.open(
  16082. options.type,
  16083. options.url,
  16084. options.async,
  16085. options.username,
  16086. options.password
  16087. );
  16088. // Apply custom fields if provided
  16089. if ( options.xhrFields ) {
  16090. for ( i in options.xhrFields ) {
  16091. xhr[ i ] = options.xhrFields[ i ];
  16092. }
  16093. }
  16094. // Override mime type if needed
  16095. if ( options.mimeType && xhr.overrideMimeType ) {
  16096. xhr.overrideMimeType( options.mimeType );
  16097. }
  16098. // X-Requested-With header
  16099. // For cross-domain requests, seeing as conditions for a preflight are
  16100. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16101. // (it can always be set on a per-request basis or even using ajaxSetup)
  16102. // For same-domain requests, won't change header if already provided.
  16103. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16104. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16105. }
  16106. // Set headers
  16107. for ( i in headers ) {
  16108. xhr.setRequestHeader( i, headers[ i ] );
  16109. }
  16110. // Callback
  16111. callback = function( type ) {
  16112. return function() {
  16113. if ( callback ) {
  16114. callback = errorCallback = xhr.onload =
  16115. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16116. xhr.onreadystatechange = null;
  16117. if ( type === "abort" ) {
  16118. xhr.abort();
  16119. } else if ( type === "error" ) {
  16120. // Support: IE <=9 only
  16121. // On a manual native abort, IE9 throws
  16122. // errors on any property access that is not readyState
  16123. if ( typeof xhr.status !== "number" ) {
  16124. complete( 0, "error" );
  16125. } else {
  16126. complete(
  16127. // File: protocol always yields status 0; see #8605, #14207
  16128. xhr.status,
  16129. xhr.statusText
  16130. );
  16131. }
  16132. } else {
  16133. complete(
  16134. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16135. xhr.statusText,
  16136. // Support: IE <=9 only
  16137. // IE9 has no XHR2 but throws on binary (trac-11426)
  16138. // For XHR2 non-text, let the caller handle it (gh-2498)
  16139. ( xhr.responseType || "text" ) !== "text" ||
  16140. typeof xhr.responseText !== "string" ?
  16141. { binary: xhr.response } :
  16142. { text: xhr.responseText },
  16143. xhr.getAllResponseHeaders()
  16144. );
  16145. }
  16146. }
  16147. };
  16148. };
  16149. // Listen to events
  16150. xhr.onload = callback();
  16151. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16152. // Support: IE 9 only
  16153. // Use onreadystatechange to replace onabort
  16154. // to handle uncaught aborts
  16155. if ( xhr.onabort !== undefined ) {
  16156. xhr.onabort = errorCallback;
  16157. } else {
  16158. xhr.onreadystatechange = function() {
  16159. // Check readyState before timeout as it changes
  16160. if ( xhr.readyState === 4 ) {
  16161. // Allow onerror to be called first,
  16162. // but that will not handle a native abort
  16163. // Also, save errorCallback to a variable
  16164. // as xhr.onerror cannot be accessed
  16165. window.setTimeout( function() {
  16166. if ( callback ) {
  16167. errorCallback();
  16168. }
  16169. } );
  16170. }
  16171. };
  16172. }
  16173. // Create the abort callback
  16174. callback = callback( "abort" );
  16175. try {
  16176. // Do send the request (this may raise an exception)
  16177. xhr.send( options.hasContent && options.data || null );
  16178. } catch ( e ) {
  16179. // #14683: Only rethrow if this hasn't been notified as an error yet
  16180. if ( callback ) {
  16181. throw e;
  16182. }
  16183. }
  16184. },
  16185. abort: function() {
  16186. if ( callback ) {
  16187. callback();
  16188. }
  16189. }
  16190. };
  16191. }
  16192. } );
  16193. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16194. jQuery.ajaxPrefilter( function( s ) {
  16195. if ( s.crossDomain ) {
  16196. s.contents.script = false;
  16197. }
  16198. } );
  16199. // Install script dataType
  16200. jQuery.ajaxSetup( {
  16201. accepts: {
  16202. script: "text/javascript, application/javascript, " +
  16203. "application/ecmascript, application/x-ecmascript"
  16204. },
  16205. contents: {
  16206. script: /\b(?:java|ecma)script\b/
  16207. },
  16208. converters: {
  16209. "text script": function( text ) {
  16210. jQuery.globalEval( text );
  16211. return text;
  16212. }
  16213. }
  16214. } );
  16215. // Handle cache's special case and crossDomain
  16216. jQuery.ajaxPrefilter( "script", function( s ) {
  16217. if ( s.cache === undefined ) {
  16218. s.cache = false;
  16219. }
  16220. if ( s.crossDomain ) {
  16221. s.type = "GET";
  16222. }
  16223. } );
  16224. // Bind script tag hack transport
  16225. jQuery.ajaxTransport( "script", function( s ) {
  16226. // This transport only deals with cross domain or forced-by-attrs requests
  16227. if ( s.crossDomain || s.scriptAttrs ) {
  16228. var script, callback;
  16229. return {
  16230. send: function( _, complete ) {
  16231. script = jQuery( "<script>" )
  16232. .attr( s.scriptAttrs || {} )
  16233. .prop( { charset: s.scriptCharset, src: s.url } )
  16234. .on( "load error", callback = function( evt ) {
  16235. script.remove();
  16236. callback = null;
  16237. if ( evt ) {
  16238. complete( evt.type === "error" ? 404 : 200, evt.type );
  16239. }
  16240. } );
  16241. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16242. document.head.appendChild( script[ 0 ] );
  16243. },
  16244. abort: function() {
  16245. if ( callback ) {
  16246. callback();
  16247. }
  16248. }
  16249. };
  16250. }
  16251. } );
  16252. var oldCallbacks = [],
  16253. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16254. // Default jsonp settings
  16255. jQuery.ajaxSetup( {
  16256. jsonp: "callback",
  16257. jsonpCallback: function() {
  16258. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16259. this[ callback ] = true;
  16260. return callback;
  16261. }
  16262. } );
  16263. // Detect, normalize options and install callbacks for jsonp requests
  16264. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16265. var callbackName, overwritten, responseContainer,
  16266. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16267. "url" :
  16268. typeof s.data === "string" &&
  16269. ( s.contentType || "" )
  16270. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16271. rjsonp.test( s.data ) && "data"
  16272. );
  16273. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16274. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16275. // Get callback name, remembering preexisting value associated with it
  16276. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16277. s.jsonpCallback() :
  16278. s.jsonpCallback;
  16279. // Insert callback into url or form data
  16280. if ( jsonProp ) {
  16281. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16282. } else if ( s.jsonp !== false ) {
  16283. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16284. }
  16285. // Use data converter to retrieve json after script execution
  16286. s.converters[ "script json" ] = function() {
  16287. if ( !responseContainer ) {
  16288. jQuery.error( callbackName + " was not called" );
  16289. }
  16290. return responseContainer[ 0 ];
  16291. };
  16292. // Force json dataType
  16293. s.dataTypes[ 0 ] = "json";
  16294. // Install callback
  16295. overwritten = window[ callbackName ];
  16296. window[ callbackName ] = function() {
  16297. responseContainer = arguments;
  16298. };
  16299. // Clean-up function (fires after converters)
  16300. jqXHR.always( function() {
  16301. // If previous value didn't exist - remove it
  16302. if ( overwritten === undefined ) {
  16303. jQuery( window ).removeProp( callbackName );
  16304. // Otherwise restore preexisting value
  16305. } else {
  16306. window[ callbackName ] = overwritten;
  16307. }
  16308. // Save back as free
  16309. if ( s[ callbackName ] ) {
  16310. // Make sure that re-using the options doesn't screw things around
  16311. s.jsonpCallback = originalSettings.jsonpCallback;
  16312. // Save the callback name for future use
  16313. oldCallbacks.push( callbackName );
  16314. }
  16315. // Call if it was a function and we have a response
  16316. if ( responseContainer && isFunction( overwritten ) ) {
  16317. overwritten( responseContainer[ 0 ] );
  16318. }
  16319. responseContainer = overwritten = undefined;
  16320. } );
  16321. // Delegate to script
  16322. return "script";
  16323. }
  16324. } );
  16325. // Support: Safari 8 only
  16326. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16327. // collapse sibling forms: the second one becomes a child of the first one.
  16328. // Because of that, this security measure has to be disabled in Safari 8.
  16329. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16330. support.createHTMLDocument = ( function() {
  16331. var body = document.implementation.createHTMLDocument( "" ).body;
  16332. body.innerHTML = "<form></form><form></form>";
  16333. return body.childNodes.length === 2;
  16334. } )();
  16335. // Argument "data" should be string of html
  16336. // context (optional): If specified, the fragment will be created in this context,
  16337. // defaults to document
  16338. // keepScripts (optional): If true, will include scripts passed in the html string
  16339. jQuery.parseHTML = function( data, context, keepScripts ) {
  16340. if ( typeof data !== "string" ) {
  16341. return [];
  16342. }
  16343. if ( typeof context === "boolean" ) {
  16344. keepScripts = context;
  16345. context = false;
  16346. }
  16347. var base, parsed, scripts;
  16348. if ( !context ) {
  16349. // Stop scripts or inline event handlers from being executed immediately
  16350. // by using document.implementation
  16351. if ( support.createHTMLDocument ) {
  16352. context = document.implementation.createHTMLDocument( "" );
  16353. // Set the base href for the created document
  16354. // so any parsed elements with URLs
  16355. // are based on the document's URL (gh-2965)
  16356. base = context.createElement( "base" );
  16357. base.href = document.location.href;
  16358. context.head.appendChild( base );
  16359. } else {
  16360. context = document;
  16361. }
  16362. }
  16363. parsed = rsingleTag.exec( data );
  16364. scripts = !keepScripts && [];
  16365. // Single tag
  16366. if ( parsed ) {
  16367. return [ context.createElement( parsed[ 1 ] ) ];
  16368. }
  16369. parsed = buildFragment( [ data ], context, scripts );
  16370. if ( scripts && scripts.length ) {
  16371. jQuery( scripts ).remove();
  16372. }
  16373. return jQuery.merge( [], parsed.childNodes );
  16374. };
  16375. /**
  16376. * Load a url into a page
  16377. */
  16378. jQuery.fn.load = function( url, params, callback ) {
  16379. var selector, type, response,
  16380. self = this,
  16381. off = url.indexOf( " " );
  16382. if ( off > -1 ) {
  16383. selector = stripAndCollapse( url.slice( off ) );
  16384. url = url.slice( 0, off );
  16385. }
  16386. // If it's a function
  16387. if ( isFunction( params ) ) {
  16388. // We assume that it's the callback
  16389. callback = params;
  16390. params = undefined;
  16391. // Otherwise, build a param string
  16392. } else if ( params && typeof params === "object" ) {
  16393. type = "POST";
  16394. }
  16395. // If we have elements to modify, make the request
  16396. if ( self.length > 0 ) {
  16397. jQuery.ajax( {
  16398. url: url,
  16399. // If "type" variable is undefined, then "GET" method will be used.
  16400. // Make value of this field explicit since
  16401. // user can override it through ajaxSetup method
  16402. type: type || "GET",
  16403. dataType: "html",
  16404. data: params
  16405. } ).done( function( responseText ) {
  16406. // Save response for use in complete callback
  16407. response = arguments;
  16408. self.html( selector ?
  16409. // If a selector was specified, locate the right elements in a dummy div
  16410. // Exclude scripts to avoid IE 'Permission Denied' errors
  16411. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16412. // Otherwise use the full result
  16413. responseText );
  16414. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16415. // but they are ignored because response was set above.
  16416. // If it fails, this function gets "jqXHR", "status", "error"
  16417. } ).always( callback && function( jqXHR, status ) {
  16418. self.each( function() {
  16419. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16420. } );
  16421. } );
  16422. }
  16423. return this;
  16424. };
  16425. // Attach a bunch of functions for handling common AJAX events
  16426. jQuery.each( [
  16427. "ajaxStart",
  16428. "ajaxStop",
  16429. "ajaxComplete",
  16430. "ajaxError",
  16431. "ajaxSuccess",
  16432. "ajaxSend"
  16433. ], function( i, type ) {
  16434. jQuery.fn[ type ] = function( fn ) {
  16435. return this.on( type, fn );
  16436. };
  16437. } );
  16438. jQuery.expr.pseudos.animated = function( elem ) {
  16439. return jQuery.grep( jQuery.timers, function( fn ) {
  16440. return elem === fn.elem;
  16441. } ).length;
  16442. };
  16443. jQuery.offset = {
  16444. setOffset: function( elem, options, i ) {
  16445. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16446. position = jQuery.css( elem, "position" ),
  16447. curElem = jQuery( elem ),
  16448. props = {};
  16449. // Set position first, in-case top/left are set even on static elem
  16450. if ( position === "static" ) {
  16451. elem.style.position = "relative";
  16452. }
  16453. curOffset = curElem.offset();
  16454. curCSSTop = jQuery.css( elem, "top" );
  16455. curCSSLeft = jQuery.css( elem, "left" );
  16456. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16457. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16458. // Need to be able to calculate position if either
  16459. // top or left is auto and position is either absolute or fixed
  16460. if ( calculatePosition ) {
  16461. curPosition = curElem.position();
  16462. curTop = curPosition.top;
  16463. curLeft = curPosition.left;
  16464. } else {
  16465. curTop = parseFloat( curCSSTop ) || 0;
  16466. curLeft = parseFloat( curCSSLeft ) || 0;
  16467. }
  16468. if ( isFunction( options ) ) {
  16469. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16470. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16471. }
  16472. if ( options.top != null ) {
  16473. props.top = ( options.top - curOffset.top ) + curTop;
  16474. }
  16475. if ( options.left != null ) {
  16476. props.left = ( options.left - curOffset.left ) + curLeft;
  16477. }
  16478. if ( "using" in options ) {
  16479. options.using.call( elem, props );
  16480. } else {
  16481. curElem.css( props );
  16482. }
  16483. }
  16484. };
  16485. jQuery.fn.extend( {
  16486. // offset() relates an element's border box to the document origin
  16487. offset: function( options ) {
  16488. // Preserve chaining for setter
  16489. if ( arguments.length ) {
  16490. return options === undefined ?
  16491. this :
  16492. this.each( function( i ) {
  16493. jQuery.offset.setOffset( this, options, i );
  16494. } );
  16495. }
  16496. var rect, win,
  16497. elem = this[ 0 ];
  16498. if ( !elem ) {
  16499. return;
  16500. }
  16501. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16502. // Support: IE <=11 only
  16503. // Running getBoundingClientRect on a
  16504. // disconnected node in IE throws an error
  16505. if ( !elem.getClientRects().length ) {
  16506. return { top: 0, left: 0 };
  16507. }
  16508. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16509. rect = elem.getBoundingClientRect();
  16510. win = elem.ownerDocument.defaultView;
  16511. return {
  16512. top: rect.top + win.pageYOffset,
  16513. left: rect.left + win.pageXOffset
  16514. };
  16515. },
  16516. // position() relates an element's margin box to its offset parent's padding box
  16517. // This corresponds to the behavior of CSS absolute positioning
  16518. position: function() {
  16519. if ( !this[ 0 ] ) {
  16520. return;
  16521. }
  16522. var offsetParent, offset, doc,
  16523. elem = this[ 0 ],
  16524. parentOffset = { top: 0, left: 0 };
  16525. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16526. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16527. // Assume position:fixed implies availability of getBoundingClientRect
  16528. offset = elem.getBoundingClientRect();
  16529. } else {
  16530. offset = this.offset();
  16531. // Account for the *real* offset parent, which can be the document or its root element
  16532. // when a statically positioned element is identified
  16533. doc = elem.ownerDocument;
  16534. offsetParent = elem.offsetParent || doc.documentElement;
  16535. while ( offsetParent &&
  16536. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16537. jQuery.css( offsetParent, "position" ) === "static" ) {
  16538. offsetParent = offsetParent.parentNode;
  16539. }
  16540. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16541. // Incorporate borders into its offset, since they are outside its content origin
  16542. parentOffset = jQuery( offsetParent ).offset();
  16543. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16544. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16545. }
  16546. }
  16547. // Subtract parent offsets and element margins
  16548. return {
  16549. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16550. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16551. };
  16552. },
  16553. // This method will return documentElement in the following cases:
  16554. // 1) For the element inside the iframe without offsetParent, this method will return
  16555. // documentElement of the parent window
  16556. // 2) For the hidden or detached element
  16557. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16558. //
  16559. // but those exceptions were never presented as a real life use-cases
  16560. // and might be considered as more preferable results.
  16561. //
  16562. // This logic, however, is not guaranteed and can change at any point in the future
  16563. offsetParent: function() {
  16564. return this.map( function() {
  16565. var offsetParent = this.offsetParent;
  16566. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16567. offsetParent = offsetParent.offsetParent;
  16568. }
  16569. return offsetParent || documentElement;
  16570. } );
  16571. }
  16572. } );
  16573. // Create scrollLeft and scrollTop methods
  16574. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16575. var top = "pageYOffset" === prop;
  16576. jQuery.fn[ method ] = function( val ) {
  16577. return access( this, function( elem, method, val ) {
  16578. // Coalesce documents and windows
  16579. var win;
  16580. if ( isWindow( elem ) ) {
  16581. win = elem;
  16582. } else if ( elem.nodeType === 9 ) {
  16583. win = elem.defaultView;
  16584. }
  16585. if ( val === undefined ) {
  16586. return win ? win[ prop ] : elem[ method ];
  16587. }
  16588. if ( win ) {
  16589. win.scrollTo(
  16590. !top ? val : win.pageXOffset,
  16591. top ? val : win.pageYOffset
  16592. );
  16593. } else {
  16594. elem[ method ] = val;
  16595. }
  16596. }, method, val, arguments.length );
  16597. };
  16598. } );
  16599. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16600. // Add the top/left cssHooks using jQuery.fn.position
  16601. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16602. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16603. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16604. // rather than make the css module depend on the offset module, just check for it here
  16605. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16606. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16607. function( elem, computed ) {
  16608. if ( computed ) {
  16609. computed = curCSS( elem, prop );
  16610. // If curCSS returns percentage, fallback to offset
  16611. return rnumnonpx.test( computed ) ?
  16612. jQuery( elem ).position()[ prop ] + "px" :
  16613. computed;
  16614. }
  16615. }
  16616. );
  16617. } );
  16618. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16619. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16620. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16621. function( defaultExtra, funcName ) {
  16622. // Margin is only for outerHeight, outerWidth
  16623. jQuery.fn[ funcName ] = function( margin, value ) {
  16624. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16625. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16626. return access( this, function( elem, type, value ) {
  16627. var doc;
  16628. if ( isWindow( elem ) ) {
  16629. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16630. return funcName.indexOf( "outer" ) === 0 ?
  16631. elem[ "inner" + name ] :
  16632. elem.document.documentElement[ "client" + name ];
  16633. }
  16634. // Get document width or height
  16635. if ( elem.nodeType === 9 ) {
  16636. doc = elem.documentElement;
  16637. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16638. // whichever is greatest
  16639. return Math.max(
  16640. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16641. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16642. doc[ "client" + name ]
  16643. );
  16644. }
  16645. return value === undefined ?
  16646. // Get width or height on the element, requesting but not forcing parseFloat
  16647. jQuery.css( elem, type, extra ) :
  16648. // Set width or height on the element
  16649. jQuery.style( elem, type, value, extra );
  16650. }, type, chainable ? margin : undefined, chainable );
  16651. };
  16652. } );
  16653. } );
  16654. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16655. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16656. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16657. function( i, name ) {
  16658. // Handle event binding
  16659. jQuery.fn[ name ] = function( data, fn ) {
  16660. return arguments.length > 0 ?
  16661. this.on( name, null, data, fn ) :
  16662. this.trigger( name );
  16663. };
  16664. } );
  16665. jQuery.fn.extend( {
  16666. hover: function( fnOver, fnOut ) {
  16667. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16668. }
  16669. } );
  16670. jQuery.fn.extend( {
  16671. bind: function( types, data, fn ) {
  16672. return this.on( types, null, data, fn );
  16673. },
  16674. unbind: function( types, fn ) {
  16675. return this.off( types, null, fn );
  16676. },
  16677. delegate: function( selector, types, data, fn ) {
  16678. return this.on( types, selector, data, fn );
  16679. },
  16680. undelegate: function( selector, types, fn ) {
  16681. // ( namespace ) or ( selector, types [, fn] )
  16682. return arguments.length === 1 ?
  16683. this.off( selector, "**" ) :
  16684. this.off( types, selector || "**", fn );
  16685. }
  16686. } );
  16687. // Bind a function to a context, optionally partially applying any
  16688. // arguments.
  16689. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16690. // However, it is not slated for removal any time soon
  16691. jQuery.proxy = function( fn, context ) {
  16692. var tmp, args, proxy;
  16693. if ( typeof context === "string" ) {
  16694. tmp = fn[ context ];
  16695. context = fn;
  16696. fn = tmp;
  16697. }
  16698. // Quick check to determine if target is callable, in the spec
  16699. // this throws a TypeError, but we will just return undefined.
  16700. if ( !isFunction( fn ) ) {
  16701. return undefined;
  16702. }
  16703. // Simulated bind
  16704. args = slice.call( arguments, 2 );
  16705. proxy = function() {
  16706. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16707. };
  16708. // Set the guid of unique handler to the same of original handler, so it can be removed
  16709. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16710. return proxy;
  16711. };
  16712. jQuery.holdReady = function( hold ) {
  16713. if ( hold ) {
  16714. jQuery.readyWait++;
  16715. } else {
  16716. jQuery.ready( true );
  16717. }
  16718. };
  16719. jQuery.isArray = Array.isArray;
  16720. jQuery.parseJSON = JSON.parse;
  16721. jQuery.nodeName = nodeName;
  16722. jQuery.isFunction = isFunction;
  16723. jQuery.isWindow = isWindow;
  16724. jQuery.camelCase = camelCase;
  16725. jQuery.type = toType;
  16726. jQuery.now = Date.now;
  16727. jQuery.isNumeric = function( obj ) {
  16728. // As of jQuery 3.0, isNumeric is limited to
  16729. // strings and numbers (primitives or objects)
  16730. // that can be coerced to finite numbers (gh-2662)
  16731. var type = jQuery.type( obj );
  16732. return ( type === "number" || type === "string" ) &&
  16733. // parseFloat NaNs numeric-cast false positives ("")
  16734. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16735. // subtraction forces infinities to NaN
  16736. !isNaN( obj - parseFloat( obj ) );
  16737. };
  16738. // Register as a named AMD module, since jQuery can be concatenated with other
  16739. // files that may use define, but not via a proper concatenation script that
  16740. // understands anonymous AMD modules. A named AMD is safest and most robust
  16741. // way to register. Lowercase jquery is used because AMD module names are
  16742. // derived from file names, and jQuery is normally delivered in a lowercase
  16743. // file name. Do this after creating the global so that if an AMD module wants
  16744. // to call noConflict to hide this version of jQuery, it will work.
  16745. // Note that for maximum portability, libraries that are not jQuery should
  16746. // declare themselves as anonymous modules, and avoid setting a global if an
  16747. // AMD loader is present. jQuery is a special case. For more information, see
  16748. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16749. if ( true ) {
  16750. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16751. return jQuery;
  16752. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16753. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16754. }
  16755. var
  16756. // Map over jQuery in case of overwrite
  16757. _jQuery = window.jQuery,
  16758. // Map over the $ in case of overwrite
  16759. _$ = window.$;
  16760. jQuery.noConflict = function( deep ) {
  16761. if ( window.$ === jQuery ) {
  16762. window.$ = _$;
  16763. }
  16764. if ( deep && window.jQuery === jQuery ) {
  16765. window.jQuery = _jQuery;
  16766. }
  16767. return jQuery;
  16768. };
  16769. // Expose jQuery and $ identifiers, even in AMD
  16770. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16771. // and CommonJS for browser emulators (#13566)
  16772. if ( !noGlobal ) {
  16773. window.jQuery = window.$ = jQuery;
  16774. }
  16775. return jQuery;
  16776. } );
  16777. /***/ }),
  16778. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16779. /*!************************************************!*\
  16780. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16781. \************************************************/
  16782. /*! exports provided: default */
  16783. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16784. "use strict";
  16785. __webpack_require__.r(__webpack_exports__);
  16786. var classCallCheck = function (instance, Constructor) {
  16787. if (!(instance instanceof Constructor)) {
  16788. throw new TypeError("Cannot call a class as a function");
  16789. }
  16790. };
  16791. var createClass = function () {
  16792. function defineProperties(target, props) {
  16793. for (var i = 0; i < props.length; i++) {
  16794. var descriptor = props[i];
  16795. descriptor.enumerable = descriptor.enumerable || false;
  16796. descriptor.configurable = true;
  16797. if ("value" in descriptor) descriptor.writable = true;
  16798. Object.defineProperty(target, descriptor.key, descriptor);
  16799. }
  16800. }
  16801. return function (Constructor, protoProps, staticProps) {
  16802. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16803. if (staticProps) defineProperties(Constructor, staticProps);
  16804. return Constructor;
  16805. };
  16806. }();
  16807. var _extends = Object.assign || function (target) {
  16808. for (var i = 1; i < arguments.length; i++) {
  16809. var source = arguments[i];
  16810. for (var key in source) {
  16811. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16812. target[key] = source[key];
  16813. }
  16814. }
  16815. }
  16816. return target;
  16817. };
  16818. var inherits = function (subClass, superClass) {
  16819. if (typeof superClass !== "function" && superClass !== null) {
  16820. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16821. }
  16822. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16823. constructor: {
  16824. value: subClass,
  16825. enumerable: false,
  16826. writable: true,
  16827. configurable: true
  16828. }
  16829. });
  16830. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16831. };
  16832. var possibleConstructorReturn = function (self, call) {
  16833. if (!self) {
  16834. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16835. }
  16836. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16837. };
  16838. var Connector = function () {
  16839. /**
  16840. * Create a new class instance.
  16841. */
  16842. function Connector(options) {
  16843. classCallCheck(this, Connector);
  16844. /**
  16845. * Default connector options.
  16846. */
  16847. this._defaultOptions = {
  16848. auth: {
  16849. headers: {}
  16850. },
  16851. authEndpoint: '/broadcasting/auth',
  16852. broadcaster: 'pusher',
  16853. csrfToken: null,
  16854. host: null,
  16855. key: null,
  16856. namespace: 'App.Events'
  16857. };
  16858. this.setOptions(options);
  16859. this.connect();
  16860. }
  16861. /**
  16862. * Merge the custom options with the defaults.
  16863. */
  16864. createClass(Connector, [{
  16865. key: 'setOptions',
  16866. value: function setOptions(options) {
  16867. this.options = _extends(this._defaultOptions, options);
  16868. if (this.csrfToken()) {
  16869. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16870. }
  16871. return options;
  16872. }
  16873. /**
  16874. * Extract the CSRF token from the page.
  16875. */
  16876. }, {
  16877. key: 'csrfToken',
  16878. value: function csrfToken() {
  16879. var selector = void 0;
  16880. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16881. return window['Laravel'].csrfToken;
  16882. } else if (this.options.csrfToken) {
  16883. return this.options.csrfToken;
  16884. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16885. return selector.getAttribute('content');
  16886. }
  16887. return null;
  16888. }
  16889. }]);
  16890. return Connector;
  16891. }();
  16892. /**
  16893. * This class represents a basic channel.
  16894. */
  16895. var Channel = function () {
  16896. function Channel() {
  16897. classCallCheck(this, Channel);
  16898. }
  16899. createClass(Channel, [{
  16900. key: 'listenForWhisper',
  16901. /**
  16902. * Listen for a whisper event on the channel instance.
  16903. */
  16904. value: function listenForWhisper(event, callback) {
  16905. return this.listen('.client-' + event, callback);
  16906. }
  16907. /**
  16908. * Listen for an event on the channel instance.
  16909. */
  16910. }, {
  16911. key: 'notification',
  16912. value: function notification(callback) {
  16913. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  16914. }
  16915. /**
  16916. * Stop listening for a whispser event on the channel instance.
  16917. */
  16918. }, {
  16919. key: 'stopListeningForWhisper',
  16920. value: function stopListeningForWhisper(event) {
  16921. return this.stopListening('.client-' + event);
  16922. }
  16923. }]);
  16924. return Channel;
  16925. }();
  16926. /**
  16927. * Event name formatter
  16928. */
  16929. var EventFormatter = function () {
  16930. /**
  16931. * Create a new class instance.
  16932. */
  16933. function EventFormatter(namespace) {
  16934. classCallCheck(this, EventFormatter);
  16935. this.setNamespace(namespace);
  16936. }
  16937. /**
  16938. * Format the given event name.
  16939. */
  16940. createClass(EventFormatter, [{
  16941. key: 'format',
  16942. value: function format(event) {
  16943. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  16944. return event.substr(1);
  16945. } else if (this.namespace) {
  16946. event = this.namespace + '.' + event;
  16947. }
  16948. return event.replace(/\./g, '\\');
  16949. }
  16950. /**
  16951. * Set the event namespace.
  16952. */
  16953. }, {
  16954. key: 'setNamespace',
  16955. value: function setNamespace(value) {
  16956. this.namespace = value;
  16957. }
  16958. }]);
  16959. return EventFormatter;
  16960. }();
  16961. /**
  16962. * This class represents a Pusher channel.
  16963. */
  16964. var PusherChannel = function (_Channel) {
  16965. inherits(PusherChannel, _Channel);
  16966. /**
  16967. * Create a new class instance.
  16968. */
  16969. function PusherChannel(pusher, name, options) {
  16970. classCallCheck(this, PusherChannel);
  16971. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  16972. _this.name = name;
  16973. _this.pusher = pusher;
  16974. _this.options = options;
  16975. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  16976. _this.subscribe();
  16977. return _this;
  16978. }
  16979. /**
  16980. * Subscribe to a Pusher channel.
  16981. */
  16982. createClass(PusherChannel, [{
  16983. key: 'subscribe',
  16984. value: function subscribe() {
  16985. this.subscription = this.pusher.subscribe(this.name);
  16986. }
  16987. /**
  16988. * Unsubscribe from a Pusher channel.
  16989. */
  16990. }, {
  16991. key: 'unsubscribe',
  16992. value: function unsubscribe() {
  16993. this.pusher.unsubscribe(this.name);
  16994. }
  16995. /**
  16996. * Listen for an event on the channel instance.
  16997. */
  16998. }, {
  16999. key: 'listen',
  17000. value: function listen(event, callback) {
  17001. this.on(this.eventFormatter.format(event), callback);
  17002. return this;
  17003. }
  17004. /**
  17005. * Stop listening for an event on the channel instance.
  17006. */
  17007. }, {
  17008. key: 'stopListening',
  17009. value: function stopListening(event) {
  17010. this.subscription.unbind(this.eventFormatter.format(event));
  17011. return this;
  17012. }
  17013. /**
  17014. * Bind a channel to an event.
  17015. */
  17016. }, {
  17017. key: 'on',
  17018. value: function on(event, callback) {
  17019. this.subscription.bind(event, callback);
  17020. return this;
  17021. }
  17022. }]);
  17023. return PusherChannel;
  17024. }(Channel);
  17025. /**
  17026. * This class represents a Pusher private channel.
  17027. */
  17028. var PusherPrivateChannel = function (_PusherChannel) {
  17029. inherits(PusherPrivateChannel, _PusherChannel);
  17030. function PusherPrivateChannel() {
  17031. classCallCheck(this, PusherPrivateChannel);
  17032. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17033. }
  17034. createClass(PusherPrivateChannel, [{
  17035. key: 'whisper',
  17036. /**
  17037. * Trigger client event on the channel.
  17038. */
  17039. value: function whisper(eventName, data) {
  17040. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17041. return this;
  17042. }
  17043. }]);
  17044. return PusherPrivateChannel;
  17045. }(PusherChannel);
  17046. /**
  17047. * This class represents a Pusher presence channel.
  17048. */
  17049. var PusherPresenceChannel = function (_PusherChannel) {
  17050. inherits(PusherPresenceChannel, _PusherChannel);
  17051. function PusherPresenceChannel() {
  17052. classCallCheck(this, PusherPresenceChannel);
  17053. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17054. }
  17055. createClass(PusherPresenceChannel, [{
  17056. key: 'here',
  17057. /**
  17058. * Register a callback to be called anytime the member list changes.
  17059. */
  17060. value: function here(callback) {
  17061. this.on('pusher:subscription_succeeded', function (data) {
  17062. callback(Object.keys(data.members).map(function (k) {
  17063. return data.members[k];
  17064. }));
  17065. });
  17066. return this;
  17067. }
  17068. /**
  17069. * Listen for someone joining the channel.
  17070. */
  17071. }, {
  17072. key: 'joining',
  17073. value: function joining(callback) {
  17074. this.on('pusher:member_added', function (member) {
  17075. callback(member.info);
  17076. });
  17077. return this;
  17078. }
  17079. /**
  17080. * Listen for someone leaving the channel.
  17081. */
  17082. }, {
  17083. key: 'leaving',
  17084. value: function leaving(callback) {
  17085. this.on('pusher:member_removed', function (member) {
  17086. callback(member.info);
  17087. });
  17088. return this;
  17089. }
  17090. /**
  17091. * Trigger client event on the channel.
  17092. */
  17093. }, {
  17094. key: 'whisper',
  17095. value: function whisper(eventName, data) {
  17096. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17097. return this;
  17098. }
  17099. }]);
  17100. return PusherPresenceChannel;
  17101. }(PusherChannel);
  17102. /**
  17103. * This class represents a Socket.io channel.
  17104. */
  17105. var SocketIoChannel = function (_Channel) {
  17106. inherits(SocketIoChannel, _Channel);
  17107. /**
  17108. * Create a new class instance.
  17109. */
  17110. function SocketIoChannel(socket, name, options) {
  17111. classCallCheck(this, SocketIoChannel);
  17112. /**
  17113. * The event callbacks applied to the channel.
  17114. */
  17115. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17116. _this.events = {};
  17117. _this.name = name;
  17118. _this.socket = socket;
  17119. _this.options = options;
  17120. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17121. _this.subscribe();
  17122. _this.configureReconnector();
  17123. return _this;
  17124. }
  17125. /**
  17126. * Subscribe to a Socket.io channel.
  17127. */
  17128. createClass(SocketIoChannel, [{
  17129. key: 'subscribe',
  17130. value: function subscribe() {
  17131. this.socket.emit('subscribe', {
  17132. channel: this.name,
  17133. auth: this.options.auth || {}
  17134. });
  17135. }
  17136. /**
  17137. * Unsubscribe from channel and ubind event callbacks.
  17138. */
  17139. }, {
  17140. key: 'unsubscribe',
  17141. value: function unsubscribe() {
  17142. this.unbind();
  17143. this.socket.emit('unsubscribe', {
  17144. channel: this.name,
  17145. auth: this.options.auth || {}
  17146. });
  17147. }
  17148. /**
  17149. * Listen for an event on the channel instance.
  17150. */
  17151. }, {
  17152. key: 'listen',
  17153. value: function listen(event, callback) {
  17154. this.on(this.eventFormatter.format(event), callback);
  17155. return this;
  17156. }
  17157. /**
  17158. * Stop listening for an event on the channel instance.
  17159. */
  17160. }, {
  17161. key: 'stopListening',
  17162. value: function stopListening(event) {
  17163. var name = this.eventFormatter.format(event);
  17164. this.socket.removeListener(name);
  17165. delete this.events[name];
  17166. return this;
  17167. }
  17168. /**
  17169. * Bind the channel's socket to an event and store the callback.
  17170. */
  17171. }, {
  17172. key: 'on',
  17173. value: function on(event, callback) {
  17174. var _this2 = this;
  17175. var listener = function listener(channel, data) {
  17176. if (_this2.name == channel) {
  17177. callback(data);
  17178. }
  17179. };
  17180. this.socket.on(event, listener);
  17181. this.bind(event, listener);
  17182. }
  17183. /**
  17184. * Attach a 'reconnect' listener and bind the event.
  17185. */
  17186. }, {
  17187. key: 'configureReconnector',
  17188. value: function configureReconnector() {
  17189. var _this3 = this;
  17190. var listener = function listener() {
  17191. _this3.subscribe();
  17192. };
  17193. this.socket.on('reconnect', listener);
  17194. this.bind('reconnect', listener);
  17195. }
  17196. /**
  17197. * Bind the channel's socket to an event and store the callback.
  17198. */
  17199. }, {
  17200. key: 'bind',
  17201. value: function bind(event, callback) {
  17202. this.events[event] = this.events[event] || [];
  17203. this.events[event].push(callback);
  17204. }
  17205. /**
  17206. * Unbind the channel's socket from all stored event callbacks.
  17207. */
  17208. }, {
  17209. key: 'unbind',
  17210. value: function unbind() {
  17211. var _this4 = this;
  17212. Object.keys(this.events).forEach(function (event) {
  17213. _this4.events[event].forEach(function (callback) {
  17214. _this4.socket.removeListener(event, callback);
  17215. });
  17216. delete _this4.events[event];
  17217. });
  17218. }
  17219. }]);
  17220. return SocketIoChannel;
  17221. }(Channel);
  17222. /**
  17223. * This class represents a Socket.io presence channel.
  17224. */
  17225. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17226. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17227. function SocketIoPrivateChannel() {
  17228. classCallCheck(this, SocketIoPrivateChannel);
  17229. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17230. }
  17231. createClass(SocketIoPrivateChannel, [{
  17232. key: 'whisper',
  17233. /**
  17234. * Trigger client event on the channel.
  17235. */
  17236. value: function whisper(eventName, data) {
  17237. this.socket.emit('client event', {
  17238. channel: this.name,
  17239. event: 'client-' + eventName,
  17240. data: data
  17241. });
  17242. return this;
  17243. }
  17244. }]);
  17245. return SocketIoPrivateChannel;
  17246. }(SocketIoChannel);
  17247. /**
  17248. * This class represents a Socket.io presence channel.
  17249. */
  17250. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17251. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17252. function SocketIoPresenceChannel() {
  17253. classCallCheck(this, SocketIoPresenceChannel);
  17254. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17255. }
  17256. createClass(SocketIoPresenceChannel, [{
  17257. key: 'here',
  17258. /**
  17259. * Register a callback to be called anytime the member list changes.
  17260. */
  17261. value: function here(callback) {
  17262. this.on('presence:subscribed', function (members) {
  17263. callback(members.map(function (m) {
  17264. return m.user_info;
  17265. }));
  17266. });
  17267. return this;
  17268. }
  17269. /**
  17270. * Listen for someone joining the channel.
  17271. */
  17272. }, {
  17273. key: 'joining',
  17274. value: function joining(callback) {
  17275. this.on('presence:joining', function (member) {
  17276. return callback(member.user_info);
  17277. });
  17278. return this;
  17279. }
  17280. /**
  17281. * Listen for someone leaving the channel.
  17282. */
  17283. }, {
  17284. key: 'leaving',
  17285. value: function leaving(callback) {
  17286. this.on('presence:leaving', function (member) {
  17287. return callback(member.user_info);
  17288. });
  17289. return this;
  17290. }
  17291. }]);
  17292. return SocketIoPresenceChannel;
  17293. }(SocketIoPrivateChannel);
  17294. /**
  17295. * This class represents a null channel.
  17296. */
  17297. var NullChannel = function (_Channel) {
  17298. inherits(NullChannel, _Channel);
  17299. function NullChannel() {
  17300. classCallCheck(this, NullChannel);
  17301. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17302. }
  17303. createClass(NullChannel, [{
  17304. key: 'subscribe',
  17305. /**
  17306. * Subscribe to a channel.
  17307. */
  17308. value: function subscribe() {}
  17309. //
  17310. /**
  17311. * Unsubscribe from a channel.
  17312. */
  17313. }, {
  17314. key: 'unsubscribe',
  17315. value: function unsubscribe() {}
  17316. //
  17317. /**
  17318. * Listen for an event on the channel instance.
  17319. */
  17320. }, {
  17321. key: 'listen',
  17322. value: function listen(event, callback) {
  17323. return this;
  17324. }
  17325. /**
  17326. * Stop listening for an event on the channel instance.
  17327. */
  17328. }, {
  17329. key: 'stopListening',
  17330. value: function stopListening(event) {
  17331. return this;
  17332. }
  17333. /**
  17334. * Bind a channel to an event.
  17335. */
  17336. }, {
  17337. key: 'on',
  17338. value: function on(event, callback) {
  17339. return this;
  17340. }
  17341. }]);
  17342. return NullChannel;
  17343. }(Channel);
  17344. /**
  17345. * This class represents a null private channel.
  17346. */
  17347. var NullPrivateChannel = function (_NullChannel) {
  17348. inherits(NullPrivateChannel, _NullChannel);
  17349. function NullPrivateChannel() {
  17350. classCallCheck(this, NullPrivateChannel);
  17351. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17352. }
  17353. createClass(NullPrivateChannel, [{
  17354. key: 'whisper',
  17355. /**
  17356. * Trigger client event on the channel.
  17357. */
  17358. value: function whisper(eventName, data) {
  17359. return this;
  17360. }
  17361. }]);
  17362. return NullPrivateChannel;
  17363. }(NullChannel);
  17364. /**
  17365. * This class represents a null presence channel.
  17366. */
  17367. var NullPresenceChannel = function (_NullChannel) {
  17368. inherits(NullPresenceChannel, _NullChannel);
  17369. function NullPresenceChannel() {
  17370. classCallCheck(this, NullPresenceChannel);
  17371. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17372. }
  17373. createClass(NullPresenceChannel, [{
  17374. key: 'here',
  17375. /**
  17376. * Register a callback to be called anytime the member list changes.
  17377. */
  17378. value: function here(callback) {
  17379. return this;
  17380. }
  17381. /**
  17382. * Listen for someone joining the channel.
  17383. */
  17384. }, {
  17385. key: 'joining',
  17386. value: function joining(callback) {
  17387. return this;
  17388. }
  17389. /**
  17390. * Listen for someone leaving the channel.
  17391. */
  17392. }, {
  17393. key: 'leaving',
  17394. value: function leaving(callback) {
  17395. return this;
  17396. }
  17397. /**
  17398. * Trigger client event on the channel.
  17399. */
  17400. }, {
  17401. key: 'whisper',
  17402. value: function whisper(eventName, data) {
  17403. return this;
  17404. }
  17405. }]);
  17406. return NullPresenceChannel;
  17407. }(NullChannel);
  17408. /**
  17409. * This class creates a connector to Pusher.
  17410. */
  17411. var PusherConnector = function (_Connector) {
  17412. inherits(PusherConnector, _Connector);
  17413. function PusherConnector() {
  17414. classCallCheck(this, PusherConnector);
  17415. /**
  17416. * All of the subscribed channel names.
  17417. */
  17418. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17419. _this.channels = {};
  17420. return _this;
  17421. }
  17422. /**
  17423. * Create a fresh Pusher connection.
  17424. */
  17425. createClass(PusherConnector, [{
  17426. key: 'connect',
  17427. value: function connect() {
  17428. if (typeof this.options.client !== 'undefined') {
  17429. this.pusher = this.options.client;
  17430. } else {
  17431. this.pusher = new Pusher(this.options.key, this.options);
  17432. }
  17433. }
  17434. /**
  17435. * Listen for an event on a channel instance.
  17436. */
  17437. }, {
  17438. key: 'listen',
  17439. value: function listen(name, event, callback) {
  17440. return this.channel(name).listen(event, callback);
  17441. }
  17442. /**
  17443. * Get a channel instance by name.
  17444. */
  17445. }, {
  17446. key: 'channel',
  17447. value: function channel(name) {
  17448. if (!this.channels[name]) {
  17449. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17450. }
  17451. return this.channels[name];
  17452. }
  17453. /**
  17454. * Get a private channel instance by name.
  17455. */
  17456. }, {
  17457. key: 'privateChannel',
  17458. value: function privateChannel(name) {
  17459. if (!this.channels['private-' + name]) {
  17460. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17461. }
  17462. return this.channels['private-' + name];
  17463. }
  17464. /**
  17465. * Get a presence channel instance by name.
  17466. */
  17467. }, {
  17468. key: 'presenceChannel',
  17469. value: function presenceChannel(name) {
  17470. if (!this.channels['presence-' + name]) {
  17471. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17472. }
  17473. return this.channels['presence-' + name];
  17474. }
  17475. /**
  17476. * Leave the given channel, as well as its private and presence variants.
  17477. */
  17478. }, {
  17479. key: 'leave',
  17480. value: function leave(name) {
  17481. var _this2 = this;
  17482. var channels = [name, 'private-' + name, 'presence-' + name];
  17483. channels.forEach(function (name, index) {
  17484. _this2.leaveChannel(name);
  17485. });
  17486. }
  17487. /**
  17488. * Leave the given channel.
  17489. */
  17490. }, {
  17491. key: 'leaveChannel',
  17492. value: function leaveChannel(name) {
  17493. if (this.channels[name]) {
  17494. this.channels[name].unsubscribe();
  17495. delete this.channels[name];
  17496. }
  17497. }
  17498. /**
  17499. * Get the socket ID for the connection.
  17500. */
  17501. }, {
  17502. key: 'socketId',
  17503. value: function socketId() {
  17504. return this.pusher.connection.socket_id;
  17505. }
  17506. /**
  17507. * Disconnect Pusher connection.
  17508. */
  17509. }, {
  17510. key: 'disconnect',
  17511. value: function disconnect() {
  17512. this.pusher.disconnect();
  17513. }
  17514. }]);
  17515. return PusherConnector;
  17516. }(Connector);
  17517. /**
  17518. * This class creates a connnector to a Socket.io server.
  17519. */
  17520. var SocketIoConnector = function (_Connector) {
  17521. inherits(SocketIoConnector, _Connector);
  17522. function SocketIoConnector() {
  17523. classCallCheck(this, SocketIoConnector);
  17524. /**
  17525. * All of the subscribed channel names.
  17526. */
  17527. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17528. _this.channels = {};
  17529. return _this;
  17530. }
  17531. /**
  17532. * Create a fresh Socket.io connection.
  17533. */
  17534. createClass(SocketIoConnector, [{
  17535. key: 'connect',
  17536. value: function connect() {
  17537. var io = this.getSocketIO();
  17538. this.socket = io(this.options.host, this.options);
  17539. return this.socket;
  17540. }
  17541. /**
  17542. * Get socket.io module from global scope or options.
  17543. */
  17544. }, {
  17545. key: 'getSocketIO',
  17546. value: function getSocketIO() {
  17547. if (typeof this.options.client !== 'undefined') {
  17548. return this.options.client;
  17549. }
  17550. if (typeof io !== 'undefined') {
  17551. return io;
  17552. }
  17553. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17554. }
  17555. /**
  17556. * Listen for an event on a channel instance.
  17557. */
  17558. }, {
  17559. key: 'listen',
  17560. value: function listen(name, event, callback) {
  17561. return this.channel(name).listen(event, callback);
  17562. }
  17563. /**
  17564. * Get a channel instance by name.
  17565. */
  17566. }, {
  17567. key: 'channel',
  17568. value: function channel(name) {
  17569. if (!this.channels[name]) {
  17570. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17571. }
  17572. return this.channels[name];
  17573. }
  17574. /**
  17575. * Get a private channel instance by name.
  17576. */
  17577. }, {
  17578. key: 'privateChannel',
  17579. value: function privateChannel(name) {
  17580. if (!this.channels['private-' + name]) {
  17581. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17582. }
  17583. return this.channels['private-' + name];
  17584. }
  17585. /**
  17586. * Get a presence channel instance by name.
  17587. */
  17588. }, {
  17589. key: 'presenceChannel',
  17590. value: function presenceChannel(name) {
  17591. if (!this.channels['presence-' + name]) {
  17592. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17593. }
  17594. return this.channels['presence-' + name];
  17595. }
  17596. /**
  17597. * Leave the given channel, as well as its private and presence variants.
  17598. */
  17599. }, {
  17600. key: 'leave',
  17601. value: function leave(name) {
  17602. var _this2 = this;
  17603. var channels = [name, 'private-' + name, 'presence-' + name];
  17604. channels.forEach(function (name) {
  17605. _this2.leaveChannel(name);
  17606. });
  17607. }
  17608. /**
  17609. * Leave the given channel.
  17610. */
  17611. }, {
  17612. key: 'leaveChannel',
  17613. value: function leaveChannel(name) {
  17614. if (this.channels[name]) {
  17615. this.channels[name].unsubscribe();
  17616. delete this.channels[name];
  17617. }
  17618. }
  17619. /**
  17620. * Get the socket ID for the connection.
  17621. */
  17622. }, {
  17623. key: 'socketId',
  17624. value: function socketId() {
  17625. return this.socket.id;
  17626. }
  17627. /**
  17628. * Disconnect Socketio connection.
  17629. */
  17630. }, {
  17631. key: 'disconnect',
  17632. value: function disconnect() {
  17633. this.socket.disconnect();
  17634. }
  17635. }]);
  17636. return SocketIoConnector;
  17637. }(Connector);
  17638. /**
  17639. * This class creates a null connector.
  17640. */
  17641. var NullConnector = function (_Connector) {
  17642. inherits(NullConnector, _Connector);
  17643. function NullConnector() {
  17644. classCallCheck(this, NullConnector);
  17645. /**
  17646. * All of the subscribed channel names.
  17647. */
  17648. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17649. _this.channels = {};
  17650. return _this;
  17651. }
  17652. /**
  17653. * Create a fresh connection.
  17654. */
  17655. createClass(NullConnector, [{
  17656. key: 'connect',
  17657. value: function connect() {}
  17658. //
  17659. /**
  17660. * Listen for an event on a channel instance.
  17661. */
  17662. }, {
  17663. key: 'listen',
  17664. value: function listen(name, event, callback) {
  17665. return new NullChannel();
  17666. }
  17667. /**
  17668. * Get a channel instance by name.
  17669. */
  17670. }, {
  17671. key: 'channel',
  17672. value: function channel(name) {
  17673. return new NullChannel();
  17674. }
  17675. /**
  17676. * Get a private channel instance by name.
  17677. */
  17678. }, {
  17679. key: 'privateChannel',
  17680. value: function privateChannel(name) {
  17681. return new NullPrivateChannel();
  17682. }
  17683. /**
  17684. * Get a presence channel instance by name.
  17685. */
  17686. }, {
  17687. key: 'presenceChannel',
  17688. value: function presenceChannel(name) {
  17689. return new NullPresenceChannel();
  17690. }
  17691. /**
  17692. * Leave the given channel, as well as its private and presence variants.
  17693. */
  17694. }, {
  17695. key: 'leave',
  17696. value: function leave(name) {}
  17697. //
  17698. /**
  17699. * Leave the given channel.
  17700. */
  17701. }, {
  17702. key: 'leaveChannel',
  17703. value: function leaveChannel(name) {}
  17704. //
  17705. /**
  17706. * Get the socket ID for the connection.
  17707. */
  17708. }, {
  17709. key: 'socketId',
  17710. value: function socketId() {
  17711. return 'fake-socket-id';
  17712. }
  17713. /**
  17714. * Disconnect the connection.
  17715. */
  17716. }, {
  17717. key: 'disconnect',
  17718. value: function disconnect() {
  17719. //
  17720. }
  17721. }]);
  17722. return NullConnector;
  17723. }(Connector);
  17724. /**
  17725. * This class is the primary API for interacting with broadcasting.
  17726. */
  17727. var Echo = function () {
  17728. /**
  17729. * Create a new class instance.
  17730. */
  17731. function Echo(options) {
  17732. classCallCheck(this, Echo);
  17733. this.options = options;
  17734. this.connect();
  17735. if (!this.options.withoutInterceptors) {
  17736. this.registerInterceptors();
  17737. }
  17738. }
  17739. /**
  17740. * Get a channel instance by name.
  17741. */
  17742. createClass(Echo, [{
  17743. key: 'channel',
  17744. value: function channel(_channel) {
  17745. return this.connector.channel(_channel);
  17746. }
  17747. /**
  17748. * Create a new connection.
  17749. */
  17750. }, {
  17751. key: 'connect',
  17752. value: function connect() {
  17753. if (this.options.broadcaster == 'pusher') {
  17754. this.connector = new PusherConnector(this.options);
  17755. } else if (this.options.broadcaster == 'socket.io') {
  17756. this.connector = new SocketIoConnector(this.options);
  17757. } else if (this.options.broadcaster == 'null') {
  17758. this.connector = new NullConnector(this.options);
  17759. } else if (typeof this.options.broadcaster == 'function') {
  17760. this.connector = new this.options.broadcaster(this.options);
  17761. }
  17762. }
  17763. /**
  17764. * Disconnect from the Echo server.
  17765. */
  17766. }, {
  17767. key: 'disconnect',
  17768. value: function disconnect() {
  17769. this.connector.disconnect();
  17770. }
  17771. /**
  17772. * Get a presence channel instance by name.
  17773. */
  17774. }, {
  17775. key: 'join',
  17776. value: function join(channel) {
  17777. return this.connector.presenceChannel(channel);
  17778. }
  17779. /**
  17780. * Leave the given channel, as well as its private and presence variants.
  17781. */
  17782. }, {
  17783. key: 'leave',
  17784. value: function leave(channel) {
  17785. this.connector.leave(channel);
  17786. }
  17787. /**
  17788. * Leave the given channel.
  17789. */
  17790. }, {
  17791. key: 'leaveChannel',
  17792. value: function leaveChannel(channel) {
  17793. this.connector.leaveChannel(channel);
  17794. }
  17795. /**
  17796. * Listen for an event on a channel instance.
  17797. */
  17798. }, {
  17799. key: 'listen',
  17800. value: function listen(channel, event, callback) {
  17801. return this.connector.listen(channel, event, callback);
  17802. }
  17803. /**
  17804. * Get a private channel instance by name.
  17805. */
  17806. }, {
  17807. key: 'private',
  17808. value: function _private(channel) {
  17809. return this.connector.privateChannel(channel);
  17810. }
  17811. /**
  17812. * Get the Socket ID for the connection.
  17813. */
  17814. }, {
  17815. key: 'socketId',
  17816. value: function socketId() {
  17817. return this.connector.socketId();
  17818. }
  17819. /**
  17820. * Register 3rd party request interceptiors. These are used to automatically
  17821. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17822. */
  17823. }, {
  17824. key: 'registerInterceptors',
  17825. value: function registerInterceptors() {
  17826. if (typeof Vue === 'function' && Vue.http) {
  17827. this.registerVueRequestInterceptor();
  17828. }
  17829. if (typeof axios === 'function') {
  17830. this.registerAxiosRequestInterceptor();
  17831. }
  17832. if (typeof jQuery === 'function') {
  17833. this.registerjQueryAjaxSetup();
  17834. }
  17835. }
  17836. /**
  17837. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17838. */
  17839. }, {
  17840. key: 'registerVueRequestInterceptor',
  17841. value: function registerVueRequestInterceptor() {
  17842. var _this = this;
  17843. Vue.http.interceptors.push(function (request, next) {
  17844. if (_this.socketId()) {
  17845. request.headers.set('X-Socket-ID', _this.socketId());
  17846. }
  17847. next();
  17848. });
  17849. }
  17850. /**
  17851. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17852. */
  17853. }, {
  17854. key: 'registerAxiosRequestInterceptor',
  17855. value: function registerAxiosRequestInterceptor() {
  17856. var _this2 = this;
  17857. axios.interceptors.request.use(function (config) {
  17858. if (_this2.socketId()) {
  17859. config.headers['X-Socket-Id'] = _this2.socketId();
  17860. }
  17861. return config;
  17862. });
  17863. }
  17864. /**
  17865. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17866. */
  17867. }, {
  17868. key: 'registerjQueryAjaxSetup',
  17869. value: function registerjQueryAjaxSetup() {
  17870. var _this3 = this;
  17871. if (typeof jQuery.ajax != 'undefined') {
  17872. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17873. if (_this3.socketId()) {
  17874. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17875. }
  17876. });
  17877. }
  17878. }
  17879. }]);
  17880. return Echo;
  17881. }();
  17882. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17883. /***/ }),
  17884. /***/ "./node_modules/lodash/lodash.js":
  17885. /*!***************************************!*\
  17886. !*** ./node_modules/lodash/lodash.js ***!
  17887. \***************************************/
  17888. /*! no static exports found */
  17889. /***/ (function(module, exports, __webpack_require__) {
  17890. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17891. * @license
  17892. * Lodash <https://lodash.com/>
  17893. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17894. * Released under MIT license <https://lodash.com/license>
  17895. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17896. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17897. */
  17898. ;(function() {
  17899. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17900. var undefined;
  17901. /** Used as the semantic version number. */
  17902. var VERSION = '4.17.15';
  17903. /** Used as the size to enable large array optimizations. */
  17904. var LARGE_ARRAY_SIZE = 200;
  17905. /** Error message constants. */
  17906. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17907. FUNC_ERROR_TEXT = 'Expected a function';
  17908. /** Used to stand-in for `undefined` hash values. */
  17909. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  17910. /** Used as the maximum memoize cache size. */
  17911. var MAX_MEMOIZE_SIZE = 500;
  17912. /** Used as the internal argument placeholder. */
  17913. var PLACEHOLDER = '__lodash_placeholder__';
  17914. /** Used to compose bitmasks for cloning. */
  17915. var CLONE_DEEP_FLAG = 1,
  17916. CLONE_FLAT_FLAG = 2,
  17917. CLONE_SYMBOLS_FLAG = 4;
  17918. /** Used to compose bitmasks for value comparisons. */
  17919. var COMPARE_PARTIAL_FLAG = 1,
  17920. COMPARE_UNORDERED_FLAG = 2;
  17921. /** Used to compose bitmasks for function metadata. */
  17922. var WRAP_BIND_FLAG = 1,
  17923. WRAP_BIND_KEY_FLAG = 2,
  17924. WRAP_CURRY_BOUND_FLAG = 4,
  17925. WRAP_CURRY_FLAG = 8,
  17926. WRAP_CURRY_RIGHT_FLAG = 16,
  17927. WRAP_PARTIAL_FLAG = 32,
  17928. WRAP_PARTIAL_RIGHT_FLAG = 64,
  17929. WRAP_ARY_FLAG = 128,
  17930. WRAP_REARG_FLAG = 256,
  17931. WRAP_FLIP_FLAG = 512;
  17932. /** Used as default options for `_.truncate`. */
  17933. var DEFAULT_TRUNC_LENGTH = 30,
  17934. DEFAULT_TRUNC_OMISSION = '...';
  17935. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  17936. var HOT_COUNT = 800,
  17937. HOT_SPAN = 16;
  17938. /** Used to indicate the type of lazy iteratees. */
  17939. var LAZY_FILTER_FLAG = 1,
  17940. LAZY_MAP_FLAG = 2,
  17941. LAZY_WHILE_FLAG = 3;
  17942. /** Used as references for various `Number` constants. */
  17943. var INFINITY = 1 / 0,
  17944. MAX_SAFE_INTEGER = 9007199254740991,
  17945. MAX_INTEGER = 1.7976931348623157e+308,
  17946. NAN = 0 / 0;
  17947. /** Used as references for the maximum length and index of an array. */
  17948. var MAX_ARRAY_LENGTH = 4294967295,
  17949. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  17950. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  17951. /** Used to associate wrap methods with their bit flags. */
  17952. var wrapFlags = [
  17953. ['ary', WRAP_ARY_FLAG],
  17954. ['bind', WRAP_BIND_FLAG],
  17955. ['bindKey', WRAP_BIND_KEY_FLAG],
  17956. ['curry', WRAP_CURRY_FLAG],
  17957. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  17958. ['flip', WRAP_FLIP_FLAG],
  17959. ['partial', WRAP_PARTIAL_FLAG],
  17960. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  17961. ['rearg', WRAP_REARG_FLAG]
  17962. ];
  17963. /** `Object#toString` result references. */
  17964. var argsTag = '[object Arguments]',
  17965. arrayTag = '[object Array]',
  17966. asyncTag = '[object AsyncFunction]',
  17967. boolTag = '[object Boolean]',
  17968. dateTag = '[object Date]',
  17969. domExcTag = '[object DOMException]',
  17970. errorTag = '[object Error]',
  17971. funcTag = '[object Function]',
  17972. genTag = '[object GeneratorFunction]',
  17973. mapTag = '[object Map]',
  17974. numberTag = '[object Number]',
  17975. nullTag = '[object Null]',
  17976. objectTag = '[object Object]',
  17977. promiseTag = '[object Promise]',
  17978. proxyTag = '[object Proxy]',
  17979. regexpTag = '[object RegExp]',
  17980. setTag = '[object Set]',
  17981. stringTag = '[object String]',
  17982. symbolTag = '[object Symbol]',
  17983. undefinedTag = '[object Undefined]',
  17984. weakMapTag = '[object WeakMap]',
  17985. weakSetTag = '[object WeakSet]';
  17986. var arrayBufferTag = '[object ArrayBuffer]',
  17987. dataViewTag = '[object DataView]',
  17988. float32Tag = '[object Float32Array]',
  17989. float64Tag = '[object Float64Array]',
  17990. int8Tag = '[object Int8Array]',
  17991. int16Tag = '[object Int16Array]',
  17992. int32Tag = '[object Int32Array]',
  17993. uint8Tag = '[object Uint8Array]',
  17994. uint8ClampedTag = '[object Uint8ClampedArray]',
  17995. uint16Tag = '[object Uint16Array]',
  17996. uint32Tag = '[object Uint32Array]';
  17997. /** Used to match empty string literals in compiled template source. */
  17998. var reEmptyStringLeading = /\b__p \+= '';/g,
  17999. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18000. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18001. /** Used to match HTML entities and HTML characters. */
  18002. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18003. reUnescapedHtml = /[&<>"']/g,
  18004. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18005. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18006. /** Used to match template delimiters. */
  18007. var reEscape = /<%-([\s\S]+?)%>/g,
  18008. reEvaluate = /<%([\s\S]+?)%>/g,
  18009. reInterpolate = /<%=([\s\S]+?)%>/g;
  18010. /** Used to match property names within property paths. */
  18011. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18012. reIsPlainProp = /^\w*$/,
  18013. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18014. /**
  18015. * Used to match `RegExp`
  18016. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18017. */
  18018. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18019. reHasRegExpChar = RegExp(reRegExpChar.source);
  18020. /** Used to match leading and trailing whitespace. */
  18021. var reTrim = /^\s+|\s+$/g,
  18022. reTrimStart = /^\s+/,
  18023. reTrimEnd = /\s+$/;
  18024. /** Used to match wrap detail comments. */
  18025. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18026. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18027. reSplitDetails = /,? & /;
  18028. /** Used to match words composed of alphanumeric characters. */
  18029. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18030. /** Used to match backslashes in property paths. */
  18031. var reEscapeChar = /\\(\\)?/g;
  18032. /**
  18033. * Used to match
  18034. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18035. */
  18036. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18037. /** Used to match `RegExp` flags from their coerced string values. */
  18038. var reFlags = /\w*$/;
  18039. /** Used to detect bad signed hexadecimal string values. */
  18040. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18041. /** Used to detect binary string values. */
  18042. var reIsBinary = /^0b[01]+$/i;
  18043. /** Used to detect host constructors (Safari). */
  18044. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18045. /** Used to detect octal string values. */
  18046. var reIsOctal = /^0o[0-7]+$/i;
  18047. /** Used to detect unsigned integer values. */
  18048. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18049. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18050. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18051. /** Used to ensure capturing order of template delimiters. */
  18052. var reNoMatch = /($^)/;
  18053. /** Used to match unescaped characters in compiled string literals. */
  18054. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18055. /** Used to compose unicode character classes. */
  18056. var rsAstralRange = '\\ud800-\\udfff',
  18057. rsComboMarksRange = '\\u0300-\\u036f',
  18058. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18059. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18060. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18061. rsDingbatRange = '\\u2700-\\u27bf',
  18062. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18063. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18064. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18065. rsPunctuationRange = '\\u2000-\\u206f',
  18066. 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',
  18067. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18068. rsVarRange = '\\ufe0e\\ufe0f',
  18069. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18070. /** Used to compose unicode capture groups. */
  18071. var rsApos = "['\u2019]",
  18072. rsAstral = '[' + rsAstralRange + ']',
  18073. rsBreak = '[' + rsBreakRange + ']',
  18074. rsCombo = '[' + rsComboRange + ']',
  18075. rsDigits = '\\d+',
  18076. rsDingbat = '[' + rsDingbatRange + ']',
  18077. rsLower = '[' + rsLowerRange + ']',
  18078. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18079. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18080. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18081. rsNonAstral = '[^' + rsAstralRange + ']',
  18082. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18083. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18084. rsUpper = '[' + rsUpperRange + ']',
  18085. rsZWJ = '\\u200d';
  18086. /** Used to compose unicode regexes. */
  18087. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18088. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18089. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18090. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18091. reOptMod = rsModifier + '?',
  18092. rsOptVar = '[' + rsVarRange + ']?',
  18093. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18094. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18095. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18096. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18097. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18098. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18099. /** Used to match apostrophes. */
  18100. var reApos = RegExp(rsApos, 'g');
  18101. /**
  18102. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18103. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18104. */
  18105. var reComboMark = RegExp(rsCombo, 'g');
  18106. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18107. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18108. /** Used to match complex or compound words. */
  18109. var reUnicodeWord = RegExp([
  18110. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18111. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18112. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18113. rsUpper + '+' + rsOptContrUpper,
  18114. rsOrdUpper,
  18115. rsOrdLower,
  18116. rsDigits,
  18117. rsEmoji
  18118. ].join('|'), 'g');
  18119. /** 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/). */
  18120. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18121. /** Used to detect strings that need a more robust regexp to match words. */
  18122. 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 ]/;
  18123. /** Used to assign default `context` object properties. */
  18124. var contextProps = [
  18125. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18126. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18127. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18128. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18129. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18130. ];
  18131. /** Used to make template sourceURLs easier to identify. */
  18132. var templateCounter = -1;
  18133. /** Used to identify `toStringTag` values of typed arrays. */
  18134. var typedArrayTags = {};
  18135. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18136. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18137. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18138. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18139. typedArrayTags[uint32Tag] = true;
  18140. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18141. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18142. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18143. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18144. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18145. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18146. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18147. typedArrayTags[weakMapTag] = false;
  18148. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18149. var cloneableTags = {};
  18150. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18151. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18152. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18153. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18154. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18155. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18156. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18157. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18158. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18159. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18160. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18161. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18162. cloneableTags[weakMapTag] = false;
  18163. /** Used to map Latin Unicode letters to basic Latin letters. */
  18164. var deburredLetters = {
  18165. // Latin-1 Supplement block.
  18166. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18167. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18168. '\xc7': 'C', '\xe7': 'c',
  18169. '\xd0': 'D', '\xf0': 'd',
  18170. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18171. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18172. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18173. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18174. '\xd1': 'N', '\xf1': 'n',
  18175. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18176. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18177. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18178. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18179. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18180. '\xc6': 'Ae', '\xe6': 'ae',
  18181. '\xde': 'Th', '\xfe': 'th',
  18182. '\xdf': 'ss',
  18183. // Latin Extended-A block.
  18184. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18185. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18186. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18187. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18188. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18189. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18190. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18191. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18192. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18193. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18194. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18195. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18196. '\u0134': 'J', '\u0135': 'j',
  18197. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18198. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18199. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18200. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18201. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18202. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18203. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18204. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18205. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18206. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18207. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18208. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18209. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18210. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18211. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18212. '\u0174': 'W', '\u0175': 'w',
  18213. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18214. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18215. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18216. '\u0132': 'IJ', '\u0133': 'ij',
  18217. '\u0152': 'Oe', '\u0153': 'oe',
  18218. '\u0149': "'n", '\u017f': 's'
  18219. };
  18220. /** Used to map characters to HTML entities. */
  18221. var htmlEscapes = {
  18222. '&': '&amp;',
  18223. '<': '&lt;',
  18224. '>': '&gt;',
  18225. '"': '&quot;',
  18226. "'": '&#39;'
  18227. };
  18228. /** Used to map HTML entities to characters. */
  18229. var htmlUnescapes = {
  18230. '&amp;': '&',
  18231. '&lt;': '<',
  18232. '&gt;': '>',
  18233. '&quot;': '"',
  18234. '&#39;': "'"
  18235. };
  18236. /** Used to escape characters for inclusion in compiled string literals. */
  18237. var stringEscapes = {
  18238. '\\': '\\',
  18239. "'": "'",
  18240. '\n': 'n',
  18241. '\r': 'r',
  18242. '\u2028': 'u2028',
  18243. '\u2029': 'u2029'
  18244. };
  18245. /** Built-in method references without a dependency on `root`. */
  18246. var freeParseFloat = parseFloat,
  18247. freeParseInt = parseInt;
  18248. /** Detect free variable `global` from Node.js. */
  18249. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18250. /** Detect free variable `self`. */
  18251. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18252. /** Used as a reference to the global object. */
  18253. var root = freeGlobal || freeSelf || Function('return this')();
  18254. /** Detect free variable `exports`. */
  18255. var freeExports = true && exports && !exports.nodeType && exports;
  18256. /** Detect free variable `module`. */
  18257. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18258. /** Detect the popular CommonJS extension `module.exports`. */
  18259. var moduleExports = freeModule && freeModule.exports === freeExports;
  18260. /** Detect free variable `process` from Node.js. */
  18261. var freeProcess = moduleExports && freeGlobal.process;
  18262. /** Used to access faster Node.js helpers. */
  18263. var nodeUtil = (function() {
  18264. try {
  18265. // Use `util.types` for Node.js 10+.
  18266. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18267. if (types) {
  18268. return types;
  18269. }
  18270. // Legacy `process.binding('util')` for Node.js < 10.
  18271. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18272. } catch (e) {}
  18273. }());
  18274. /* Node.js helper references. */
  18275. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18276. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18277. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18278. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18279. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18280. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18281. /*--------------------------------------------------------------------------*/
  18282. /**
  18283. * A faster alternative to `Function#apply`, this function invokes `func`
  18284. * with the `this` binding of `thisArg` and the arguments of `args`.
  18285. *
  18286. * @private
  18287. * @param {Function} func The function to invoke.
  18288. * @param {*} thisArg The `this` binding of `func`.
  18289. * @param {Array} args The arguments to invoke `func` with.
  18290. * @returns {*} Returns the result of `func`.
  18291. */
  18292. function apply(func, thisArg, args) {
  18293. switch (args.length) {
  18294. case 0: return func.call(thisArg);
  18295. case 1: return func.call(thisArg, args[0]);
  18296. case 2: return func.call(thisArg, args[0], args[1]);
  18297. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18298. }
  18299. return func.apply(thisArg, args);
  18300. }
  18301. /**
  18302. * A specialized version of `baseAggregator` for arrays.
  18303. *
  18304. * @private
  18305. * @param {Array} [array] The array to iterate over.
  18306. * @param {Function} setter The function to set `accumulator` values.
  18307. * @param {Function} iteratee The iteratee to transform keys.
  18308. * @param {Object} accumulator The initial aggregated object.
  18309. * @returns {Function} Returns `accumulator`.
  18310. */
  18311. function arrayAggregator(array, setter, iteratee, accumulator) {
  18312. var index = -1,
  18313. length = array == null ? 0 : array.length;
  18314. while (++index < length) {
  18315. var value = array[index];
  18316. setter(accumulator, value, iteratee(value), array);
  18317. }
  18318. return accumulator;
  18319. }
  18320. /**
  18321. * A specialized version of `_.forEach` for arrays without support for
  18322. * iteratee shorthands.
  18323. *
  18324. * @private
  18325. * @param {Array} [array] The array to iterate over.
  18326. * @param {Function} iteratee The function invoked per iteration.
  18327. * @returns {Array} Returns `array`.
  18328. */
  18329. function arrayEach(array, iteratee) {
  18330. var index = -1,
  18331. length = array == null ? 0 : array.length;
  18332. while (++index < length) {
  18333. if (iteratee(array[index], index, array) === false) {
  18334. break;
  18335. }
  18336. }
  18337. return array;
  18338. }
  18339. /**
  18340. * A specialized version of `_.forEachRight` for arrays without support for
  18341. * iteratee shorthands.
  18342. *
  18343. * @private
  18344. * @param {Array} [array] The array to iterate over.
  18345. * @param {Function} iteratee The function invoked per iteration.
  18346. * @returns {Array} Returns `array`.
  18347. */
  18348. function arrayEachRight(array, iteratee) {
  18349. var length = array == null ? 0 : array.length;
  18350. while (length--) {
  18351. if (iteratee(array[length], length, array) === false) {
  18352. break;
  18353. }
  18354. }
  18355. return array;
  18356. }
  18357. /**
  18358. * A specialized version of `_.every` for arrays without support for
  18359. * iteratee shorthands.
  18360. *
  18361. * @private
  18362. * @param {Array} [array] The array to iterate over.
  18363. * @param {Function} predicate The function invoked per iteration.
  18364. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18365. * else `false`.
  18366. */
  18367. function arrayEvery(array, predicate) {
  18368. var index = -1,
  18369. length = array == null ? 0 : array.length;
  18370. while (++index < length) {
  18371. if (!predicate(array[index], index, array)) {
  18372. return false;
  18373. }
  18374. }
  18375. return true;
  18376. }
  18377. /**
  18378. * A specialized version of `_.filter` for arrays without support for
  18379. * iteratee shorthands.
  18380. *
  18381. * @private
  18382. * @param {Array} [array] The array to iterate over.
  18383. * @param {Function} predicate The function invoked per iteration.
  18384. * @returns {Array} Returns the new filtered array.
  18385. */
  18386. function arrayFilter(array, predicate) {
  18387. var index = -1,
  18388. length = array == null ? 0 : array.length,
  18389. resIndex = 0,
  18390. result = [];
  18391. while (++index < length) {
  18392. var value = array[index];
  18393. if (predicate(value, index, array)) {
  18394. result[resIndex++] = value;
  18395. }
  18396. }
  18397. return result;
  18398. }
  18399. /**
  18400. * A specialized version of `_.includes` for arrays without support for
  18401. * specifying an index to search from.
  18402. *
  18403. * @private
  18404. * @param {Array} [array] The array to inspect.
  18405. * @param {*} target The value to search for.
  18406. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18407. */
  18408. function arrayIncludes(array, value) {
  18409. var length = array == null ? 0 : array.length;
  18410. return !!length && baseIndexOf(array, value, 0) > -1;
  18411. }
  18412. /**
  18413. * This function is like `arrayIncludes` except that it accepts a comparator.
  18414. *
  18415. * @private
  18416. * @param {Array} [array] The array to inspect.
  18417. * @param {*} target The value to search for.
  18418. * @param {Function} comparator The comparator invoked per element.
  18419. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18420. */
  18421. function arrayIncludesWith(array, value, comparator) {
  18422. var index = -1,
  18423. length = array == null ? 0 : array.length;
  18424. while (++index < length) {
  18425. if (comparator(value, array[index])) {
  18426. return true;
  18427. }
  18428. }
  18429. return false;
  18430. }
  18431. /**
  18432. * A specialized version of `_.map` for arrays without support for iteratee
  18433. * shorthands.
  18434. *
  18435. * @private
  18436. * @param {Array} [array] The array to iterate over.
  18437. * @param {Function} iteratee The function invoked per iteration.
  18438. * @returns {Array} Returns the new mapped array.
  18439. */
  18440. function arrayMap(array, iteratee) {
  18441. var index = -1,
  18442. length = array == null ? 0 : array.length,
  18443. result = Array(length);
  18444. while (++index < length) {
  18445. result[index] = iteratee(array[index], index, array);
  18446. }
  18447. return result;
  18448. }
  18449. /**
  18450. * Appends the elements of `values` to `array`.
  18451. *
  18452. * @private
  18453. * @param {Array} array The array to modify.
  18454. * @param {Array} values The values to append.
  18455. * @returns {Array} Returns `array`.
  18456. */
  18457. function arrayPush(array, values) {
  18458. var index = -1,
  18459. length = values.length,
  18460. offset = array.length;
  18461. while (++index < length) {
  18462. array[offset + index] = values[index];
  18463. }
  18464. return array;
  18465. }
  18466. /**
  18467. * A specialized version of `_.reduce` for arrays without support for
  18468. * iteratee shorthands.
  18469. *
  18470. * @private
  18471. * @param {Array} [array] The array to iterate over.
  18472. * @param {Function} iteratee The function invoked per iteration.
  18473. * @param {*} [accumulator] The initial value.
  18474. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18475. * the initial value.
  18476. * @returns {*} Returns the accumulated value.
  18477. */
  18478. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18479. var index = -1,
  18480. length = array == null ? 0 : array.length;
  18481. if (initAccum && length) {
  18482. accumulator = array[++index];
  18483. }
  18484. while (++index < length) {
  18485. accumulator = iteratee(accumulator, array[index], index, array);
  18486. }
  18487. return accumulator;
  18488. }
  18489. /**
  18490. * A specialized version of `_.reduceRight` for arrays without support for
  18491. * iteratee shorthands.
  18492. *
  18493. * @private
  18494. * @param {Array} [array] The array to iterate over.
  18495. * @param {Function} iteratee The function invoked per iteration.
  18496. * @param {*} [accumulator] The initial value.
  18497. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18498. * the initial value.
  18499. * @returns {*} Returns the accumulated value.
  18500. */
  18501. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18502. var length = array == null ? 0 : array.length;
  18503. if (initAccum && length) {
  18504. accumulator = array[--length];
  18505. }
  18506. while (length--) {
  18507. accumulator = iteratee(accumulator, array[length], length, array);
  18508. }
  18509. return accumulator;
  18510. }
  18511. /**
  18512. * A specialized version of `_.some` for arrays without support for iteratee
  18513. * shorthands.
  18514. *
  18515. * @private
  18516. * @param {Array} [array] The array to iterate over.
  18517. * @param {Function} predicate The function invoked per iteration.
  18518. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18519. * else `false`.
  18520. */
  18521. function arraySome(array, predicate) {
  18522. var index = -1,
  18523. length = array == null ? 0 : array.length;
  18524. while (++index < length) {
  18525. if (predicate(array[index], index, array)) {
  18526. return true;
  18527. }
  18528. }
  18529. return false;
  18530. }
  18531. /**
  18532. * Gets the size of an ASCII `string`.
  18533. *
  18534. * @private
  18535. * @param {string} string The string inspect.
  18536. * @returns {number} Returns the string size.
  18537. */
  18538. var asciiSize = baseProperty('length');
  18539. /**
  18540. * Converts an ASCII `string` to an array.
  18541. *
  18542. * @private
  18543. * @param {string} string The string to convert.
  18544. * @returns {Array} Returns the converted array.
  18545. */
  18546. function asciiToArray(string) {
  18547. return string.split('');
  18548. }
  18549. /**
  18550. * Splits an ASCII `string` into an array of its words.
  18551. *
  18552. * @private
  18553. * @param {string} The string to inspect.
  18554. * @returns {Array} Returns the words of `string`.
  18555. */
  18556. function asciiWords(string) {
  18557. return string.match(reAsciiWord) || [];
  18558. }
  18559. /**
  18560. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18561. * without support for iteratee shorthands, which iterates over `collection`
  18562. * using `eachFunc`.
  18563. *
  18564. * @private
  18565. * @param {Array|Object} collection The collection to inspect.
  18566. * @param {Function} predicate The function invoked per iteration.
  18567. * @param {Function} eachFunc The function to iterate over `collection`.
  18568. * @returns {*} Returns the found element or its key, else `undefined`.
  18569. */
  18570. function baseFindKey(collection, predicate, eachFunc) {
  18571. var result;
  18572. eachFunc(collection, function(value, key, collection) {
  18573. if (predicate(value, key, collection)) {
  18574. result = key;
  18575. return false;
  18576. }
  18577. });
  18578. return result;
  18579. }
  18580. /**
  18581. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18582. * support for iteratee shorthands.
  18583. *
  18584. * @private
  18585. * @param {Array} array The array to inspect.
  18586. * @param {Function} predicate The function invoked per iteration.
  18587. * @param {number} fromIndex The index to search from.
  18588. * @param {boolean} [fromRight] Specify iterating from right to left.
  18589. * @returns {number} Returns the index of the matched value, else `-1`.
  18590. */
  18591. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18592. var length = array.length,
  18593. index = fromIndex + (fromRight ? 1 : -1);
  18594. while ((fromRight ? index-- : ++index < length)) {
  18595. if (predicate(array[index], index, array)) {
  18596. return index;
  18597. }
  18598. }
  18599. return -1;
  18600. }
  18601. /**
  18602. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18603. *
  18604. * @private
  18605. * @param {Array} array The array to inspect.
  18606. * @param {*} value The value to search for.
  18607. * @param {number} fromIndex The index to search from.
  18608. * @returns {number} Returns the index of the matched value, else `-1`.
  18609. */
  18610. function baseIndexOf(array, value, fromIndex) {
  18611. return value === value
  18612. ? strictIndexOf(array, value, fromIndex)
  18613. : baseFindIndex(array, baseIsNaN, fromIndex);
  18614. }
  18615. /**
  18616. * This function is like `baseIndexOf` except that it accepts a comparator.
  18617. *
  18618. * @private
  18619. * @param {Array} array The array to inspect.
  18620. * @param {*} value The value to search for.
  18621. * @param {number} fromIndex The index to search from.
  18622. * @param {Function} comparator The comparator invoked per element.
  18623. * @returns {number} Returns the index of the matched value, else `-1`.
  18624. */
  18625. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18626. var index = fromIndex - 1,
  18627. length = array.length;
  18628. while (++index < length) {
  18629. if (comparator(array[index], value)) {
  18630. return index;
  18631. }
  18632. }
  18633. return -1;
  18634. }
  18635. /**
  18636. * The base implementation of `_.isNaN` without support for number objects.
  18637. *
  18638. * @private
  18639. * @param {*} value The value to check.
  18640. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18641. */
  18642. function baseIsNaN(value) {
  18643. return value !== value;
  18644. }
  18645. /**
  18646. * The base implementation of `_.mean` and `_.meanBy` without support for
  18647. * iteratee shorthands.
  18648. *
  18649. * @private
  18650. * @param {Array} array The array to iterate over.
  18651. * @param {Function} iteratee The function invoked per iteration.
  18652. * @returns {number} Returns the mean.
  18653. */
  18654. function baseMean(array, iteratee) {
  18655. var length = array == null ? 0 : array.length;
  18656. return length ? (baseSum(array, iteratee) / length) : NAN;
  18657. }
  18658. /**
  18659. * The base implementation of `_.property` without support for deep paths.
  18660. *
  18661. * @private
  18662. * @param {string} key The key of the property to get.
  18663. * @returns {Function} Returns the new accessor function.
  18664. */
  18665. function baseProperty(key) {
  18666. return function(object) {
  18667. return object == null ? undefined : object[key];
  18668. };
  18669. }
  18670. /**
  18671. * The base implementation of `_.propertyOf` without support for deep paths.
  18672. *
  18673. * @private
  18674. * @param {Object} object The object to query.
  18675. * @returns {Function} Returns the new accessor function.
  18676. */
  18677. function basePropertyOf(object) {
  18678. return function(key) {
  18679. return object == null ? undefined : object[key];
  18680. };
  18681. }
  18682. /**
  18683. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18684. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18685. *
  18686. * @private
  18687. * @param {Array|Object} collection The collection to iterate over.
  18688. * @param {Function} iteratee The function invoked per iteration.
  18689. * @param {*} accumulator The initial value.
  18690. * @param {boolean} initAccum Specify using the first or last element of
  18691. * `collection` as the initial value.
  18692. * @param {Function} eachFunc The function to iterate over `collection`.
  18693. * @returns {*} Returns the accumulated value.
  18694. */
  18695. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18696. eachFunc(collection, function(value, index, collection) {
  18697. accumulator = initAccum
  18698. ? (initAccum = false, value)
  18699. : iteratee(accumulator, value, index, collection);
  18700. });
  18701. return accumulator;
  18702. }
  18703. /**
  18704. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18705. * sort order of `array` and replaces criteria objects with their corresponding
  18706. * values.
  18707. *
  18708. * @private
  18709. * @param {Array} array The array to sort.
  18710. * @param {Function} comparer The function to define sort order.
  18711. * @returns {Array} Returns `array`.
  18712. */
  18713. function baseSortBy(array, comparer) {
  18714. var length = array.length;
  18715. array.sort(comparer);
  18716. while (length--) {
  18717. array[length] = array[length].value;
  18718. }
  18719. return array;
  18720. }
  18721. /**
  18722. * The base implementation of `_.sum` and `_.sumBy` without support for
  18723. * iteratee shorthands.
  18724. *
  18725. * @private
  18726. * @param {Array} array The array to iterate over.
  18727. * @param {Function} iteratee The function invoked per iteration.
  18728. * @returns {number} Returns the sum.
  18729. */
  18730. function baseSum(array, iteratee) {
  18731. var result,
  18732. index = -1,
  18733. length = array.length;
  18734. while (++index < length) {
  18735. var current = iteratee(array[index]);
  18736. if (current !== undefined) {
  18737. result = result === undefined ? current : (result + current);
  18738. }
  18739. }
  18740. return result;
  18741. }
  18742. /**
  18743. * The base implementation of `_.times` without support for iteratee shorthands
  18744. * or max array length checks.
  18745. *
  18746. * @private
  18747. * @param {number} n The number of times to invoke `iteratee`.
  18748. * @param {Function} iteratee The function invoked per iteration.
  18749. * @returns {Array} Returns the array of results.
  18750. */
  18751. function baseTimes(n, iteratee) {
  18752. var index = -1,
  18753. result = Array(n);
  18754. while (++index < n) {
  18755. result[index] = iteratee(index);
  18756. }
  18757. return result;
  18758. }
  18759. /**
  18760. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18761. * of key-value pairs for `object` corresponding to the property names of `props`.
  18762. *
  18763. * @private
  18764. * @param {Object} object The object to query.
  18765. * @param {Array} props The property names to get values for.
  18766. * @returns {Object} Returns the key-value pairs.
  18767. */
  18768. function baseToPairs(object, props) {
  18769. return arrayMap(props, function(key) {
  18770. return [key, object[key]];
  18771. });
  18772. }
  18773. /**
  18774. * The base implementation of `_.unary` without support for storing metadata.
  18775. *
  18776. * @private
  18777. * @param {Function} func The function to cap arguments for.
  18778. * @returns {Function} Returns the new capped function.
  18779. */
  18780. function baseUnary(func) {
  18781. return function(value) {
  18782. return func(value);
  18783. };
  18784. }
  18785. /**
  18786. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18787. * array of `object` property values corresponding to the property names
  18788. * of `props`.
  18789. *
  18790. * @private
  18791. * @param {Object} object The object to query.
  18792. * @param {Array} props The property names to get values for.
  18793. * @returns {Object} Returns the array of property values.
  18794. */
  18795. function baseValues(object, props) {
  18796. return arrayMap(props, function(key) {
  18797. return object[key];
  18798. });
  18799. }
  18800. /**
  18801. * Checks if a `cache` value for `key` exists.
  18802. *
  18803. * @private
  18804. * @param {Object} cache The cache to query.
  18805. * @param {string} key The key of the entry to check.
  18806. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18807. */
  18808. function cacheHas(cache, key) {
  18809. return cache.has(key);
  18810. }
  18811. /**
  18812. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18813. * that is not found in the character symbols.
  18814. *
  18815. * @private
  18816. * @param {Array} strSymbols The string symbols to inspect.
  18817. * @param {Array} chrSymbols The character symbols to find.
  18818. * @returns {number} Returns the index of the first unmatched string symbol.
  18819. */
  18820. function charsStartIndex(strSymbols, chrSymbols) {
  18821. var index = -1,
  18822. length = strSymbols.length;
  18823. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18824. return index;
  18825. }
  18826. /**
  18827. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18828. * that is not found in the character symbols.
  18829. *
  18830. * @private
  18831. * @param {Array} strSymbols The string symbols to inspect.
  18832. * @param {Array} chrSymbols The character symbols to find.
  18833. * @returns {number} Returns the index of the last unmatched string symbol.
  18834. */
  18835. function charsEndIndex(strSymbols, chrSymbols) {
  18836. var index = strSymbols.length;
  18837. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18838. return index;
  18839. }
  18840. /**
  18841. * Gets the number of `placeholder` occurrences in `array`.
  18842. *
  18843. * @private
  18844. * @param {Array} array The array to inspect.
  18845. * @param {*} placeholder The placeholder to search for.
  18846. * @returns {number} Returns the placeholder count.
  18847. */
  18848. function countHolders(array, placeholder) {
  18849. var length = array.length,
  18850. result = 0;
  18851. while (length--) {
  18852. if (array[length] === placeholder) {
  18853. ++result;
  18854. }
  18855. }
  18856. return result;
  18857. }
  18858. /**
  18859. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18860. * letters to basic Latin letters.
  18861. *
  18862. * @private
  18863. * @param {string} letter The matched letter to deburr.
  18864. * @returns {string} Returns the deburred letter.
  18865. */
  18866. var deburrLetter = basePropertyOf(deburredLetters);
  18867. /**
  18868. * Used by `_.escape` to convert characters to HTML entities.
  18869. *
  18870. * @private
  18871. * @param {string} chr The matched character to escape.
  18872. * @returns {string} Returns the escaped character.
  18873. */
  18874. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18875. /**
  18876. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18877. *
  18878. * @private
  18879. * @param {string} chr The matched character to escape.
  18880. * @returns {string} Returns the escaped character.
  18881. */
  18882. function escapeStringChar(chr) {
  18883. return '\\' + stringEscapes[chr];
  18884. }
  18885. /**
  18886. * Gets the value at `key` of `object`.
  18887. *
  18888. * @private
  18889. * @param {Object} [object] The object to query.
  18890. * @param {string} key The key of the property to get.
  18891. * @returns {*} Returns the property value.
  18892. */
  18893. function getValue(object, key) {
  18894. return object == null ? undefined : object[key];
  18895. }
  18896. /**
  18897. * Checks if `string` contains Unicode symbols.
  18898. *
  18899. * @private
  18900. * @param {string} string The string to inspect.
  18901. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18902. */
  18903. function hasUnicode(string) {
  18904. return reHasUnicode.test(string);
  18905. }
  18906. /**
  18907. * Checks if `string` contains a word composed of Unicode symbols.
  18908. *
  18909. * @private
  18910. * @param {string} string The string to inspect.
  18911. * @returns {boolean} Returns `true` if a word is found, else `false`.
  18912. */
  18913. function hasUnicodeWord(string) {
  18914. return reHasUnicodeWord.test(string);
  18915. }
  18916. /**
  18917. * Converts `iterator` to an array.
  18918. *
  18919. * @private
  18920. * @param {Object} iterator The iterator to convert.
  18921. * @returns {Array} Returns the converted array.
  18922. */
  18923. function iteratorToArray(iterator) {
  18924. var data,
  18925. result = [];
  18926. while (!(data = iterator.next()).done) {
  18927. result.push(data.value);
  18928. }
  18929. return result;
  18930. }
  18931. /**
  18932. * Converts `map` to its key-value pairs.
  18933. *
  18934. * @private
  18935. * @param {Object} map The map to convert.
  18936. * @returns {Array} Returns the key-value pairs.
  18937. */
  18938. function mapToArray(map) {
  18939. var index = -1,
  18940. result = Array(map.size);
  18941. map.forEach(function(value, key) {
  18942. result[++index] = [key, value];
  18943. });
  18944. return result;
  18945. }
  18946. /**
  18947. * Creates a unary function that invokes `func` with its argument transformed.
  18948. *
  18949. * @private
  18950. * @param {Function} func The function to wrap.
  18951. * @param {Function} transform The argument transform.
  18952. * @returns {Function} Returns the new function.
  18953. */
  18954. function overArg(func, transform) {
  18955. return function(arg) {
  18956. return func(transform(arg));
  18957. };
  18958. }
  18959. /**
  18960. * Replaces all `placeholder` elements in `array` with an internal placeholder
  18961. * and returns an array of their indexes.
  18962. *
  18963. * @private
  18964. * @param {Array} array The array to modify.
  18965. * @param {*} placeholder The placeholder to replace.
  18966. * @returns {Array} Returns the new array of placeholder indexes.
  18967. */
  18968. function replaceHolders(array, placeholder) {
  18969. var index = -1,
  18970. length = array.length,
  18971. resIndex = 0,
  18972. result = [];
  18973. while (++index < length) {
  18974. var value = array[index];
  18975. if (value === placeholder || value === PLACEHOLDER) {
  18976. array[index] = PLACEHOLDER;
  18977. result[resIndex++] = index;
  18978. }
  18979. }
  18980. return result;
  18981. }
  18982. /**
  18983. * Converts `set` to an array of its values.
  18984. *
  18985. * @private
  18986. * @param {Object} set The set to convert.
  18987. * @returns {Array} Returns the values.
  18988. */
  18989. function setToArray(set) {
  18990. var index = -1,
  18991. result = Array(set.size);
  18992. set.forEach(function(value) {
  18993. result[++index] = value;
  18994. });
  18995. return result;
  18996. }
  18997. /**
  18998. * Converts `set` to its value-value pairs.
  18999. *
  19000. * @private
  19001. * @param {Object} set The set to convert.
  19002. * @returns {Array} Returns the value-value pairs.
  19003. */
  19004. function setToPairs(set) {
  19005. var index = -1,
  19006. result = Array(set.size);
  19007. set.forEach(function(value) {
  19008. result[++index] = [value, value];
  19009. });
  19010. return result;
  19011. }
  19012. /**
  19013. * A specialized version of `_.indexOf` which performs strict equality
  19014. * comparisons of values, i.e. `===`.
  19015. *
  19016. * @private
  19017. * @param {Array} array The array to inspect.
  19018. * @param {*} value The value to search for.
  19019. * @param {number} fromIndex The index to search from.
  19020. * @returns {number} Returns the index of the matched value, else `-1`.
  19021. */
  19022. function strictIndexOf(array, value, fromIndex) {
  19023. var index = fromIndex - 1,
  19024. length = array.length;
  19025. while (++index < length) {
  19026. if (array[index] === value) {
  19027. return index;
  19028. }
  19029. }
  19030. return -1;
  19031. }
  19032. /**
  19033. * A specialized version of `_.lastIndexOf` which performs strict equality
  19034. * comparisons of values, i.e. `===`.
  19035. *
  19036. * @private
  19037. * @param {Array} array The array to inspect.
  19038. * @param {*} value The value to search for.
  19039. * @param {number} fromIndex The index to search from.
  19040. * @returns {number} Returns the index of the matched value, else `-1`.
  19041. */
  19042. function strictLastIndexOf(array, value, fromIndex) {
  19043. var index = fromIndex + 1;
  19044. while (index--) {
  19045. if (array[index] === value) {
  19046. return index;
  19047. }
  19048. }
  19049. return index;
  19050. }
  19051. /**
  19052. * Gets the number of symbols in `string`.
  19053. *
  19054. * @private
  19055. * @param {string} string The string to inspect.
  19056. * @returns {number} Returns the string size.
  19057. */
  19058. function stringSize(string) {
  19059. return hasUnicode(string)
  19060. ? unicodeSize(string)
  19061. : asciiSize(string);
  19062. }
  19063. /**
  19064. * Converts `string` to an array.
  19065. *
  19066. * @private
  19067. * @param {string} string The string to convert.
  19068. * @returns {Array} Returns the converted array.
  19069. */
  19070. function stringToArray(string) {
  19071. return hasUnicode(string)
  19072. ? unicodeToArray(string)
  19073. : asciiToArray(string);
  19074. }
  19075. /**
  19076. * Used by `_.unescape` to convert HTML entities to characters.
  19077. *
  19078. * @private
  19079. * @param {string} chr The matched character to unescape.
  19080. * @returns {string} Returns the unescaped character.
  19081. */
  19082. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19083. /**
  19084. * Gets the size of a Unicode `string`.
  19085. *
  19086. * @private
  19087. * @param {string} string The string inspect.
  19088. * @returns {number} Returns the string size.
  19089. */
  19090. function unicodeSize(string) {
  19091. var result = reUnicode.lastIndex = 0;
  19092. while (reUnicode.test(string)) {
  19093. ++result;
  19094. }
  19095. return result;
  19096. }
  19097. /**
  19098. * Converts a Unicode `string` to an array.
  19099. *
  19100. * @private
  19101. * @param {string} string The string to convert.
  19102. * @returns {Array} Returns the converted array.
  19103. */
  19104. function unicodeToArray(string) {
  19105. return string.match(reUnicode) || [];
  19106. }
  19107. /**
  19108. * Splits a Unicode `string` into an array of its words.
  19109. *
  19110. * @private
  19111. * @param {string} The string to inspect.
  19112. * @returns {Array} Returns the words of `string`.
  19113. */
  19114. function unicodeWords(string) {
  19115. return string.match(reUnicodeWord) || [];
  19116. }
  19117. /*--------------------------------------------------------------------------*/
  19118. /**
  19119. * Create a new pristine `lodash` function using the `context` object.
  19120. *
  19121. * @static
  19122. * @memberOf _
  19123. * @since 1.1.0
  19124. * @category Util
  19125. * @param {Object} [context=root] The context object.
  19126. * @returns {Function} Returns a new `lodash` function.
  19127. * @example
  19128. *
  19129. * _.mixin({ 'foo': _.constant('foo') });
  19130. *
  19131. * var lodash = _.runInContext();
  19132. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19133. *
  19134. * _.isFunction(_.foo);
  19135. * // => true
  19136. * _.isFunction(_.bar);
  19137. * // => false
  19138. *
  19139. * lodash.isFunction(lodash.foo);
  19140. * // => false
  19141. * lodash.isFunction(lodash.bar);
  19142. * // => true
  19143. *
  19144. * // Create a suped-up `defer` in Node.js.
  19145. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19146. */
  19147. var runInContext = (function runInContext(context) {
  19148. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19149. /** Built-in constructor references. */
  19150. var Array = context.Array,
  19151. Date = context.Date,
  19152. Error = context.Error,
  19153. Function = context.Function,
  19154. Math = context.Math,
  19155. Object = context.Object,
  19156. RegExp = context.RegExp,
  19157. String = context.String,
  19158. TypeError = context.TypeError;
  19159. /** Used for built-in method references. */
  19160. var arrayProto = Array.prototype,
  19161. funcProto = Function.prototype,
  19162. objectProto = Object.prototype;
  19163. /** Used to detect overreaching core-js shims. */
  19164. var coreJsData = context['__core-js_shared__'];
  19165. /** Used to resolve the decompiled source of functions. */
  19166. var funcToString = funcProto.toString;
  19167. /** Used to check objects for own properties. */
  19168. var hasOwnProperty = objectProto.hasOwnProperty;
  19169. /** Used to generate unique IDs. */
  19170. var idCounter = 0;
  19171. /** Used to detect methods masquerading as native. */
  19172. var maskSrcKey = (function() {
  19173. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19174. return uid ? ('Symbol(src)_1.' + uid) : '';
  19175. }());
  19176. /**
  19177. * Used to resolve the
  19178. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19179. * of values.
  19180. */
  19181. var nativeObjectToString = objectProto.toString;
  19182. /** Used to infer the `Object` constructor. */
  19183. var objectCtorString = funcToString.call(Object);
  19184. /** Used to restore the original `_` reference in `_.noConflict`. */
  19185. var oldDash = root._;
  19186. /** Used to detect if a method is native. */
  19187. var reIsNative = RegExp('^' +
  19188. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19189. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19190. );
  19191. /** Built-in value references. */
  19192. var Buffer = moduleExports ? context.Buffer : undefined,
  19193. Symbol = context.Symbol,
  19194. Uint8Array = context.Uint8Array,
  19195. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19196. getPrototype = overArg(Object.getPrototypeOf, Object),
  19197. objectCreate = Object.create,
  19198. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19199. splice = arrayProto.splice,
  19200. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19201. symIterator = Symbol ? Symbol.iterator : undefined,
  19202. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19203. var defineProperty = (function() {
  19204. try {
  19205. var func = getNative(Object, 'defineProperty');
  19206. func({}, '', {});
  19207. return func;
  19208. } catch (e) {}
  19209. }());
  19210. /** Mocked built-ins. */
  19211. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19212. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19213. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19214. /* Built-in method references for those with the same name as other `lodash` methods. */
  19215. var nativeCeil = Math.ceil,
  19216. nativeFloor = Math.floor,
  19217. nativeGetSymbols = Object.getOwnPropertySymbols,
  19218. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19219. nativeIsFinite = context.isFinite,
  19220. nativeJoin = arrayProto.join,
  19221. nativeKeys = overArg(Object.keys, Object),
  19222. nativeMax = Math.max,
  19223. nativeMin = Math.min,
  19224. nativeNow = Date.now,
  19225. nativeParseInt = context.parseInt,
  19226. nativeRandom = Math.random,
  19227. nativeReverse = arrayProto.reverse;
  19228. /* Built-in method references that are verified to be native. */
  19229. var DataView = getNative(context, 'DataView'),
  19230. Map = getNative(context, 'Map'),
  19231. Promise = getNative(context, 'Promise'),
  19232. Set = getNative(context, 'Set'),
  19233. WeakMap = getNative(context, 'WeakMap'),
  19234. nativeCreate = getNative(Object, 'create');
  19235. /** Used to store function metadata. */
  19236. var metaMap = WeakMap && new WeakMap;
  19237. /** Used to lookup unminified function names. */
  19238. var realNames = {};
  19239. /** Used to detect maps, sets, and weakmaps. */
  19240. var dataViewCtorString = toSource(DataView),
  19241. mapCtorString = toSource(Map),
  19242. promiseCtorString = toSource(Promise),
  19243. setCtorString = toSource(Set),
  19244. weakMapCtorString = toSource(WeakMap);
  19245. /** Used to convert symbols to primitives and strings. */
  19246. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19247. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19248. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19249. /*------------------------------------------------------------------------*/
  19250. /**
  19251. * Creates a `lodash` object which wraps `value` to enable implicit method
  19252. * chain sequences. Methods that operate on and return arrays, collections,
  19253. * and functions can be chained together. Methods that retrieve a single value
  19254. * or may return a primitive value will automatically end the chain sequence
  19255. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19256. * with `_#value`.
  19257. *
  19258. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19259. * enabled using `_.chain`.
  19260. *
  19261. * The execution of chained methods is lazy, that is, it's deferred until
  19262. * `_#value` is implicitly or explicitly called.
  19263. *
  19264. * Lazy evaluation allows several methods to support shortcut fusion.
  19265. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19266. * the creation of intermediate arrays and can greatly reduce the number of
  19267. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19268. * fusion if the section is applied to an array and iteratees accept only
  19269. * one argument. The heuristic for whether a section qualifies for shortcut
  19270. * fusion is subject to change.
  19271. *
  19272. * Chaining is supported in custom builds as long as the `_#value` method is
  19273. * directly or indirectly included in the build.
  19274. *
  19275. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19276. *
  19277. * The wrapper `Array` methods are:
  19278. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19279. *
  19280. * The wrapper `String` methods are:
  19281. * `replace` and `split`
  19282. *
  19283. * The wrapper methods that support shortcut fusion are:
  19284. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19285. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19286. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19287. *
  19288. * The chainable wrapper methods are:
  19289. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19290. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19291. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19292. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19293. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19294. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19295. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19296. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19297. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19298. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19299. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19300. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19301. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19302. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19303. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19304. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19305. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19306. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19307. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19308. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19309. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19310. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19311. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19312. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19313. *
  19314. * The wrapper methods that are **not** chainable by default are:
  19315. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19316. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19317. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19318. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19319. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19320. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19321. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19322. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19323. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19324. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19325. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19326. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19327. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19328. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19329. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19330. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19331. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19332. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19333. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19334. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19335. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19336. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19337. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19338. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19339. * `upperFirst`, `value`, and `words`
  19340. *
  19341. * @name _
  19342. * @constructor
  19343. * @category Seq
  19344. * @param {*} value The value to wrap in a `lodash` instance.
  19345. * @returns {Object} Returns the new `lodash` wrapper instance.
  19346. * @example
  19347. *
  19348. * function square(n) {
  19349. * return n * n;
  19350. * }
  19351. *
  19352. * var wrapped = _([1, 2, 3]);
  19353. *
  19354. * // Returns an unwrapped value.
  19355. * wrapped.reduce(_.add);
  19356. * // => 6
  19357. *
  19358. * // Returns a wrapped value.
  19359. * var squares = wrapped.map(square);
  19360. *
  19361. * _.isArray(squares);
  19362. * // => false
  19363. *
  19364. * _.isArray(squares.value());
  19365. * // => true
  19366. */
  19367. function lodash(value) {
  19368. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19369. if (value instanceof LodashWrapper) {
  19370. return value;
  19371. }
  19372. if (hasOwnProperty.call(value, '__wrapped__')) {
  19373. return wrapperClone(value);
  19374. }
  19375. }
  19376. return new LodashWrapper(value);
  19377. }
  19378. /**
  19379. * The base implementation of `_.create` without support for assigning
  19380. * properties to the created object.
  19381. *
  19382. * @private
  19383. * @param {Object} proto The object to inherit from.
  19384. * @returns {Object} Returns the new object.
  19385. */
  19386. var baseCreate = (function() {
  19387. function object() {}
  19388. return function(proto) {
  19389. if (!isObject(proto)) {
  19390. return {};
  19391. }
  19392. if (objectCreate) {
  19393. return objectCreate(proto);
  19394. }
  19395. object.prototype = proto;
  19396. var result = new object;
  19397. object.prototype = undefined;
  19398. return result;
  19399. };
  19400. }());
  19401. /**
  19402. * The function whose prototype chain sequence wrappers inherit from.
  19403. *
  19404. * @private
  19405. */
  19406. function baseLodash() {
  19407. // No operation performed.
  19408. }
  19409. /**
  19410. * The base constructor for creating `lodash` wrapper objects.
  19411. *
  19412. * @private
  19413. * @param {*} value The value to wrap.
  19414. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19415. */
  19416. function LodashWrapper(value, chainAll) {
  19417. this.__wrapped__ = value;
  19418. this.__actions__ = [];
  19419. this.__chain__ = !!chainAll;
  19420. this.__index__ = 0;
  19421. this.__values__ = undefined;
  19422. }
  19423. /**
  19424. * By default, the template delimiters used by lodash are like those in
  19425. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19426. * following template settings to use alternative delimiters.
  19427. *
  19428. * @static
  19429. * @memberOf _
  19430. * @type {Object}
  19431. */
  19432. lodash.templateSettings = {
  19433. /**
  19434. * Used to detect `data` property values to be HTML-escaped.
  19435. *
  19436. * @memberOf _.templateSettings
  19437. * @type {RegExp}
  19438. */
  19439. 'escape': reEscape,
  19440. /**
  19441. * Used to detect code to be evaluated.
  19442. *
  19443. * @memberOf _.templateSettings
  19444. * @type {RegExp}
  19445. */
  19446. 'evaluate': reEvaluate,
  19447. /**
  19448. * Used to detect `data` property values to inject.
  19449. *
  19450. * @memberOf _.templateSettings
  19451. * @type {RegExp}
  19452. */
  19453. 'interpolate': reInterpolate,
  19454. /**
  19455. * Used to reference the data object in the template text.
  19456. *
  19457. * @memberOf _.templateSettings
  19458. * @type {string}
  19459. */
  19460. 'variable': '',
  19461. /**
  19462. * Used to import variables into the compiled template.
  19463. *
  19464. * @memberOf _.templateSettings
  19465. * @type {Object}
  19466. */
  19467. 'imports': {
  19468. /**
  19469. * A reference to the `lodash` function.
  19470. *
  19471. * @memberOf _.templateSettings.imports
  19472. * @type {Function}
  19473. */
  19474. '_': lodash
  19475. }
  19476. };
  19477. // Ensure wrappers are instances of `baseLodash`.
  19478. lodash.prototype = baseLodash.prototype;
  19479. lodash.prototype.constructor = lodash;
  19480. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19481. LodashWrapper.prototype.constructor = LodashWrapper;
  19482. /*------------------------------------------------------------------------*/
  19483. /**
  19484. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19485. *
  19486. * @private
  19487. * @constructor
  19488. * @param {*} value The value to wrap.
  19489. */
  19490. function LazyWrapper(value) {
  19491. this.__wrapped__ = value;
  19492. this.__actions__ = [];
  19493. this.__dir__ = 1;
  19494. this.__filtered__ = false;
  19495. this.__iteratees__ = [];
  19496. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19497. this.__views__ = [];
  19498. }
  19499. /**
  19500. * Creates a clone of the lazy wrapper object.
  19501. *
  19502. * @private
  19503. * @name clone
  19504. * @memberOf LazyWrapper
  19505. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19506. */
  19507. function lazyClone() {
  19508. var result = new LazyWrapper(this.__wrapped__);
  19509. result.__actions__ = copyArray(this.__actions__);
  19510. result.__dir__ = this.__dir__;
  19511. result.__filtered__ = this.__filtered__;
  19512. result.__iteratees__ = copyArray(this.__iteratees__);
  19513. result.__takeCount__ = this.__takeCount__;
  19514. result.__views__ = copyArray(this.__views__);
  19515. return result;
  19516. }
  19517. /**
  19518. * Reverses the direction of lazy iteration.
  19519. *
  19520. * @private
  19521. * @name reverse
  19522. * @memberOf LazyWrapper
  19523. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19524. */
  19525. function lazyReverse() {
  19526. if (this.__filtered__) {
  19527. var result = new LazyWrapper(this);
  19528. result.__dir__ = -1;
  19529. result.__filtered__ = true;
  19530. } else {
  19531. result = this.clone();
  19532. result.__dir__ *= -1;
  19533. }
  19534. return result;
  19535. }
  19536. /**
  19537. * Extracts the unwrapped value from its lazy wrapper.
  19538. *
  19539. * @private
  19540. * @name value
  19541. * @memberOf LazyWrapper
  19542. * @returns {*} Returns the unwrapped value.
  19543. */
  19544. function lazyValue() {
  19545. var array = this.__wrapped__.value(),
  19546. dir = this.__dir__,
  19547. isArr = isArray(array),
  19548. isRight = dir < 0,
  19549. arrLength = isArr ? array.length : 0,
  19550. view = getView(0, arrLength, this.__views__),
  19551. start = view.start,
  19552. end = view.end,
  19553. length = end - start,
  19554. index = isRight ? end : (start - 1),
  19555. iteratees = this.__iteratees__,
  19556. iterLength = iteratees.length,
  19557. resIndex = 0,
  19558. takeCount = nativeMin(length, this.__takeCount__);
  19559. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19560. return baseWrapperValue(array, this.__actions__);
  19561. }
  19562. var result = [];
  19563. outer:
  19564. while (length-- && resIndex < takeCount) {
  19565. index += dir;
  19566. var iterIndex = -1,
  19567. value = array[index];
  19568. while (++iterIndex < iterLength) {
  19569. var data = iteratees[iterIndex],
  19570. iteratee = data.iteratee,
  19571. type = data.type,
  19572. computed = iteratee(value);
  19573. if (type == LAZY_MAP_FLAG) {
  19574. value = computed;
  19575. } else if (!computed) {
  19576. if (type == LAZY_FILTER_FLAG) {
  19577. continue outer;
  19578. } else {
  19579. break outer;
  19580. }
  19581. }
  19582. }
  19583. result[resIndex++] = value;
  19584. }
  19585. return result;
  19586. }
  19587. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19588. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19589. LazyWrapper.prototype.constructor = LazyWrapper;
  19590. /*------------------------------------------------------------------------*/
  19591. /**
  19592. * Creates a hash object.
  19593. *
  19594. * @private
  19595. * @constructor
  19596. * @param {Array} [entries] The key-value pairs to cache.
  19597. */
  19598. function Hash(entries) {
  19599. var index = -1,
  19600. length = entries == null ? 0 : entries.length;
  19601. this.clear();
  19602. while (++index < length) {
  19603. var entry = entries[index];
  19604. this.set(entry[0], entry[1]);
  19605. }
  19606. }
  19607. /**
  19608. * Removes all key-value entries from the hash.
  19609. *
  19610. * @private
  19611. * @name clear
  19612. * @memberOf Hash
  19613. */
  19614. function hashClear() {
  19615. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19616. this.size = 0;
  19617. }
  19618. /**
  19619. * Removes `key` and its value from the hash.
  19620. *
  19621. * @private
  19622. * @name delete
  19623. * @memberOf Hash
  19624. * @param {Object} hash The hash to modify.
  19625. * @param {string} key The key of the value to remove.
  19626. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19627. */
  19628. function hashDelete(key) {
  19629. var result = this.has(key) && delete this.__data__[key];
  19630. this.size -= result ? 1 : 0;
  19631. return result;
  19632. }
  19633. /**
  19634. * Gets the hash value for `key`.
  19635. *
  19636. * @private
  19637. * @name get
  19638. * @memberOf Hash
  19639. * @param {string} key The key of the value to get.
  19640. * @returns {*} Returns the entry value.
  19641. */
  19642. function hashGet(key) {
  19643. var data = this.__data__;
  19644. if (nativeCreate) {
  19645. var result = data[key];
  19646. return result === HASH_UNDEFINED ? undefined : result;
  19647. }
  19648. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19649. }
  19650. /**
  19651. * Checks if a hash value for `key` exists.
  19652. *
  19653. * @private
  19654. * @name has
  19655. * @memberOf Hash
  19656. * @param {string} key The key of the entry to check.
  19657. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19658. */
  19659. function hashHas(key) {
  19660. var data = this.__data__;
  19661. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19662. }
  19663. /**
  19664. * Sets the hash `key` to `value`.
  19665. *
  19666. * @private
  19667. * @name set
  19668. * @memberOf Hash
  19669. * @param {string} key The key of the value to set.
  19670. * @param {*} value The value to set.
  19671. * @returns {Object} Returns the hash instance.
  19672. */
  19673. function hashSet(key, value) {
  19674. var data = this.__data__;
  19675. this.size += this.has(key) ? 0 : 1;
  19676. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19677. return this;
  19678. }
  19679. // Add methods to `Hash`.
  19680. Hash.prototype.clear = hashClear;
  19681. Hash.prototype['delete'] = hashDelete;
  19682. Hash.prototype.get = hashGet;
  19683. Hash.prototype.has = hashHas;
  19684. Hash.prototype.set = hashSet;
  19685. /*------------------------------------------------------------------------*/
  19686. /**
  19687. * Creates an list cache object.
  19688. *
  19689. * @private
  19690. * @constructor
  19691. * @param {Array} [entries] The key-value pairs to cache.
  19692. */
  19693. function ListCache(entries) {
  19694. var index = -1,
  19695. length = entries == null ? 0 : entries.length;
  19696. this.clear();
  19697. while (++index < length) {
  19698. var entry = entries[index];
  19699. this.set(entry[0], entry[1]);
  19700. }
  19701. }
  19702. /**
  19703. * Removes all key-value entries from the list cache.
  19704. *
  19705. * @private
  19706. * @name clear
  19707. * @memberOf ListCache
  19708. */
  19709. function listCacheClear() {
  19710. this.__data__ = [];
  19711. this.size = 0;
  19712. }
  19713. /**
  19714. * Removes `key` and its value from the list cache.
  19715. *
  19716. * @private
  19717. * @name delete
  19718. * @memberOf ListCache
  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 listCacheDelete(key) {
  19723. var data = this.__data__,
  19724. index = assocIndexOf(data, key);
  19725. if (index < 0) {
  19726. return false;
  19727. }
  19728. var lastIndex = data.length - 1;
  19729. if (index == lastIndex) {
  19730. data.pop();
  19731. } else {
  19732. splice.call(data, index, 1);
  19733. }
  19734. --this.size;
  19735. return true;
  19736. }
  19737. /**
  19738. * Gets the list cache value for `key`.
  19739. *
  19740. * @private
  19741. * @name get
  19742. * @memberOf ListCache
  19743. * @param {string} key The key of the value to get.
  19744. * @returns {*} Returns the entry value.
  19745. */
  19746. function listCacheGet(key) {
  19747. var data = this.__data__,
  19748. index = assocIndexOf(data, key);
  19749. return index < 0 ? undefined : data[index][1];
  19750. }
  19751. /**
  19752. * Checks if a list cache value for `key` exists.
  19753. *
  19754. * @private
  19755. * @name has
  19756. * @memberOf ListCache
  19757. * @param {string} key The key of the entry to check.
  19758. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19759. */
  19760. function listCacheHas(key) {
  19761. return assocIndexOf(this.__data__, key) > -1;
  19762. }
  19763. /**
  19764. * Sets the list cache `key` to `value`.
  19765. *
  19766. * @private
  19767. * @name set
  19768. * @memberOf ListCache
  19769. * @param {string} key The key of the value to set.
  19770. * @param {*} value The value to set.
  19771. * @returns {Object} Returns the list cache instance.
  19772. */
  19773. function listCacheSet(key, value) {
  19774. var data = this.__data__,
  19775. index = assocIndexOf(data, key);
  19776. if (index < 0) {
  19777. ++this.size;
  19778. data.push([key, value]);
  19779. } else {
  19780. data[index][1] = value;
  19781. }
  19782. return this;
  19783. }
  19784. // Add methods to `ListCache`.
  19785. ListCache.prototype.clear = listCacheClear;
  19786. ListCache.prototype['delete'] = listCacheDelete;
  19787. ListCache.prototype.get = listCacheGet;
  19788. ListCache.prototype.has = listCacheHas;
  19789. ListCache.prototype.set = listCacheSet;
  19790. /*------------------------------------------------------------------------*/
  19791. /**
  19792. * Creates a map cache object to store key-value pairs.
  19793. *
  19794. * @private
  19795. * @constructor
  19796. * @param {Array} [entries] The key-value pairs to cache.
  19797. */
  19798. function MapCache(entries) {
  19799. var index = -1,
  19800. length = entries == null ? 0 : entries.length;
  19801. this.clear();
  19802. while (++index < length) {
  19803. var entry = entries[index];
  19804. this.set(entry[0], entry[1]);
  19805. }
  19806. }
  19807. /**
  19808. * Removes all key-value entries from the map.
  19809. *
  19810. * @private
  19811. * @name clear
  19812. * @memberOf MapCache
  19813. */
  19814. function mapCacheClear() {
  19815. this.size = 0;
  19816. this.__data__ = {
  19817. 'hash': new Hash,
  19818. 'map': new (Map || ListCache),
  19819. 'string': new Hash
  19820. };
  19821. }
  19822. /**
  19823. * Removes `key` and its value from the map.
  19824. *
  19825. * @private
  19826. * @name delete
  19827. * @memberOf MapCache
  19828. * @param {string} key The key of the value to remove.
  19829. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19830. */
  19831. function mapCacheDelete(key) {
  19832. var result = getMapData(this, key)['delete'](key);
  19833. this.size -= result ? 1 : 0;
  19834. return result;
  19835. }
  19836. /**
  19837. * Gets the map value for `key`.
  19838. *
  19839. * @private
  19840. * @name get
  19841. * @memberOf MapCache
  19842. * @param {string} key The key of the value to get.
  19843. * @returns {*} Returns the entry value.
  19844. */
  19845. function mapCacheGet(key) {
  19846. return getMapData(this, key).get(key);
  19847. }
  19848. /**
  19849. * Checks if a map value for `key` exists.
  19850. *
  19851. * @private
  19852. * @name has
  19853. * @memberOf MapCache
  19854. * @param {string} key The key of the entry to check.
  19855. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19856. */
  19857. function mapCacheHas(key) {
  19858. return getMapData(this, key).has(key);
  19859. }
  19860. /**
  19861. * Sets the map `key` to `value`.
  19862. *
  19863. * @private
  19864. * @name set
  19865. * @memberOf MapCache
  19866. * @param {string} key The key of the value to set.
  19867. * @param {*} value The value to set.
  19868. * @returns {Object} Returns the map cache instance.
  19869. */
  19870. function mapCacheSet(key, value) {
  19871. var data = getMapData(this, key),
  19872. size = data.size;
  19873. data.set(key, value);
  19874. this.size += data.size == size ? 0 : 1;
  19875. return this;
  19876. }
  19877. // Add methods to `MapCache`.
  19878. MapCache.prototype.clear = mapCacheClear;
  19879. MapCache.prototype['delete'] = mapCacheDelete;
  19880. MapCache.prototype.get = mapCacheGet;
  19881. MapCache.prototype.has = mapCacheHas;
  19882. MapCache.prototype.set = mapCacheSet;
  19883. /*------------------------------------------------------------------------*/
  19884. /**
  19885. *
  19886. * Creates an array cache object to store unique values.
  19887. *
  19888. * @private
  19889. * @constructor
  19890. * @param {Array} [values] The values to cache.
  19891. */
  19892. function SetCache(values) {
  19893. var index = -1,
  19894. length = values == null ? 0 : values.length;
  19895. this.__data__ = new MapCache;
  19896. while (++index < length) {
  19897. this.add(values[index]);
  19898. }
  19899. }
  19900. /**
  19901. * Adds `value` to the array cache.
  19902. *
  19903. * @private
  19904. * @name add
  19905. * @memberOf SetCache
  19906. * @alias push
  19907. * @param {*} value The value to cache.
  19908. * @returns {Object} Returns the cache instance.
  19909. */
  19910. function setCacheAdd(value) {
  19911. this.__data__.set(value, HASH_UNDEFINED);
  19912. return this;
  19913. }
  19914. /**
  19915. * Checks if `value` is in the array cache.
  19916. *
  19917. * @private
  19918. * @name has
  19919. * @memberOf SetCache
  19920. * @param {*} value The value to search for.
  19921. * @returns {number} Returns `true` if `value` is found, else `false`.
  19922. */
  19923. function setCacheHas(value) {
  19924. return this.__data__.has(value);
  19925. }
  19926. // Add methods to `SetCache`.
  19927. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  19928. SetCache.prototype.has = setCacheHas;
  19929. /*------------------------------------------------------------------------*/
  19930. /**
  19931. * Creates a stack cache object to store key-value pairs.
  19932. *
  19933. * @private
  19934. * @constructor
  19935. * @param {Array} [entries] The key-value pairs to cache.
  19936. */
  19937. function Stack(entries) {
  19938. var data = this.__data__ = new ListCache(entries);
  19939. this.size = data.size;
  19940. }
  19941. /**
  19942. * Removes all key-value entries from the stack.
  19943. *
  19944. * @private
  19945. * @name clear
  19946. * @memberOf Stack
  19947. */
  19948. function stackClear() {
  19949. this.__data__ = new ListCache;
  19950. this.size = 0;
  19951. }
  19952. /**
  19953. * Removes `key` and its value from the stack.
  19954. *
  19955. * @private
  19956. * @name delete
  19957. * @memberOf Stack
  19958. * @param {string} key The key of the value to remove.
  19959. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19960. */
  19961. function stackDelete(key) {
  19962. var data = this.__data__,
  19963. result = data['delete'](key);
  19964. this.size = data.size;
  19965. return result;
  19966. }
  19967. /**
  19968. * Gets the stack value for `key`.
  19969. *
  19970. * @private
  19971. * @name get
  19972. * @memberOf Stack
  19973. * @param {string} key The key of the value to get.
  19974. * @returns {*} Returns the entry value.
  19975. */
  19976. function stackGet(key) {
  19977. return this.__data__.get(key);
  19978. }
  19979. /**
  19980. * Checks if a stack value for `key` exists.
  19981. *
  19982. * @private
  19983. * @name has
  19984. * @memberOf Stack
  19985. * @param {string} key The key of the entry to check.
  19986. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19987. */
  19988. function stackHas(key) {
  19989. return this.__data__.has(key);
  19990. }
  19991. /**
  19992. * Sets the stack `key` to `value`.
  19993. *
  19994. * @private
  19995. * @name set
  19996. * @memberOf Stack
  19997. * @param {string} key The key of the value to set.
  19998. * @param {*} value The value to set.
  19999. * @returns {Object} Returns the stack cache instance.
  20000. */
  20001. function stackSet(key, value) {
  20002. var data = this.__data__;
  20003. if (data instanceof ListCache) {
  20004. var pairs = data.__data__;
  20005. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20006. pairs.push([key, value]);
  20007. this.size = ++data.size;
  20008. return this;
  20009. }
  20010. data = this.__data__ = new MapCache(pairs);
  20011. }
  20012. data.set(key, value);
  20013. this.size = data.size;
  20014. return this;
  20015. }
  20016. // Add methods to `Stack`.
  20017. Stack.prototype.clear = stackClear;
  20018. Stack.prototype['delete'] = stackDelete;
  20019. Stack.prototype.get = stackGet;
  20020. Stack.prototype.has = stackHas;
  20021. Stack.prototype.set = stackSet;
  20022. /*------------------------------------------------------------------------*/
  20023. /**
  20024. * Creates an array of the enumerable property names of the array-like `value`.
  20025. *
  20026. * @private
  20027. * @param {*} value The value to query.
  20028. * @param {boolean} inherited Specify returning inherited property names.
  20029. * @returns {Array} Returns the array of property names.
  20030. */
  20031. function arrayLikeKeys(value, inherited) {
  20032. var isArr = isArray(value),
  20033. isArg = !isArr && isArguments(value),
  20034. isBuff = !isArr && !isArg && isBuffer(value),
  20035. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20036. skipIndexes = isArr || isArg || isBuff || isType,
  20037. result = skipIndexes ? baseTimes(value.length, String) : [],
  20038. length = result.length;
  20039. for (var key in value) {
  20040. if ((inherited || hasOwnProperty.call(value, key)) &&
  20041. !(skipIndexes && (
  20042. // Safari 9 has enumerable `arguments.length` in strict mode.
  20043. key == 'length' ||
  20044. // Node.js 0.10 has enumerable non-index properties on buffers.
  20045. (isBuff && (key == 'offset' || key == 'parent')) ||
  20046. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20047. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20048. // Skip index properties.
  20049. isIndex(key, length)
  20050. ))) {
  20051. result.push(key);
  20052. }
  20053. }
  20054. return result;
  20055. }
  20056. /**
  20057. * A specialized version of `_.sample` for arrays.
  20058. *
  20059. * @private
  20060. * @param {Array} array The array to sample.
  20061. * @returns {*} Returns the random element.
  20062. */
  20063. function arraySample(array) {
  20064. var length = array.length;
  20065. return length ? array[baseRandom(0, length - 1)] : undefined;
  20066. }
  20067. /**
  20068. * A specialized version of `_.sampleSize` for arrays.
  20069. *
  20070. * @private
  20071. * @param {Array} array The array to sample.
  20072. * @param {number} n The number of elements to sample.
  20073. * @returns {Array} Returns the random elements.
  20074. */
  20075. function arraySampleSize(array, n) {
  20076. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20077. }
  20078. /**
  20079. * A specialized version of `_.shuffle` for arrays.
  20080. *
  20081. * @private
  20082. * @param {Array} array The array to shuffle.
  20083. * @returns {Array} Returns the new shuffled array.
  20084. */
  20085. function arrayShuffle(array) {
  20086. return shuffleSelf(copyArray(array));
  20087. }
  20088. /**
  20089. * This function is like `assignValue` except that it doesn't assign
  20090. * `undefined` values.
  20091. *
  20092. * @private
  20093. * @param {Object} object The object to modify.
  20094. * @param {string} key The key of the property to assign.
  20095. * @param {*} value The value to assign.
  20096. */
  20097. function assignMergeValue(object, key, value) {
  20098. if ((value !== undefined && !eq(object[key], value)) ||
  20099. (value === undefined && !(key in object))) {
  20100. baseAssignValue(object, key, value);
  20101. }
  20102. }
  20103. /**
  20104. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20105. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20106. * for equality comparisons.
  20107. *
  20108. * @private
  20109. * @param {Object} object The object to modify.
  20110. * @param {string} key The key of the property to assign.
  20111. * @param {*} value The value to assign.
  20112. */
  20113. function assignValue(object, key, value) {
  20114. var objValue = object[key];
  20115. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20116. (value === undefined && !(key in object))) {
  20117. baseAssignValue(object, key, value);
  20118. }
  20119. }
  20120. /**
  20121. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20122. *
  20123. * @private
  20124. * @param {Array} array The array to inspect.
  20125. * @param {*} key The key to search for.
  20126. * @returns {number} Returns the index of the matched value, else `-1`.
  20127. */
  20128. function assocIndexOf(array, key) {
  20129. var length = array.length;
  20130. while (length--) {
  20131. if (eq(array[length][0], key)) {
  20132. return length;
  20133. }
  20134. }
  20135. return -1;
  20136. }
  20137. /**
  20138. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20139. * by `iteratee` and values set by `setter`.
  20140. *
  20141. * @private
  20142. * @param {Array|Object} collection The collection to iterate over.
  20143. * @param {Function} setter The function to set `accumulator` values.
  20144. * @param {Function} iteratee The iteratee to transform keys.
  20145. * @param {Object} accumulator The initial aggregated object.
  20146. * @returns {Function} Returns `accumulator`.
  20147. */
  20148. function baseAggregator(collection, setter, iteratee, accumulator) {
  20149. baseEach(collection, function(value, key, collection) {
  20150. setter(accumulator, value, iteratee(value), collection);
  20151. });
  20152. return accumulator;
  20153. }
  20154. /**
  20155. * The base implementation of `_.assign` without support for multiple sources
  20156. * or `customizer` functions.
  20157. *
  20158. * @private
  20159. * @param {Object} object The destination object.
  20160. * @param {Object} source The source object.
  20161. * @returns {Object} Returns `object`.
  20162. */
  20163. function baseAssign(object, source) {
  20164. return object && copyObject(source, keys(source), object);
  20165. }
  20166. /**
  20167. * The base implementation of `_.assignIn` without support for multiple sources
  20168. * or `customizer` functions.
  20169. *
  20170. * @private
  20171. * @param {Object} object The destination object.
  20172. * @param {Object} source The source object.
  20173. * @returns {Object} Returns `object`.
  20174. */
  20175. function baseAssignIn(object, source) {
  20176. return object && copyObject(source, keysIn(source), object);
  20177. }
  20178. /**
  20179. * The base implementation of `assignValue` and `assignMergeValue` without
  20180. * value checks.
  20181. *
  20182. * @private
  20183. * @param {Object} object The object to modify.
  20184. * @param {string} key The key of the property to assign.
  20185. * @param {*} value The value to assign.
  20186. */
  20187. function baseAssignValue(object, key, value) {
  20188. if (key == '__proto__' && defineProperty) {
  20189. defineProperty(object, key, {
  20190. 'configurable': true,
  20191. 'enumerable': true,
  20192. 'value': value,
  20193. 'writable': true
  20194. });
  20195. } else {
  20196. object[key] = value;
  20197. }
  20198. }
  20199. /**
  20200. * The base implementation of `_.at` without support for individual paths.
  20201. *
  20202. * @private
  20203. * @param {Object} object The object to iterate over.
  20204. * @param {string[]} paths The property paths to pick.
  20205. * @returns {Array} Returns the picked elements.
  20206. */
  20207. function baseAt(object, paths) {
  20208. var index = -1,
  20209. length = paths.length,
  20210. result = Array(length),
  20211. skip = object == null;
  20212. while (++index < length) {
  20213. result[index] = skip ? undefined : get(object, paths[index]);
  20214. }
  20215. return result;
  20216. }
  20217. /**
  20218. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20219. *
  20220. * @private
  20221. * @param {number} number The number to clamp.
  20222. * @param {number} [lower] The lower bound.
  20223. * @param {number} upper The upper bound.
  20224. * @returns {number} Returns the clamped number.
  20225. */
  20226. function baseClamp(number, lower, upper) {
  20227. if (number === number) {
  20228. if (upper !== undefined) {
  20229. number = number <= upper ? number : upper;
  20230. }
  20231. if (lower !== undefined) {
  20232. number = number >= lower ? number : lower;
  20233. }
  20234. }
  20235. return number;
  20236. }
  20237. /**
  20238. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20239. * traversed objects.
  20240. *
  20241. * @private
  20242. * @param {*} value The value to clone.
  20243. * @param {boolean} bitmask The bitmask flags.
  20244. * 1 - Deep clone
  20245. * 2 - Flatten inherited properties
  20246. * 4 - Clone symbols
  20247. * @param {Function} [customizer] The function to customize cloning.
  20248. * @param {string} [key] The key of `value`.
  20249. * @param {Object} [object] The parent object of `value`.
  20250. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20251. * @returns {*} Returns the cloned value.
  20252. */
  20253. function baseClone(value, bitmask, customizer, key, object, stack) {
  20254. var result,
  20255. isDeep = bitmask & CLONE_DEEP_FLAG,
  20256. isFlat = bitmask & CLONE_FLAT_FLAG,
  20257. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20258. if (customizer) {
  20259. result = object ? customizer(value, key, object, stack) : customizer(value);
  20260. }
  20261. if (result !== undefined) {
  20262. return result;
  20263. }
  20264. if (!isObject(value)) {
  20265. return value;
  20266. }
  20267. var isArr = isArray(value);
  20268. if (isArr) {
  20269. result = initCloneArray(value);
  20270. if (!isDeep) {
  20271. return copyArray(value, result);
  20272. }
  20273. } else {
  20274. var tag = getTag(value),
  20275. isFunc = tag == funcTag || tag == genTag;
  20276. if (isBuffer(value)) {
  20277. return cloneBuffer(value, isDeep);
  20278. }
  20279. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20280. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20281. if (!isDeep) {
  20282. return isFlat
  20283. ? copySymbolsIn(value, baseAssignIn(result, value))
  20284. : copySymbols(value, baseAssign(result, value));
  20285. }
  20286. } else {
  20287. if (!cloneableTags[tag]) {
  20288. return object ? value : {};
  20289. }
  20290. result = initCloneByTag(value, tag, isDeep);
  20291. }
  20292. }
  20293. // Check for circular references and return its corresponding clone.
  20294. stack || (stack = new Stack);
  20295. var stacked = stack.get(value);
  20296. if (stacked) {
  20297. return stacked;
  20298. }
  20299. stack.set(value, result);
  20300. if (isSet(value)) {
  20301. value.forEach(function(subValue) {
  20302. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20303. });
  20304. } else if (isMap(value)) {
  20305. value.forEach(function(subValue, key) {
  20306. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20307. });
  20308. }
  20309. var keysFunc = isFull
  20310. ? (isFlat ? getAllKeysIn : getAllKeys)
  20311. : (isFlat ? keysIn : keys);
  20312. var props = isArr ? undefined : keysFunc(value);
  20313. arrayEach(props || value, function(subValue, key) {
  20314. if (props) {
  20315. key = subValue;
  20316. subValue = value[key];
  20317. }
  20318. // Recursively populate clone (susceptible to call stack limits).
  20319. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20320. });
  20321. return result;
  20322. }
  20323. /**
  20324. * The base implementation of `_.conforms` which doesn't clone `source`.
  20325. *
  20326. * @private
  20327. * @param {Object} source The object of property predicates to conform to.
  20328. * @returns {Function} Returns the new spec function.
  20329. */
  20330. function baseConforms(source) {
  20331. var props = keys(source);
  20332. return function(object) {
  20333. return baseConformsTo(object, source, props);
  20334. };
  20335. }
  20336. /**
  20337. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20338. *
  20339. * @private
  20340. * @param {Object} object The object to inspect.
  20341. * @param {Object} source The object of property predicates to conform to.
  20342. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20343. */
  20344. function baseConformsTo(object, source, props) {
  20345. var length = props.length;
  20346. if (object == null) {
  20347. return !length;
  20348. }
  20349. object = Object(object);
  20350. while (length--) {
  20351. var key = props[length],
  20352. predicate = source[key],
  20353. value = object[key];
  20354. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20355. return false;
  20356. }
  20357. }
  20358. return true;
  20359. }
  20360. /**
  20361. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20362. * to provide to `func`.
  20363. *
  20364. * @private
  20365. * @param {Function} func The function to delay.
  20366. * @param {number} wait The number of milliseconds to delay invocation.
  20367. * @param {Array} args The arguments to provide to `func`.
  20368. * @returns {number|Object} Returns the timer id or timeout object.
  20369. */
  20370. function baseDelay(func, wait, args) {
  20371. if (typeof func != 'function') {
  20372. throw new TypeError(FUNC_ERROR_TEXT);
  20373. }
  20374. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20375. }
  20376. /**
  20377. * The base implementation of methods like `_.difference` without support
  20378. * for excluding multiple arrays or iteratee shorthands.
  20379. *
  20380. * @private
  20381. * @param {Array} array The array to inspect.
  20382. * @param {Array} values The values to exclude.
  20383. * @param {Function} [iteratee] The iteratee invoked per element.
  20384. * @param {Function} [comparator] The comparator invoked per element.
  20385. * @returns {Array} Returns the new array of filtered values.
  20386. */
  20387. function baseDifference(array, values, iteratee, comparator) {
  20388. var index = -1,
  20389. includes = arrayIncludes,
  20390. isCommon = true,
  20391. length = array.length,
  20392. result = [],
  20393. valuesLength = values.length;
  20394. if (!length) {
  20395. return result;
  20396. }
  20397. if (iteratee) {
  20398. values = arrayMap(values, baseUnary(iteratee));
  20399. }
  20400. if (comparator) {
  20401. includes = arrayIncludesWith;
  20402. isCommon = false;
  20403. }
  20404. else if (values.length >= LARGE_ARRAY_SIZE) {
  20405. includes = cacheHas;
  20406. isCommon = false;
  20407. values = new SetCache(values);
  20408. }
  20409. outer:
  20410. while (++index < length) {
  20411. var value = array[index],
  20412. computed = iteratee == null ? value : iteratee(value);
  20413. value = (comparator || value !== 0) ? value : 0;
  20414. if (isCommon && computed === computed) {
  20415. var valuesIndex = valuesLength;
  20416. while (valuesIndex--) {
  20417. if (values[valuesIndex] === computed) {
  20418. continue outer;
  20419. }
  20420. }
  20421. result.push(value);
  20422. }
  20423. else if (!includes(values, computed, comparator)) {
  20424. result.push(value);
  20425. }
  20426. }
  20427. return result;
  20428. }
  20429. /**
  20430. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20431. *
  20432. * @private
  20433. * @param {Array|Object} collection The collection to iterate over.
  20434. * @param {Function} iteratee The function invoked per iteration.
  20435. * @returns {Array|Object} Returns `collection`.
  20436. */
  20437. var baseEach = createBaseEach(baseForOwn);
  20438. /**
  20439. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20440. *
  20441. * @private
  20442. * @param {Array|Object} collection The collection to iterate over.
  20443. * @param {Function} iteratee The function invoked per iteration.
  20444. * @returns {Array|Object} Returns `collection`.
  20445. */
  20446. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20447. /**
  20448. * The base implementation of `_.every` without support for iteratee shorthands.
  20449. *
  20450. * @private
  20451. * @param {Array|Object} collection The collection to iterate over.
  20452. * @param {Function} predicate The function invoked per iteration.
  20453. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20454. * else `false`
  20455. */
  20456. function baseEvery(collection, predicate) {
  20457. var result = true;
  20458. baseEach(collection, function(value, index, collection) {
  20459. result = !!predicate(value, index, collection);
  20460. return result;
  20461. });
  20462. return result;
  20463. }
  20464. /**
  20465. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20466. * `comparator` to determine the extremum value.
  20467. *
  20468. * @private
  20469. * @param {Array} array The array to iterate over.
  20470. * @param {Function} iteratee The iteratee invoked per iteration.
  20471. * @param {Function} comparator The comparator used to compare values.
  20472. * @returns {*} Returns the extremum value.
  20473. */
  20474. function baseExtremum(array, iteratee, comparator) {
  20475. var index = -1,
  20476. length = array.length;
  20477. while (++index < length) {
  20478. var value = array[index],
  20479. current = iteratee(value);
  20480. if (current != null && (computed === undefined
  20481. ? (current === current && !isSymbol(current))
  20482. : comparator(current, computed)
  20483. )) {
  20484. var computed = current,
  20485. result = value;
  20486. }
  20487. }
  20488. return result;
  20489. }
  20490. /**
  20491. * The base implementation of `_.fill` without an iteratee call guard.
  20492. *
  20493. * @private
  20494. * @param {Array} array The array to fill.
  20495. * @param {*} value The value to fill `array` with.
  20496. * @param {number} [start=0] The start position.
  20497. * @param {number} [end=array.length] The end position.
  20498. * @returns {Array} Returns `array`.
  20499. */
  20500. function baseFill(array, value, start, end) {
  20501. var length = array.length;
  20502. start = toInteger(start);
  20503. if (start < 0) {
  20504. start = -start > length ? 0 : (length + start);
  20505. }
  20506. end = (end === undefined || end > length) ? length : toInteger(end);
  20507. if (end < 0) {
  20508. end += length;
  20509. }
  20510. end = start > end ? 0 : toLength(end);
  20511. while (start < end) {
  20512. array[start++] = value;
  20513. }
  20514. return array;
  20515. }
  20516. /**
  20517. * The base implementation of `_.filter` without support for iteratee shorthands.
  20518. *
  20519. * @private
  20520. * @param {Array|Object} collection The collection to iterate over.
  20521. * @param {Function} predicate The function invoked per iteration.
  20522. * @returns {Array} Returns the new filtered array.
  20523. */
  20524. function baseFilter(collection, predicate) {
  20525. var result = [];
  20526. baseEach(collection, function(value, index, collection) {
  20527. if (predicate(value, index, collection)) {
  20528. result.push(value);
  20529. }
  20530. });
  20531. return result;
  20532. }
  20533. /**
  20534. * The base implementation of `_.flatten` with support for restricting flattening.
  20535. *
  20536. * @private
  20537. * @param {Array} array The array to flatten.
  20538. * @param {number} depth The maximum recursion depth.
  20539. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20540. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20541. * @param {Array} [result=[]] The initial result value.
  20542. * @returns {Array} Returns the new flattened array.
  20543. */
  20544. function baseFlatten(array, depth, predicate, isStrict, result) {
  20545. var index = -1,
  20546. length = array.length;
  20547. predicate || (predicate = isFlattenable);
  20548. result || (result = []);
  20549. while (++index < length) {
  20550. var value = array[index];
  20551. if (depth > 0 && predicate(value)) {
  20552. if (depth > 1) {
  20553. // Recursively flatten arrays (susceptible to call stack limits).
  20554. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20555. } else {
  20556. arrayPush(result, value);
  20557. }
  20558. } else if (!isStrict) {
  20559. result[result.length] = value;
  20560. }
  20561. }
  20562. return result;
  20563. }
  20564. /**
  20565. * The base implementation of `baseForOwn` which iterates over `object`
  20566. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20567. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20568. *
  20569. * @private
  20570. * @param {Object} object The object to iterate over.
  20571. * @param {Function} iteratee The function invoked per iteration.
  20572. * @param {Function} keysFunc The function to get the keys of `object`.
  20573. * @returns {Object} Returns `object`.
  20574. */
  20575. var baseFor = createBaseFor();
  20576. /**
  20577. * This function is like `baseFor` except that it iterates over properties
  20578. * in the opposite order.
  20579. *
  20580. * @private
  20581. * @param {Object} object The object to iterate over.
  20582. * @param {Function} iteratee The function invoked per iteration.
  20583. * @param {Function} keysFunc The function to get the keys of `object`.
  20584. * @returns {Object} Returns `object`.
  20585. */
  20586. var baseForRight = createBaseFor(true);
  20587. /**
  20588. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20589. *
  20590. * @private
  20591. * @param {Object} object The object to iterate over.
  20592. * @param {Function} iteratee The function invoked per iteration.
  20593. * @returns {Object} Returns `object`.
  20594. */
  20595. function baseForOwn(object, iteratee) {
  20596. return object && baseFor(object, iteratee, keys);
  20597. }
  20598. /**
  20599. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20600. *
  20601. * @private
  20602. * @param {Object} object The object to iterate over.
  20603. * @param {Function} iteratee The function invoked per iteration.
  20604. * @returns {Object} Returns `object`.
  20605. */
  20606. function baseForOwnRight(object, iteratee) {
  20607. return object && baseForRight(object, iteratee, keys);
  20608. }
  20609. /**
  20610. * The base implementation of `_.functions` which creates an array of
  20611. * `object` function property names filtered from `props`.
  20612. *
  20613. * @private
  20614. * @param {Object} object The object to inspect.
  20615. * @param {Array} props The property names to filter.
  20616. * @returns {Array} Returns the function names.
  20617. */
  20618. function baseFunctions(object, props) {
  20619. return arrayFilter(props, function(key) {
  20620. return isFunction(object[key]);
  20621. });
  20622. }
  20623. /**
  20624. * The base implementation of `_.get` without support for default values.
  20625. *
  20626. * @private
  20627. * @param {Object} object The object to query.
  20628. * @param {Array|string} path The path of the property to get.
  20629. * @returns {*} Returns the resolved value.
  20630. */
  20631. function baseGet(object, path) {
  20632. path = castPath(path, object);
  20633. var index = 0,
  20634. length = path.length;
  20635. while (object != null && index < length) {
  20636. object = object[toKey(path[index++])];
  20637. }
  20638. return (index && index == length) ? object : undefined;
  20639. }
  20640. /**
  20641. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20642. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20643. * symbols of `object`.
  20644. *
  20645. * @private
  20646. * @param {Object} object The object to query.
  20647. * @param {Function} keysFunc The function to get the keys of `object`.
  20648. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20649. * @returns {Array} Returns the array of property names and symbols.
  20650. */
  20651. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20652. var result = keysFunc(object);
  20653. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20654. }
  20655. /**
  20656. * The base implementation of `getTag` without fallbacks for buggy environments.
  20657. *
  20658. * @private
  20659. * @param {*} value The value to query.
  20660. * @returns {string} Returns the `toStringTag`.
  20661. */
  20662. function baseGetTag(value) {
  20663. if (value == null) {
  20664. return value === undefined ? undefinedTag : nullTag;
  20665. }
  20666. return (symToStringTag && symToStringTag in Object(value))
  20667. ? getRawTag(value)
  20668. : objectToString(value);
  20669. }
  20670. /**
  20671. * The base implementation of `_.gt` which doesn't coerce arguments.
  20672. *
  20673. * @private
  20674. * @param {*} value The value to compare.
  20675. * @param {*} other The other value to compare.
  20676. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20677. * else `false`.
  20678. */
  20679. function baseGt(value, other) {
  20680. return value > other;
  20681. }
  20682. /**
  20683. * The base implementation of `_.has` without support for deep paths.
  20684. *
  20685. * @private
  20686. * @param {Object} [object] The object to query.
  20687. * @param {Array|string} key The key to check.
  20688. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20689. */
  20690. function baseHas(object, key) {
  20691. return object != null && hasOwnProperty.call(object, key);
  20692. }
  20693. /**
  20694. * The base implementation of `_.hasIn` without support for deep paths.
  20695. *
  20696. * @private
  20697. * @param {Object} [object] The object to query.
  20698. * @param {Array|string} key The key to check.
  20699. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20700. */
  20701. function baseHasIn(object, key) {
  20702. return object != null && key in Object(object);
  20703. }
  20704. /**
  20705. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20706. *
  20707. * @private
  20708. * @param {number} number The number to check.
  20709. * @param {number} start The start of the range.
  20710. * @param {number} end The end of the range.
  20711. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20712. */
  20713. function baseInRange(number, start, end) {
  20714. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20715. }
  20716. /**
  20717. * The base implementation of methods like `_.intersection`, without support
  20718. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20719. *
  20720. * @private
  20721. * @param {Array} arrays The arrays to inspect.
  20722. * @param {Function} [iteratee] The iteratee invoked per element.
  20723. * @param {Function} [comparator] The comparator invoked per element.
  20724. * @returns {Array} Returns the new array of shared values.
  20725. */
  20726. function baseIntersection(arrays, iteratee, comparator) {
  20727. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20728. length = arrays[0].length,
  20729. othLength = arrays.length,
  20730. othIndex = othLength,
  20731. caches = Array(othLength),
  20732. maxLength = Infinity,
  20733. result = [];
  20734. while (othIndex--) {
  20735. var array = arrays[othIndex];
  20736. if (othIndex && iteratee) {
  20737. array = arrayMap(array, baseUnary(iteratee));
  20738. }
  20739. maxLength = nativeMin(array.length, maxLength);
  20740. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20741. ? new SetCache(othIndex && array)
  20742. : undefined;
  20743. }
  20744. array = arrays[0];
  20745. var index = -1,
  20746. seen = caches[0];
  20747. outer:
  20748. while (++index < length && result.length < maxLength) {
  20749. var value = array[index],
  20750. computed = iteratee ? iteratee(value) : value;
  20751. value = (comparator || value !== 0) ? value : 0;
  20752. if (!(seen
  20753. ? cacheHas(seen, computed)
  20754. : includes(result, computed, comparator)
  20755. )) {
  20756. othIndex = othLength;
  20757. while (--othIndex) {
  20758. var cache = caches[othIndex];
  20759. if (!(cache
  20760. ? cacheHas(cache, computed)
  20761. : includes(arrays[othIndex], computed, comparator))
  20762. ) {
  20763. continue outer;
  20764. }
  20765. }
  20766. if (seen) {
  20767. seen.push(computed);
  20768. }
  20769. result.push(value);
  20770. }
  20771. }
  20772. return result;
  20773. }
  20774. /**
  20775. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20776. * `object` with values transformed by `iteratee` and set by `setter`.
  20777. *
  20778. * @private
  20779. * @param {Object} object The object to iterate over.
  20780. * @param {Function} setter The function to set `accumulator` values.
  20781. * @param {Function} iteratee The iteratee to transform values.
  20782. * @param {Object} accumulator The initial inverted object.
  20783. * @returns {Function} Returns `accumulator`.
  20784. */
  20785. function baseInverter(object, setter, iteratee, accumulator) {
  20786. baseForOwn(object, function(value, key, object) {
  20787. setter(accumulator, iteratee(value), key, object);
  20788. });
  20789. return accumulator;
  20790. }
  20791. /**
  20792. * The base implementation of `_.invoke` without support for individual
  20793. * method arguments.
  20794. *
  20795. * @private
  20796. * @param {Object} object The object to query.
  20797. * @param {Array|string} path The path of the method to invoke.
  20798. * @param {Array} args The arguments to invoke the method with.
  20799. * @returns {*} Returns the result of the invoked method.
  20800. */
  20801. function baseInvoke(object, path, args) {
  20802. path = castPath(path, object);
  20803. object = parent(object, path);
  20804. var func = object == null ? object : object[toKey(last(path))];
  20805. return func == null ? undefined : apply(func, object, args);
  20806. }
  20807. /**
  20808. * The base implementation of `_.isArguments`.
  20809. *
  20810. * @private
  20811. * @param {*} value The value to check.
  20812. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20813. */
  20814. function baseIsArguments(value) {
  20815. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20816. }
  20817. /**
  20818. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20819. *
  20820. * @private
  20821. * @param {*} value The value to check.
  20822. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20823. */
  20824. function baseIsArrayBuffer(value) {
  20825. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20826. }
  20827. /**
  20828. * The base implementation of `_.isDate` without Node.js optimizations.
  20829. *
  20830. * @private
  20831. * @param {*} value The value to check.
  20832. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20833. */
  20834. function baseIsDate(value) {
  20835. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20836. }
  20837. /**
  20838. * The base implementation of `_.isEqual` which supports partial comparisons
  20839. * and tracks traversed objects.
  20840. *
  20841. * @private
  20842. * @param {*} value The value to compare.
  20843. * @param {*} other The other value to compare.
  20844. * @param {boolean} bitmask The bitmask flags.
  20845. * 1 - Unordered comparison
  20846. * 2 - Partial comparison
  20847. * @param {Function} [customizer] The function to customize comparisons.
  20848. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20849. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20850. */
  20851. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20852. if (value === other) {
  20853. return true;
  20854. }
  20855. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20856. return value !== value && other !== other;
  20857. }
  20858. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20859. }
  20860. /**
  20861. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20862. * deep comparisons and tracks traversed objects enabling objects with circular
  20863. * references to be compared.
  20864. *
  20865. * @private
  20866. * @param {Object} object The object to compare.
  20867. * @param {Object} other The other object to compare.
  20868. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20869. * @param {Function} customizer The function to customize comparisons.
  20870. * @param {Function} equalFunc The function to determine equivalents of values.
  20871. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20872. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20873. */
  20874. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20875. var objIsArr = isArray(object),
  20876. othIsArr = isArray(other),
  20877. objTag = objIsArr ? arrayTag : getTag(object),
  20878. othTag = othIsArr ? arrayTag : getTag(other);
  20879. objTag = objTag == argsTag ? objectTag : objTag;
  20880. othTag = othTag == argsTag ? objectTag : othTag;
  20881. var objIsObj = objTag == objectTag,
  20882. othIsObj = othTag == objectTag,
  20883. isSameTag = objTag == othTag;
  20884. if (isSameTag && isBuffer(object)) {
  20885. if (!isBuffer(other)) {
  20886. return false;
  20887. }
  20888. objIsArr = true;
  20889. objIsObj = false;
  20890. }
  20891. if (isSameTag && !objIsObj) {
  20892. stack || (stack = new Stack);
  20893. return (objIsArr || isTypedArray(object))
  20894. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20895. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20896. }
  20897. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20898. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20899. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20900. if (objIsWrapped || othIsWrapped) {
  20901. var objUnwrapped = objIsWrapped ? object.value() : object,
  20902. othUnwrapped = othIsWrapped ? other.value() : other;
  20903. stack || (stack = new Stack);
  20904. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20905. }
  20906. }
  20907. if (!isSameTag) {
  20908. return false;
  20909. }
  20910. stack || (stack = new Stack);
  20911. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  20912. }
  20913. /**
  20914. * The base implementation of `_.isMap` without Node.js optimizations.
  20915. *
  20916. * @private
  20917. * @param {*} value The value to check.
  20918. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  20919. */
  20920. function baseIsMap(value) {
  20921. return isObjectLike(value) && getTag(value) == mapTag;
  20922. }
  20923. /**
  20924. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  20925. *
  20926. * @private
  20927. * @param {Object} object The object to inspect.
  20928. * @param {Object} source The object of property values to match.
  20929. * @param {Array} matchData The property names, values, and compare flags to match.
  20930. * @param {Function} [customizer] The function to customize comparisons.
  20931. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20932. */
  20933. function baseIsMatch(object, source, matchData, customizer) {
  20934. var index = matchData.length,
  20935. length = index,
  20936. noCustomizer = !customizer;
  20937. if (object == null) {
  20938. return !length;
  20939. }
  20940. object = Object(object);
  20941. while (index--) {
  20942. var data = matchData[index];
  20943. if ((noCustomizer && data[2])
  20944. ? data[1] !== object[data[0]]
  20945. : !(data[0] in object)
  20946. ) {
  20947. return false;
  20948. }
  20949. }
  20950. while (++index < length) {
  20951. data = matchData[index];
  20952. var key = data[0],
  20953. objValue = object[key],
  20954. srcValue = data[1];
  20955. if (noCustomizer && data[2]) {
  20956. if (objValue === undefined && !(key in object)) {
  20957. return false;
  20958. }
  20959. } else {
  20960. var stack = new Stack;
  20961. if (customizer) {
  20962. var result = customizer(objValue, srcValue, key, object, source, stack);
  20963. }
  20964. if (!(result === undefined
  20965. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  20966. : result
  20967. )) {
  20968. return false;
  20969. }
  20970. }
  20971. }
  20972. return true;
  20973. }
  20974. /**
  20975. * The base implementation of `_.isNative` without bad shim checks.
  20976. *
  20977. * @private
  20978. * @param {*} value The value to check.
  20979. * @returns {boolean} Returns `true` if `value` is a native function,
  20980. * else `false`.
  20981. */
  20982. function baseIsNative(value) {
  20983. if (!isObject(value) || isMasked(value)) {
  20984. return false;
  20985. }
  20986. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  20987. return pattern.test(toSource(value));
  20988. }
  20989. /**
  20990. * The base implementation of `_.isRegExp` without Node.js optimizations.
  20991. *
  20992. * @private
  20993. * @param {*} value The value to check.
  20994. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  20995. */
  20996. function baseIsRegExp(value) {
  20997. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  20998. }
  20999. /**
  21000. * The base implementation of `_.isSet` without Node.js optimizations.
  21001. *
  21002. * @private
  21003. * @param {*} value The value to check.
  21004. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21005. */
  21006. function baseIsSet(value) {
  21007. return isObjectLike(value) && getTag(value) == setTag;
  21008. }
  21009. /**
  21010. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21011. *
  21012. * @private
  21013. * @param {*} value The value to check.
  21014. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21015. */
  21016. function baseIsTypedArray(value) {
  21017. return isObjectLike(value) &&
  21018. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21019. }
  21020. /**
  21021. * The base implementation of `_.iteratee`.
  21022. *
  21023. * @private
  21024. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21025. * @returns {Function} Returns the iteratee.
  21026. */
  21027. function baseIteratee(value) {
  21028. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21029. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21030. if (typeof value == 'function') {
  21031. return value;
  21032. }
  21033. if (value == null) {
  21034. return identity;
  21035. }
  21036. if (typeof value == 'object') {
  21037. return isArray(value)
  21038. ? baseMatchesProperty(value[0], value[1])
  21039. : baseMatches(value);
  21040. }
  21041. return property(value);
  21042. }
  21043. /**
  21044. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21045. *
  21046. * @private
  21047. * @param {Object} object The object to query.
  21048. * @returns {Array} Returns the array of property names.
  21049. */
  21050. function baseKeys(object) {
  21051. if (!isPrototype(object)) {
  21052. return nativeKeys(object);
  21053. }
  21054. var result = [];
  21055. for (var key in Object(object)) {
  21056. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21057. result.push(key);
  21058. }
  21059. }
  21060. return result;
  21061. }
  21062. /**
  21063. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21064. *
  21065. * @private
  21066. * @param {Object} object The object to query.
  21067. * @returns {Array} Returns the array of property names.
  21068. */
  21069. function baseKeysIn(object) {
  21070. if (!isObject(object)) {
  21071. return nativeKeysIn(object);
  21072. }
  21073. var isProto = isPrototype(object),
  21074. result = [];
  21075. for (var key in object) {
  21076. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21077. result.push(key);
  21078. }
  21079. }
  21080. return result;
  21081. }
  21082. /**
  21083. * The base implementation of `_.lt` which doesn't coerce arguments.
  21084. *
  21085. * @private
  21086. * @param {*} value The value to compare.
  21087. * @param {*} other The other value to compare.
  21088. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21089. * else `false`.
  21090. */
  21091. function baseLt(value, other) {
  21092. return value < other;
  21093. }
  21094. /**
  21095. * The base implementation of `_.map` without support for iteratee shorthands.
  21096. *
  21097. * @private
  21098. * @param {Array|Object} collection The collection to iterate over.
  21099. * @param {Function} iteratee The function invoked per iteration.
  21100. * @returns {Array} Returns the new mapped array.
  21101. */
  21102. function baseMap(collection, iteratee) {
  21103. var index = -1,
  21104. result = isArrayLike(collection) ? Array(collection.length) : [];
  21105. baseEach(collection, function(value, key, collection) {
  21106. result[++index] = iteratee(value, key, collection);
  21107. });
  21108. return result;
  21109. }
  21110. /**
  21111. * The base implementation of `_.matches` which doesn't clone `source`.
  21112. *
  21113. * @private
  21114. * @param {Object} source The object of property values to match.
  21115. * @returns {Function} Returns the new spec function.
  21116. */
  21117. function baseMatches(source) {
  21118. var matchData = getMatchData(source);
  21119. if (matchData.length == 1 && matchData[0][2]) {
  21120. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21121. }
  21122. return function(object) {
  21123. return object === source || baseIsMatch(object, source, matchData);
  21124. };
  21125. }
  21126. /**
  21127. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21128. *
  21129. * @private
  21130. * @param {string} path The path of the property to get.
  21131. * @param {*} srcValue The value to match.
  21132. * @returns {Function} Returns the new spec function.
  21133. */
  21134. function baseMatchesProperty(path, srcValue) {
  21135. if (isKey(path) && isStrictComparable(srcValue)) {
  21136. return matchesStrictComparable(toKey(path), srcValue);
  21137. }
  21138. return function(object) {
  21139. var objValue = get(object, path);
  21140. return (objValue === undefined && objValue === srcValue)
  21141. ? hasIn(object, path)
  21142. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21143. };
  21144. }
  21145. /**
  21146. * The base implementation of `_.merge` without support for multiple sources.
  21147. *
  21148. * @private
  21149. * @param {Object} object The destination object.
  21150. * @param {Object} source The source object.
  21151. * @param {number} srcIndex The index of `source`.
  21152. * @param {Function} [customizer] The function to customize merged values.
  21153. * @param {Object} [stack] Tracks traversed source values and their merged
  21154. * counterparts.
  21155. */
  21156. function baseMerge(object, source, srcIndex, customizer, stack) {
  21157. if (object === source) {
  21158. return;
  21159. }
  21160. baseFor(source, function(srcValue, key) {
  21161. stack || (stack = new Stack);
  21162. if (isObject(srcValue)) {
  21163. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21164. }
  21165. else {
  21166. var newValue = customizer
  21167. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21168. : undefined;
  21169. if (newValue === undefined) {
  21170. newValue = srcValue;
  21171. }
  21172. assignMergeValue(object, key, newValue);
  21173. }
  21174. }, keysIn);
  21175. }
  21176. /**
  21177. * A specialized version of `baseMerge` for arrays and objects which performs
  21178. * deep merges and tracks traversed objects enabling objects with circular
  21179. * references to be merged.
  21180. *
  21181. * @private
  21182. * @param {Object} object The destination object.
  21183. * @param {Object} source The source object.
  21184. * @param {string} key The key of the value to merge.
  21185. * @param {number} srcIndex The index of `source`.
  21186. * @param {Function} mergeFunc The function to merge values.
  21187. * @param {Function} [customizer] The function to customize assigned values.
  21188. * @param {Object} [stack] Tracks traversed source values and their merged
  21189. * counterparts.
  21190. */
  21191. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21192. var objValue = safeGet(object, key),
  21193. srcValue = safeGet(source, key),
  21194. stacked = stack.get(srcValue);
  21195. if (stacked) {
  21196. assignMergeValue(object, key, stacked);
  21197. return;
  21198. }
  21199. var newValue = customizer
  21200. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21201. : undefined;
  21202. var isCommon = newValue === undefined;
  21203. if (isCommon) {
  21204. var isArr = isArray(srcValue),
  21205. isBuff = !isArr && isBuffer(srcValue),
  21206. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21207. newValue = srcValue;
  21208. if (isArr || isBuff || isTyped) {
  21209. if (isArray(objValue)) {
  21210. newValue = objValue;
  21211. }
  21212. else if (isArrayLikeObject(objValue)) {
  21213. newValue = copyArray(objValue);
  21214. }
  21215. else if (isBuff) {
  21216. isCommon = false;
  21217. newValue = cloneBuffer(srcValue, true);
  21218. }
  21219. else if (isTyped) {
  21220. isCommon = false;
  21221. newValue = cloneTypedArray(srcValue, true);
  21222. }
  21223. else {
  21224. newValue = [];
  21225. }
  21226. }
  21227. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21228. newValue = objValue;
  21229. if (isArguments(objValue)) {
  21230. newValue = toPlainObject(objValue);
  21231. }
  21232. else if (!isObject(objValue) || isFunction(objValue)) {
  21233. newValue = initCloneObject(srcValue);
  21234. }
  21235. }
  21236. else {
  21237. isCommon = false;
  21238. }
  21239. }
  21240. if (isCommon) {
  21241. // Recursively merge objects and arrays (susceptible to call stack limits).
  21242. stack.set(srcValue, newValue);
  21243. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21244. stack['delete'](srcValue);
  21245. }
  21246. assignMergeValue(object, key, newValue);
  21247. }
  21248. /**
  21249. * The base implementation of `_.nth` which doesn't coerce arguments.
  21250. *
  21251. * @private
  21252. * @param {Array} array The array to query.
  21253. * @param {number} n The index of the element to return.
  21254. * @returns {*} Returns the nth element of `array`.
  21255. */
  21256. function baseNth(array, n) {
  21257. var length = array.length;
  21258. if (!length) {
  21259. return;
  21260. }
  21261. n += n < 0 ? length : 0;
  21262. return isIndex(n, length) ? array[n] : undefined;
  21263. }
  21264. /**
  21265. * The base implementation of `_.orderBy` without param guards.
  21266. *
  21267. * @private
  21268. * @param {Array|Object} collection The collection to iterate over.
  21269. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21270. * @param {string[]} orders The sort orders of `iteratees`.
  21271. * @returns {Array} Returns the new sorted array.
  21272. */
  21273. function baseOrderBy(collection, iteratees, orders) {
  21274. var index = -1;
  21275. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21276. var result = baseMap(collection, function(value, key, collection) {
  21277. var criteria = arrayMap(iteratees, function(iteratee) {
  21278. return iteratee(value);
  21279. });
  21280. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21281. });
  21282. return baseSortBy(result, function(object, other) {
  21283. return compareMultiple(object, other, orders);
  21284. });
  21285. }
  21286. /**
  21287. * The base implementation of `_.pick` without support for individual
  21288. * property identifiers.
  21289. *
  21290. * @private
  21291. * @param {Object} object The source object.
  21292. * @param {string[]} paths The property paths to pick.
  21293. * @returns {Object} Returns the new object.
  21294. */
  21295. function basePick(object, paths) {
  21296. return basePickBy(object, paths, function(value, path) {
  21297. return hasIn(object, path);
  21298. });
  21299. }
  21300. /**
  21301. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21302. *
  21303. * @private
  21304. * @param {Object} object The source object.
  21305. * @param {string[]} paths The property paths to pick.
  21306. * @param {Function} predicate The function invoked per property.
  21307. * @returns {Object} Returns the new object.
  21308. */
  21309. function basePickBy(object, paths, predicate) {
  21310. var index = -1,
  21311. length = paths.length,
  21312. result = {};
  21313. while (++index < length) {
  21314. var path = paths[index],
  21315. value = baseGet(object, path);
  21316. if (predicate(value, path)) {
  21317. baseSet(result, castPath(path, object), value);
  21318. }
  21319. }
  21320. return result;
  21321. }
  21322. /**
  21323. * A specialized version of `baseProperty` which supports deep paths.
  21324. *
  21325. * @private
  21326. * @param {Array|string} path The path of the property to get.
  21327. * @returns {Function} Returns the new accessor function.
  21328. */
  21329. function basePropertyDeep(path) {
  21330. return function(object) {
  21331. return baseGet(object, path);
  21332. };
  21333. }
  21334. /**
  21335. * The base implementation of `_.pullAllBy` without support for iteratee
  21336. * shorthands.
  21337. *
  21338. * @private
  21339. * @param {Array} array The array to modify.
  21340. * @param {Array} values The values to remove.
  21341. * @param {Function} [iteratee] The iteratee invoked per element.
  21342. * @param {Function} [comparator] The comparator invoked per element.
  21343. * @returns {Array} Returns `array`.
  21344. */
  21345. function basePullAll(array, values, iteratee, comparator) {
  21346. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21347. index = -1,
  21348. length = values.length,
  21349. seen = array;
  21350. if (array === values) {
  21351. values = copyArray(values);
  21352. }
  21353. if (iteratee) {
  21354. seen = arrayMap(array, baseUnary(iteratee));
  21355. }
  21356. while (++index < length) {
  21357. var fromIndex = 0,
  21358. value = values[index],
  21359. computed = iteratee ? iteratee(value) : value;
  21360. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21361. if (seen !== array) {
  21362. splice.call(seen, fromIndex, 1);
  21363. }
  21364. splice.call(array, fromIndex, 1);
  21365. }
  21366. }
  21367. return array;
  21368. }
  21369. /**
  21370. * The base implementation of `_.pullAt` without support for individual
  21371. * indexes or capturing the removed elements.
  21372. *
  21373. * @private
  21374. * @param {Array} array The array to modify.
  21375. * @param {number[]} indexes The indexes of elements to remove.
  21376. * @returns {Array} Returns `array`.
  21377. */
  21378. function basePullAt(array, indexes) {
  21379. var length = array ? indexes.length : 0,
  21380. lastIndex = length - 1;
  21381. while (length--) {
  21382. var index = indexes[length];
  21383. if (length == lastIndex || index !== previous) {
  21384. var previous = index;
  21385. if (isIndex(index)) {
  21386. splice.call(array, index, 1);
  21387. } else {
  21388. baseUnset(array, index);
  21389. }
  21390. }
  21391. }
  21392. return array;
  21393. }
  21394. /**
  21395. * The base implementation of `_.random` without support for returning
  21396. * floating-point numbers.
  21397. *
  21398. * @private
  21399. * @param {number} lower The lower bound.
  21400. * @param {number} upper The upper bound.
  21401. * @returns {number} Returns the random number.
  21402. */
  21403. function baseRandom(lower, upper) {
  21404. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21405. }
  21406. /**
  21407. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21408. * coerce arguments.
  21409. *
  21410. * @private
  21411. * @param {number} start The start of the range.
  21412. * @param {number} end The end of the range.
  21413. * @param {number} step The value to increment or decrement by.
  21414. * @param {boolean} [fromRight] Specify iterating from right to left.
  21415. * @returns {Array} Returns the range of numbers.
  21416. */
  21417. function baseRange(start, end, step, fromRight) {
  21418. var index = -1,
  21419. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21420. result = Array(length);
  21421. while (length--) {
  21422. result[fromRight ? length : ++index] = start;
  21423. start += step;
  21424. }
  21425. return result;
  21426. }
  21427. /**
  21428. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21429. *
  21430. * @private
  21431. * @param {string} string The string to repeat.
  21432. * @param {number} n The number of times to repeat the string.
  21433. * @returns {string} Returns the repeated string.
  21434. */
  21435. function baseRepeat(string, n) {
  21436. var result = '';
  21437. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21438. return result;
  21439. }
  21440. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21441. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21442. do {
  21443. if (n % 2) {
  21444. result += string;
  21445. }
  21446. n = nativeFloor(n / 2);
  21447. if (n) {
  21448. string += string;
  21449. }
  21450. } while (n);
  21451. return result;
  21452. }
  21453. /**
  21454. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21455. *
  21456. * @private
  21457. * @param {Function} func The function to apply a rest parameter to.
  21458. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21459. * @returns {Function} Returns the new function.
  21460. */
  21461. function baseRest(func, start) {
  21462. return setToString(overRest(func, start, identity), func + '');
  21463. }
  21464. /**
  21465. * The base implementation of `_.sample`.
  21466. *
  21467. * @private
  21468. * @param {Array|Object} collection The collection to sample.
  21469. * @returns {*} Returns the random element.
  21470. */
  21471. function baseSample(collection) {
  21472. return arraySample(values(collection));
  21473. }
  21474. /**
  21475. * The base implementation of `_.sampleSize` without param guards.
  21476. *
  21477. * @private
  21478. * @param {Array|Object} collection The collection to sample.
  21479. * @param {number} n The number of elements to sample.
  21480. * @returns {Array} Returns the random elements.
  21481. */
  21482. function baseSampleSize(collection, n) {
  21483. var array = values(collection);
  21484. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21485. }
  21486. /**
  21487. * The base implementation of `_.set`.
  21488. *
  21489. * @private
  21490. * @param {Object} object The object to modify.
  21491. * @param {Array|string} path The path of the property to set.
  21492. * @param {*} value The value to set.
  21493. * @param {Function} [customizer] The function to customize path creation.
  21494. * @returns {Object} Returns `object`.
  21495. */
  21496. function baseSet(object, path, value, customizer) {
  21497. if (!isObject(object)) {
  21498. return object;
  21499. }
  21500. path = castPath(path, object);
  21501. var index = -1,
  21502. length = path.length,
  21503. lastIndex = length - 1,
  21504. nested = object;
  21505. while (nested != null && ++index < length) {
  21506. var key = toKey(path[index]),
  21507. newValue = value;
  21508. if (index != lastIndex) {
  21509. var objValue = nested[key];
  21510. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21511. if (newValue === undefined) {
  21512. newValue = isObject(objValue)
  21513. ? objValue
  21514. : (isIndex(path[index + 1]) ? [] : {});
  21515. }
  21516. }
  21517. assignValue(nested, key, newValue);
  21518. nested = nested[key];
  21519. }
  21520. return object;
  21521. }
  21522. /**
  21523. * The base implementation of `setData` without support for hot loop shorting.
  21524. *
  21525. * @private
  21526. * @param {Function} func The function to associate metadata with.
  21527. * @param {*} data The metadata.
  21528. * @returns {Function} Returns `func`.
  21529. */
  21530. var baseSetData = !metaMap ? identity : function(func, data) {
  21531. metaMap.set(func, data);
  21532. return func;
  21533. };
  21534. /**
  21535. * The base implementation of `setToString` without support for hot loop shorting.
  21536. *
  21537. * @private
  21538. * @param {Function} func The function to modify.
  21539. * @param {Function} string The `toString` result.
  21540. * @returns {Function} Returns `func`.
  21541. */
  21542. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21543. return defineProperty(func, 'toString', {
  21544. 'configurable': true,
  21545. 'enumerable': false,
  21546. 'value': constant(string),
  21547. 'writable': true
  21548. });
  21549. };
  21550. /**
  21551. * The base implementation of `_.shuffle`.
  21552. *
  21553. * @private
  21554. * @param {Array|Object} collection The collection to shuffle.
  21555. * @returns {Array} Returns the new shuffled array.
  21556. */
  21557. function baseShuffle(collection) {
  21558. return shuffleSelf(values(collection));
  21559. }
  21560. /**
  21561. * The base implementation of `_.slice` without an iteratee call guard.
  21562. *
  21563. * @private
  21564. * @param {Array} array The array to slice.
  21565. * @param {number} [start=0] The start position.
  21566. * @param {number} [end=array.length] The end position.
  21567. * @returns {Array} Returns the slice of `array`.
  21568. */
  21569. function baseSlice(array, start, end) {
  21570. var index = -1,
  21571. length = array.length;
  21572. if (start < 0) {
  21573. start = -start > length ? 0 : (length + start);
  21574. }
  21575. end = end > length ? length : end;
  21576. if (end < 0) {
  21577. end += length;
  21578. }
  21579. length = start > end ? 0 : ((end - start) >>> 0);
  21580. start >>>= 0;
  21581. var result = Array(length);
  21582. while (++index < length) {
  21583. result[index] = array[index + start];
  21584. }
  21585. return result;
  21586. }
  21587. /**
  21588. * The base implementation of `_.some` without support for iteratee shorthands.
  21589. *
  21590. * @private
  21591. * @param {Array|Object} collection The collection to iterate over.
  21592. * @param {Function} predicate The function invoked per iteration.
  21593. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21594. * else `false`.
  21595. */
  21596. function baseSome(collection, predicate) {
  21597. var result;
  21598. baseEach(collection, function(value, index, collection) {
  21599. result = predicate(value, index, collection);
  21600. return !result;
  21601. });
  21602. return !!result;
  21603. }
  21604. /**
  21605. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21606. * performs a binary search of `array` to determine the index at which `value`
  21607. * should be inserted into `array` in order to maintain its sort order.
  21608. *
  21609. * @private
  21610. * @param {Array} array The sorted array to inspect.
  21611. * @param {*} value The value to evaluate.
  21612. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21613. * @returns {number} Returns the index at which `value` should be inserted
  21614. * into `array`.
  21615. */
  21616. function baseSortedIndex(array, value, retHighest) {
  21617. var low = 0,
  21618. high = array == null ? low : array.length;
  21619. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21620. while (low < high) {
  21621. var mid = (low + high) >>> 1,
  21622. computed = array[mid];
  21623. if (computed !== null && !isSymbol(computed) &&
  21624. (retHighest ? (computed <= value) : (computed < value))) {
  21625. low = mid + 1;
  21626. } else {
  21627. high = mid;
  21628. }
  21629. }
  21630. return high;
  21631. }
  21632. return baseSortedIndexBy(array, value, identity, retHighest);
  21633. }
  21634. /**
  21635. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21636. * which invokes `iteratee` for `value` and each element of `array` to compute
  21637. * their sort ranking. The iteratee is invoked with one argument; (value).
  21638. *
  21639. * @private
  21640. * @param {Array} array The sorted array to inspect.
  21641. * @param {*} value The value to evaluate.
  21642. * @param {Function} iteratee The iteratee invoked per element.
  21643. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21644. * @returns {number} Returns the index at which `value` should be inserted
  21645. * into `array`.
  21646. */
  21647. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21648. value = iteratee(value);
  21649. var low = 0,
  21650. high = array == null ? 0 : array.length,
  21651. valIsNaN = value !== value,
  21652. valIsNull = value === null,
  21653. valIsSymbol = isSymbol(value),
  21654. valIsUndefined = value === undefined;
  21655. while (low < high) {
  21656. var mid = nativeFloor((low + high) / 2),
  21657. computed = iteratee(array[mid]),
  21658. othIsDefined = computed !== undefined,
  21659. othIsNull = computed === null,
  21660. othIsReflexive = computed === computed,
  21661. othIsSymbol = isSymbol(computed);
  21662. if (valIsNaN) {
  21663. var setLow = retHighest || othIsReflexive;
  21664. } else if (valIsUndefined) {
  21665. setLow = othIsReflexive && (retHighest || othIsDefined);
  21666. } else if (valIsNull) {
  21667. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21668. } else if (valIsSymbol) {
  21669. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21670. } else if (othIsNull || othIsSymbol) {
  21671. setLow = false;
  21672. } else {
  21673. setLow = retHighest ? (computed <= value) : (computed < value);
  21674. }
  21675. if (setLow) {
  21676. low = mid + 1;
  21677. } else {
  21678. high = mid;
  21679. }
  21680. }
  21681. return nativeMin(high, MAX_ARRAY_INDEX);
  21682. }
  21683. /**
  21684. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21685. * support for iteratee shorthands.
  21686. *
  21687. * @private
  21688. * @param {Array} array The array to inspect.
  21689. * @param {Function} [iteratee] The iteratee invoked per element.
  21690. * @returns {Array} Returns the new duplicate free array.
  21691. */
  21692. function baseSortedUniq(array, iteratee) {
  21693. var index = -1,
  21694. length = array.length,
  21695. resIndex = 0,
  21696. result = [];
  21697. while (++index < length) {
  21698. var value = array[index],
  21699. computed = iteratee ? iteratee(value) : value;
  21700. if (!index || !eq(computed, seen)) {
  21701. var seen = computed;
  21702. result[resIndex++] = value === 0 ? 0 : value;
  21703. }
  21704. }
  21705. return result;
  21706. }
  21707. /**
  21708. * The base implementation of `_.toNumber` which doesn't ensure correct
  21709. * conversions of binary, hexadecimal, or octal string values.
  21710. *
  21711. * @private
  21712. * @param {*} value The value to process.
  21713. * @returns {number} Returns the number.
  21714. */
  21715. function baseToNumber(value) {
  21716. if (typeof value == 'number') {
  21717. return value;
  21718. }
  21719. if (isSymbol(value)) {
  21720. return NAN;
  21721. }
  21722. return +value;
  21723. }
  21724. /**
  21725. * The base implementation of `_.toString` which doesn't convert nullish
  21726. * values to empty strings.
  21727. *
  21728. * @private
  21729. * @param {*} value The value to process.
  21730. * @returns {string} Returns the string.
  21731. */
  21732. function baseToString(value) {
  21733. // Exit early for strings to avoid a performance hit in some environments.
  21734. if (typeof value == 'string') {
  21735. return value;
  21736. }
  21737. if (isArray(value)) {
  21738. // Recursively convert values (susceptible to call stack limits).
  21739. return arrayMap(value, baseToString) + '';
  21740. }
  21741. if (isSymbol(value)) {
  21742. return symbolToString ? symbolToString.call(value) : '';
  21743. }
  21744. var result = (value + '');
  21745. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21746. }
  21747. /**
  21748. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21749. *
  21750. * @private
  21751. * @param {Array} array The array to inspect.
  21752. * @param {Function} [iteratee] The iteratee invoked per element.
  21753. * @param {Function} [comparator] The comparator invoked per element.
  21754. * @returns {Array} Returns the new duplicate free array.
  21755. */
  21756. function baseUniq(array, iteratee, comparator) {
  21757. var index = -1,
  21758. includes = arrayIncludes,
  21759. length = array.length,
  21760. isCommon = true,
  21761. result = [],
  21762. seen = result;
  21763. if (comparator) {
  21764. isCommon = false;
  21765. includes = arrayIncludesWith;
  21766. }
  21767. else if (length >= LARGE_ARRAY_SIZE) {
  21768. var set = iteratee ? null : createSet(array);
  21769. if (set) {
  21770. return setToArray(set);
  21771. }
  21772. isCommon = false;
  21773. includes = cacheHas;
  21774. seen = new SetCache;
  21775. }
  21776. else {
  21777. seen = iteratee ? [] : result;
  21778. }
  21779. outer:
  21780. while (++index < length) {
  21781. var value = array[index],
  21782. computed = iteratee ? iteratee(value) : value;
  21783. value = (comparator || value !== 0) ? value : 0;
  21784. if (isCommon && computed === computed) {
  21785. var seenIndex = seen.length;
  21786. while (seenIndex--) {
  21787. if (seen[seenIndex] === computed) {
  21788. continue outer;
  21789. }
  21790. }
  21791. if (iteratee) {
  21792. seen.push(computed);
  21793. }
  21794. result.push(value);
  21795. }
  21796. else if (!includes(seen, computed, comparator)) {
  21797. if (seen !== result) {
  21798. seen.push(computed);
  21799. }
  21800. result.push(value);
  21801. }
  21802. }
  21803. return result;
  21804. }
  21805. /**
  21806. * The base implementation of `_.unset`.
  21807. *
  21808. * @private
  21809. * @param {Object} object The object to modify.
  21810. * @param {Array|string} path The property path to unset.
  21811. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21812. */
  21813. function baseUnset(object, path) {
  21814. path = castPath(path, object);
  21815. object = parent(object, path);
  21816. return object == null || delete object[toKey(last(path))];
  21817. }
  21818. /**
  21819. * The base implementation of `_.update`.
  21820. *
  21821. * @private
  21822. * @param {Object} object The object to modify.
  21823. * @param {Array|string} path The path of the property to update.
  21824. * @param {Function} updater The function to produce the updated value.
  21825. * @param {Function} [customizer] The function to customize path creation.
  21826. * @returns {Object} Returns `object`.
  21827. */
  21828. function baseUpdate(object, path, updater, customizer) {
  21829. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21830. }
  21831. /**
  21832. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21833. * without support for iteratee shorthands.
  21834. *
  21835. * @private
  21836. * @param {Array} array The array to query.
  21837. * @param {Function} predicate The function invoked per iteration.
  21838. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21839. * @param {boolean} [fromRight] Specify iterating from right to left.
  21840. * @returns {Array} Returns the slice of `array`.
  21841. */
  21842. function baseWhile(array, predicate, isDrop, fromRight) {
  21843. var length = array.length,
  21844. index = fromRight ? length : -1;
  21845. while ((fromRight ? index-- : ++index < length) &&
  21846. predicate(array[index], index, array)) {}
  21847. return isDrop
  21848. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21849. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21850. }
  21851. /**
  21852. * The base implementation of `wrapperValue` which returns the result of
  21853. * performing a sequence of actions on the unwrapped `value`, where each
  21854. * successive action is supplied the return value of the previous.
  21855. *
  21856. * @private
  21857. * @param {*} value The unwrapped value.
  21858. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21859. * @returns {*} Returns the resolved value.
  21860. */
  21861. function baseWrapperValue(value, actions) {
  21862. var result = value;
  21863. if (result instanceof LazyWrapper) {
  21864. result = result.value();
  21865. }
  21866. return arrayReduce(actions, function(result, action) {
  21867. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21868. }, result);
  21869. }
  21870. /**
  21871. * The base implementation of methods like `_.xor`, without support for
  21872. * iteratee shorthands, that accepts an array of arrays to inspect.
  21873. *
  21874. * @private
  21875. * @param {Array} arrays The arrays to inspect.
  21876. * @param {Function} [iteratee] The iteratee invoked per element.
  21877. * @param {Function} [comparator] The comparator invoked per element.
  21878. * @returns {Array} Returns the new array of values.
  21879. */
  21880. function baseXor(arrays, iteratee, comparator) {
  21881. var length = arrays.length;
  21882. if (length < 2) {
  21883. return length ? baseUniq(arrays[0]) : [];
  21884. }
  21885. var index = -1,
  21886. result = Array(length);
  21887. while (++index < length) {
  21888. var array = arrays[index],
  21889. othIndex = -1;
  21890. while (++othIndex < length) {
  21891. if (othIndex != index) {
  21892. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21893. }
  21894. }
  21895. }
  21896. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21897. }
  21898. /**
  21899. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21900. *
  21901. * @private
  21902. * @param {Array} props The property identifiers.
  21903. * @param {Array} values The property values.
  21904. * @param {Function} assignFunc The function to assign values.
  21905. * @returns {Object} Returns the new object.
  21906. */
  21907. function baseZipObject(props, values, assignFunc) {
  21908. var index = -1,
  21909. length = props.length,
  21910. valsLength = values.length,
  21911. result = {};
  21912. while (++index < length) {
  21913. var value = index < valsLength ? values[index] : undefined;
  21914. assignFunc(result, props[index], value);
  21915. }
  21916. return result;
  21917. }
  21918. /**
  21919. * Casts `value` to an empty array if it's not an array like object.
  21920. *
  21921. * @private
  21922. * @param {*} value The value to inspect.
  21923. * @returns {Array|Object} Returns the cast array-like object.
  21924. */
  21925. function castArrayLikeObject(value) {
  21926. return isArrayLikeObject(value) ? value : [];
  21927. }
  21928. /**
  21929. * Casts `value` to `identity` if it's not a function.
  21930. *
  21931. * @private
  21932. * @param {*} value The value to inspect.
  21933. * @returns {Function} Returns cast function.
  21934. */
  21935. function castFunction(value) {
  21936. return typeof value == 'function' ? value : identity;
  21937. }
  21938. /**
  21939. * Casts `value` to a path array if it's not one.
  21940. *
  21941. * @private
  21942. * @param {*} value The value to inspect.
  21943. * @param {Object} [object] The object to query keys on.
  21944. * @returns {Array} Returns the cast property path array.
  21945. */
  21946. function castPath(value, object) {
  21947. if (isArray(value)) {
  21948. return value;
  21949. }
  21950. return isKey(value, object) ? [value] : stringToPath(toString(value));
  21951. }
  21952. /**
  21953. * A `baseRest` alias which can be replaced with `identity` by module
  21954. * replacement plugins.
  21955. *
  21956. * @private
  21957. * @type {Function}
  21958. * @param {Function} func The function to apply a rest parameter to.
  21959. * @returns {Function} Returns the new function.
  21960. */
  21961. var castRest = baseRest;
  21962. /**
  21963. * Casts `array` to a slice if it's needed.
  21964. *
  21965. * @private
  21966. * @param {Array} array The array to inspect.
  21967. * @param {number} start The start position.
  21968. * @param {number} [end=array.length] The end position.
  21969. * @returns {Array} Returns the cast slice.
  21970. */
  21971. function castSlice(array, start, end) {
  21972. var length = array.length;
  21973. end = end === undefined ? length : end;
  21974. return (!start && end >= length) ? array : baseSlice(array, start, end);
  21975. }
  21976. /**
  21977. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  21978. *
  21979. * @private
  21980. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  21981. */
  21982. var clearTimeout = ctxClearTimeout || function(id) {
  21983. return root.clearTimeout(id);
  21984. };
  21985. /**
  21986. * Creates a clone of `buffer`.
  21987. *
  21988. * @private
  21989. * @param {Buffer} buffer The buffer to clone.
  21990. * @param {boolean} [isDeep] Specify a deep clone.
  21991. * @returns {Buffer} Returns the cloned buffer.
  21992. */
  21993. function cloneBuffer(buffer, isDeep) {
  21994. if (isDeep) {
  21995. return buffer.slice();
  21996. }
  21997. var length = buffer.length,
  21998. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  21999. buffer.copy(result);
  22000. return result;
  22001. }
  22002. /**
  22003. * Creates a clone of `arrayBuffer`.
  22004. *
  22005. * @private
  22006. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22007. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22008. */
  22009. function cloneArrayBuffer(arrayBuffer) {
  22010. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22011. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22012. return result;
  22013. }
  22014. /**
  22015. * Creates a clone of `dataView`.
  22016. *
  22017. * @private
  22018. * @param {Object} dataView The data view to clone.
  22019. * @param {boolean} [isDeep] Specify a deep clone.
  22020. * @returns {Object} Returns the cloned data view.
  22021. */
  22022. function cloneDataView(dataView, isDeep) {
  22023. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22024. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22025. }
  22026. /**
  22027. * Creates a clone of `regexp`.
  22028. *
  22029. * @private
  22030. * @param {Object} regexp The regexp to clone.
  22031. * @returns {Object} Returns the cloned regexp.
  22032. */
  22033. function cloneRegExp(regexp) {
  22034. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22035. result.lastIndex = regexp.lastIndex;
  22036. return result;
  22037. }
  22038. /**
  22039. * Creates a clone of the `symbol` object.
  22040. *
  22041. * @private
  22042. * @param {Object} symbol The symbol object to clone.
  22043. * @returns {Object} Returns the cloned symbol object.
  22044. */
  22045. function cloneSymbol(symbol) {
  22046. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22047. }
  22048. /**
  22049. * Creates a clone of `typedArray`.
  22050. *
  22051. * @private
  22052. * @param {Object} typedArray The typed array to clone.
  22053. * @param {boolean} [isDeep] Specify a deep clone.
  22054. * @returns {Object} Returns the cloned typed array.
  22055. */
  22056. function cloneTypedArray(typedArray, isDeep) {
  22057. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22058. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22059. }
  22060. /**
  22061. * Compares values to sort them in ascending order.
  22062. *
  22063. * @private
  22064. * @param {*} value The value to compare.
  22065. * @param {*} other The other value to compare.
  22066. * @returns {number} Returns the sort order indicator for `value`.
  22067. */
  22068. function compareAscending(value, other) {
  22069. if (value !== other) {
  22070. var valIsDefined = value !== undefined,
  22071. valIsNull = value === null,
  22072. valIsReflexive = value === value,
  22073. valIsSymbol = isSymbol(value);
  22074. var othIsDefined = other !== undefined,
  22075. othIsNull = other === null,
  22076. othIsReflexive = other === other,
  22077. othIsSymbol = isSymbol(other);
  22078. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22079. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22080. (valIsNull && othIsDefined && othIsReflexive) ||
  22081. (!valIsDefined && othIsReflexive) ||
  22082. !valIsReflexive) {
  22083. return 1;
  22084. }
  22085. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22086. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22087. (othIsNull && valIsDefined && valIsReflexive) ||
  22088. (!othIsDefined && valIsReflexive) ||
  22089. !othIsReflexive) {
  22090. return -1;
  22091. }
  22092. }
  22093. return 0;
  22094. }
  22095. /**
  22096. * Used by `_.orderBy` to compare multiple properties of a value to another
  22097. * and stable sort them.
  22098. *
  22099. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22100. * specify an order of "desc" for descending or "asc" for ascending sort order
  22101. * of corresponding values.
  22102. *
  22103. * @private
  22104. * @param {Object} object The object to compare.
  22105. * @param {Object} other The other object to compare.
  22106. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22107. * @returns {number} Returns the sort order indicator for `object`.
  22108. */
  22109. function compareMultiple(object, other, orders) {
  22110. var index = -1,
  22111. objCriteria = object.criteria,
  22112. othCriteria = other.criteria,
  22113. length = objCriteria.length,
  22114. ordersLength = orders.length;
  22115. while (++index < length) {
  22116. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22117. if (result) {
  22118. if (index >= ordersLength) {
  22119. return result;
  22120. }
  22121. var order = orders[index];
  22122. return result * (order == 'desc' ? -1 : 1);
  22123. }
  22124. }
  22125. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22126. // that causes it, under certain circumstances, to provide the same value for
  22127. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22128. // for more details.
  22129. //
  22130. // This also ensures a stable sort in V8 and other engines.
  22131. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22132. return object.index - other.index;
  22133. }
  22134. /**
  22135. * Creates an array that is the composition of partially applied arguments,
  22136. * placeholders, and provided arguments into a single array of arguments.
  22137. *
  22138. * @private
  22139. * @param {Array} args The provided arguments.
  22140. * @param {Array} partials The arguments to prepend to those provided.
  22141. * @param {Array} holders The `partials` placeholder indexes.
  22142. * @params {boolean} [isCurried] Specify composing for a curried function.
  22143. * @returns {Array} Returns the new array of composed arguments.
  22144. */
  22145. function composeArgs(args, partials, holders, isCurried) {
  22146. var argsIndex = -1,
  22147. argsLength = args.length,
  22148. holdersLength = holders.length,
  22149. leftIndex = -1,
  22150. leftLength = partials.length,
  22151. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22152. result = Array(leftLength + rangeLength),
  22153. isUncurried = !isCurried;
  22154. while (++leftIndex < leftLength) {
  22155. result[leftIndex] = partials[leftIndex];
  22156. }
  22157. while (++argsIndex < holdersLength) {
  22158. if (isUncurried || argsIndex < argsLength) {
  22159. result[holders[argsIndex]] = args[argsIndex];
  22160. }
  22161. }
  22162. while (rangeLength--) {
  22163. result[leftIndex++] = args[argsIndex++];
  22164. }
  22165. return result;
  22166. }
  22167. /**
  22168. * This function is like `composeArgs` except that the arguments composition
  22169. * is tailored for `_.partialRight`.
  22170. *
  22171. * @private
  22172. * @param {Array} args The provided arguments.
  22173. * @param {Array} partials The arguments to append to those provided.
  22174. * @param {Array} holders The `partials` placeholder indexes.
  22175. * @params {boolean} [isCurried] Specify composing for a curried function.
  22176. * @returns {Array} Returns the new array of composed arguments.
  22177. */
  22178. function composeArgsRight(args, partials, holders, isCurried) {
  22179. var argsIndex = -1,
  22180. argsLength = args.length,
  22181. holdersIndex = -1,
  22182. holdersLength = holders.length,
  22183. rightIndex = -1,
  22184. rightLength = partials.length,
  22185. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22186. result = Array(rangeLength + rightLength),
  22187. isUncurried = !isCurried;
  22188. while (++argsIndex < rangeLength) {
  22189. result[argsIndex] = args[argsIndex];
  22190. }
  22191. var offset = argsIndex;
  22192. while (++rightIndex < rightLength) {
  22193. result[offset + rightIndex] = partials[rightIndex];
  22194. }
  22195. while (++holdersIndex < holdersLength) {
  22196. if (isUncurried || argsIndex < argsLength) {
  22197. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22198. }
  22199. }
  22200. return result;
  22201. }
  22202. /**
  22203. * Copies the values of `source` to `array`.
  22204. *
  22205. * @private
  22206. * @param {Array} source The array to copy values from.
  22207. * @param {Array} [array=[]] The array to copy values to.
  22208. * @returns {Array} Returns `array`.
  22209. */
  22210. function copyArray(source, array) {
  22211. var index = -1,
  22212. length = source.length;
  22213. array || (array = Array(length));
  22214. while (++index < length) {
  22215. array[index] = source[index];
  22216. }
  22217. return array;
  22218. }
  22219. /**
  22220. * Copies properties of `source` to `object`.
  22221. *
  22222. * @private
  22223. * @param {Object} source The object to copy properties from.
  22224. * @param {Array} props The property identifiers to copy.
  22225. * @param {Object} [object={}] The object to copy properties to.
  22226. * @param {Function} [customizer] The function to customize copied values.
  22227. * @returns {Object} Returns `object`.
  22228. */
  22229. function copyObject(source, props, object, customizer) {
  22230. var isNew = !object;
  22231. object || (object = {});
  22232. var index = -1,
  22233. length = props.length;
  22234. while (++index < length) {
  22235. var key = props[index];
  22236. var newValue = customizer
  22237. ? customizer(object[key], source[key], key, object, source)
  22238. : undefined;
  22239. if (newValue === undefined) {
  22240. newValue = source[key];
  22241. }
  22242. if (isNew) {
  22243. baseAssignValue(object, key, newValue);
  22244. } else {
  22245. assignValue(object, key, newValue);
  22246. }
  22247. }
  22248. return object;
  22249. }
  22250. /**
  22251. * Copies own symbols of `source` to `object`.
  22252. *
  22253. * @private
  22254. * @param {Object} source The object to copy symbols from.
  22255. * @param {Object} [object={}] The object to copy symbols to.
  22256. * @returns {Object} Returns `object`.
  22257. */
  22258. function copySymbols(source, object) {
  22259. return copyObject(source, getSymbols(source), object);
  22260. }
  22261. /**
  22262. * Copies own and inherited symbols of `source` to `object`.
  22263. *
  22264. * @private
  22265. * @param {Object} source The object to copy symbols from.
  22266. * @param {Object} [object={}] The object to copy symbols to.
  22267. * @returns {Object} Returns `object`.
  22268. */
  22269. function copySymbolsIn(source, object) {
  22270. return copyObject(source, getSymbolsIn(source), object);
  22271. }
  22272. /**
  22273. * Creates a function like `_.groupBy`.
  22274. *
  22275. * @private
  22276. * @param {Function} setter The function to set accumulator values.
  22277. * @param {Function} [initializer] The accumulator object initializer.
  22278. * @returns {Function} Returns the new aggregator function.
  22279. */
  22280. function createAggregator(setter, initializer) {
  22281. return function(collection, iteratee) {
  22282. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22283. accumulator = initializer ? initializer() : {};
  22284. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22285. };
  22286. }
  22287. /**
  22288. * Creates a function like `_.assign`.
  22289. *
  22290. * @private
  22291. * @param {Function} assigner The function to assign values.
  22292. * @returns {Function} Returns the new assigner function.
  22293. */
  22294. function createAssigner(assigner) {
  22295. return baseRest(function(object, sources) {
  22296. var index = -1,
  22297. length = sources.length,
  22298. customizer = length > 1 ? sources[length - 1] : undefined,
  22299. guard = length > 2 ? sources[2] : undefined;
  22300. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22301. ? (length--, customizer)
  22302. : undefined;
  22303. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22304. customizer = length < 3 ? undefined : customizer;
  22305. length = 1;
  22306. }
  22307. object = Object(object);
  22308. while (++index < length) {
  22309. var source = sources[index];
  22310. if (source) {
  22311. assigner(object, source, index, customizer);
  22312. }
  22313. }
  22314. return object;
  22315. });
  22316. }
  22317. /**
  22318. * Creates a `baseEach` or `baseEachRight` function.
  22319. *
  22320. * @private
  22321. * @param {Function} eachFunc The function to iterate over a collection.
  22322. * @param {boolean} [fromRight] Specify iterating from right to left.
  22323. * @returns {Function} Returns the new base function.
  22324. */
  22325. function createBaseEach(eachFunc, fromRight) {
  22326. return function(collection, iteratee) {
  22327. if (collection == null) {
  22328. return collection;
  22329. }
  22330. if (!isArrayLike(collection)) {
  22331. return eachFunc(collection, iteratee);
  22332. }
  22333. var length = collection.length,
  22334. index = fromRight ? length : -1,
  22335. iterable = Object(collection);
  22336. while ((fromRight ? index-- : ++index < length)) {
  22337. if (iteratee(iterable[index], index, iterable) === false) {
  22338. break;
  22339. }
  22340. }
  22341. return collection;
  22342. };
  22343. }
  22344. /**
  22345. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22346. *
  22347. * @private
  22348. * @param {boolean} [fromRight] Specify iterating from right to left.
  22349. * @returns {Function} Returns the new base function.
  22350. */
  22351. function createBaseFor(fromRight) {
  22352. return function(object, iteratee, keysFunc) {
  22353. var index = -1,
  22354. iterable = Object(object),
  22355. props = keysFunc(object),
  22356. length = props.length;
  22357. while (length--) {
  22358. var key = props[fromRight ? length : ++index];
  22359. if (iteratee(iterable[key], key, iterable) === false) {
  22360. break;
  22361. }
  22362. }
  22363. return object;
  22364. };
  22365. }
  22366. /**
  22367. * Creates a function that wraps `func` to invoke it with the optional `this`
  22368. * binding of `thisArg`.
  22369. *
  22370. * @private
  22371. * @param {Function} func The function to wrap.
  22372. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22373. * @param {*} [thisArg] The `this` binding of `func`.
  22374. * @returns {Function} Returns the new wrapped function.
  22375. */
  22376. function createBind(func, bitmask, thisArg) {
  22377. var isBind = bitmask & WRAP_BIND_FLAG,
  22378. Ctor = createCtor(func);
  22379. function wrapper() {
  22380. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22381. return fn.apply(isBind ? thisArg : this, arguments);
  22382. }
  22383. return wrapper;
  22384. }
  22385. /**
  22386. * Creates a function like `_.lowerFirst`.
  22387. *
  22388. * @private
  22389. * @param {string} methodName The name of the `String` case method to use.
  22390. * @returns {Function} Returns the new case function.
  22391. */
  22392. function createCaseFirst(methodName) {
  22393. return function(string) {
  22394. string = toString(string);
  22395. var strSymbols = hasUnicode(string)
  22396. ? stringToArray(string)
  22397. : undefined;
  22398. var chr = strSymbols
  22399. ? strSymbols[0]
  22400. : string.charAt(0);
  22401. var trailing = strSymbols
  22402. ? castSlice(strSymbols, 1).join('')
  22403. : string.slice(1);
  22404. return chr[methodName]() + trailing;
  22405. };
  22406. }
  22407. /**
  22408. * Creates a function like `_.camelCase`.
  22409. *
  22410. * @private
  22411. * @param {Function} callback The function to combine each word.
  22412. * @returns {Function} Returns the new compounder function.
  22413. */
  22414. function createCompounder(callback) {
  22415. return function(string) {
  22416. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22417. };
  22418. }
  22419. /**
  22420. * Creates a function that produces an instance of `Ctor` regardless of
  22421. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22422. *
  22423. * @private
  22424. * @param {Function} Ctor The constructor to wrap.
  22425. * @returns {Function} Returns the new wrapped function.
  22426. */
  22427. function createCtor(Ctor) {
  22428. return function() {
  22429. // Use a `switch` statement to work with class constructors. See
  22430. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22431. // for more details.
  22432. var args = arguments;
  22433. switch (args.length) {
  22434. case 0: return new Ctor;
  22435. case 1: return new Ctor(args[0]);
  22436. case 2: return new Ctor(args[0], args[1]);
  22437. case 3: return new Ctor(args[0], args[1], args[2]);
  22438. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22439. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22440. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22441. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22442. }
  22443. var thisBinding = baseCreate(Ctor.prototype),
  22444. result = Ctor.apply(thisBinding, args);
  22445. // Mimic the constructor's `return` behavior.
  22446. // See https://es5.github.io/#x13.2.2 for more details.
  22447. return isObject(result) ? result : thisBinding;
  22448. };
  22449. }
  22450. /**
  22451. * Creates a function that wraps `func` to enable currying.
  22452. *
  22453. * @private
  22454. * @param {Function} func The function to wrap.
  22455. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22456. * @param {number} arity The arity of `func`.
  22457. * @returns {Function} Returns the new wrapped function.
  22458. */
  22459. function createCurry(func, bitmask, arity) {
  22460. var Ctor = createCtor(func);
  22461. function wrapper() {
  22462. var length = arguments.length,
  22463. args = Array(length),
  22464. index = length,
  22465. placeholder = getHolder(wrapper);
  22466. while (index--) {
  22467. args[index] = arguments[index];
  22468. }
  22469. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22470. ? []
  22471. : replaceHolders(args, placeholder);
  22472. length -= holders.length;
  22473. if (length < arity) {
  22474. return createRecurry(
  22475. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22476. args, holders, undefined, undefined, arity - length);
  22477. }
  22478. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22479. return apply(fn, this, args);
  22480. }
  22481. return wrapper;
  22482. }
  22483. /**
  22484. * Creates a `_.find` or `_.findLast` function.
  22485. *
  22486. * @private
  22487. * @param {Function} findIndexFunc The function to find the collection index.
  22488. * @returns {Function} Returns the new find function.
  22489. */
  22490. function createFind(findIndexFunc) {
  22491. return function(collection, predicate, fromIndex) {
  22492. var iterable = Object(collection);
  22493. if (!isArrayLike(collection)) {
  22494. var iteratee = getIteratee(predicate, 3);
  22495. collection = keys(collection);
  22496. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22497. }
  22498. var index = findIndexFunc(collection, predicate, fromIndex);
  22499. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22500. };
  22501. }
  22502. /**
  22503. * Creates a `_.flow` or `_.flowRight` function.
  22504. *
  22505. * @private
  22506. * @param {boolean} [fromRight] Specify iterating from right to left.
  22507. * @returns {Function} Returns the new flow function.
  22508. */
  22509. function createFlow(fromRight) {
  22510. return flatRest(function(funcs) {
  22511. var length = funcs.length,
  22512. index = length,
  22513. prereq = LodashWrapper.prototype.thru;
  22514. if (fromRight) {
  22515. funcs.reverse();
  22516. }
  22517. while (index--) {
  22518. var func = funcs[index];
  22519. if (typeof func != 'function') {
  22520. throw new TypeError(FUNC_ERROR_TEXT);
  22521. }
  22522. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22523. var wrapper = new LodashWrapper([], true);
  22524. }
  22525. }
  22526. index = wrapper ? index : length;
  22527. while (++index < length) {
  22528. func = funcs[index];
  22529. var funcName = getFuncName(func),
  22530. data = funcName == 'wrapper' ? getData(func) : undefined;
  22531. if (data && isLaziable(data[0]) &&
  22532. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22533. !data[4].length && data[9] == 1
  22534. ) {
  22535. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22536. } else {
  22537. wrapper = (func.length == 1 && isLaziable(func))
  22538. ? wrapper[funcName]()
  22539. : wrapper.thru(func);
  22540. }
  22541. }
  22542. return function() {
  22543. var args = arguments,
  22544. value = args[0];
  22545. if (wrapper && args.length == 1 && isArray(value)) {
  22546. return wrapper.plant(value).value();
  22547. }
  22548. var index = 0,
  22549. result = length ? funcs[index].apply(this, args) : value;
  22550. while (++index < length) {
  22551. result = funcs[index].call(this, result);
  22552. }
  22553. return result;
  22554. };
  22555. });
  22556. }
  22557. /**
  22558. * Creates a function that wraps `func` to invoke it with optional `this`
  22559. * binding of `thisArg`, partial application, and currying.
  22560. *
  22561. * @private
  22562. * @param {Function|string} func The function or method name to wrap.
  22563. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22564. * @param {*} [thisArg] The `this` binding of `func`.
  22565. * @param {Array} [partials] The arguments to prepend to those provided to
  22566. * the new function.
  22567. * @param {Array} [holders] The `partials` placeholder indexes.
  22568. * @param {Array} [partialsRight] The arguments to append to those provided
  22569. * to the new function.
  22570. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22571. * @param {Array} [argPos] The argument positions of the new function.
  22572. * @param {number} [ary] The arity cap of `func`.
  22573. * @param {number} [arity] The arity of `func`.
  22574. * @returns {Function} Returns the new wrapped function.
  22575. */
  22576. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22577. var isAry = bitmask & WRAP_ARY_FLAG,
  22578. isBind = bitmask & WRAP_BIND_FLAG,
  22579. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22580. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22581. isFlip = bitmask & WRAP_FLIP_FLAG,
  22582. Ctor = isBindKey ? undefined : createCtor(func);
  22583. function wrapper() {
  22584. var length = arguments.length,
  22585. args = Array(length),
  22586. index = length;
  22587. while (index--) {
  22588. args[index] = arguments[index];
  22589. }
  22590. if (isCurried) {
  22591. var placeholder = getHolder(wrapper),
  22592. holdersCount = countHolders(args, placeholder);
  22593. }
  22594. if (partials) {
  22595. args = composeArgs(args, partials, holders, isCurried);
  22596. }
  22597. if (partialsRight) {
  22598. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22599. }
  22600. length -= holdersCount;
  22601. if (isCurried && length < arity) {
  22602. var newHolders = replaceHolders(args, placeholder);
  22603. return createRecurry(
  22604. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22605. args, newHolders, argPos, ary, arity - length
  22606. );
  22607. }
  22608. var thisBinding = isBind ? thisArg : this,
  22609. fn = isBindKey ? thisBinding[func] : func;
  22610. length = args.length;
  22611. if (argPos) {
  22612. args = reorder(args, argPos);
  22613. } else if (isFlip && length > 1) {
  22614. args.reverse();
  22615. }
  22616. if (isAry && ary < length) {
  22617. args.length = ary;
  22618. }
  22619. if (this && this !== root && this instanceof wrapper) {
  22620. fn = Ctor || createCtor(fn);
  22621. }
  22622. return fn.apply(thisBinding, args);
  22623. }
  22624. return wrapper;
  22625. }
  22626. /**
  22627. * Creates a function like `_.invertBy`.
  22628. *
  22629. * @private
  22630. * @param {Function} setter The function to set accumulator values.
  22631. * @param {Function} toIteratee The function to resolve iteratees.
  22632. * @returns {Function} Returns the new inverter function.
  22633. */
  22634. function createInverter(setter, toIteratee) {
  22635. return function(object, iteratee) {
  22636. return baseInverter(object, setter, toIteratee(iteratee), {});
  22637. };
  22638. }
  22639. /**
  22640. * Creates a function that performs a mathematical operation on two values.
  22641. *
  22642. * @private
  22643. * @param {Function} operator The function to perform the operation.
  22644. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22645. * @returns {Function} Returns the new mathematical operation function.
  22646. */
  22647. function createMathOperation(operator, defaultValue) {
  22648. return function(value, other) {
  22649. var result;
  22650. if (value === undefined && other === undefined) {
  22651. return defaultValue;
  22652. }
  22653. if (value !== undefined) {
  22654. result = value;
  22655. }
  22656. if (other !== undefined) {
  22657. if (result === undefined) {
  22658. return other;
  22659. }
  22660. if (typeof value == 'string' || typeof other == 'string') {
  22661. value = baseToString(value);
  22662. other = baseToString(other);
  22663. } else {
  22664. value = baseToNumber(value);
  22665. other = baseToNumber(other);
  22666. }
  22667. result = operator(value, other);
  22668. }
  22669. return result;
  22670. };
  22671. }
  22672. /**
  22673. * Creates a function like `_.over`.
  22674. *
  22675. * @private
  22676. * @param {Function} arrayFunc The function to iterate over iteratees.
  22677. * @returns {Function} Returns the new over function.
  22678. */
  22679. function createOver(arrayFunc) {
  22680. return flatRest(function(iteratees) {
  22681. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22682. return baseRest(function(args) {
  22683. var thisArg = this;
  22684. return arrayFunc(iteratees, function(iteratee) {
  22685. return apply(iteratee, thisArg, args);
  22686. });
  22687. });
  22688. });
  22689. }
  22690. /**
  22691. * Creates the padding for `string` based on `length`. The `chars` string
  22692. * is truncated if the number of characters exceeds `length`.
  22693. *
  22694. * @private
  22695. * @param {number} length The padding length.
  22696. * @param {string} [chars=' '] The string used as padding.
  22697. * @returns {string} Returns the padding for `string`.
  22698. */
  22699. function createPadding(length, chars) {
  22700. chars = chars === undefined ? ' ' : baseToString(chars);
  22701. var charsLength = chars.length;
  22702. if (charsLength < 2) {
  22703. return charsLength ? baseRepeat(chars, length) : chars;
  22704. }
  22705. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22706. return hasUnicode(chars)
  22707. ? castSlice(stringToArray(result), 0, length).join('')
  22708. : result.slice(0, length);
  22709. }
  22710. /**
  22711. * Creates a function that wraps `func` to invoke it with the `this` binding
  22712. * of `thisArg` and `partials` prepended to the arguments it receives.
  22713. *
  22714. * @private
  22715. * @param {Function} func The function to wrap.
  22716. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22717. * @param {*} thisArg The `this` binding of `func`.
  22718. * @param {Array} partials The arguments to prepend to those provided to
  22719. * the new function.
  22720. * @returns {Function} Returns the new wrapped function.
  22721. */
  22722. function createPartial(func, bitmask, thisArg, partials) {
  22723. var isBind = bitmask & WRAP_BIND_FLAG,
  22724. Ctor = createCtor(func);
  22725. function wrapper() {
  22726. var argsIndex = -1,
  22727. argsLength = arguments.length,
  22728. leftIndex = -1,
  22729. leftLength = partials.length,
  22730. args = Array(leftLength + argsLength),
  22731. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22732. while (++leftIndex < leftLength) {
  22733. args[leftIndex] = partials[leftIndex];
  22734. }
  22735. while (argsLength--) {
  22736. args[leftIndex++] = arguments[++argsIndex];
  22737. }
  22738. return apply(fn, isBind ? thisArg : this, args);
  22739. }
  22740. return wrapper;
  22741. }
  22742. /**
  22743. * Creates a `_.range` or `_.rangeRight` function.
  22744. *
  22745. * @private
  22746. * @param {boolean} [fromRight] Specify iterating from right to left.
  22747. * @returns {Function} Returns the new range function.
  22748. */
  22749. function createRange(fromRight) {
  22750. return function(start, end, step) {
  22751. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22752. end = step = undefined;
  22753. }
  22754. // Ensure the sign of `-0` is preserved.
  22755. start = toFinite(start);
  22756. if (end === undefined) {
  22757. end = start;
  22758. start = 0;
  22759. } else {
  22760. end = toFinite(end);
  22761. }
  22762. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22763. return baseRange(start, end, step, fromRight);
  22764. };
  22765. }
  22766. /**
  22767. * Creates a function that performs a relational operation on two values.
  22768. *
  22769. * @private
  22770. * @param {Function} operator The function to perform the operation.
  22771. * @returns {Function} Returns the new relational operation function.
  22772. */
  22773. function createRelationalOperation(operator) {
  22774. return function(value, other) {
  22775. if (!(typeof value == 'string' && typeof other == 'string')) {
  22776. value = toNumber(value);
  22777. other = toNumber(other);
  22778. }
  22779. return operator(value, other);
  22780. };
  22781. }
  22782. /**
  22783. * Creates a function that wraps `func` to continue currying.
  22784. *
  22785. * @private
  22786. * @param {Function} func The function to wrap.
  22787. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22788. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22789. * @param {*} placeholder The placeholder value.
  22790. * @param {*} [thisArg] The `this` binding of `func`.
  22791. * @param {Array} [partials] The arguments to prepend to those provided to
  22792. * the new function.
  22793. * @param {Array} [holders] The `partials` placeholder indexes.
  22794. * @param {Array} [argPos] The argument positions of the new function.
  22795. * @param {number} [ary] The arity cap of `func`.
  22796. * @param {number} [arity] The arity of `func`.
  22797. * @returns {Function} Returns the new wrapped function.
  22798. */
  22799. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22800. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22801. newHolders = isCurry ? holders : undefined,
  22802. newHoldersRight = isCurry ? undefined : holders,
  22803. newPartials = isCurry ? partials : undefined,
  22804. newPartialsRight = isCurry ? undefined : partials;
  22805. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22806. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22807. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22808. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22809. }
  22810. var newData = [
  22811. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22812. newHoldersRight, argPos, ary, arity
  22813. ];
  22814. var result = wrapFunc.apply(undefined, newData);
  22815. if (isLaziable(func)) {
  22816. setData(result, newData);
  22817. }
  22818. result.placeholder = placeholder;
  22819. return setWrapToString(result, func, bitmask);
  22820. }
  22821. /**
  22822. * Creates a function like `_.round`.
  22823. *
  22824. * @private
  22825. * @param {string} methodName The name of the `Math` method to use when rounding.
  22826. * @returns {Function} Returns the new round function.
  22827. */
  22828. function createRound(methodName) {
  22829. var func = Math[methodName];
  22830. return function(number, precision) {
  22831. number = toNumber(number);
  22832. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22833. if (precision && nativeIsFinite(number)) {
  22834. // Shift with exponential notation to avoid floating-point issues.
  22835. // See [MDN](https://mdn.io/round#Examples) for more details.
  22836. var pair = (toString(number) + 'e').split('e'),
  22837. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22838. pair = (toString(value) + 'e').split('e');
  22839. return +(pair[0] + 'e' + (+pair[1] - precision));
  22840. }
  22841. return func(number);
  22842. };
  22843. }
  22844. /**
  22845. * Creates a set object of `values`.
  22846. *
  22847. * @private
  22848. * @param {Array} values The values to add to the set.
  22849. * @returns {Object} Returns the new set.
  22850. */
  22851. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22852. return new Set(values);
  22853. };
  22854. /**
  22855. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22856. *
  22857. * @private
  22858. * @param {Function} keysFunc The function to get the keys of a given object.
  22859. * @returns {Function} Returns the new pairs function.
  22860. */
  22861. function createToPairs(keysFunc) {
  22862. return function(object) {
  22863. var tag = getTag(object);
  22864. if (tag == mapTag) {
  22865. return mapToArray(object);
  22866. }
  22867. if (tag == setTag) {
  22868. return setToPairs(object);
  22869. }
  22870. return baseToPairs(object, keysFunc(object));
  22871. };
  22872. }
  22873. /**
  22874. * Creates a function that either curries or invokes `func` with optional
  22875. * `this` binding and partially applied arguments.
  22876. *
  22877. * @private
  22878. * @param {Function|string} func The function or method name to wrap.
  22879. * @param {number} bitmask The bitmask flags.
  22880. * 1 - `_.bind`
  22881. * 2 - `_.bindKey`
  22882. * 4 - `_.curry` or `_.curryRight` of a bound function
  22883. * 8 - `_.curry`
  22884. * 16 - `_.curryRight`
  22885. * 32 - `_.partial`
  22886. * 64 - `_.partialRight`
  22887. * 128 - `_.rearg`
  22888. * 256 - `_.ary`
  22889. * 512 - `_.flip`
  22890. * @param {*} [thisArg] The `this` binding of `func`.
  22891. * @param {Array} [partials] The arguments to be partially applied.
  22892. * @param {Array} [holders] The `partials` placeholder indexes.
  22893. * @param {Array} [argPos] The argument positions of the new function.
  22894. * @param {number} [ary] The arity cap of `func`.
  22895. * @param {number} [arity] The arity of `func`.
  22896. * @returns {Function} Returns the new wrapped function.
  22897. */
  22898. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22899. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22900. if (!isBindKey && typeof func != 'function') {
  22901. throw new TypeError(FUNC_ERROR_TEXT);
  22902. }
  22903. var length = partials ? partials.length : 0;
  22904. if (!length) {
  22905. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22906. partials = holders = undefined;
  22907. }
  22908. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22909. arity = arity === undefined ? arity : toInteger(arity);
  22910. length -= holders ? holders.length : 0;
  22911. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  22912. var partialsRight = partials,
  22913. holdersRight = holders;
  22914. partials = holders = undefined;
  22915. }
  22916. var data = isBindKey ? undefined : getData(func);
  22917. var newData = [
  22918. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  22919. argPos, ary, arity
  22920. ];
  22921. if (data) {
  22922. mergeData(newData, data);
  22923. }
  22924. func = newData[0];
  22925. bitmask = newData[1];
  22926. thisArg = newData[2];
  22927. partials = newData[3];
  22928. holders = newData[4];
  22929. arity = newData[9] = newData[9] === undefined
  22930. ? (isBindKey ? 0 : func.length)
  22931. : nativeMax(newData[9] - length, 0);
  22932. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  22933. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  22934. }
  22935. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  22936. var result = createBind(func, bitmask, thisArg);
  22937. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  22938. result = createCurry(func, bitmask, arity);
  22939. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  22940. result = createPartial(func, bitmask, thisArg, partials);
  22941. } else {
  22942. result = createHybrid.apply(undefined, newData);
  22943. }
  22944. var setter = data ? baseSetData : setData;
  22945. return setWrapToString(setter(result, newData), func, bitmask);
  22946. }
  22947. /**
  22948. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  22949. * of source objects to the destination object for all destination properties
  22950. * that resolve to `undefined`.
  22951. *
  22952. * @private
  22953. * @param {*} objValue The destination value.
  22954. * @param {*} srcValue The source value.
  22955. * @param {string} key The key of the property to assign.
  22956. * @param {Object} object The parent object of `objValue`.
  22957. * @returns {*} Returns the value to assign.
  22958. */
  22959. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  22960. if (objValue === undefined ||
  22961. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  22962. return srcValue;
  22963. }
  22964. return objValue;
  22965. }
  22966. /**
  22967. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  22968. * objects into destination objects that are passed thru.
  22969. *
  22970. * @private
  22971. * @param {*} objValue The destination value.
  22972. * @param {*} srcValue The source value.
  22973. * @param {string} key The key of the property to merge.
  22974. * @param {Object} object The parent object of `objValue`.
  22975. * @param {Object} source The parent object of `srcValue`.
  22976. * @param {Object} [stack] Tracks traversed source values and their merged
  22977. * counterparts.
  22978. * @returns {*} Returns the value to assign.
  22979. */
  22980. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  22981. if (isObject(objValue) && isObject(srcValue)) {
  22982. // Recursively merge objects and arrays (susceptible to call stack limits).
  22983. stack.set(srcValue, objValue);
  22984. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  22985. stack['delete'](srcValue);
  22986. }
  22987. return objValue;
  22988. }
  22989. /**
  22990. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  22991. * objects.
  22992. *
  22993. * @private
  22994. * @param {*} value The value to inspect.
  22995. * @param {string} key The key of the property to inspect.
  22996. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  22997. */
  22998. function customOmitClone(value) {
  22999. return isPlainObject(value) ? undefined : value;
  23000. }
  23001. /**
  23002. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23003. * partial deep comparisons.
  23004. *
  23005. * @private
  23006. * @param {Array} array The array to compare.
  23007. * @param {Array} other The other array to compare.
  23008. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23009. * @param {Function} customizer The function to customize comparisons.
  23010. * @param {Function} equalFunc The function to determine equivalents of values.
  23011. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23012. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23013. */
  23014. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23015. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23016. arrLength = array.length,
  23017. othLength = other.length;
  23018. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23019. return false;
  23020. }
  23021. // Assume cyclic values are equal.
  23022. var stacked = stack.get(array);
  23023. if (stacked && stack.get(other)) {
  23024. return stacked == other;
  23025. }
  23026. var index = -1,
  23027. result = true,
  23028. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23029. stack.set(array, other);
  23030. stack.set(other, array);
  23031. // Ignore non-index properties.
  23032. while (++index < arrLength) {
  23033. var arrValue = array[index],
  23034. othValue = other[index];
  23035. if (customizer) {
  23036. var compared = isPartial
  23037. ? customizer(othValue, arrValue, index, other, array, stack)
  23038. : customizer(arrValue, othValue, index, array, other, stack);
  23039. }
  23040. if (compared !== undefined) {
  23041. if (compared) {
  23042. continue;
  23043. }
  23044. result = false;
  23045. break;
  23046. }
  23047. // Recursively compare arrays (susceptible to call stack limits).
  23048. if (seen) {
  23049. if (!arraySome(other, function(othValue, othIndex) {
  23050. if (!cacheHas(seen, othIndex) &&
  23051. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23052. return seen.push(othIndex);
  23053. }
  23054. })) {
  23055. result = false;
  23056. break;
  23057. }
  23058. } else if (!(
  23059. arrValue === othValue ||
  23060. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23061. )) {
  23062. result = false;
  23063. break;
  23064. }
  23065. }
  23066. stack['delete'](array);
  23067. stack['delete'](other);
  23068. return result;
  23069. }
  23070. /**
  23071. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23072. * the same `toStringTag`.
  23073. *
  23074. * **Note:** This function only supports comparing values with tags of
  23075. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23076. *
  23077. * @private
  23078. * @param {Object} object The object to compare.
  23079. * @param {Object} other The other object to compare.
  23080. * @param {string} tag The `toStringTag` of the objects to compare.
  23081. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23082. * @param {Function} customizer The function to customize comparisons.
  23083. * @param {Function} equalFunc The function to determine equivalents of values.
  23084. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23085. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23086. */
  23087. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23088. switch (tag) {
  23089. case dataViewTag:
  23090. if ((object.byteLength != other.byteLength) ||
  23091. (object.byteOffset != other.byteOffset)) {
  23092. return false;
  23093. }
  23094. object = object.buffer;
  23095. other = other.buffer;
  23096. case arrayBufferTag:
  23097. if ((object.byteLength != other.byteLength) ||
  23098. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23099. return false;
  23100. }
  23101. return true;
  23102. case boolTag:
  23103. case dateTag:
  23104. case numberTag:
  23105. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23106. // Invalid dates are coerced to `NaN`.
  23107. return eq(+object, +other);
  23108. case errorTag:
  23109. return object.name == other.name && object.message == other.message;
  23110. case regexpTag:
  23111. case stringTag:
  23112. // Coerce regexes to strings and treat strings, primitives and objects,
  23113. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23114. // for more details.
  23115. return object == (other + '');
  23116. case mapTag:
  23117. var convert = mapToArray;
  23118. case setTag:
  23119. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23120. convert || (convert = setToArray);
  23121. if (object.size != other.size && !isPartial) {
  23122. return false;
  23123. }
  23124. // Assume cyclic values are equal.
  23125. var stacked = stack.get(object);
  23126. if (stacked) {
  23127. return stacked == other;
  23128. }
  23129. bitmask |= COMPARE_UNORDERED_FLAG;
  23130. // Recursively compare objects (susceptible to call stack limits).
  23131. stack.set(object, other);
  23132. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23133. stack['delete'](object);
  23134. return result;
  23135. case symbolTag:
  23136. if (symbolValueOf) {
  23137. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23138. }
  23139. }
  23140. return false;
  23141. }
  23142. /**
  23143. * A specialized version of `baseIsEqualDeep` for objects with support for
  23144. * partial deep comparisons.
  23145. *
  23146. * @private
  23147. * @param {Object} object The object to compare.
  23148. * @param {Object} other The other object to compare.
  23149. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23150. * @param {Function} customizer The function to customize comparisons.
  23151. * @param {Function} equalFunc The function to determine equivalents of values.
  23152. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23153. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23154. */
  23155. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23156. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23157. objProps = getAllKeys(object),
  23158. objLength = objProps.length,
  23159. othProps = getAllKeys(other),
  23160. othLength = othProps.length;
  23161. if (objLength != othLength && !isPartial) {
  23162. return false;
  23163. }
  23164. var index = objLength;
  23165. while (index--) {
  23166. var key = objProps[index];
  23167. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23168. return false;
  23169. }
  23170. }
  23171. // Assume cyclic values are equal.
  23172. var stacked = stack.get(object);
  23173. if (stacked && stack.get(other)) {
  23174. return stacked == other;
  23175. }
  23176. var result = true;
  23177. stack.set(object, other);
  23178. stack.set(other, object);
  23179. var skipCtor = isPartial;
  23180. while (++index < objLength) {
  23181. key = objProps[index];
  23182. var objValue = object[key],
  23183. othValue = other[key];
  23184. if (customizer) {
  23185. var compared = isPartial
  23186. ? customizer(othValue, objValue, key, other, object, stack)
  23187. : customizer(objValue, othValue, key, object, other, stack);
  23188. }
  23189. // Recursively compare objects (susceptible to call stack limits).
  23190. if (!(compared === undefined
  23191. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23192. : compared
  23193. )) {
  23194. result = false;
  23195. break;
  23196. }
  23197. skipCtor || (skipCtor = key == 'constructor');
  23198. }
  23199. if (result && !skipCtor) {
  23200. var objCtor = object.constructor,
  23201. othCtor = other.constructor;
  23202. // Non `Object` object instances with different constructors are not equal.
  23203. if (objCtor != othCtor &&
  23204. ('constructor' in object && 'constructor' in other) &&
  23205. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23206. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23207. result = false;
  23208. }
  23209. }
  23210. stack['delete'](object);
  23211. stack['delete'](other);
  23212. return result;
  23213. }
  23214. /**
  23215. * A specialized version of `baseRest` which flattens the rest array.
  23216. *
  23217. * @private
  23218. * @param {Function} func The function to apply a rest parameter to.
  23219. * @returns {Function} Returns the new function.
  23220. */
  23221. function flatRest(func) {
  23222. return setToString(overRest(func, undefined, flatten), func + '');
  23223. }
  23224. /**
  23225. * Creates an array of own enumerable property names and symbols of `object`.
  23226. *
  23227. * @private
  23228. * @param {Object} object The object to query.
  23229. * @returns {Array} Returns the array of property names and symbols.
  23230. */
  23231. function getAllKeys(object) {
  23232. return baseGetAllKeys(object, keys, getSymbols);
  23233. }
  23234. /**
  23235. * Creates an array of own and inherited enumerable property names and
  23236. * symbols of `object`.
  23237. *
  23238. * @private
  23239. * @param {Object} object The object to query.
  23240. * @returns {Array} Returns the array of property names and symbols.
  23241. */
  23242. function getAllKeysIn(object) {
  23243. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23244. }
  23245. /**
  23246. * Gets metadata for `func`.
  23247. *
  23248. * @private
  23249. * @param {Function} func The function to query.
  23250. * @returns {*} Returns the metadata for `func`.
  23251. */
  23252. var getData = !metaMap ? noop : function(func) {
  23253. return metaMap.get(func);
  23254. };
  23255. /**
  23256. * Gets the name of `func`.
  23257. *
  23258. * @private
  23259. * @param {Function} func The function to query.
  23260. * @returns {string} Returns the function name.
  23261. */
  23262. function getFuncName(func) {
  23263. var result = (func.name + ''),
  23264. array = realNames[result],
  23265. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23266. while (length--) {
  23267. var data = array[length],
  23268. otherFunc = data.func;
  23269. if (otherFunc == null || otherFunc == func) {
  23270. return data.name;
  23271. }
  23272. }
  23273. return result;
  23274. }
  23275. /**
  23276. * Gets the argument placeholder value for `func`.
  23277. *
  23278. * @private
  23279. * @param {Function} func The function to inspect.
  23280. * @returns {*} Returns the placeholder value.
  23281. */
  23282. function getHolder(func) {
  23283. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23284. return object.placeholder;
  23285. }
  23286. /**
  23287. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23288. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23289. * If arguments are provided, the chosen function is invoked with them and
  23290. * its result is returned.
  23291. *
  23292. * @private
  23293. * @param {*} [value] The value to convert to an iteratee.
  23294. * @param {number} [arity] The arity of the created iteratee.
  23295. * @returns {Function} Returns the chosen function or its result.
  23296. */
  23297. function getIteratee() {
  23298. var result = lodash.iteratee || iteratee;
  23299. result = result === iteratee ? baseIteratee : result;
  23300. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23301. }
  23302. /**
  23303. * Gets the data for `map`.
  23304. *
  23305. * @private
  23306. * @param {Object} map The map to query.
  23307. * @param {string} key The reference key.
  23308. * @returns {*} Returns the map data.
  23309. */
  23310. function getMapData(map, key) {
  23311. var data = map.__data__;
  23312. return isKeyable(key)
  23313. ? data[typeof key == 'string' ? 'string' : 'hash']
  23314. : data.map;
  23315. }
  23316. /**
  23317. * Gets the property names, values, and compare flags of `object`.
  23318. *
  23319. * @private
  23320. * @param {Object} object The object to query.
  23321. * @returns {Array} Returns the match data of `object`.
  23322. */
  23323. function getMatchData(object) {
  23324. var result = keys(object),
  23325. length = result.length;
  23326. while (length--) {
  23327. var key = result[length],
  23328. value = object[key];
  23329. result[length] = [key, value, isStrictComparable(value)];
  23330. }
  23331. return result;
  23332. }
  23333. /**
  23334. * Gets the native function at `key` of `object`.
  23335. *
  23336. * @private
  23337. * @param {Object} object The object to query.
  23338. * @param {string} key The key of the method to get.
  23339. * @returns {*} Returns the function if it's native, else `undefined`.
  23340. */
  23341. function getNative(object, key) {
  23342. var value = getValue(object, key);
  23343. return baseIsNative(value) ? value : undefined;
  23344. }
  23345. /**
  23346. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23347. *
  23348. * @private
  23349. * @param {*} value The value to query.
  23350. * @returns {string} Returns the raw `toStringTag`.
  23351. */
  23352. function getRawTag(value) {
  23353. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23354. tag = value[symToStringTag];
  23355. try {
  23356. value[symToStringTag] = undefined;
  23357. var unmasked = true;
  23358. } catch (e) {}
  23359. var result = nativeObjectToString.call(value);
  23360. if (unmasked) {
  23361. if (isOwn) {
  23362. value[symToStringTag] = tag;
  23363. } else {
  23364. delete value[symToStringTag];
  23365. }
  23366. }
  23367. return result;
  23368. }
  23369. /**
  23370. * Creates an array of the own enumerable symbols of `object`.
  23371. *
  23372. * @private
  23373. * @param {Object} object The object to query.
  23374. * @returns {Array} Returns the array of symbols.
  23375. */
  23376. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23377. if (object == null) {
  23378. return [];
  23379. }
  23380. object = Object(object);
  23381. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23382. return propertyIsEnumerable.call(object, symbol);
  23383. });
  23384. };
  23385. /**
  23386. * Creates an array of the own and inherited enumerable symbols of `object`.
  23387. *
  23388. * @private
  23389. * @param {Object} object The object to query.
  23390. * @returns {Array} Returns the array of symbols.
  23391. */
  23392. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23393. var result = [];
  23394. while (object) {
  23395. arrayPush(result, getSymbols(object));
  23396. object = getPrototype(object);
  23397. }
  23398. return result;
  23399. };
  23400. /**
  23401. * Gets the `toStringTag` of `value`.
  23402. *
  23403. * @private
  23404. * @param {*} value The value to query.
  23405. * @returns {string} Returns the `toStringTag`.
  23406. */
  23407. var getTag = baseGetTag;
  23408. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23409. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23410. (Map && getTag(new Map) != mapTag) ||
  23411. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23412. (Set && getTag(new Set) != setTag) ||
  23413. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23414. getTag = function(value) {
  23415. var result = baseGetTag(value),
  23416. Ctor = result == objectTag ? value.constructor : undefined,
  23417. ctorString = Ctor ? toSource(Ctor) : '';
  23418. if (ctorString) {
  23419. switch (ctorString) {
  23420. case dataViewCtorString: return dataViewTag;
  23421. case mapCtorString: return mapTag;
  23422. case promiseCtorString: return promiseTag;
  23423. case setCtorString: return setTag;
  23424. case weakMapCtorString: return weakMapTag;
  23425. }
  23426. }
  23427. return result;
  23428. };
  23429. }
  23430. /**
  23431. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23432. *
  23433. * @private
  23434. * @param {number} start The start of the view.
  23435. * @param {number} end The end of the view.
  23436. * @param {Array} transforms The transformations to apply to the view.
  23437. * @returns {Object} Returns an object containing the `start` and `end`
  23438. * positions of the view.
  23439. */
  23440. function getView(start, end, transforms) {
  23441. var index = -1,
  23442. length = transforms.length;
  23443. while (++index < length) {
  23444. var data = transforms[index],
  23445. size = data.size;
  23446. switch (data.type) {
  23447. case 'drop': start += size; break;
  23448. case 'dropRight': end -= size; break;
  23449. case 'take': end = nativeMin(end, start + size); break;
  23450. case 'takeRight': start = nativeMax(start, end - size); break;
  23451. }
  23452. }
  23453. return { 'start': start, 'end': end };
  23454. }
  23455. /**
  23456. * Extracts wrapper details from the `source` body comment.
  23457. *
  23458. * @private
  23459. * @param {string} source The source to inspect.
  23460. * @returns {Array} Returns the wrapper details.
  23461. */
  23462. function getWrapDetails(source) {
  23463. var match = source.match(reWrapDetails);
  23464. return match ? match[1].split(reSplitDetails) : [];
  23465. }
  23466. /**
  23467. * Checks if `path` exists on `object`.
  23468. *
  23469. * @private
  23470. * @param {Object} object The object to query.
  23471. * @param {Array|string} path The path to check.
  23472. * @param {Function} hasFunc The function to check properties.
  23473. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23474. */
  23475. function hasPath(object, path, hasFunc) {
  23476. path = castPath(path, object);
  23477. var index = -1,
  23478. length = path.length,
  23479. result = false;
  23480. while (++index < length) {
  23481. var key = toKey(path[index]);
  23482. if (!(result = object != null && hasFunc(object, key))) {
  23483. break;
  23484. }
  23485. object = object[key];
  23486. }
  23487. if (result || ++index != length) {
  23488. return result;
  23489. }
  23490. length = object == null ? 0 : object.length;
  23491. return !!length && isLength(length) && isIndex(key, length) &&
  23492. (isArray(object) || isArguments(object));
  23493. }
  23494. /**
  23495. * Initializes an array clone.
  23496. *
  23497. * @private
  23498. * @param {Array} array The array to clone.
  23499. * @returns {Array} Returns the initialized clone.
  23500. */
  23501. function initCloneArray(array) {
  23502. var length = array.length,
  23503. result = new array.constructor(length);
  23504. // Add properties assigned by `RegExp#exec`.
  23505. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23506. result.index = array.index;
  23507. result.input = array.input;
  23508. }
  23509. return result;
  23510. }
  23511. /**
  23512. * Initializes an object clone.
  23513. *
  23514. * @private
  23515. * @param {Object} object The object to clone.
  23516. * @returns {Object} Returns the initialized clone.
  23517. */
  23518. function initCloneObject(object) {
  23519. return (typeof object.constructor == 'function' && !isPrototype(object))
  23520. ? baseCreate(getPrototype(object))
  23521. : {};
  23522. }
  23523. /**
  23524. * Initializes an object clone based on its `toStringTag`.
  23525. *
  23526. * **Note:** This function only supports cloning values with tags of
  23527. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23528. *
  23529. * @private
  23530. * @param {Object} object The object to clone.
  23531. * @param {string} tag The `toStringTag` of the object to clone.
  23532. * @param {boolean} [isDeep] Specify a deep clone.
  23533. * @returns {Object} Returns the initialized clone.
  23534. */
  23535. function initCloneByTag(object, tag, isDeep) {
  23536. var Ctor = object.constructor;
  23537. switch (tag) {
  23538. case arrayBufferTag:
  23539. return cloneArrayBuffer(object);
  23540. case boolTag:
  23541. case dateTag:
  23542. return new Ctor(+object);
  23543. case dataViewTag:
  23544. return cloneDataView(object, isDeep);
  23545. case float32Tag: case float64Tag:
  23546. case int8Tag: case int16Tag: case int32Tag:
  23547. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23548. return cloneTypedArray(object, isDeep);
  23549. case mapTag:
  23550. return new Ctor;
  23551. case numberTag:
  23552. case stringTag:
  23553. return new Ctor(object);
  23554. case regexpTag:
  23555. return cloneRegExp(object);
  23556. case setTag:
  23557. return new Ctor;
  23558. case symbolTag:
  23559. return cloneSymbol(object);
  23560. }
  23561. }
  23562. /**
  23563. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23564. *
  23565. * @private
  23566. * @param {string} source The source to modify.
  23567. * @returns {Array} details The details to insert.
  23568. * @returns {string} Returns the modified source.
  23569. */
  23570. function insertWrapDetails(source, details) {
  23571. var length = details.length;
  23572. if (!length) {
  23573. return source;
  23574. }
  23575. var lastIndex = length - 1;
  23576. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23577. details = details.join(length > 2 ? ', ' : ' ');
  23578. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23579. }
  23580. /**
  23581. * Checks if `value` is a flattenable `arguments` object or array.
  23582. *
  23583. * @private
  23584. * @param {*} value The value to check.
  23585. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23586. */
  23587. function isFlattenable(value) {
  23588. return isArray(value) || isArguments(value) ||
  23589. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23590. }
  23591. /**
  23592. * Checks if `value` is a valid array-like index.
  23593. *
  23594. * @private
  23595. * @param {*} value The value to check.
  23596. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23597. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23598. */
  23599. function isIndex(value, length) {
  23600. var type = typeof value;
  23601. length = length == null ? MAX_SAFE_INTEGER : length;
  23602. return !!length &&
  23603. (type == 'number' ||
  23604. (type != 'symbol' && reIsUint.test(value))) &&
  23605. (value > -1 && value % 1 == 0 && value < length);
  23606. }
  23607. /**
  23608. * Checks if the given arguments are from an iteratee call.
  23609. *
  23610. * @private
  23611. * @param {*} value The potential iteratee value argument.
  23612. * @param {*} index The potential iteratee index or key argument.
  23613. * @param {*} object The potential iteratee object argument.
  23614. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23615. * else `false`.
  23616. */
  23617. function isIterateeCall(value, index, object) {
  23618. if (!isObject(object)) {
  23619. return false;
  23620. }
  23621. var type = typeof index;
  23622. if (type == 'number'
  23623. ? (isArrayLike(object) && isIndex(index, object.length))
  23624. : (type == 'string' && index in object)
  23625. ) {
  23626. return eq(object[index], value);
  23627. }
  23628. return false;
  23629. }
  23630. /**
  23631. * Checks if `value` is a property name and not a property path.
  23632. *
  23633. * @private
  23634. * @param {*} value The value to check.
  23635. * @param {Object} [object] The object to query keys on.
  23636. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23637. */
  23638. function isKey(value, object) {
  23639. if (isArray(value)) {
  23640. return false;
  23641. }
  23642. var type = typeof value;
  23643. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23644. value == null || isSymbol(value)) {
  23645. return true;
  23646. }
  23647. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23648. (object != null && value in Object(object));
  23649. }
  23650. /**
  23651. * Checks if `value` is suitable for use as unique object key.
  23652. *
  23653. * @private
  23654. * @param {*} value The value to check.
  23655. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23656. */
  23657. function isKeyable(value) {
  23658. var type = typeof value;
  23659. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23660. ? (value !== '__proto__')
  23661. : (value === null);
  23662. }
  23663. /**
  23664. * Checks if `func` has a lazy counterpart.
  23665. *
  23666. * @private
  23667. * @param {Function} func The function to check.
  23668. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23669. * else `false`.
  23670. */
  23671. function isLaziable(func) {
  23672. var funcName = getFuncName(func),
  23673. other = lodash[funcName];
  23674. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23675. return false;
  23676. }
  23677. if (func === other) {
  23678. return true;
  23679. }
  23680. var data = getData(other);
  23681. return !!data && func === data[0];
  23682. }
  23683. /**
  23684. * Checks if `func` has its source masked.
  23685. *
  23686. * @private
  23687. * @param {Function} func The function to check.
  23688. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23689. */
  23690. function isMasked(func) {
  23691. return !!maskSrcKey && (maskSrcKey in func);
  23692. }
  23693. /**
  23694. * Checks if `func` is capable of being masked.
  23695. *
  23696. * @private
  23697. * @param {*} value The value to check.
  23698. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23699. */
  23700. var isMaskable = coreJsData ? isFunction : stubFalse;
  23701. /**
  23702. * Checks if `value` is likely a prototype object.
  23703. *
  23704. * @private
  23705. * @param {*} value The value to check.
  23706. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23707. */
  23708. function isPrototype(value) {
  23709. var Ctor = value && value.constructor,
  23710. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23711. return value === proto;
  23712. }
  23713. /**
  23714. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23715. *
  23716. * @private
  23717. * @param {*} value The value to check.
  23718. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23719. * equality comparisons, else `false`.
  23720. */
  23721. function isStrictComparable(value) {
  23722. return value === value && !isObject(value);
  23723. }
  23724. /**
  23725. * A specialized version of `matchesProperty` for source values suitable
  23726. * for strict equality comparisons, i.e. `===`.
  23727. *
  23728. * @private
  23729. * @param {string} key The key of the property to get.
  23730. * @param {*} srcValue The value to match.
  23731. * @returns {Function} Returns the new spec function.
  23732. */
  23733. function matchesStrictComparable(key, srcValue) {
  23734. return function(object) {
  23735. if (object == null) {
  23736. return false;
  23737. }
  23738. return object[key] === srcValue &&
  23739. (srcValue !== undefined || (key in Object(object)));
  23740. };
  23741. }
  23742. /**
  23743. * A specialized version of `_.memoize` which clears the memoized function's
  23744. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23745. *
  23746. * @private
  23747. * @param {Function} func The function to have its output memoized.
  23748. * @returns {Function} Returns the new memoized function.
  23749. */
  23750. function memoizeCapped(func) {
  23751. var result = memoize(func, function(key) {
  23752. if (cache.size === MAX_MEMOIZE_SIZE) {
  23753. cache.clear();
  23754. }
  23755. return key;
  23756. });
  23757. var cache = result.cache;
  23758. return result;
  23759. }
  23760. /**
  23761. * Merges the function metadata of `source` into `data`.
  23762. *
  23763. * Merging metadata reduces the number of wrappers used to invoke a function.
  23764. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23765. * may be applied regardless of execution order. Methods like `_.ary` and
  23766. * `_.rearg` modify function arguments, making the order in which they are
  23767. * executed important, preventing the merging of metadata. However, we make
  23768. * an exception for a safe combined case where curried functions have `_.ary`
  23769. * and or `_.rearg` applied.
  23770. *
  23771. * @private
  23772. * @param {Array} data The destination metadata.
  23773. * @param {Array} source The source metadata.
  23774. * @returns {Array} Returns `data`.
  23775. */
  23776. function mergeData(data, source) {
  23777. var bitmask = data[1],
  23778. srcBitmask = source[1],
  23779. newBitmask = bitmask | srcBitmask,
  23780. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23781. var isCombo =
  23782. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23783. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23784. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23785. // Exit early if metadata can't be merged.
  23786. if (!(isCommon || isCombo)) {
  23787. return data;
  23788. }
  23789. // Use source `thisArg` if available.
  23790. if (srcBitmask & WRAP_BIND_FLAG) {
  23791. data[2] = source[2];
  23792. // Set when currying a bound function.
  23793. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23794. }
  23795. // Compose partial arguments.
  23796. var value = source[3];
  23797. if (value) {
  23798. var partials = data[3];
  23799. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23800. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23801. }
  23802. // Compose partial right arguments.
  23803. value = source[5];
  23804. if (value) {
  23805. partials = data[5];
  23806. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23807. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23808. }
  23809. // Use source `argPos` if available.
  23810. value = source[7];
  23811. if (value) {
  23812. data[7] = value;
  23813. }
  23814. // Use source `ary` if it's smaller.
  23815. if (srcBitmask & WRAP_ARY_FLAG) {
  23816. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23817. }
  23818. // Use source `arity` if one is not provided.
  23819. if (data[9] == null) {
  23820. data[9] = source[9];
  23821. }
  23822. // Use source `func` and merge bitmasks.
  23823. data[0] = source[0];
  23824. data[1] = newBitmask;
  23825. return data;
  23826. }
  23827. /**
  23828. * This function is like
  23829. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23830. * except that it includes inherited enumerable properties.
  23831. *
  23832. * @private
  23833. * @param {Object} object The object to query.
  23834. * @returns {Array} Returns the array of property names.
  23835. */
  23836. function nativeKeysIn(object) {
  23837. var result = [];
  23838. if (object != null) {
  23839. for (var key in Object(object)) {
  23840. result.push(key);
  23841. }
  23842. }
  23843. return result;
  23844. }
  23845. /**
  23846. * Converts `value` to a string using `Object.prototype.toString`.
  23847. *
  23848. * @private
  23849. * @param {*} value The value to convert.
  23850. * @returns {string} Returns the converted string.
  23851. */
  23852. function objectToString(value) {
  23853. return nativeObjectToString.call(value);
  23854. }
  23855. /**
  23856. * A specialized version of `baseRest` which transforms the rest array.
  23857. *
  23858. * @private
  23859. * @param {Function} func The function to apply a rest parameter to.
  23860. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23861. * @param {Function} transform The rest array transform.
  23862. * @returns {Function} Returns the new function.
  23863. */
  23864. function overRest(func, start, transform) {
  23865. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23866. return function() {
  23867. var args = arguments,
  23868. index = -1,
  23869. length = nativeMax(args.length - start, 0),
  23870. array = Array(length);
  23871. while (++index < length) {
  23872. array[index] = args[start + index];
  23873. }
  23874. index = -1;
  23875. var otherArgs = Array(start + 1);
  23876. while (++index < start) {
  23877. otherArgs[index] = args[index];
  23878. }
  23879. otherArgs[start] = transform(array);
  23880. return apply(func, this, otherArgs);
  23881. };
  23882. }
  23883. /**
  23884. * Gets the parent value at `path` of `object`.
  23885. *
  23886. * @private
  23887. * @param {Object} object The object to query.
  23888. * @param {Array} path The path to get the parent value of.
  23889. * @returns {*} Returns the parent value.
  23890. */
  23891. function parent(object, path) {
  23892. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23893. }
  23894. /**
  23895. * Reorder `array` according to the specified indexes where the element at
  23896. * the first index is assigned as the first element, the element at
  23897. * the second index is assigned as the second element, and so on.
  23898. *
  23899. * @private
  23900. * @param {Array} array The array to reorder.
  23901. * @param {Array} indexes The arranged array indexes.
  23902. * @returns {Array} Returns `array`.
  23903. */
  23904. function reorder(array, indexes) {
  23905. var arrLength = array.length,
  23906. length = nativeMin(indexes.length, arrLength),
  23907. oldArray = copyArray(array);
  23908. while (length--) {
  23909. var index = indexes[length];
  23910. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  23911. }
  23912. return array;
  23913. }
  23914. /**
  23915. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  23916. *
  23917. * @private
  23918. * @param {Object} object The object to query.
  23919. * @param {string} key The key of the property to get.
  23920. * @returns {*} Returns the property value.
  23921. */
  23922. function safeGet(object, key) {
  23923. if (key === 'constructor' && typeof object[key] === 'function') {
  23924. return;
  23925. }
  23926. if (key == '__proto__') {
  23927. return;
  23928. }
  23929. return object[key];
  23930. }
  23931. /**
  23932. * Sets metadata for `func`.
  23933. *
  23934. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  23935. * period of time, it will trip its breaker and transition to an identity
  23936. * function to avoid garbage collection pauses in V8. See
  23937. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  23938. * for more details.
  23939. *
  23940. * @private
  23941. * @param {Function} func The function to associate metadata with.
  23942. * @param {*} data The metadata.
  23943. * @returns {Function} Returns `func`.
  23944. */
  23945. var setData = shortOut(baseSetData);
  23946. /**
  23947. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  23948. *
  23949. * @private
  23950. * @param {Function} func The function to delay.
  23951. * @param {number} wait The number of milliseconds to delay invocation.
  23952. * @returns {number|Object} Returns the timer id or timeout object.
  23953. */
  23954. var setTimeout = ctxSetTimeout || function(func, wait) {
  23955. return root.setTimeout(func, wait);
  23956. };
  23957. /**
  23958. * Sets the `toString` method of `func` to return `string`.
  23959. *
  23960. * @private
  23961. * @param {Function} func The function to modify.
  23962. * @param {Function} string The `toString` result.
  23963. * @returns {Function} Returns `func`.
  23964. */
  23965. var setToString = shortOut(baseSetToString);
  23966. /**
  23967. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  23968. * with wrapper details in a comment at the top of the source body.
  23969. *
  23970. * @private
  23971. * @param {Function} wrapper The function to modify.
  23972. * @param {Function} reference The reference function.
  23973. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23974. * @returns {Function} Returns `wrapper`.
  23975. */
  23976. function setWrapToString(wrapper, reference, bitmask) {
  23977. var source = (reference + '');
  23978. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  23979. }
  23980. /**
  23981. * Creates a function that'll short out and invoke `identity` instead
  23982. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  23983. * milliseconds.
  23984. *
  23985. * @private
  23986. * @param {Function} func The function to restrict.
  23987. * @returns {Function} Returns the new shortable function.
  23988. */
  23989. function shortOut(func) {
  23990. var count = 0,
  23991. lastCalled = 0;
  23992. return function() {
  23993. var stamp = nativeNow(),
  23994. remaining = HOT_SPAN - (stamp - lastCalled);
  23995. lastCalled = stamp;
  23996. if (remaining > 0) {
  23997. if (++count >= HOT_COUNT) {
  23998. return arguments[0];
  23999. }
  24000. } else {
  24001. count = 0;
  24002. }
  24003. return func.apply(undefined, arguments);
  24004. };
  24005. }
  24006. /**
  24007. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24008. *
  24009. * @private
  24010. * @param {Array} array The array to shuffle.
  24011. * @param {number} [size=array.length] The size of `array`.
  24012. * @returns {Array} Returns `array`.
  24013. */
  24014. function shuffleSelf(array, size) {
  24015. var index = -1,
  24016. length = array.length,
  24017. lastIndex = length - 1;
  24018. size = size === undefined ? length : size;
  24019. while (++index < size) {
  24020. var rand = baseRandom(index, lastIndex),
  24021. value = array[rand];
  24022. array[rand] = array[index];
  24023. array[index] = value;
  24024. }
  24025. array.length = size;
  24026. return array;
  24027. }
  24028. /**
  24029. * Converts `string` to a property path array.
  24030. *
  24031. * @private
  24032. * @param {string} string The string to convert.
  24033. * @returns {Array} Returns the property path array.
  24034. */
  24035. var stringToPath = memoizeCapped(function(string) {
  24036. var result = [];
  24037. if (string.charCodeAt(0) === 46 /* . */) {
  24038. result.push('');
  24039. }
  24040. string.replace(rePropName, function(match, number, quote, subString) {
  24041. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24042. });
  24043. return result;
  24044. });
  24045. /**
  24046. * Converts `value` to a string key if it's not a string or symbol.
  24047. *
  24048. * @private
  24049. * @param {*} value The value to inspect.
  24050. * @returns {string|symbol} Returns the key.
  24051. */
  24052. function toKey(value) {
  24053. if (typeof value == 'string' || isSymbol(value)) {
  24054. return value;
  24055. }
  24056. var result = (value + '');
  24057. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24058. }
  24059. /**
  24060. * Converts `func` to its source code.
  24061. *
  24062. * @private
  24063. * @param {Function} func The function to convert.
  24064. * @returns {string} Returns the source code.
  24065. */
  24066. function toSource(func) {
  24067. if (func != null) {
  24068. try {
  24069. return funcToString.call(func);
  24070. } catch (e) {}
  24071. try {
  24072. return (func + '');
  24073. } catch (e) {}
  24074. }
  24075. return '';
  24076. }
  24077. /**
  24078. * Updates wrapper `details` based on `bitmask` flags.
  24079. *
  24080. * @private
  24081. * @returns {Array} details The details to modify.
  24082. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24083. * @returns {Array} Returns `details`.
  24084. */
  24085. function updateWrapDetails(details, bitmask) {
  24086. arrayEach(wrapFlags, function(pair) {
  24087. var value = '_.' + pair[0];
  24088. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24089. details.push(value);
  24090. }
  24091. });
  24092. return details.sort();
  24093. }
  24094. /**
  24095. * Creates a clone of `wrapper`.
  24096. *
  24097. * @private
  24098. * @param {Object} wrapper The wrapper to clone.
  24099. * @returns {Object} Returns the cloned wrapper.
  24100. */
  24101. function wrapperClone(wrapper) {
  24102. if (wrapper instanceof LazyWrapper) {
  24103. return wrapper.clone();
  24104. }
  24105. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24106. result.__actions__ = copyArray(wrapper.__actions__);
  24107. result.__index__ = wrapper.__index__;
  24108. result.__values__ = wrapper.__values__;
  24109. return result;
  24110. }
  24111. /*------------------------------------------------------------------------*/
  24112. /**
  24113. * Creates an array of elements split into groups the length of `size`.
  24114. * If `array` can't be split evenly, the final chunk will be the remaining
  24115. * elements.
  24116. *
  24117. * @static
  24118. * @memberOf _
  24119. * @since 3.0.0
  24120. * @category Array
  24121. * @param {Array} array The array to process.
  24122. * @param {number} [size=1] The length of each chunk
  24123. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24124. * @returns {Array} Returns the new array of chunks.
  24125. * @example
  24126. *
  24127. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24128. * // => [['a', 'b'], ['c', 'd']]
  24129. *
  24130. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24131. * // => [['a', 'b', 'c'], ['d']]
  24132. */
  24133. function chunk(array, size, guard) {
  24134. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24135. size = 1;
  24136. } else {
  24137. size = nativeMax(toInteger(size), 0);
  24138. }
  24139. var length = array == null ? 0 : array.length;
  24140. if (!length || size < 1) {
  24141. return [];
  24142. }
  24143. var index = 0,
  24144. resIndex = 0,
  24145. result = Array(nativeCeil(length / size));
  24146. while (index < length) {
  24147. result[resIndex++] = baseSlice(array, index, (index += size));
  24148. }
  24149. return result;
  24150. }
  24151. /**
  24152. * Creates an array with all falsey values removed. The values `false`, `null`,
  24153. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24154. *
  24155. * @static
  24156. * @memberOf _
  24157. * @since 0.1.0
  24158. * @category Array
  24159. * @param {Array} array The array to compact.
  24160. * @returns {Array} Returns the new array of filtered values.
  24161. * @example
  24162. *
  24163. * _.compact([0, 1, false, 2, '', 3]);
  24164. * // => [1, 2, 3]
  24165. */
  24166. function compact(array) {
  24167. var index = -1,
  24168. length = array == null ? 0 : array.length,
  24169. resIndex = 0,
  24170. result = [];
  24171. while (++index < length) {
  24172. var value = array[index];
  24173. if (value) {
  24174. result[resIndex++] = value;
  24175. }
  24176. }
  24177. return result;
  24178. }
  24179. /**
  24180. * Creates a new array concatenating `array` with any additional arrays
  24181. * and/or values.
  24182. *
  24183. * @static
  24184. * @memberOf _
  24185. * @since 4.0.0
  24186. * @category Array
  24187. * @param {Array} array The array to concatenate.
  24188. * @param {...*} [values] The values to concatenate.
  24189. * @returns {Array} Returns the new concatenated array.
  24190. * @example
  24191. *
  24192. * var array = [1];
  24193. * var other = _.concat(array, 2, [3], [[4]]);
  24194. *
  24195. * console.log(other);
  24196. * // => [1, 2, 3, [4]]
  24197. *
  24198. * console.log(array);
  24199. * // => [1]
  24200. */
  24201. function concat() {
  24202. var length = arguments.length;
  24203. if (!length) {
  24204. return [];
  24205. }
  24206. var args = Array(length - 1),
  24207. array = arguments[0],
  24208. index = length;
  24209. while (index--) {
  24210. args[index - 1] = arguments[index];
  24211. }
  24212. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24213. }
  24214. /**
  24215. * Creates an array of `array` values not included in the other given arrays
  24216. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24217. * for equality comparisons. The order and references of result values are
  24218. * determined by the first array.
  24219. *
  24220. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24221. *
  24222. * @static
  24223. * @memberOf _
  24224. * @since 0.1.0
  24225. * @category Array
  24226. * @param {Array} array The array to inspect.
  24227. * @param {...Array} [values] The values to exclude.
  24228. * @returns {Array} Returns the new array of filtered values.
  24229. * @see _.without, _.xor
  24230. * @example
  24231. *
  24232. * _.difference([2, 1], [2, 3]);
  24233. * // => [1]
  24234. */
  24235. var difference = baseRest(function(array, values) {
  24236. return isArrayLikeObject(array)
  24237. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24238. : [];
  24239. });
  24240. /**
  24241. * This method is like `_.difference` except that it accepts `iteratee` which
  24242. * is invoked for each element of `array` and `values` to generate the criterion
  24243. * by which they're compared. The order and references of result values are
  24244. * determined by the first array. The iteratee is invoked with one argument:
  24245. * (value).
  24246. *
  24247. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24248. *
  24249. * @static
  24250. * @memberOf _
  24251. * @since 4.0.0
  24252. * @category Array
  24253. * @param {Array} array The array to inspect.
  24254. * @param {...Array} [values] The values to exclude.
  24255. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24256. * @returns {Array} Returns the new array of filtered values.
  24257. * @example
  24258. *
  24259. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24260. * // => [1.2]
  24261. *
  24262. * // The `_.property` iteratee shorthand.
  24263. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24264. * // => [{ 'x': 2 }]
  24265. */
  24266. var differenceBy = baseRest(function(array, values) {
  24267. var iteratee = last(values);
  24268. if (isArrayLikeObject(iteratee)) {
  24269. iteratee = undefined;
  24270. }
  24271. return isArrayLikeObject(array)
  24272. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24273. : [];
  24274. });
  24275. /**
  24276. * This method is like `_.difference` except that it accepts `comparator`
  24277. * which is invoked to compare elements of `array` to `values`. The order and
  24278. * references of result values are determined by the first array. The comparator
  24279. * is invoked with two arguments: (arrVal, othVal).
  24280. *
  24281. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24282. *
  24283. * @static
  24284. * @memberOf _
  24285. * @since 4.0.0
  24286. * @category Array
  24287. * @param {Array} array The array to inspect.
  24288. * @param {...Array} [values] The values to exclude.
  24289. * @param {Function} [comparator] The comparator invoked per element.
  24290. * @returns {Array} Returns the new array of filtered values.
  24291. * @example
  24292. *
  24293. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24294. *
  24295. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24296. * // => [{ 'x': 2, 'y': 1 }]
  24297. */
  24298. var differenceWith = baseRest(function(array, values) {
  24299. var comparator = last(values);
  24300. if (isArrayLikeObject(comparator)) {
  24301. comparator = undefined;
  24302. }
  24303. return isArrayLikeObject(array)
  24304. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24305. : [];
  24306. });
  24307. /**
  24308. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24309. *
  24310. * @static
  24311. * @memberOf _
  24312. * @since 0.5.0
  24313. * @category Array
  24314. * @param {Array} array The array to query.
  24315. * @param {number} [n=1] The number of elements to drop.
  24316. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24317. * @returns {Array} Returns the slice of `array`.
  24318. * @example
  24319. *
  24320. * _.drop([1, 2, 3]);
  24321. * // => [2, 3]
  24322. *
  24323. * _.drop([1, 2, 3], 2);
  24324. * // => [3]
  24325. *
  24326. * _.drop([1, 2, 3], 5);
  24327. * // => []
  24328. *
  24329. * _.drop([1, 2, 3], 0);
  24330. * // => [1, 2, 3]
  24331. */
  24332. function drop(array, n, guard) {
  24333. var length = array == null ? 0 : array.length;
  24334. if (!length) {
  24335. return [];
  24336. }
  24337. n = (guard || n === undefined) ? 1 : toInteger(n);
  24338. return baseSlice(array, n < 0 ? 0 : n, length);
  24339. }
  24340. /**
  24341. * Creates a slice of `array` with `n` elements dropped from the end.
  24342. *
  24343. * @static
  24344. * @memberOf _
  24345. * @since 3.0.0
  24346. * @category Array
  24347. * @param {Array} array The array to query.
  24348. * @param {number} [n=1] The number of elements to drop.
  24349. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24350. * @returns {Array} Returns the slice of `array`.
  24351. * @example
  24352. *
  24353. * _.dropRight([1, 2, 3]);
  24354. * // => [1, 2]
  24355. *
  24356. * _.dropRight([1, 2, 3], 2);
  24357. * // => [1]
  24358. *
  24359. * _.dropRight([1, 2, 3], 5);
  24360. * // => []
  24361. *
  24362. * _.dropRight([1, 2, 3], 0);
  24363. * // => [1, 2, 3]
  24364. */
  24365. function dropRight(array, n, guard) {
  24366. var length = array == null ? 0 : array.length;
  24367. if (!length) {
  24368. return [];
  24369. }
  24370. n = (guard || n === undefined) ? 1 : toInteger(n);
  24371. n = length - n;
  24372. return baseSlice(array, 0, n < 0 ? 0 : n);
  24373. }
  24374. /**
  24375. * Creates a slice of `array` excluding elements dropped from the end.
  24376. * Elements are dropped until `predicate` returns falsey. The predicate is
  24377. * invoked with three arguments: (value, index, array).
  24378. *
  24379. * @static
  24380. * @memberOf _
  24381. * @since 3.0.0
  24382. * @category Array
  24383. * @param {Array} array The array to query.
  24384. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24385. * @returns {Array} Returns the slice of `array`.
  24386. * @example
  24387. *
  24388. * var users = [
  24389. * { 'user': 'barney', 'active': true },
  24390. * { 'user': 'fred', 'active': false },
  24391. * { 'user': 'pebbles', 'active': false }
  24392. * ];
  24393. *
  24394. * _.dropRightWhile(users, function(o) { return !o.active; });
  24395. * // => objects for ['barney']
  24396. *
  24397. * // The `_.matches` iteratee shorthand.
  24398. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24399. * // => objects for ['barney', 'fred']
  24400. *
  24401. * // The `_.matchesProperty` iteratee shorthand.
  24402. * _.dropRightWhile(users, ['active', false]);
  24403. * // => objects for ['barney']
  24404. *
  24405. * // The `_.property` iteratee shorthand.
  24406. * _.dropRightWhile(users, 'active');
  24407. * // => objects for ['barney', 'fred', 'pebbles']
  24408. */
  24409. function dropRightWhile(array, predicate) {
  24410. return (array && array.length)
  24411. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24412. : [];
  24413. }
  24414. /**
  24415. * Creates a slice of `array` excluding elements dropped from the beginning.
  24416. * Elements are dropped until `predicate` returns falsey. The predicate is
  24417. * invoked with three arguments: (value, index, array).
  24418. *
  24419. * @static
  24420. * @memberOf _
  24421. * @since 3.0.0
  24422. * @category Array
  24423. * @param {Array} array The array to query.
  24424. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24425. * @returns {Array} Returns the slice of `array`.
  24426. * @example
  24427. *
  24428. * var users = [
  24429. * { 'user': 'barney', 'active': false },
  24430. * { 'user': 'fred', 'active': false },
  24431. * { 'user': 'pebbles', 'active': true }
  24432. * ];
  24433. *
  24434. * _.dropWhile(users, function(o) { return !o.active; });
  24435. * // => objects for ['pebbles']
  24436. *
  24437. * // The `_.matches` iteratee shorthand.
  24438. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24439. * // => objects for ['fred', 'pebbles']
  24440. *
  24441. * // The `_.matchesProperty` iteratee shorthand.
  24442. * _.dropWhile(users, ['active', false]);
  24443. * // => objects for ['pebbles']
  24444. *
  24445. * // The `_.property` iteratee shorthand.
  24446. * _.dropWhile(users, 'active');
  24447. * // => objects for ['barney', 'fred', 'pebbles']
  24448. */
  24449. function dropWhile(array, predicate) {
  24450. return (array && array.length)
  24451. ? baseWhile(array, getIteratee(predicate, 3), true)
  24452. : [];
  24453. }
  24454. /**
  24455. * Fills elements of `array` with `value` from `start` up to, but not
  24456. * including, `end`.
  24457. *
  24458. * **Note:** This method mutates `array`.
  24459. *
  24460. * @static
  24461. * @memberOf _
  24462. * @since 3.2.0
  24463. * @category Array
  24464. * @param {Array} array The array to fill.
  24465. * @param {*} value The value to fill `array` with.
  24466. * @param {number} [start=0] The start position.
  24467. * @param {number} [end=array.length] The end position.
  24468. * @returns {Array} Returns `array`.
  24469. * @example
  24470. *
  24471. * var array = [1, 2, 3];
  24472. *
  24473. * _.fill(array, 'a');
  24474. * console.log(array);
  24475. * // => ['a', 'a', 'a']
  24476. *
  24477. * _.fill(Array(3), 2);
  24478. * // => [2, 2, 2]
  24479. *
  24480. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24481. * // => [4, '*', '*', 10]
  24482. */
  24483. function fill(array, value, start, end) {
  24484. var length = array == null ? 0 : array.length;
  24485. if (!length) {
  24486. return [];
  24487. }
  24488. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24489. start = 0;
  24490. end = length;
  24491. }
  24492. return baseFill(array, value, start, end);
  24493. }
  24494. /**
  24495. * This method is like `_.find` except that it returns the index of the first
  24496. * element `predicate` returns truthy for instead of the element itself.
  24497. *
  24498. * @static
  24499. * @memberOf _
  24500. * @since 1.1.0
  24501. * @category Array
  24502. * @param {Array} array The array to inspect.
  24503. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24504. * @param {number} [fromIndex=0] The index to search from.
  24505. * @returns {number} Returns the index of the found element, else `-1`.
  24506. * @example
  24507. *
  24508. * var users = [
  24509. * { 'user': 'barney', 'active': false },
  24510. * { 'user': 'fred', 'active': false },
  24511. * { 'user': 'pebbles', 'active': true }
  24512. * ];
  24513. *
  24514. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24515. * // => 0
  24516. *
  24517. * // The `_.matches` iteratee shorthand.
  24518. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24519. * // => 1
  24520. *
  24521. * // The `_.matchesProperty` iteratee shorthand.
  24522. * _.findIndex(users, ['active', false]);
  24523. * // => 0
  24524. *
  24525. * // The `_.property` iteratee shorthand.
  24526. * _.findIndex(users, 'active');
  24527. * // => 2
  24528. */
  24529. function findIndex(array, predicate, fromIndex) {
  24530. var length = array == null ? 0 : array.length;
  24531. if (!length) {
  24532. return -1;
  24533. }
  24534. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24535. if (index < 0) {
  24536. index = nativeMax(length + index, 0);
  24537. }
  24538. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24539. }
  24540. /**
  24541. * This method is like `_.findIndex` except that it iterates over elements
  24542. * of `collection` from right to left.
  24543. *
  24544. * @static
  24545. * @memberOf _
  24546. * @since 2.0.0
  24547. * @category Array
  24548. * @param {Array} array The array to inspect.
  24549. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24550. * @param {number} [fromIndex=array.length-1] The index to search from.
  24551. * @returns {number} Returns the index of the found element, else `-1`.
  24552. * @example
  24553. *
  24554. * var users = [
  24555. * { 'user': 'barney', 'active': true },
  24556. * { 'user': 'fred', 'active': false },
  24557. * { 'user': 'pebbles', 'active': false }
  24558. * ];
  24559. *
  24560. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24561. * // => 2
  24562. *
  24563. * // The `_.matches` iteratee shorthand.
  24564. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24565. * // => 0
  24566. *
  24567. * // The `_.matchesProperty` iteratee shorthand.
  24568. * _.findLastIndex(users, ['active', false]);
  24569. * // => 2
  24570. *
  24571. * // The `_.property` iteratee shorthand.
  24572. * _.findLastIndex(users, 'active');
  24573. * // => 0
  24574. */
  24575. function findLastIndex(array, predicate, fromIndex) {
  24576. var length = array == null ? 0 : array.length;
  24577. if (!length) {
  24578. return -1;
  24579. }
  24580. var index = length - 1;
  24581. if (fromIndex !== undefined) {
  24582. index = toInteger(fromIndex);
  24583. index = fromIndex < 0
  24584. ? nativeMax(length + index, 0)
  24585. : nativeMin(index, length - 1);
  24586. }
  24587. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24588. }
  24589. /**
  24590. * Flattens `array` a single level deep.
  24591. *
  24592. * @static
  24593. * @memberOf _
  24594. * @since 0.1.0
  24595. * @category Array
  24596. * @param {Array} array The array to flatten.
  24597. * @returns {Array} Returns the new flattened array.
  24598. * @example
  24599. *
  24600. * _.flatten([1, [2, [3, [4]], 5]]);
  24601. * // => [1, 2, [3, [4]], 5]
  24602. */
  24603. function flatten(array) {
  24604. var length = array == null ? 0 : array.length;
  24605. return length ? baseFlatten(array, 1) : [];
  24606. }
  24607. /**
  24608. * Recursively flattens `array`.
  24609. *
  24610. * @static
  24611. * @memberOf _
  24612. * @since 3.0.0
  24613. * @category Array
  24614. * @param {Array} array The array to flatten.
  24615. * @returns {Array} Returns the new flattened array.
  24616. * @example
  24617. *
  24618. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24619. * // => [1, 2, 3, 4, 5]
  24620. */
  24621. function flattenDeep(array) {
  24622. var length = array == null ? 0 : array.length;
  24623. return length ? baseFlatten(array, INFINITY) : [];
  24624. }
  24625. /**
  24626. * Recursively flatten `array` up to `depth` times.
  24627. *
  24628. * @static
  24629. * @memberOf _
  24630. * @since 4.4.0
  24631. * @category Array
  24632. * @param {Array} array The array to flatten.
  24633. * @param {number} [depth=1] The maximum recursion depth.
  24634. * @returns {Array} Returns the new flattened array.
  24635. * @example
  24636. *
  24637. * var array = [1, [2, [3, [4]], 5]];
  24638. *
  24639. * _.flattenDepth(array, 1);
  24640. * // => [1, 2, [3, [4]], 5]
  24641. *
  24642. * _.flattenDepth(array, 2);
  24643. * // => [1, 2, 3, [4], 5]
  24644. */
  24645. function flattenDepth(array, depth) {
  24646. var length = array == null ? 0 : array.length;
  24647. if (!length) {
  24648. return [];
  24649. }
  24650. depth = depth === undefined ? 1 : toInteger(depth);
  24651. return baseFlatten(array, depth);
  24652. }
  24653. /**
  24654. * The inverse of `_.toPairs`; this method returns an object composed
  24655. * from key-value `pairs`.
  24656. *
  24657. * @static
  24658. * @memberOf _
  24659. * @since 4.0.0
  24660. * @category Array
  24661. * @param {Array} pairs The key-value pairs.
  24662. * @returns {Object} Returns the new object.
  24663. * @example
  24664. *
  24665. * _.fromPairs([['a', 1], ['b', 2]]);
  24666. * // => { 'a': 1, 'b': 2 }
  24667. */
  24668. function fromPairs(pairs) {
  24669. var index = -1,
  24670. length = pairs == null ? 0 : pairs.length,
  24671. result = {};
  24672. while (++index < length) {
  24673. var pair = pairs[index];
  24674. result[pair[0]] = pair[1];
  24675. }
  24676. return result;
  24677. }
  24678. /**
  24679. * Gets the first element of `array`.
  24680. *
  24681. * @static
  24682. * @memberOf _
  24683. * @since 0.1.0
  24684. * @alias first
  24685. * @category Array
  24686. * @param {Array} array The array to query.
  24687. * @returns {*} Returns the first element of `array`.
  24688. * @example
  24689. *
  24690. * _.head([1, 2, 3]);
  24691. * // => 1
  24692. *
  24693. * _.head([]);
  24694. * // => undefined
  24695. */
  24696. function head(array) {
  24697. return (array && array.length) ? array[0] : undefined;
  24698. }
  24699. /**
  24700. * Gets the index at which the first occurrence of `value` is found in `array`
  24701. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24702. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24703. * offset from the end of `array`.
  24704. *
  24705. * @static
  24706. * @memberOf _
  24707. * @since 0.1.0
  24708. * @category Array
  24709. * @param {Array} array The array to inspect.
  24710. * @param {*} value The value to search for.
  24711. * @param {number} [fromIndex=0] The index to search from.
  24712. * @returns {number} Returns the index of the matched value, else `-1`.
  24713. * @example
  24714. *
  24715. * _.indexOf([1, 2, 1, 2], 2);
  24716. * // => 1
  24717. *
  24718. * // Search from the `fromIndex`.
  24719. * _.indexOf([1, 2, 1, 2], 2, 2);
  24720. * // => 3
  24721. */
  24722. function indexOf(array, value, fromIndex) {
  24723. var length = array == null ? 0 : array.length;
  24724. if (!length) {
  24725. return -1;
  24726. }
  24727. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24728. if (index < 0) {
  24729. index = nativeMax(length + index, 0);
  24730. }
  24731. return baseIndexOf(array, value, index);
  24732. }
  24733. /**
  24734. * Gets all but the last element of `array`.
  24735. *
  24736. * @static
  24737. * @memberOf _
  24738. * @since 0.1.0
  24739. * @category Array
  24740. * @param {Array} array The array to query.
  24741. * @returns {Array} Returns the slice of `array`.
  24742. * @example
  24743. *
  24744. * _.initial([1, 2, 3]);
  24745. * // => [1, 2]
  24746. */
  24747. function initial(array) {
  24748. var length = array == null ? 0 : array.length;
  24749. return length ? baseSlice(array, 0, -1) : [];
  24750. }
  24751. /**
  24752. * Creates an array of unique values that are included in all given arrays
  24753. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24754. * for equality comparisons. The order and references of result values are
  24755. * determined by the first array.
  24756. *
  24757. * @static
  24758. * @memberOf _
  24759. * @since 0.1.0
  24760. * @category Array
  24761. * @param {...Array} [arrays] The arrays to inspect.
  24762. * @returns {Array} Returns the new array of intersecting values.
  24763. * @example
  24764. *
  24765. * _.intersection([2, 1], [2, 3]);
  24766. * // => [2]
  24767. */
  24768. var intersection = baseRest(function(arrays) {
  24769. var mapped = arrayMap(arrays, castArrayLikeObject);
  24770. return (mapped.length && mapped[0] === arrays[0])
  24771. ? baseIntersection(mapped)
  24772. : [];
  24773. });
  24774. /**
  24775. * This method is like `_.intersection` except that it accepts `iteratee`
  24776. * which is invoked for each element of each `arrays` to generate the criterion
  24777. * by which they're compared. The order and references of result values are
  24778. * determined by the first array. The iteratee is invoked with one argument:
  24779. * (value).
  24780. *
  24781. * @static
  24782. * @memberOf _
  24783. * @since 4.0.0
  24784. * @category Array
  24785. * @param {...Array} [arrays] The arrays to inspect.
  24786. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24787. * @returns {Array} Returns the new array of intersecting values.
  24788. * @example
  24789. *
  24790. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24791. * // => [2.1]
  24792. *
  24793. * // The `_.property` iteratee shorthand.
  24794. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24795. * // => [{ 'x': 1 }]
  24796. */
  24797. var intersectionBy = baseRest(function(arrays) {
  24798. var iteratee = last(arrays),
  24799. mapped = arrayMap(arrays, castArrayLikeObject);
  24800. if (iteratee === last(mapped)) {
  24801. iteratee = undefined;
  24802. } else {
  24803. mapped.pop();
  24804. }
  24805. return (mapped.length && mapped[0] === arrays[0])
  24806. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24807. : [];
  24808. });
  24809. /**
  24810. * This method is like `_.intersection` except that it accepts `comparator`
  24811. * which is invoked to compare elements of `arrays`. The order and references
  24812. * of result values are determined by the first array. The comparator is
  24813. * invoked with two arguments: (arrVal, othVal).
  24814. *
  24815. * @static
  24816. * @memberOf _
  24817. * @since 4.0.0
  24818. * @category Array
  24819. * @param {...Array} [arrays] The arrays to inspect.
  24820. * @param {Function} [comparator] The comparator invoked per element.
  24821. * @returns {Array} Returns the new array of intersecting values.
  24822. * @example
  24823. *
  24824. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24825. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24826. *
  24827. * _.intersectionWith(objects, others, _.isEqual);
  24828. * // => [{ 'x': 1, 'y': 2 }]
  24829. */
  24830. var intersectionWith = baseRest(function(arrays) {
  24831. var comparator = last(arrays),
  24832. mapped = arrayMap(arrays, castArrayLikeObject);
  24833. comparator = typeof comparator == 'function' ? comparator : undefined;
  24834. if (comparator) {
  24835. mapped.pop();
  24836. }
  24837. return (mapped.length && mapped[0] === arrays[0])
  24838. ? baseIntersection(mapped, undefined, comparator)
  24839. : [];
  24840. });
  24841. /**
  24842. * Converts all elements in `array` into a string separated by `separator`.
  24843. *
  24844. * @static
  24845. * @memberOf _
  24846. * @since 4.0.0
  24847. * @category Array
  24848. * @param {Array} array The array to convert.
  24849. * @param {string} [separator=','] The element separator.
  24850. * @returns {string} Returns the joined string.
  24851. * @example
  24852. *
  24853. * _.join(['a', 'b', 'c'], '~');
  24854. * // => 'a~b~c'
  24855. */
  24856. function join(array, separator) {
  24857. return array == null ? '' : nativeJoin.call(array, separator);
  24858. }
  24859. /**
  24860. * Gets the last element of `array`.
  24861. *
  24862. * @static
  24863. * @memberOf _
  24864. * @since 0.1.0
  24865. * @category Array
  24866. * @param {Array} array The array to query.
  24867. * @returns {*} Returns the last element of `array`.
  24868. * @example
  24869. *
  24870. * _.last([1, 2, 3]);
  24871. * // => 3
  24872. */
  24873. function last(array) {
  24874. var length = array == null ? 0 : array.length;
  24875. return length ? array[length - 1] : undefined;
  24876. }
  24877. /**
  24878. * This method is like `_.indexOf` except that it iterates over elements of
  24879. * `array` from right to left.
  24880. *
  24881. * @static
  24882. * @memberOf _
  24883. * @since 0.1.0
  24884. * @category Array
  24885. * @param {Array} array The array to inspect.
  24886. * @param {*} value The value to search for.
  24887. * @param {number} [fromIndex=array.length-1] The index to search from.
  24888. * @returns {number} Returns the index of the matched value, else `-1`.
  24889. * @example
  24890. *
  24891. * _.lastIndexOf([1, 2, 1, 2], 2);
  24892. * // => 3
  24893. *
  24894. * // Search from the `fromIndex`.
  24895. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24896. * // => 1
  24897. */
  24898. function lastIndexOf(array, value, fromIndex) {
  24899. var length = array == null ? 0 : array.length;
  24900. if (!length) {
  24901. return -1;
  24902. }
  24903. var index = length;
  24904. if (fromIndex !== undefined) {
  24905. index = toInteger(fromIndex);
  24906. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24907. }
  24908. return value === value
  24909. ? strictLastIndexOf(array, value, index)
  24910. : baseFindIndex(array, baseIsNaN, index, true);
  24911. }
  24912. /**
  24913. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  24914. * element from the end is returned.
  24915. *
  24916. * @static
  24917. * @memberOf _
  24918. * @since 4.11.0
  24919. * @category Array
  24920. * @param {Array} array The array to query.
  24921. * @param {number} [n=0] The index of the element to return.
  24922. * @returns {*} Returns the nth element of `array`.
  24923. * @example
  24924. *
  24925. * var array = ['a', 'b', 'c', 'd'];
  24926. *
  24927. * _.nth(array, 1);
  24928. * // => 'b'
  24929. *
  24930. * _.nth(array, -2);
  24931. * // => 'c';
  24932. */
  24933. function nth(array, n) {
  24934. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  24935. }
  24936. /**
  24937. * Removes all given values from `array` using
  24938. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24939. * for equality comparisons.
  24940. *
  24941. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  24942. * to remove elements from an array by predicate.
  24943. *
  24944. * @static
  24945. * @memberOf _
  24946. * @since 2.0.0
  24947. * @category Array
  24948. * @param {Array} array The array to modify.
  24949. * @param {...*} [values] The values to remove.
  24950. * @returns {Array} Returns `array`.
  24951. * @example
  24952. *
  24953. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24954. *
  24955. * _.pull(array, 'a', 'c');
  24956. * console.log(array);
  24957. * // => ['b', 'b']
  24958. */
  24959. var pull = baseRest(pullAll);
  24960. /**
  24961. * This method is like `_.pull` except that it accepts an array of values to remove.
  24962. *
  24963. * **Note:** Unlike `_.difference`, this method mutates `array`.
  24964. *
  24965. * @static
  24966. * @memberOf _
  24967. * @since 4.0.0
  24968. * @category Array
  24969. * @param {Array} array The array to modify.
  24970. * @param {Array} values The values to remove.
  24971. * @returns {Array} Returns `array`.
  24972. * @example
  24973. *
  24974. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24975. *
  24976. * _.pullAll(array, ['a', 'c']);
  24977. * console.log(array);
  24978. * // => ['b', 'b']
  24979. */
  24980. function pullAll(array, values) {
  24981. return (array && array.length && values && values.length)
  24982. ? basePullAll(array, values)
  24983. : array;
  24984. }
  24985. /**
  24986. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  24987. * invoked for each element of `array` and `values` to generate the criterion
  24988. * by which they're compared. The iteratee is invoked with one argument: (value).
  24989. *
  24990. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  24991. *
  24992. * @static
  24993. * @memberOf _
  24994. * @since 4.0.0
  24995. * @category Array
  24996. * @param {Array} array The array to modify.
  24997. * @param {Array} values The values to remove.
  24998. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24999. * @returns {Array} Returns `array`.
  25000. * @example
  25001. *
  25002. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25003. *
  25004. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25005. * console.log(array);
  25006. * // => [{ 'x': 2 }]
  25007. */
  25008. function pullAllBy(array, values, iteratee) {
  25009. return (array && array.length && values && values.length)
  25010. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25011. : array;
  25012. }
  25013. /**
  25014. * This method is like `_.pullAll` except that it accepts `comparator` which
  25015. * is invoked to compare elements of `array` to `values`. The comparator is
  25016. * invoked with two arguments: (arrVal, othVal).
  25017. *
  25018. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25019. *
  25020. * @static
  25021. * @memberOf _
  25022. * @since 4.6.0
  25023. * @category Array
  25024. * @param {Array} array The array to modify.
  25025. * @param {Array} values The values to remove.
  25026. * @param {Function} [comparator] The comparator invoked per element.
  25027. * @returns {Array} Returns `array`.
  25028. * @example
  25029. *
  25030. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25031. *
  25032. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25033. * console.log(array);
  25034. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25035. */
  25036. function pullAllWith(array, values, comparator) {
  25037. return (array && array.length && values && values.length)
  25038. ? basePullAll(array, values, undefined, comparator)
  25039. : array;
  25040. }
  25041. /**
  25042. * Removes elements from `array` corresponding to `indexes` and returns an
  25043. * array of removed elements.
  25044. *
  25045. * **Note:** Unlike `_.at`, this method mutates `array`.
  25046. *
  25047. * @static
  25048. * @memberOf _
  25049. * @since 3.0.0
  25050. * @category Array
  25051. * @param {Array} array The array to modify.
  25052. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25053. * @returns {Array} Returns the new array of removed elements.
  25054. * @example
  25055. *
  25056. * var array = ['a', 'b', 'c', 'd'];
  25057. * var pulled = _.pullAt(array, [1, 3]);
  25058. *
  25059. * console.log(array);
  25060. * // => ['a', 'c']
  25061. *
  25062. * console.log(pulled);
  25063. * // => ['b', 'd']
  25064. */
  25065. var pullAt = flatRest(function(array, indexes) {
  25066. var length = array == null ? 0 : array.length,
  25067. result = baseAt(array, indexes);
  25068. basePullAt(array, arrayMap(indexes, function(index) {
  25069. return isIndex(index, length) ? +index : index;
  25070. }).sort(compareAscending));
  25071. return result;
  25072. });
  25073. /**
  25074. * Removes all elements from `array` that `predicate` returns truthy for
  25075. * and returns an array of the removed elements. The predicate is invoked
  25076. * with three arguments: (value, index, array).
  25077. *
  25078. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25079. * to pull elements from an array by value.
  25080. *
  25081. * @static
  25082. * @memberOf _
  25083. * @since 2.0.0
  25084. * @category Array
  25085. * @param {Array} array The array to modify.
  25086. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25087. * @returns {Array} Returns the new array of removed elements.
  25088. * @example
  25089. *
  25090. * var array = [1, 2, 3, 4];
  25091. * var evens = _.remove(array, function(n) {
  25092. * return n % 2 == 0;
  25093. * });
  25094. *
  25095. * console.log(array);
  25096. * // => [1, 3]
  25097. *
  25098. * console.log(evens);
  25099. * // => [2, 4]
  25100. */
  25101. function remove(array, predicate) {
  25102. var result = [];
  25103. if (!(array && array.length)) {
  25104. return result;
  25105. }
  25106. var index = -1,
  25107. indexes = [],
  25108. length = array.length;
  25109. predicate = getIteratee(predicate, 3);
  25110. while (++index < length) {
  25111. var value = array[index];
  25112. if (predicate(value, index, array)) {
  25113. result.push(value);
  25114. indexes.push(index);
  25115. }
  25116. }
  25117. basePullAt(array, indexes);
  25118. return result;
  25119. }
  25120. /**
  25121. * Reverses `array` so that the first element becomes the last, the second
  25122. * element becomes the second to last, and so on.
  25123. *
  25124. * **Note:** This method mutates `array` and is based on
  25125. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25126. *
  25127. * @static
  25128. * @memberOf _
  25129. * @since 4.0.0
  25130. * @category Array
  25131. * @param {Array} array The array to modify.
  25132. * @returns {Array} Returns `array`.
  25133. * @example
  25134. *
  25135. * var array = [1, 2, 3];
  25136. *
  25137. * _.reverse(array);
  25138. * // => [3, 2, 1]
  25139. *
  25140. * console.log(array);
  25141. * // => [3, 2, 1]
  25142. */
  25143. function reverse(array) {
  25144. return array == null ? array : nativeReverse.call(array);
  25145. }
  25146. /**
  25147. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25148. *
  25149. * **Note:** This method is used instead of
  25150. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25151. * returned.
  25152. *
  25153. * @static
  25154. * @memberOf _
  25155. * @since 3.0.0
  25156. * @category Array
  25157. * @param {Array} array The array to slice.
  25158. * @param {number} [start=0] The start position.
  25159. * @param {number} [end=array.length] The end position.
  25160. * @returns {Array} Returns the slice of `array`.
  25161. */
  25162. function slice(array, start, end) {
  25163. var length = array == null ? 0 : array.length;
  25164. if (!length) {
  25165. return [];
  25166. }
  25167. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25168. start = 0;
  25169. end = length;
  25170. }
  25171. else {
  25172. start = start == null ? 0 : toInteger(start);
  25173. end = end === undefined ? length : toInteger(end);
  25174. }
  25175. return baseSlice(array, start, end);
  25176. }
  25177. /**
  25178. * Uses a binary search to determine the lowest index at which `value`
  25179. * should be inserted into `array` in order to maintain its sort order.
  25180. *
  25181. * @static
  25182. * @memberOf _
  25183. * @since 0.1.0
  25184. * @category Array
  25185. * @param {Array} array The sorted array to inspect.
  25186. * @param {*} value The value to evaluate.
  25187. * @returns {number} Returns the index at which `value` should be inserted
  25188. * into `array`.
  25189. * @example
  25190. *
  25191. * _.sortedIndex([30, 50], 40);
  25192. * // => 1
  25193. */
  25194. function sortedIndex(array, value) {
  25195. return baseSortedIndex(array, value);
  25196. }
  25197. /**
  25198. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25199. * which is invoked for `value` and each element of `array` to compute their
  25200. * sort ranking. The iteratee is invoked with one argument: (value).
  25201. *
  25202. * @static
  25203. * @memberOf _
  25204. * @since 4.0.0
  25205. * @category Array
  25206. * @param {Array} array The sorted array to inspect.
  25207. * @param {*} value The value to evaluate.
  25208. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25209. * @returns {number} Returns the index at which `value` should be inserted
  25210. * into `array`.
  25211. * @example
  25212. *
  25213. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25214. *
  25215. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25216. * // => 0
  25217. *
  25218. * // The `_.property` iteratee shorthand.
  25219. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25220. * // => 0
  25221. */
  25222. function sortedIndexBy(array, value, iteratee) {
  25223. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25224. }
  25225. /**
  25226. * This method is like `_.indexOf` except that it performs a binary
  25227. * search on a sorted `array`.
  25228. *
  25229. * @static
  25230. * @memberOf _
  25231. * @since 4.0.0
  25232. * @category Array
  25233. * @param {Array} array The array to inspect.
  25234. * @param {*} value The value to search for.
  25235. * @returns {number} Returns the index of the matched value, else `-1`.
  25236. * @example
  25237. *
  25238. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25239. * // => 1
  25240. */
  25241. function sortedIndexOf(array, value) {
  25242. var length = array == null ? 0 : array.length;
  25243. if (length) {
  25244. var index = baseSortedIndex(array, value);
  25245. if (index < length && eq(array[index], value)) {
  25246. return index;
  25247. }
  25248. }
  25249. return -1;
  25250. }
  25251. /**
  25252. * This method is like `_.sortedIndex` except that it returns the highest
  25253. * index at which `value` should be inserted into `array` in order to
  25254. * maintain its sort order.
  25255. *
  25256. * @static
  25257. * @memberOf _
  25258. * @since 3.0.0
  25259. * @category Array
  25260. * @param {Array} array The sorted array to inspect.
  25261. * @param {*} value The value to evaluate.
  25262. * @returns {number} Returns the index at which `value` should be inserted
  25263. * into `array`.
  25264. * @example
  25265. *
  25266. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25267. * // => 4
  25268. */
  25269. function sortedLastIndex(array, value) {
  25270. return baseSortedIndex(array, value, true);
  25271. }
  25272. /**
  25273. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25274. * which is invoked for `value` and each element of `array` to compute their
  25275. * sort ranking. The iteratee is invoked with one argument: (value).
  25276. *
  25277. * @static
  25278. * @memberOf _
  25279. * @since 4.0.0
  25280. * @category Array
  25281. * @param {Array} array The sorted array to inspect.
  25282. * @param {*} value The value to evaluate.
  25283. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25284. * @returns {number} Returns the index at which `value` should be inserted
  25285. * into `array`.
  25286. * @example
  25287. *
  25288. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25289. *
  25290. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25291. * // => 1
  25292. *
  25293. * // The `_.property` iteratee shorthand.
  25294. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25295. * // => 1
  25296. */
  25297. function sortedLastIndexBy(array, value, iteratee) {
  25298. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25299. }
  25300. /**
  25301. * This method is like `_.lastIndexOf` except that it performs a binary
  25302. * search on a sorted `array`.
  25303. *
  25304. * @static
  25305. * @memberOf _
  25306. * @since 4.0.0
  25307. * @category Array
  25308. * @param {Array} array The array to inspect.
  25309. * @param {*} value The value to search for.
  25310. * @returns {number} Returns the index of the matched value, else `-1`.
  25311. * @example
  25312. *
  25313. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25314. * // => 3
  25315. */
  25316. function sortedLastIndexOf(array, value) {
  25317. var length = array == null ? 0 : array.length;
  25318. if (length) {
  25319. var index = baseSortedIndex(array, value, true) - 1;
  25320. if (eq(array[index], value)) {
  25321. return index;
  25322. }
  25323. }
  25324. return -1;
  25325. }
  25326. /**
  25327. * This method is like `_.uniq` except that it's designed and optimized
  25328. * for sorted arrays.
  25329. *
  25330. * @static
  25331. * @memberOf _
  25332. * @since 4.0.0
  25333. * @category Array
  25334. * @param {Array} array The array to inspect.
  25335. * @returns {Array} Returns the new duplicate free array.
  25336. * @example
  25337. *
  25338. * _.sortedUniq([1, 1, 2]);
  25339. * // => [1, 2]
  25340. */
  25341. function sortedUniq(array) {
  25342. return (array && array.length)
  25343. ? baseSortedUniq(array)
  25344. : [];
  25345. }
  25346. /**
  25347. * This method is like `_.uniqBy` except that it's designed and optimized
  25348. * for sorted arrays.
  25349. *
  25350. * @static
  25351. * @memberOf _
  25352. * @since 4.0.0
  25353. * @category Array
  25354. * @param {Array} array The array to inspect.
  25355. * @param {Function} [iteratee] The iteratee invoked per element.
  25356. * @returns {Array} Returns the new duplicate free array.
  25357. * @example
  25358. *
  25359. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25360. * // => [1.1, 2.3]
  25361. */
  25362. function sortedUniqBy(array, iteratee) {
  25363. return (array && array.length)
  25364. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25365. : [];
  25366. }
  25367. /**
  25368. * Gets all but the first element of `array`.
  25369. *
  25370. * @static
  25371. * @memberOf _
  25372. * @since 4.0.0
  25373. * @category Array
  25374. * @param {Array} array The array to query.
  25375. * @returns {Array} Returns the slice of `array`.
  25376. * @example
  25377. *
  25378. * _.tail([1, 2, 3]);
  25379. * // => [2, 3]
  25380. */
  25381. function tail(array) {
  25382. var length = array == null ? 0 : array.length;
  25383. return length ? baseSlice(array, 1, length) : [];
  25384. }
  25385. /**
  25386. * Creates a slice of `array` with `n` elements taken from the beginning.
  25387. *
  25388. * @static
  25389. * @memberOf _
  25390. * @since 0.1.0
  25391. * @category Array
  25392. * @param {Array} array The array to query.
  25393. * @param {number} [n=1] The number of elements to take.
  25394. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25395. * @returns {Array} Returns the slice of `array`.
  25396. * @example
  25397. *
  25398. * _.take([1, 2, 3]);
  25399. * // => [1]
  25400. *
  25401. * _.take([1, 2, 3], 2);
  25402. * // => [1, 2]
  25403. *
  25404. * _.take([1, 2, 3], 5);
  25405. * // => [1, 2, 3]
  25406. *
  25407. * _.take([1, 2, 3], 0);
  25408. * // => []
  25409. */
  25410. function take(array, n, guard) {
  25411. if (!(array && array.length)) {
  25412. return [];
  25413. }
  25414. n = (guard || n === undefined) ? 1 : toInteger(n);
  25415. return baseSlice(array, 0, n < 0 ? 0 : n);
  25416. }
  25417. /**
  25418. * Creates a slice of `array` with `n` elements taken from the end.
  25419. *
  25420. * @static
  25421. * @memberOf _
  25422. * @since 3.0.0
  25423. * @category Array
  25424. * @param {Array} array The array to query.
  25425. * @param {number} [n=1] The number of elements to take.
  25426. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25427. * @returns {Array} Returns the slice of `array`.
  25428. * @example
  25429. *
  25430. * _.takeRight([1, 2, 3]);
  25431. * // => [3]
  25432. *
  25433. * _.takeRight([1, 2, 3], 2);
  25434. * // => [2, 3]
  25435. *
  25436. * _.takeRight([1, 2, 3], 5);
  25437. * // => [1, 2, 3]
  25438. *
  25439. * _.takeRight([1, 2, 3], 0);
  25440. * // => []
  25441. */
  25442. function takeRight(array, n, guard) {
  25443. var length = array == null ? 0 : array.length;
  25444. if (!length) {
  25445. return [];
  25446. }
  25447. n = (guard || n === undefined) ? 1 : toInteger(n);
  25448. n = length - n;
  25449. return baseSlice(array, n < 0 ? 0 : n, length);
  25450. }
  25451. /**
  25452. * Creates a slice of `array` with elements taken from the end. Elements are
  25453. * taken until `predicate` returns falsey. The predicate is invoked with
  25454. * three arguments: (value, index, array).
  25455. *
  25456. * @static
  25457. * @memberOf _
  25458. * @since 3.0.0
  25459. * @category Array
  25460. * @param {Array} array The array to query.
  25461. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25462. * @returns {Array} Returns the slice of `array`.
  25463. * @example
  25464. *
  25465. * var users = [
  25466. * { 'user': 'barney', 'active': true },
  25467. * { 'user': 'fred', 'active': false },
  25468. * { 'user': 'pebbles', 'active': false }
  25469. * ];
  25470. *
  25471. * _.takeRightWhile(users, function(o) { return !o.active; });
  25472. * // => objects for ['fred', 'pebbles']
  25473. *
  25474. * // The `_.matches` iteratee shorthand.
  25475. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25476. * // => objects for ['pebbles']
  25477. *
  25478. * // The `_.matchesProperty` iteratee shorthand.
  25479. * _.takeRightWhile(users, ['active', false]);
  25480. * // => objects for ['fred', 'pebbles']
  25481. *
  25482. * // The `_.property` iteratee shorthand.
  25483. * _.takeRightWhile(users, 'active');
  25484. * // => []
  25485. */
  25486. function takeRightWhile(array, predicate) {
  25487. return (array && array.length)
  25488. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25489. : [];
  25490. }
  25491. /**
  25492. * Creates a slice of `array` with elements taken from the beginning. Elements
  25493. * are taken until `predicate` returns falsey. The predicate is invoked with
  25494. * three arguments: (value, index, array).
  25495. *
  25496. * @static
  25497. * @memberOf _
  25498. * @since 3.0.0
  25499. * @category Array
  25500. * @param {Array} array The array to query.
  25501. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25502. * @returns {Array} Returns the slice of `array`.
  25503. * @example
  25504. *
  25505. * var users = [
  25506. * { 'user': 'barney', 'active': false },
  25507. * { 'user': 'fred', 'active': false },
  25508. * { 'user': 'pebbles', 'active': true }
  25509. * ];
  25510. *
  25511. * _.takeWhile(users, function(o) { return !o.active; });
  25512. * // => objects for ['barney', 'fred']
  25513. *
  25514. * // The `_.matches` iteratee shorthand.
  25515. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25516. * // => objects for ['barney']
  25517. *
  25518. * // The `_.matchesProperty` iteratee shorthand.
  25519. * _.takeWhile(users, ['active', false]);
  25520. * // => objects for ['barney', 'fred']
  25521. *
  25522. * // The `_.property` iteratee shorthand.
  25523. * _.takeWhile(users, 'active');
  25524. * // => []
  25525. */
  25526. function takeWhile(array, predicate) {
  25527. return (array && array.length)
  25528. ? baseWhile(array, getIteratee(predicate, 3))
  25529. : [];
  25530. }
  25531. /**
  25532. * Creates an array of unique values, in order, from all given arrays using
  25533. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25534. * for equality comparisons.
  25535. *
  25536. * @static
  25537. * @memberOf _
  25538. * @since 0.1.0
  25539. * @category Array
  25540. * @param {...Array} [arrays] The arrays to inspect.
  25541. * @returns {Array} Returns the new array of combined values.
  25542. * @example
  25543. *
  25544. * _.union([2], [1, 2]);
  25545. * // => [2, 1]
  25546. */
  25547. var union = baseRest(function(arrays) {
  25548. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25549. });
  25550. /**
  25551. * This method is like `_.union` except that it accepts `iteratee` which is
  25552. * invoked for each element of each `arrays` to generate the criterion by
  25553. * which uniqueness is computed. Result values are chosen from the first
  25554. * array in which the value occurs. The iteratee is invoked with one argument:
  25555. * (value).
  25556. *
  25557. * @static
  25558. * @memberOf _
  25559. * @since 4.0.0
  25560. * @category Array
  25561. * @param {...Array} [arrays] The arrays to inspect.
  25562. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25563. * @returns {Array} Returns the new array of combined values.
  25564. * @example
  25565. *
  25566. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25567. * // => [2.1, 1.2]
  25568. *
  25569. * // The `_.property` iteratee shorthand.
  25570. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25571. * // => [{ 'x': 1 }, { 'x': 2 }]
  25572. */
  25573. var unionBy = baseRest(function(arrays) {
  25574. var iteratee = last(arrays);
  25575. if (isArrayLikeObject(iteratee)) {
  25576. iteratee = undefined;
  25577. }
  25578. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25579. });
  25580. /**
  25581. * This method is like `_.union` except that it accepts `comparator` which
  25582. * is invoked to compare elements of `arrays`. Result values are chosen from
  25583. * the first array in which the value occurs. The comparator is invoked
  25584. * with two arguments: (arrVal, othVal).
  25585. *
  25586. * @static
  25587. * @memberOf _
  25588. * @since 4.0.0
  25589. * @category Array
  25590. * @param {...Array} [arrays] The arrays to inspect.
  25591. * @param {Function} [comparator] The comparator invoked per element.
  25592. * @returns {Array} Returns the new array of combined values.
  25593. * @example
  25594. *
  25595. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25596. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25597. *
  25598. * _.unionWith(objects, others, _.isEqual);
  25599. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25600. */
  25601. var unionWith = baseRest(function(arrays) {
  25602. var comparator = last(arrays);
  25603. comparator = typeof comparator == 'function' ? comparator : undefined;
  25604. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25605. });
  25606. /**
  25607. * Creates a duplicate-free version of an array, using
  25608. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25609. * for equality comparisons, in which only the first occurrence of each element
  25610. * is kept. The order of result values is determined by the order they occur
  25611. * in the array.
  25612. *
  25613. * @static
  25614. * @memberOf _
  25615. * @since 0.1.0
  25616. * @category Array
  25617. * @param {Array} array The array to inspect.
  25618. * @returns {Array} Returns the new duplicate free array.
  25619. * @example
  25620. *
  25621. * _.uniq([2, 1, 2]);
  25622. * // => [2, 1]
  25623. */
  25624. function uniq(array) {
  25625. return (array && array.length) ? baseUniq(array) : [];
  25626. }
  25627. /**
  25628. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25629. * invoked for each element in `array` to generate the criterion by which
  25630. * uniqueness is computed. The order of result values is determined by the
  25631. * order they occur in the array. The iteratee is invoked with one argument:
  25632. * (value).
  25633. *
  25634. * @static
  25635. * @memberOf _
  25636. * @since 4.0.0
  25637. * @category Array
  25638. * @param {Array} array The array to inspect.
  25639. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25640. * @returns {Array} Returns the new duplicate free array.
  25641. * @example
  25642. *
  25643. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25644. * // => [2.1, 1.2]
  25645. *
  25646. * // The `_.property` iteratee shorthand.
  25647. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25648. * // => [{ 'x': 1 }, { 'x': 2 }]
  25649. */
  25650. function uniqBy(array, iteratee) {
  25651. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25652. }
  25653. /**
  25654. * This method is like `_.uniq` except that it accepts `comparator` which
  25655. * is invoked to compare elements of `array`. The order of result values is
  25656. * determined by the order they occur in the array.The comparator is invoked
  25657. * with two arguments: (arrVal, othVal).
  25658. *
  25659. * @static
  25660. * @memberOf _
  25661. * @since 4.0.0
  25662. * @category Array
  25663. * @param {Array} array The array to inspect.
  25664. * @param {Function} [comparator] The comparator invoked per element.
  25665. * @returns {Array} Returns the new duplicate free array.
  25666. * @example
  25667. *
  25668. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25669. *
  25670. * _.uniqWith(objects, _.isEqual);
  25671. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25672. */
  25673. function uniqWith(array, comparator) {
  25674. comparator = typeof comparator == 'function' ? comparator : undefined;
  25675. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25676. }
  25677. /**
  25678. * This method is like `_.zip` except that it accepts an array of grouped
  25679. * elements and creates an array regrouping the elements to their pre-zip
  25680. * configuration.
  25681. *
  25682. * @static
  25683. * @memberOf _
  25684. * @since 1.2.0
  25685. * @category Array
  25686. * @param {Array} array The array of grouped elements to process.
  25687. * @returns {Array} Returns the new array of regrouped elements.
  25688. * @example
  25689. *
  25690. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25691. * // => [['a', 1, true], ['b', 2, false]]
  25692. *
  25693. * _.unzip(zipped);
  25694. * // => [['a', 'b'], [1, 2], [true, false]]
  25695. */
  25696. function unzip(array) {
  25697. if (!(array && array.length)) {
  25698. return [];
  25699. }
  25700. var length = 0;
  25701. array = arrayFilter(array, function(group) {
  25702. if (isArrayLikeObject(group)) {
  25703. length = nativeMax(group.length, length);
  25704. return true;
  25705. }
  25706. });
  25707. return baseTimes(length, function(index) {
  25708. return arrayMap(array, baseProperty(index));
  25709. });
  25710. }
  25711. /**
  25712. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25713. * how regrouped values should be combined. The iteratee is invoked with the
  25714. * elements of each group: (...group).
  25715. *
  25716. * @static
  25717. * @memberOf _
  25718. * @since 3.8.0
  25719. * @category Array
  25720. * @param {Array} array The array of grouped elements to process.
  25721. * @param {Function} [iteratee=_.identity] The function to combine
  25722. * regrouped values.
  25723. * @returns {Array} Returns the new array of regrouped elements.
  25724. * @example
  25725. *
  25726. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25727. * // => [[1, 10, 100], [2, 20, 200]]
  25728. *
  25729. * _.unzipWith(zipped, _.add);
  25730. * // => [3, 30, 300]
  25731. */
  25732. function unzipWith(array, iteratee) {
  25733. if (!(array && array.length)) {
  25734. return [];
  25735. }
  25736. var result = unzip(array);
  25737. if (iteratee == null) {
  25738. return result;
  25739. }
  25740. return arrayMap(result, function(group) {
  25741. return apply(iteratee, undefined, group);
  25742. });
  25743. }
  25744. /**
  25745. * Creates an array excluding all given values using
  25746. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25747. * for equality comparisons.
  25748. *
  25749. * **Note:** Unlike `_.pull`, this method returns a new array.
  25750. *
  25751. * @static
  25752. * @memberOf _
  25753. * @since 0.1.0
  25754. * @category Array
  25755. * @param {Array} array The array to inspect.
  25756. * @param {...*} [values] The values to exclude.
  25757. * @returns {Array} Returns the new array of filtered values.
  25758. * @see _.difference, _.xor
  25759. * @example
  25760. *
  25761. * _.without([2, 1, 2, 3], 1, 2);
  25762. * // => [3]
  25763. */
  25764. var without = baseRest(function(array, values) {
  25765. return isArrayLikeObject(array)
  25766. ? baseDifference(array, values)
  25767. : [];
  25768. });
  25769. /**
  25770. * Creates an array of unique values that is the
  25771. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25772. * of the given arrays. The order of result values is determined by the order
  25773. * they occur in the arrays.
  25774. *
  25775. * @static
  25776. * @memberOf _
  25777. * @since 2.4.0
  25778. * @category Array
  25779. * @param {...Array} [arrays] The arrays to inspect.
  25780. * @returns {Array} Returns the new array of filtered values.
  25781. * @see _.difference, _.without
  25782. * @example
  25783. *
  25784. * _.xor([2, 1], [2, 3]);
  25785. * // => [1, 3]
  25786. */
  25787. var xor = baseRest(function(arrays) {
  25788. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25789. });
  25790. /**
  25791. * This method is like `_.xor` except that it accepts `iteratee` which is
  25792. * invoked for each element of each `arrays` to generate the criterion by
  25793. * which by which they're compared. The order of result values is determined
  25794. * by the order they occur in the arrays. The iteratee is invoked with one
  25795. * argument: (value).
  25796. *
  25797. * @static
  25798. * @memberOf _
  25799. * @since 4.0.0
  25800. * @category Array
  25801. * @param {...Array} [arrays] The arrays to inspect.
  25802. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25803. * @returns {Array} Returns the new array of filtered values.
  25804. * @example
  25805. *
  25806. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25807. * // => [1.2, 3.4]
  25808. *
  25809. * // The `_.property` iteratee shorthand.
  25810. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25811. * // => [{ 'x': 2 }]
  25812. */
  25813. var xorBy = baseRest(function(arrays) {
  25814. var iteratee = last(arrays);
  25815. if (isArrayLikeObject(iteratee)) {
  25816. iteratee = undefined;
  25817. }
  25818. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25819. });
  25820. /**
  25821. * This method is like `_.xor` except that it accepts `comparator` which is
  25822. * invoked to compare elements of `arrays`. The order of result values is
  25823. * determined by the order they occur in the arrays. The comparator is invoked
  25824. * with two arguments: (arrVal, othVal).
  25825. *
  25826. * @static
  25827. * @memberOf _
  25828. * @since 4.0.0
  25829. * @category Array
  25830. * @param {...Array} [arrays] The arrays to inspect.
  25831. * @param {Function} [comparator] The comparator invoked per element.
  25832. * @returns {Array} Returns the new array of filtered values.
  25833. * @example
  25834. *
  25835. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25836. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25837. *
  25838. * _.xorWith(objects, others, _.isEqual);
  25839. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25840. */
  25841. var xorWith = baseRest(function(arrays) {
  25842. var comparator = last(arrays);
  25843. comparator = typeof comparator == 'function' ? comparator : undefined;
  25844. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25845. });
  25846. /**
  25847. * Creates an array of grouped elements, the first of which contains the
  25848. * first elements of the given arrays, the second of which contains the
  25849. * second elements of the given arrays, and so on.
  25850. *
  25851. * @static
  25852. * @memberOf _
  25853. * @since 0.1.0
  25854. * @category Array
  25855. * @param {...Array} [arrays] The arrays to process.
  25856. * @returns {Array} Returns the new array of grouped elements.
  25857. * @example
  25858. *
  25859. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25860. * // => [['a', 1, true], ['b', 2, false]]
  25861. */
  25862. var zip = baseRest(unzip);
  25863. /**
  25864. * This method is like `_.fromPairs` except that it accepts two arrays,
  25865. * one of property identifiers and one of corresponding values.
  25866. *
  25867. * @static
  25868. * @memberOf _
  25869. * @since 0.4.0
  25870. * @category Array
  25871. * @param {Array} [props=[]] The property identifiers.
  25872. * @param {Array} [values=[]] The property values.
  25873. * @returns {Object} Returns the new object.
  25874. * @example
  25875. *
  25876. * _.zipObject(['a', 'b'], [1, 2]);
  25877. * // => { 'a': 1, 'b': 2 }
  25878. */
  25879. function zipObject(props, values) {
  25880. return baseZipObject(props || [], values || [], assignValue);
  25881. }
  25882. /**
  25883. * This method is like `_.zipObject` except that it supports property paths.
  25884. *
  25885. * @static
  25886. * @memberOf _
  25887. * @since 4.1.0
  25888. * @category Array
  25889. * @param {Array} [props=[]] The property identifiers.
  25890. * @param {Array} [values=[]] The property values.
  25891. * @returns {Object} Returns the new object.
  25892. * @example
  25893. *
  25894. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25895. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25896. */
  25897. function zipObjectDeep(props, values) {
  25898. return baseZipObject(props || [], values || [], baseSet);
  25899. }
  25900. /**
  25901. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25902. * how grouped values should be combined. The iteratee is invoked with the
  25903. * elements of each group: (...group).
  25904. *
  25905. * @static
  25906. * @memberOf _
  25907. * @since 3.8.0
  25908. * @category Array
  25909. * @param {...Array} [arrays] The arrays to process.
  25910. * @param {Function} [iteratee=_.identity] The function to combine
  25911. * grouped values.
  25912. * @returns {Array} Returns the new array of grouped elements.
  25913. * @example
  25914. *
  25915. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  25916. * return a + b + c;
  25917. * });
  25918. * // => [111, 222]
  25919. */
  25920. var zipWith = baseRest(function(arrays) {
  25921. var length = arrays.length,
  25922. iteratee = length > 1 ? arrays[length - 1] : undefined;
  25923. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  25924. return unzipWith(arrays, iteratee);
  25925. });
  25926. /*------------------------------------------------------------------------*/
  25927. /**
  25928. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  25929. * chain sequences enabled. The result of such sequences must be unwrapped
  25930. * with `_#value`.
  25931. *
  25932. * @static
  25933. * @memberOf _
  25934. * @since 1.3.0
  25935. * @category Seq
  25936. * @param {*} value The value to wrap.
  25937. * @returns {Object} Returns the new `lodash` wrapper instance.
  25938. * @example
  25939. *
  25940. * var users = [
  25941. * { 'user': 'barney', 'age': 36 },
  25942. * { 'user': 'fred', 'age': 40 },
  25943. * { 'user': 'pebbles', 'age': 1 }
  25944. * ];
  25945. *
  25946. * var youngest = _
  25947. * .chain(users)
  25948. * .sortBy('age')
  25949. * .map(function(o) {
  25950. * return o.user + ' is ' + o.age;
  25951. * })
  25952. * .head()
  25953. * .value();
  25954. * // => 'pebbles is 1'
  25955. */
  25956. function chain(value) {
  25957. var result = lodash(value);
  25958. result.__chain__ = true;
  25959. return result;
  25960. }
  25961. /**
  25962. * This method invokes `interceptor` and returns `value`. The interceptor
  25963. * is invoked with one argument; (value). The purpose of this method is to
  25964. * "tap into" a method chain sequence in order to modify intermediate results.
  25965. *
  25966. * @static
  25967. * @memberOf _
  25968. * @since 0.1.0
  25969. * @category Seq
  25970. * @param {*} value The value to provide to `interceptor`.
  25971. * @param {Function} interceptor The function to invoke.
  25972. * @returns {*} Returns `value`.
  25973. * @example
  25974. *
  25975. * _([1, 2, 3])
  25976. * .tap(function(array) {
  25977. * // Mutate input array.
  25978. * array.pop();
  25979. * })
  25980. * .reverse()
  25981. * .value();
  25982. * // => [2, 1]
  25983. */
  25984. function tap(value, interceptor) {
  25985. interceptor(value);
  25986. return value;
  25987. }
  25988. /**
  25989. * This method is like `_.tap` except that it returns the result of `interceptor`.
  25990. * The purpose of this method is to "pass thru" values replacing intermediate
  25991. * results in a method chain sequence.
  25992. *
  25993. * @static
  25994. * @memberOf _
  25995. * @since 3.0.0
  25996. * @category Seq
  25997. * @param {*} value The value to provide to `interceptor`.
  25998. * @param {Function} interceptor The function to invoke.
  25999. * @returns {*} Returns the result of `interceptor`.
  26000. * @example
  26001. *
  26002. * _(' abc ')
  26003. * .chain()
  26004. * .trim()
  26005. * .thru(function(value) {
  26006. * return [value];
  26007. * })
  26008. * .value();
  26009. * // => ['abc']
  26010. */
  26011. function thru(value, interceptor) {
  26012. return interceptor(value);
  26013. }
  26014. /**
  26015. * This method is the wrapper version of `_.at`.
  26016. *
  26017. * @name at
  26018. * @memberOf _
  26019. * @since 1.0.0
  26020. * @category Seq
  26021. * @param {...(string|string[])} [paths] The property paths to pick.
  26022. * @returns {Object} Returns the new `lodash` wrapper instance.
  26023. * @example
  26024. *
  26025. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26026. *
  26027. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26028. * // => [3, 4]
  26029. */
  26030. var wrapperAt = flatRest(function(paths) {
  26031. var length = paths.length,
  26032. start = length ? paths[0] : 0,
  26033. value = this.__wrapped__,
  26034. interceptor = function(object) { return baseAt(object, paths); };
  26035. if (length > 1 || this.__actions__.length ||
  26036. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26037. return this.thru(interceptor);
  26038. }
  26039. value = value.slice(start, +start + (length ? 1 : 0));
  26040. value.__actions__.push({
  26041. 'func': thru,
  26042. 'args': [interceptor],
  26043. 'thisArg': undefined
  26044. });
  26045. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26046. if (length && !array.length) {
  26047. array.push(undefined);
  26048. }
  26049. return array;
  26050. });
  26051. });
  26052. /**
  26053. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26054. *
  26055. * @name chain
  26056. * @memberOf _
  26057. * @since 0.1.0
  26058. * @category Seq
  26059. * @returns {Object} Returns the new `lodash` wrapper instance.
  26060. * @example
  26061. *
  26062. * var users = [
  26063. * { 'user': 'barney', 'age': 36 },
  26064. * { 'user': 'fred', 'age': 40 }
  26065. * ];
  26066. *
  26067. * // A sequence without explicit chaining.
  26068. * _(users).head();
  26069. * // => { 'user': 'barney', 'age': 36 }
  26070. *
  26071. * // A sequence with explicit chaining.
  26072. * _(users)
  26073. * .chain()
  26074. * .head()
  26075. * .pick('user')
  26076. * .value();
  26077. * // => { 'user': 'barney' }
  26078. */
  26079. function wrapperChain() {
  26080. return chain(this);
  26081. }
  26082. /**
  26083. * Executes the chain sequence and returns the wrapped result.
  26084. *
  26085. * @name commit
  26086. * @memberOf _
  26087. * @since 3.2.0
  26088. * @category Seq
  26089. * @returns {Object} Returns the new `lodash` wrapper instance.
  26090. * @example
  26091. *
  26092. * var array = [1, 2];
  26093. * var wrapped = _(array).push(3);
  26094. *
  26095. * console.log(array);
  26096. * // => [1, 2]
  26097. *
  26098. * wrapped = wrapped.commit();
  26099. * console.log(array);
  26100. * // => [1, 2, 3]
  26101. *
  26102. * wrapped.last();
  26103. * // => 3
  26104. *
  26105. * console.log(array);
  26106. * // => [1, 2, 3]
  26107. */
  26108. function wrapperCommit() {
  26109. return new LodashWrapper(this.value(), this.__chain__);
  26110. }
  26111. /**
  26112. * Gets the next value on a wrapped object following the
  26113. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26114. *
  26115. * @name next
  26116. * @memberOf _
  26117. * @since 4.0.0
  26118. * @category Seq
  26119. * @returns {Object} Returns the next iterator value.
  26120. * @example
  26121. *
  26122. * var wrapped = _([1, 2]);
  26123. *
  26124. * wrapped.next();
  26125. * // => { 'done': false, 'value': 1 }
  26126. *
  26127. * wrapped.next();
  26128. * // => { 'done': false, 'value': 2 }
  26129. *
  26130. * wrapped.next();
  26131. * // => { 'done': true, 'value': undefined }
  26132. */
  26133. function wrapperNext() {
  26134. if (this.__values__ === undefined) {
  26135. this.__values__ = toArray(this.value());
  26136. }
  26137. var done = this.__index__ >= this.__values__.length,
  26138. value = done ? undefined : this.__values__[this.__index__++];
  26139. return { 'done': done, 'value': value };
  26140. }
  26141. /**
  26142. * Enables the wrapper to be iterable.
  26143. *
  26144. * @name Symbol.iterator
  26145. * @memberOf _
  26146. * @since 4.0.0
  26147. * @category Seq
  26148. * @returns {Object} Returns the wrapper object.
  26149. * @example
  26150. *
  26151. * var wrapped = _([1, 2]);
  26152. *
  26153. * wrapped[Symbol.iterator]() === wrapped;
  26154. * // => true
  26155. *
  26156. * Array.from(wrapped);
  26157. * // => [1, 2]
  26158. */
  26159. function wrapperToIterator() {
  26160. return this;
  26161. }
  26162. /**
  26163. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26164. *
  26165. * @name plant
  26166. * @memberOf _
  26167. * @since 3.2.0
  26168. * @category Seq
  26169. * @param {*} value The value to plant.
  26170. * @returns {Object} Returns the new `lodash` wrapper instance.
  26171. * @example
  26172. *
  26173. * function square(n) {
  26174. * return n * n;
  26175. * }
  26176. *
  26177. * var wrapped = _([1, 2]).map(square);
  26178. * var other = wrapped.plant([3, 4]);
  26179. *
  26180. * other.value();
  26181. * // => [9, 16]
  26182. *
  26183. * wrapped.value();
  26184. * // => [1, 4]
  26185. */
  26186. function wrapperPlant(value) {
  26187. var result,
  26188. parent = this;
  26189. while (parent instanceof baseLodash) {
  26190. var clone = wrapperClone(parent);
  26191. clone.__index__ = 0;
  26192. clone.__values__ = undefined;
  26193. if (result) {
  26194. previous.__wrapped__ = clone;
  26195. } else {
  26196. result = clone;
  26197. }
  26198. var previous = clone;
  26199. parent = parent.__wrapped__;
  26200. }
  26201. previous.__wrapped__ = value;
  26202. return result;
  26203. }
  26204. /**
  26205. * This method is the wrapper version of `_.reverse`.
  26206. *
  26207. * **Note:** This method mutates the wrapped array.
  26208. *
  26209. * @name reverse
  26210. * @memberOf _
  26211. * @since 0.1.0
  26212. * @category Seq
  26213. * @returns {Object} Returns the new `lodash` wrapper instance.
  26214. * @example
  26215. *
  26216. * var array = [1, 2, 3];
  26217. *
  26218. * _(array).reverse().value()
  26219. * // => [3, 2, 1]
  26220. *
  26221. * console.log(array);
  26222. * // => [3, 2, 1]
  26223. */
  26224. function wrapperReverse() {
  26225. var value = this.__wrapped__;
  26226. if (value instanceof LazyWrapper) {
  26227. var wrapped = value;
  26228. if (this.__actions__.length) {
  26229. wrapped = new LazyWrapper(this);
  26230. }
  26231. wrapped = wrapped.reverse();
  26232. wrapped.__actions__.push({
  26233. 'func': thru,
  26234. 'args': [reverse],
  26235. 'thisArg': undefined
  26236. });
  26237. return new LodashWrapper(wrapped, this.__chain__);
  26238. }
  26239. return this.thru(reverse);
  26240. }
  26241. /**
  26242. * Executes the chain sequence to resolve the unwrapped value.
  26243. *
  26244. * @name value
  26245. * @memberOf _
  26246. * @since 0.1.0
  26247. * @alias toJSON, valueOf
  26248. * @category Seq
  26249. * @returns {*} Returns the resolved unwrapped value.
  26250. * @example
  26251. *
  26252. * _([1, 2, 3]).value();
  26253. * // => [1, 2, 3]
  26254. */
  26255. function wrapperValue() {
  26256. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26257. }
  26258. /*------------------------------------------------------------------------*/
  26259. /**
  26260. * Creates an object composed of keys generated from the results of running
  26261. * each element of `collection` thru `iteratee`. The corresponding value of
  26262. * each key is the number of times the key was returned by `iteratee`. The
  26263. * iteratee is invoked with one argument: (value).
  26264. *
  26265. * @static
  26266. * @memberOf _
  26267. * @since 0.5.0
  26268. * @category Collection
  26269. * @param {Array|Object} collection The collection to iterate over.
  26270. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26271. * @returns {Object} Returns the composed aggregate object.
  26272. * @example
  26273. *
  26274. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26275. * // => { '4': 1, '6': 2 }
  26276. *
  26277. * // The `_.property` iteratee shorthand.
  26278. * _.countBy(['one', 'two', 'three'], 'length');
  26279. * // => { '3': 2, '5': 1 }
  26280. */
  26281. var countBy = createAggregator(function(result, value, key) {
  26282. if (hasOwnProperty.call(result, key)) {
  26283. ++result[key];
  26284. } else {
  26285. baseAssignValue(result, key, 1);
  26286. }
  26287. });
  26288. /**
  26289. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26290. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26291. * invoked with three arguments: (value, index|key, collection).
  26292. *
  26293. * **Note:** This method returns `true` for
  26294. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26295. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26296. * elements of empty collections.
  26297. *
  26298. * @static
  26299. * @memberOf _
  26300. * @since 0.1.0
  26301. * @category Collection
  26302. * @param {Array|Object} collection The collection to iterate over.
  26303. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26304. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26305. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26306. * else `false`.
  26307. * @example
  26308. *
  26309. * _.every([true, 1, null, 'yes'], Boolean);
  26310. * // => false
  26311. *
  26312. * var users = [
  26313. * { 'user': 'barney', 'age': 36, 'active': false },
  26314. * { 'user': 'fred', 'age': 40, 'active': false }
  26315. * ];
  26316. *
  26317. * // The `_.matches` iteratee shorthand.
  26318. * _.every(users, { 'user': 'barney', 'active': false });
  26319. * // => false
  26320. *
  26321. * // The `_.matchesProperty` iteratee shorthand.
  26322. * _.every(users, ['active', false]);
  26323. * // => true
  26324. *
  26325. * // The `_.property` iteratee shorthand.
  26326. * _.every(users, 'active');
  26327. * // => false
  26328. */
  26329. function every(collection, predicate, guard) {
  26330. var func = isArray(collection) ? arrayEvery : baseEvery;
  26331. if (guard && isIterateeCall(collection, predicate, guard)) {
  26332. predicate = undefined;
  26333. }
  26334. return func(collection, getIteratee(predicate, 3));
  26335. }
  26336. /**
  26337. * Iterates over elements of `collection`, returning an array of all elements
  26338. * `predicate` returns truthy for. The predicate is invoked with three
  26339. * arguments: (value, index|key, collection).
  26340. *
  26341. * **Note:** Unlike `_.remove`, this method returns a new array.
  26342. *
  26343. * @static
  26344. * @memberOf _
  26345. * @since 0.1.0
  26346. * @category Collection
  26347. * @param {Array|Object} collection The collection to iterate over.
  26348. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26349. * @returns {Array} Returns the new filtered array.
  26350. * @see _.reject
  26351. * @example
  26352. *
  26353. * var users = [
  26354. * { 'user': 'barney', 'age': 36, 'active': true },
  26355. * { 'user': 'fred', 'age': 40, 'active': false }
  26356. * ];
  26357. *
  26358. * _.filter(users, function(o) { return !o.active; });
  26359. * // => objects for ['fred']
  26360. *
  26361. * // The `_.matches` iteratee shorthand.
  26362. * _.filter(users, { 'age': 36, 'active': true });
  26363. * // => objects for ['barney']
  26364. *
  26365. * // The `_.matchesProperty` iteratee shorthand.
  26366. * _.filter(users, ['active', false]);
  26367. * // => objects for ['fred']
  26368. *
  26369. * // The `_.property` iteratee shorthand.
  26370. * _.filter(users, 'active');
  26371. * // => objects for ['barney']
  26372. */
  26373. function filter(collection, predicate) {
  26374. var func = isArray(collection) ? arrayFilter : baseFilter;
  26375. return func(collection, getIteratee(predicate, 3));
  26376. }
  26377. /**
  26378. * Iterates over elements of `collection`, returning the first element
  26379. * `predicate` returns truthy for. The predicate is invoked with three
  26380. * arguments: (value, index|key, collection).
  26381. *
  26382. * @static
  26383. * @memberOf _
  26384. * @since 0.1.0
  26385. * @category Collection
  26386. * @param {Array|Object} collection The collection to inspect.
  26387. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26388. * @param {number} [fromIndex=0] The index to search from.
  26389. * @returns {*} Returns the matched element, else `undefined`.
  26390. * @example
  26391. *
  26392. * var users = [
  26393. * { 'user': 'barney', 'age': 36, 'active': true },
  26394. * { 'user': 'fred', 'age': 40, 'active': false },
  26395. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26396. * ];
  26397. *
  26398. * _.find(users, function(o) { return o.age < 40; });
  26399. * // => object for 'barney'
  26400. *
  26401. * // The `_.matches` iteratee shorthand.
  26402. * _.find(users, { 'age': 1, 'active': true });
  26403. * // => object for 'pebbles'
  26404. *
  26405. * // The `_.matchesProperty` iteratee shorthand.
  26406. * _.find(users, ['active', false]);
  26407. * // => object for 'fred'
  26408. *
  26409. * // The `_.property` iteratee shorthand.
  26410. * _.find(users, 'active');
  26411. * // => object for 'barney'
  26412. */
  26413. var find = createFind(findIndex);
  26414. /**
  26415. * This method is like `_.find` except that it iterates over elements of
  26416. * `collection` from right to left.
  26417. *
  26418. * @static
  26419. * @memberOf _
  26420. * @since 2.0.0
  26421. * @category Collection
  26422. * @param {Array|Object} collection The collection to inspect.
  26423. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26424. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26425. * @returns {*} Returns the matched element, else `undefined`.
  26426. * @example
  26427. *
  26428. * _.findLast([1, 2, 3, 4], function(n) {
  26429. * return n % 2 == 1;
  26430. * });
  26431. * // => 3
  26432. */
  26433. var findLast = createFind(findLastIndex);
  26434. /**
  26435. * Creates a flattened array of values by running each element in `collection`
  26436. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26437. * with three arguments: (value, index|key, collection).
  26438. *
  26439. * @static
  26440. * @memberOf _
  26441. * @since 4.0.0
  26442. * @category Collection
  26443. * @param {Array|Object} collection The collection to iterate over.
  26444. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26445. * @returns {Array} Returns the new flattened array.
  26446. * @example
  26447. *
  26448. * function duplicate(n) {
  26449. * return [n, n];
  26450. * }
  26451. *
  26452. * _.flatMap([1, 2], duplicate);
  26453. * // => [1, 1, 2, 2]
  26454. */
  26455. function flatMap(collection, iteratee) {
  26456. return baseFlatten(map(collection, iteratee), 1);
  26457. }
  26458. /**
  26459. * This method is like `_.flatMap` except that it recursively flattens the
  26460. * mapped results.
  26461. *
  26462. * @static
  26463. * @memberOf _
  26464. * @since 4.7.0
  26465. * @category Collection
  26466. * @param {Array|Object} collection The collection to iterate over.
  26467. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26468. * @returns {Array} Returns the new flattened array.
  26469. * @example
  26470. *
  26471. * function duplicate(n) {
  26472. * return [[[n, n]]];
  26473. * }
  26474. *
  26475. * _.flatMapDeep([1, 2], duplicate);
  26476. * // => [1, 1, 2, 2]
  26477. */
  26478. function flatMapDeep(collection, iteratee) {
  26479. return baseFlatten(map(collection, iteratee), INFINITY);
  26480. }
  26481. /**
  26482. * This method is like `_.flatMap` except that it recursively flattens the
  26483. * mapped results up to `depth` times.
  26484. *
  26485. * @static
  26486. * @memberOf _
  26487. * @since 4.7.0
  26488. * @category Collection
  26489. * @param {Array|Object} collection The collection to iterate over.
  26490. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26491. * @param {number} [depth=1] The maximum recursion depth.
  26492. * @returns {Array} Returns the new flattened array.
  26493. * @example
  26494. *
  26495. * function duplicate(n) {
  26496. * return [[[n, n]]];
  26497. * }
  26498. *
  26499. * _.flatMapDepth([1, 2], duplicate, 2);
  26500. * // => [[1, 1], [2, 2]]
  26501. */
  26502. function flatMapDepth(collection, iteratee, depth) {
  26503. depth = depth === undefined ? 1 : toInteger(depth);
  26504. return baseFlatten(map(collection, iteratee), depth);
  26505. }
  26506. /**
  26507. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26508. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26509. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26510. *
  26511. * **Note:** As with other "Collections" methods, objects with a "length"
  26512. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26513. * or `_.forOwn` for object iteration.
  26514. *
  26515. * @static
  26516. * @memberOf _
  26517. * @since 0.1.0
  26518. * @alias each
  26519. * @category Collection
  26520. * @param {Array|Object} collection The collection to iterate over.
  26521. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26522. * @returns {Array|Object} Returns `collection`.
  26523. * @see _.forEachRight
  26524. * @example
  26525. *
  26526. * _.forEach([1, 2], function(value) {
  26527. * console.log(value);
  26528. * });
  26529. * // => Logs `1` then `2`.
  26530. *
  26531. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26532. * console.log(key);
  26533. * });
  26534. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26535. */
  26536. function forEach(collection, iteratee) {
  26537. var func = isArray(collection) ? arrayEach : baseEach;
  26538. return func(collection, getIteratee(iteratee, 3));
  26539. }
  26540. /**
  26541. * This method is like `_.forEach` except that it iterates over elements of
  26542. * `collection` from right to left.
  26543. *
  26544. * @static
  26545. * @memberOf _
  26546. * @since 2.0.0
  26547. * @alias eachRight
  26548. * @category Collection
  26549. * @param {Array|Object} collection The collection to iterate over.
  26550. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26551. * @returns {Array|Object} Returns `collection`.
  26552. * @see _.forEach
  26553. * @example
  26554. *
  26555. * _.forEachRight([1, 2], function(value) {
  26556. * console.log(value);
  26557. * });
  26558. * // => Logs `2` then `1`.
  26559. */
  26560. function forEachRight(collection, iteratee) {
  26561. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26562. return func(collection, getIteratee(iteratee, 3));
  26563. }
  26564. /**
  26565. * Creates an object composed of keys generated from the results of running
  26566. * each element of `collection` thru `iteratee`. The order of grouped values
  26567. * is determined by the order they occur in `collection`. The corresponding
  26568. * value of each key is an array of elements responsible for generating the
  26569. * key. The iteratee is invoked with one argument: (value).
  26570. *
  26571. * @static
  26572. * @memberOf _
  26573. * @since 0.1.0
  26574. * @category Collection
  26575. * @param {Array|Object} collection The collection to iterate over.
  26576. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26577. * @returns {Object} Returns the composed aggregate object.
  26578. * @example
  26579. *
  26580. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26581. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26582. *
  26583. * // The `_.property` iteratee shorthand.
  26584. * _.groupBy(['one', 'two', 'three'], 'length');
  26585. * // => { '3': ['one', 'two'], '5': ['three'] }
  26586. */
  26587. var groupBy = createAggregator(function(result, value, key) {
  26588. if (hasOwnProperty.call(result, key)) {
  26589. result[key].push(value);
  26590. } else {
  26591. baseAssignValue(result, key, [value]);
  26592. }
  26593. });
  26594. /**
  26595. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26596. * checked for a substring of `value`, otherwise
  26597. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26598. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26599. * the offset from the end of `collection`.
  26600. *
  26601. * @static
  26602. * @memberOf _
  26603. * @since 0.1.0
  26604. * @category Collection
  26605. * @param {Array|Object|string} collection The collection to inspect.
  26606. * @param {*} value The value to search for.
  26607. * @param {number} [fromIndex=0] The index to search from.
  26608. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26609. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26610. * @example
  26611. *
  26612. * _.includes([1, 2, 3], 1);
  26613. * // => true
  26614. *
  26615. * _.includes([1, 2, 3], 1, 2);
  26616. * // => false
  26617. *
  26618. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26619. * // => true
  26620. *
  26621. * _.includes('abcd', 'bc');
  26622. * // => true
  26623. */
  26624. function includes(collection, value, fromIndex, guard) {
  26625. collection = isArrayLike(collection) ? collection : values(collection);
  26626. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26627. var length = collection.length;
  26628. if (fromIndex < 0) {
  26629. fromIndex = nativeMax(length + fromIndex, 0);
  26630. }
  26631. return isString(collection)
  26632. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26633. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26634. }
  26635. /**
  26636. * Invokes the method at `path` of each element in `collection`, returning
  26637. * an array of the results of each invoked method. Any additional arguments
  26638. * are provided to each invoked method. If `path` is a function, it's invoked
  26639. * for, and `this` bound to, each element in `collection`.
  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|string} path The path of the method to invoke or
  26647. * the function invoked per iteration.
  26648. * @param {...*} [args] The arguments to invoke each method with.
  26649. * @returns {Array} Returns the array of results.
  26650. * @example
  26651. *
  26652. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26653. * // => [[1, 5, 7], [1, 2, 3]]
  26654. *
  26655. * _.invokeMap([123, 456], String.prototype.split, '');
  26656. * // => [['1', '2', '3'], ['4', '5', '6']]
  26657. */
  26658. var invokeMap = baseRest(function(collection, path, args) {
  26659. var index = -1,
  26660. isFunc = typeof path == 'function',
  26661. result = isArrayLike(collection) ? Array(collection.length) : [];
  26662. baseEach(collection, function(value) {
  26663. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26664. });
  26665. return result;
  26666. });
  26667. /**
  26668. * Creates an object composed of keys generated from the results of running
  26669. * each element of `collection` thru `iteratee`. The corresponding value of
  26670. * each key is the last element responsible for generating the key. The
  26671. * iteratee is invoked with one argument: (value).
  26672. *
  26673. * @static
  26674. * @memberOf _
  26675. * @since 4.0.0
  26676. * @category Collection
  26677. * @param {Array|Object} collection The collection to iterate over.
  26678. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26679. * @returns {Object} Returns the composed aggregate object.
  26680. * @example
  26681. *
  26682. * var array = [
  26683. * { 'dir': 'left', 'code': 97 },
  26684. * { 'dir': 'right', 'code': 100 }
  26685. * ];
  26686. *
  26687. * _.keyBy(array, function(o) {
  26688. * return String.fromCharCode(o.code);
  26689. * });
  26690. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26691. *
  26692. * _.keyBy(array, 'dir');
  26693. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26694. */
  26695. var keyBy = createAggregator(function(result, value, key) {
  26696. baseAssignValue(result, key, value);
  26697. });
  26698. /**
  26699. * Creates an array of values by running each element in `collection` thru
  26700. * `iteratee`. The iteratee is invoked with three arguments:
  26701. * (value, index|key, collection).
  26702. *
  26703. * Many lodash methods are guarded to work as iteratees for methods like
  26704. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26705. *
  26706. * The guarded methods are:
  26707. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26708. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26709. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26710. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26711. *
  26712. * @static
  26713. * @memberOf _
  26714. * @since 0.1.0
  26715. * @category Collection
  26716. * @param {Array|Object} collection The collection to iterate over.
  26717. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26718. * @returns {Array} Returns the new mapped array.
  26719. * @example
  26720. *
  26721. * function square(n) {
  26722. * return n * n;
  26723. * }
  26724. *
  26725. * _.map([4, 8], square);
  26726. * // => [16, 64]
  26727. *
  26728. * _.map({ 'a': 4, 'b': 8 }, square);
  26729. * // => [16, 64] (iteration order is not guaranteed)
  26730. *
  26731. * var users = [
  26732. * { 'user': 'barney' },
  26733. * { 'user': 'fred' }
  26734. * ];
  26735. *
  26736. * // The `_.property` iteratee shorthand.
  26737. * _.map(users, 'user');
  26738. * // => ['barney', 'fred']
  26739. */
  26740. function map(collection, iteratee) {
  26741. var func = isArray(collection) ? arrayMap : baseMap;
  26742. return func(collection, getIteratee(iteratee, 3));
  26743. }
  26744. /**
  26745. * This method is like `_.sortBy` except that it allows specifying the sort
  26746. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26747. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26748. * descending or "asc" for ascending sort order of corresponding values.
  26749. *
  26750. * @static
  26751. * @memberOf _
  26752. * @since 4.0.0
  26753. * @category Collection
  26754. * @param {Array|Object} collection The collection to iterate over.
  26755. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26756. * The iteratees to sort by.
  26757. * @param {string[]} [orders] The sort orders of `iteratees`.
  26758. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26759. * @returns {Array} Returns the new sorted array.
  26760. * @example
  26761. *
  26762. * var users = [
  26763. * { 'user': 'fred', 'age': 48 },
  26764. * { 'user': 'barney', 'age': 34 },
  26765. * { 'user': 'fred', 'age': 40 },
  26766. * { 'user': 'barney', 'age': 36 }
  26767. * ];
  26768. *
  26769. * // Sort by `user` in ascending order and by `age` in descending order.
  26770. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26771. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26772. */
  26773. function orderBy(collection, iteratees, orders, guard) {
  26774. if (collection == null) {
  26775. return [];
  26776. }
  26777. if (!isArray(iteratees)) {
  26778. iteratees = iteratees == null ? [] : [iteratees];
  26779. }
  26780. orders = guard ? undefined : orders;
  26781. if (!isArray(orders)) {
  26782. orders = orders == null ? [] : [orders];
  26783. }
  26784. return baseOrderBy(collection, iteratees, orders);
  26785. }
  26786. /**
  26787. * Creates an array of elements split into two groups, the first of which
  26788. * contains elements `predicate` returns truthy for, the second of which
  26789. * contains elements `predicate` returns falsey for. The predicate is
  26790. * invoked with one argument: (value).
  26791. *
  26792. * @static
  26793. * @memberOf _
  26794. * @since 3.0.0
  26795. * @category Collection
  26796. * @param {Array|Object} collection The collection to iterate over.
  26797. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26798. * @returns {Array} Returns the array of grouped elements.
  26799. * @example
  26800. *
  26801. * var users = [
  26802. * { 'user': 'barney', 'age': 36, 'active': false },
  26803. * { 'user': 'fred', 'age': 40, 'active': true },
  26804. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26805. * ];
  26806. *
  26807. * _.partition(users, function(o) { return o.active; });
  26808. * // => objects for [['fred'], ['barney', 'pebbles']]
  26809. *
  26810. * // The `_.matches` iteratee shorthand.
  26811. * _.partition(users, { 'age': 1, 'active': false });
  26812. * // => objects for [['pebbles'], ['barney', 'fred']]
  26813. *
  26814. * // The `_.matchesProperty` iteratee shorthand.
  26815. * _.partition(users, ['active', false]);
  26816. * // => objects for [['barney', 'pebbles'], ['fred']]
  26817. *
  26818. * // The `_.property` iteratee shorthand.
  26819. * _.partition(users, 'active');
  26820. * // => objects for [['fred'], ['barney', 'pebbles']]
  26821. */
  26822. var partition = createAggregator(function(result, value, key) {
  26823. result[key ? 0 : 1].push(value);
  26824. }, function() { return [[], []]; });
  26825. /**
  26826. * Reduces `collection` to a value which is the accumulated result of running
  26827. * each element in `collection` thru `iteratee`, where each successive
  26828. * invocation is supplied the return value of the previous. If `accumulator`
  26829. * is not given, the first element of `collection` is used as the initial
  26830. * value. The iteratee is invoked with four arguments:
  26831. * (accumulator, value, index|key, collection).
  26832. *
  26833. * Many lodash methods are guarded to work as iteratees for methods like
  26834. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26835. *
  26836. * The guarded methods are:
  26837. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26838. * and `sortBy`
  26839. *
  26840. * @static
  26841. * @memberOf _
  26842. * @since 0.1.0
  26843. * @category Collection
  26844. * @param {Array|Object} collection The collection to iterate over.
  26845. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26846. * @param {*} [accumulator] The initial value.
  26847. * @returns {*} Returns the accumulated value.
  26848. * @see _.reduceRight
  26849. * @example
  26850. *
  26851. * _.reduce([1, 2], function(sum, n) {
  26852. * return sum + n;
  26853. * }, 0);
  26854. * // => 3
  26855. *
  26856. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26857. * (result[value] || (result[value] = [])).push(key);
  26858. * return result;
  26859. * }, {});
  26860. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26861. */
  26862. function reduce(collection, iteratee, accumulator) {
  26863. var func = isArray(collection) ? arrayReduce : baseReduce,
  26864. initAccum = arguments.length < 3;
  26865. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26866. }
  26867. /**
  26868. * This method is like `_.reduce` except that it iterates over elements of
  26869. * `collection` from right to left.
  26870. *
  26871. * @static
  26872. * @memberOf _
  26873. * @since 0.1.0
  26874. * @category Collection
  26875. * @param {Array|Object} collection The collection to iterate over.
  26876. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26877. * @param {*} [accumulator] The initial value.
  26878. * @returns {*} Returns the accumulated value.
  26879. * @see _.reduce
  26880. * @example
  26881. *
  26882. * var array = [[0, 1], [2, 3], [4, 5]];
  26883. *
  26884. * _.reduceRight(array, function(flattened, other) {
  26885. * return flattened.concat(other);
  26886. * }, []);
  26887. * // => [4, 5, 2, 3, 0, 1]
  26888. */
  26889. function reduceRight(collection, iteratee, accumulator) {
  26890. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26891. initAccum = arguments.length < 3;
  26892. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26893. }
  26894. /**
  26895. * The opposite of `_.filter`; this method returns the elements of `collection`
  26896. * that `predicate` does **not** return truthy for.
  26897. *
  26898. * @static
  26899. * @memberOf _
  26900. * @since 0.1.0
  26901. * @category Collection
  26902. * @param {Array|Object} collection The collection to iterate over.
  26903. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26904. * @returns {Array} Returns the new filtered array.
  26905. * @see _.filter
  26906. * @example
  26907. *
  26908. * var users = [
  26909. * { 'user': 'barney', 'age': 36, 'active': false },
  26910. * { 'user': 'fred', 'age': 40, 'active': true }
  26911. * ];
  26912. *
  26913. * _.reject(users, function(o) { return !o.active; });
  26914. * // => objects for ['fred']
  26915. *
  26916. * // The `_.matches` iteratee shorthand.
  26917. * _.reject(users, { 'age': 40, 'active': true });
  26918. * // => objects for ['barney']
  26919. *
  26920. * // The `_.matchesProperty` iteratee shorthand.
  26921. * _.reject(users, ['active', false]);
  26922. * // => objects for ['fred']
  26923. *
  26924. * // The `_.property` iteratee shorthand.
  26925. * _.reject(users, 'active');
  26926. * // => objects for ['barney']
  26927. */
  26928. function reject(collection, predicate) {
  26929. var func = isArray(collection) ? arrayFilter : baseFilter;
  26930. return func(collection, negate(getIteratee(predicate, 3)));
  26931. }
  26932. /**
  26933. * Gets a random element from `collection`.
  26934. *
  26935. * @static
  26936. * @memberOf _
  26937. * @since 2.0.0
  26938. * @category Collection
  26939. * @param {Array|Object} collection The collection to sample.
  26940. * @returns {*} Returns the random element.
  26941. * @example
  26942. *
  26943. * _.sample([1, 2, 3, 4]);
  26944. * // => 2
  26945. */
  26946. function sample(collection) {
  26947. var func = isArray(collection) ? arraySample : baseSample;
  26948. return func(collection);
  26949. }
  26950. /**
  26951. * Gets `n` random elements at unique keys from `collection` up to the
  26952. * size of `collection`.
  26953. *
  26954. * @static
  26955. * @memberOf _
  26956. * @since 4.0.0
  26957. * @category Collection
  26958. * @param {Array|Object} collection The collection to sample.
  26959. * @param {number} [n=1] The number of elements to sample.
  26960. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26961. * @returns {Array} Returns the random elements.
  26962. * @example
  26963. *
  26964. * _.sampleSize([1, 2, 3], 2);
  26965. * // => [3, 1]
  26966. *
  26967. * _.sampleSize([1, 2, 3], 4);
  26968. * // => [2, 3, 1]
  26969. */
  26970. function sampleSize(collection, n, guard) {
  26971. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  26972. n = 1;
  26973. } else {
  26974. n = toInteger(n);
  26975. }
  26976. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  26977. return func(collection, n);
  26978. }
  26979. /**
  26980. * Creates an array of shuffled values, using a version of the
  26981. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  26982. *
  26983. * @static
  26984. * @memberOf _
  26985. * @since 0.1.0
  26986. * @category Collection
  26987. * @param {Array|Object} collection The collection to shuffle.
  26988. * @returns {Array} Returns the new shuffled array.
  26989. * @example
  26990. *
  26991. * _.shuffle([1, 2, 3, 4]);
  26992. * // => [4, 1, 3, 2]
  26993. */
  26994. function shuffle(collection) {
  26995. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  26996. return func(collection);
  26997. }
  26998. /**
  26999. * Gets the size of `collection` by returning its length for array-like
  27000. * values or the number of own enumerable string keyed properties for objects.
  27001. *
  27002. * @static
  27003. * @memberOf _
  27004. * @since 0.1.0
  27005. * @category Collection
  27006. * @param {Array|Object|string} collection The collection to inspect.
  27007. * @returns {number} Returns the collection size.
  27008. * @example
  27009. *
  27010. * _.size([1, 2, 3]);
  27011. * // => 3
  27012. *
  27013. * _.size({ 'a': 1, 'b': 2 });
  27014. * // => 2
  27015. *
  27016. * _.size('pebbles');
  27017. * // => 7
  27018. */
  27019. function size(collection) {
  27020. if (collection == null) {
  27021. return 0;
  27022. }
  27023. if (isArrayLike(collection)) {
  27024. return isString(collection) ? stringSize(collection) : collection.length;
  27025. }
  27026. var tag = getTag(collection);
  27027. if (tag == mapTag || tag == setTag) {
  27028. return collection.size;
  27029. }
  27030. return baseKeys(collection).length;
  27031. }
  27032. /**
  27033. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27034. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27035. * invoked with three arguments: (value, index|key, collection).
  27036. *
  27037. * @static
  27038. * @memberOf _
  27039. * @since 0.1.0
  27040. * @category Collection
  27041. * @param {Array|Object} collection The collection to iterate over.
  27042. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27043. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27044. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27045. * else `false`.
  27046. * @example
  27047. *
  27048. * _.some([null, 0, 'yes', false], Boolean);
  27049. * // => true
  27050. *
  27051. * var users = [
  27052. * { 'user': 'barney', 'active': true },
  27053. * { 'user': 'fred', 'active': false }
  27054. * ];
  27055. *
  27056. * // The `_.matches` iteratee shorthand.
  27057. * _.some(users, { 'user': 'barney', 'active': false });
  27058. * // => false
  27059. *
  27060. * // The `_.matchesProperty` iteratee shorthand.
  27061. * _.some(users, ['active', false]);
  27062. * // => true
  27063. *
  27064. * // The `_.property` iteratee shorthand.
  27065. * _.some(users, 'active');
  27066. * // => true
  27067. */
  27068. function some(collection, predicate, guard) {
  27069. var func = isArray(collection) ? arraySome : baseSome;
  27070. if (guard && isIterateeCall(collection, predicate, guard)) {
  27071. predicate = undefined;
  27072. }
  27073. return func(collection, getIteratee(predicate, 3));
  27074. }
  27075. /**
  27076. * Creates an array of elements, sorted in ascending order by the results of
  27077. * running each element in a collection thru each iteratee. This method
  27078. * performs a stable sort, that is, it preserves the original sort order of
  27079. * equal elements. The iteratees are invoked with one argument: (value).
  27080. *
  27081. * @static
  27082. * @memberOf _
  27083. * @since 0.1.0
  27084. * @category Collection
  27085. * @param {Array|Object} collection The collection to iterate over.
  27086. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27087. * The iteratees to sort by.
  27088. * @returns {Array} Returns the new sorted array.
  27089. * @example
  27090. *
  27091. * var users = [
  27092. * { 'user': 'fred', 'age': 48 },
  27093. * { 'user': 'barney', 'age': 36 },
  27094. * { 'user': 'fred', 'age': 40 },
  27095. * { 'user': 'barney', 'age': 34 }
  27096. * ];
  27097. *
  27098. * _.sortBy(users, [function(o) { return o.user; }]);
  27099. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27100. *
  27101. * _.sortBy(users, ['user', 'age']);
  27102. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27103. */
  27104. var sortBy = baseRest(function(collection, iteratees) {
  27105. if (collection == null) {
  27106. return [];
  27107. }
  27108. var length = iteratees.length;
  27109. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27110. iteratees = [];
  27111. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27112. iteratees = [iteratees[0]];
  27113. }
  27114. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27115. });
  27116. /*------------------------------------------------------------------------*/
  27117. /**
  27118. * Gets the timestamp of the number of milliseconds that have elapsed since
  27119. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27120. *
  27121. * @static
  27122. * @memberOf _
  27123. * @since 2.4.0
  27124. * @category Date
  27125. * @returns {number} Returns the timestamp.
  27126. * @example
  27127. *
  27128. * _.defer(function(stamp) {
  27129. * console.log(_.now() - stamp);
  27130. * }, _.now());
  27131. * // => Logs the number of milliseconds it took for the deferred invocation.
  27132. */
  27133. var now = ctxNow || function() {
  27134. return root.Date.now();
  27135. };
  27136. /*------------------------------------------------------------------------*/
  27137. /**
  27138. * The opposite of `_.before`; this method creates a function that invokes
  27139. * `func` once it's called `n` or more times.
  27140. *
  27141. * @static
  27142. * @memberOf _
  27143. * @since 0.1.0
  27144. * @category Function
  27145. * @param {number} n The number of calls before `func` is invoked.
  27146. * @param {Function} func The function to restrict.
  27147. * @returns {Function} Returns the new restricted function.
  27148. * @example
  27149. *
  27150. * var saves = ['profile', 'settings'];
  27151. *
  27152. * var done = _.after(saves.length, function() {
  27153. * console.log('done saving!');
  27154. * });
  27155. *
  27156. * _.forEach(saves, function(type) {
  27157. * asyncSave({ 'type': type, 'complete': done });
  27158. * });
  27159. * // => Logs 'done saving!' after the two async saves have completed.
  27160. */
  27161. function after(n, func) {
  27162. if (typeof func != 'function') {
  27163. throw new TypeError(FUNC_ERROR_TEXT);
  27164. }
  27165. n = toInteger(n);
  27166. return function() {
  27167. if (--n < 1) {
  27168. return func.apply(this, arguments);
  27169. }
  27170. };
  27171. }
  27172. /**
  27173. * Creates a function that invokes `func`, with up to `n` arguments,
  27174. * ignoring any additional arguments.
  27175. *
  27176. * @static
  27177. * @memberOf _
  27178. * @since 3.0.0
  27179. * @category Function
  27180. * @param {Function} func The function to cap arguments for.
  27181. * @param {number} [n=func.length] The arity cap.
  27182. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27183. * @returns {Function} Returns the new capped function.
  27184. * @example
  27185. *
  27186. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27187. * // => [6, 8, 10]
  27188. */
  27189. function ary(func, n, guard) {
  27190. n = guard ? undefined : n;
  27191. n = (func && n == null) ? func.length : n;
  27192. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27193. }
  27194. /**
  27195. * Creates a function that invokes `func`, with the `this` binding and arguments
  27196. * of the created function, while it's called less than `n` times. Subsequent
  27197. * calls to the created function return the result of the last `func` invocation.
  27198. *
  27199. * @static
  27200. * @memberOf _
  27201. * @since 3.0.0
  27202. * @category Function
  27203. * @param {number} n The number of calls at which `func` is no longer invoked.
  27204. * @param {Function} func The function to restrict.
  27205. * @returns {Function} Returns the new restricted function.
  27206. * @example
  27207. *
  27208. * jQuery(element).on('click', _.before(5, addContactToList));
  27209. * // => Allows adding up to 4 contacts to the list.
  27210. */
  27211. function before(n, func) {
  27212. var result;
  27213. if (typeof func != 'function') {
  27214. throw new TypeError(FUNC_ERROR_TEXT);
  27215. }
  27216. n = toInteger(n);
  27217. return function() {
  27218. if (--n > 0) {
  27219. result = func.apply(this, arguments);
  27220. }
  27221. if (n <= 1) {
  27222. func = undefined;
  27223. }
  27224. return result;
  27225. };
  27226. }
  27227. /**
  27228. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27229. * and `partials` prepended to the arguments it receives.
  27230. *
  27231. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27232. * may be used as a placeholder for partially applied arguments.
  27233. *
  27234. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27235. * property of bound functions.
  27236. *
  27237. * @static
  27238. * @memberOf _
  27239. * @since 0.1.0
  27240. * @category Function
  27241. * @param {Function} func The function to bind.
  27242. * @param {*} thisArg The `this` binding of `func`.
  27243. * @param {...*} [partials] The arguments to be partially applied.
  27244. * @returns {Function} Returns the new bound function.
  27245. * @example
  27246. *
  27247. * function greet(greeting, punctuation) {
  27248. * return greeting + ' ' + this.user + punctuation;
  27249. * }
  27250. *
  27251. * var object = { 'user': 'fred' };
  27252. *
  27253. * var bound = _.bind(greet, object, 'hi');
  27254. * bound('!');
  27255. * // => 'hi fred!'
  27256. *
  27257. * // Bound with placeholders.
  27258. * var bound = _.bind(greet, object, _, '!');
  27259. * bound('hi');
  27260. * // => 'hi fred!'
  27261. */
  27262. var bind = baseRest(function(func, thisArg, partials) {
  27263. var bitmask = WRAP_BIND_FLAG;
  27264. if (partials.length) {
  27265. var holders = replaceHolders(partials, getHolder(bind));
  27266. bitmask |= WRAP_PARTIAL_FLAG;
  27267. }
  27268. return createWrap(func, bitmask, thisArg, partials, holders);
  27269. });
  27270. /**
  27271. * Creates a function that invokes the method at `object[key]` with `partials`
  27272. * prepended to the arguments it receives.
  27273. *
  27274. * This method differs from `_.bind` by allowing bound functions to reference
  27275. * methods that may be redefined or don't yet exist. See
  27276. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27277. * for more details.
  27278. *
  27279. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27280. * builds, may be used as a placeholder for partially applied arguments.
  27281. *
  27282. * @static
  27283. * @memberOf _
  27284. * @since 0.10.0
  27285. * @category Function
  27286. * @param {Object} object The object to invoke the method on.
  27287. * @param {string} key The key of the method.
  27288. * @param {...*} [partials] The arguments to be partially applied.
  27289. * @returns {Function} Returns the new bound function.
  27290. * @example
  27291. *
  27292. * var object = {
  27293. * 'user': 'fred',
  27294. * 'greet': function(greeting, punctuation) {
  27295. * return greeting + ' ' + this.user + punctuation;
  27296. * }
  27297. * };
  27298. *
  27299. * var bound = _.bindKey(object, 'greet', 'hi');
  27300. * bound('!');
  27301. * // => 'hi fred!'
  27302. *
  27303. * object.greet = function(greeting, punctuation) {
  27304. * return greeting + 'ya ' + this.user + punctuation;
  27305. * };
  27306. *
  27307. * bound('!');
  27308. * // => 'hiya fred!'
  27309. *
  27310. * // Bound with placeholders.
  27311. * var bound = _.bindKey(object, 'greet', _, '!');
  27312. * bound('hi');
  27313. * // => 'hiya fred!'
  27314. */
  27315. var bindKey = baseRest(function(object, key, partials) {
  27316. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27317. if (partials.length) {
  27318. var holders = replaceHolders(partials, getHolder(bindKey));
  27319. bitmask |= WRAP_PARTIAL_FLAG;
  27320. }
  27321. return createWrap(key, bitmask, object, partials, holders);
  27322. });
  27323. /**
  27324. * Creates a function that accepts arguments of `func` and either invokes
  27325. * `func` returning its result, if at least `arity` number of arguments have
  27326. * been provided, or returns a function that accepts the remaining `func`
  27327. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27328. * is not sufficient.
  27329. *
  27330. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27331. * may be used as a placeholder for provided arguments.
  27332. *
  27333. * **Note:** This method doesn't set the "length" property of curried functions.
  27334. *
  27335. * @static
  27336. * @memberOf _
  27337. * @since 2.0.0
  27338. * @category Function
  27339. * @param {Function} func The function to curry.
  27340. * @param {number} [arity=func.length] The arity of `func`.
  27341. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27342. * @returns {Function} Returns the new curried function.
  27343. * @example
  27344. *
  27345. * var abc = function(a, b, c) {
  27346. * return [a, b, c];
  27347. * };
  27348. *
  27349. * var curried = _.curry(abc);
  27350. *
  27351. * curried(1)(2)(3);
  27352. * // => [1, 2, 3]
  27353. *
  27354. * curried(1, 2)(3);
  27355. * // => [1, 2, 3]
  27356. *
  27357. * curried(1, 2, 3);
  27358. * // => [1, 2, 3]
  27359. *
  27360. * // Curried with placeholders.
  27361. * curried(1)(_, 3)(2);
  27362. * // => [1, 2, 3]
  27363. */
  27364. function curry(func, arity, guard) {
  27365. arity = guard ? undefined : arity;
  27366. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27367. result.placeholder = curry.placeholder;
  27368. return result;
  27369. }
  27370. /**
  27371. * This method is like `_.curry` except that arguments are applied to `func`
  27372. * in the manner of `_.partialRight` instead of `_.partial`.
  27373. *
  27374. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27375. * builds, may be used as a placeholder for provided arguments.
  27376. *
  27377. * **Note:** This method doesn't set the "length" property of curried functions.
  27378. *
  27379. * @static
  27380. * @memberOf _
  27381. * @since 3.0.0
  27382. * @category Function
  27383. * @param {Function} func The function to curry.
  27384. * @param {number} [arity=func.length] The arity of `func`.
  27385. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27386. * @returns {Function} Returns the new curried function.
  27387. * @example
  27388. *
  27389. * var abc = function(a, b, c) {
  27390. * return [a, b, c];
  27391. * };
  27392. *
  27393. * var curried = _.curryRight(abc);
  27394. *
  27395. * curried(3)(2)(1);
  27396. * // => [1, 2, 3]
  27397. *
  27398. * curried(2, 3)(1);
  27399. * // => [1, 2, 3]
  27400. *
  27401. * curried(1, 2, 3);
  27402. * // => [1, 2, 3]
  27403. *
  27404. * // Curried with placeholders.
  27405. * curried(3)(1, _)(2);
  27406. * // => [1, 2, 3]
  27407. */
  27408. function curryRight(func, arity, guard) {
  27409. arity = guard ? undefined : arity;
  27410. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27411. result.placeholder = curryRight.placeholder;
  27412. return result;
  27413. }
  27414. /**
  27415. * Creates a debounced function that delays invoking `func` until after `wait`
  27416. * milliseconds have elapsed since the last time the debounced function was
  27417. * invoked. The debounced function comes with a `cancel` method to cancel
  27418. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27419. * Provide `options` to indicate whether `func` should be invoked on the
  27420. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27421. * with the last arguments provided to the debounced function. Subsequent
  27422. * calls to the debounced function return the result of the last `func`
  27423. * invocation.
  27424. *
  27425. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27426. * invoked on the trailing edge of the timeout only if the debounced function
  27427. * is invoked more than once during the `wait` timeout.
  27428. *
  27429. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27430. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27431. *
  27432. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27433. * for details over the differences between `_.debounce` and `_.throttle`.
  27434. *
  27435. * @static
  27436. * @memberOf _
  27437. * @since 0.1.0
  27438. * @category Function
  27439. * @param {Function} func The function to debounce.
  27440. * @param {number} [wait=0] The number of milliseconds to delay.
  27441. * @param {Object} [options={}] The options object.
  27442. * @param {boolean} [options.leading=false]
  27443. * Specify invoking on the leading edge of the timeout.
  27444. * @param {number} [options.maxWait]
  27445. * The maximum time `func` is allowed to be delayed before it's invoked.
  27446. * @param {boolean} [options.trailing=true]
  27447. * Specify invoking on the trailing edge of the timeout.
  27448. * @returns {Function} Returns the new debounced function.
  27449. * @example
  27450. *
  27451. * // Avoid costly calculations while the window size is in flux.
  27452. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27453. *
  27454. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27455. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27456. * 'leading': true,
  27457. * 'trailing': false
  27458. * }));
  27459. *
  27460. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27461. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27462. * var source = new EventSource('/stream');
  27463. * jQuery(source).on('message', debounced);
  27464. *
  27465. * // Cancel the trailing debounced invocation.
  27466. * jQuery(window).on('popstate', debounced.cancel);
  27467. */
  27468. function debounce(func, wait, options) {
  27469. var lastArgs,
  27470. lastThis,
  27471. maxWait,
  27472. result,
  27473. timerId,
  27474. lastCallTime,
  27475. lastInvokeTime = 0,
  27476. leading = false,
  27477. maxing = false,
  27478. trailing = true;
  27479. if (typeof func != 'function') {
  27480. throw new TypeError(FUNC_ERROR_TEXT);
  27481. }
  27482. wait = toNumber(wait) || 0;
  27483. if (isObject(options)) {
  27484. leading = !!options.leading;
  27485. maxing = 'maxWait' in options;
  27486. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27487. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27488. }
  27489. function invokeFunc(time) {
  27490. var args = lastArgs,
  27491. thisArg = lastThis;
  27492. lastArgs = lastThis = undefined;
  27493. lastInvokeTime = time;
  27494. result = func.apply(thisArg, args);
  27495. return result;
  27496. }
  27497. function leadingEdge(time) {
  27498. // Reset any `maxWait` timer.
  27499. lastInvokeTime = time;
  27500. // Start the timer for the trailing edge.
  27501. timerId = setTimeout(timerExpired, wait);
  27502. // Invoke the leading edge.
  27503. return leading ? invokeFunc(time) : result;
  27504. }
  27505. function remainingWait(time) {
  27506. var timeSinceLastCall = time - lastCallTime,
  27507. timeSinceLastInvoke = time - lastInvokeTime,
  27508. timeWaiting = wait - timeSinceLastCall;
  27509. return maxing
  27510. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27511. : timeWaiting;
  27512. }
  27513. function shouldInvoke(time) {
  27514. var timeSinceLastCall = time - lastCallTime,
  27515. timeSinceLastInvoke = time - lastInvokeTime;
  27516. // Either this is the first call, activity has stopped and we're at the
  27517. // trailing edge, the system time has gone backwards and we're treating
  27518. // it as the trailing edge, or we've hit the `maxWait` limit.
  27519. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27520. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27521. }
  27522. function timerExpired() {
  27523. var time = now();
  27524. if (shouldInvoke(time)) {
  27525. return trailingEdge(time);
  27526. }
  27527. // Restart the timer.
  27528. timerId = setTimeout(timerExpired, remainingWait(time));
  27529. }
  27530. function trailingEdge(time) {
  27531. timerId = undefined;
  27532. // Only invoke if we have `lastArgs` which means `func` has been
  27533. // debounced at least once.
  27534. if (trailing && lastArgs) {
  27535. return invokeFunc(time);
  27536. }
  27537. lastArgs = lastThis = undefined;
  27538. return result;
  27539. }
  27540. function cancel() {
  27541. if (timerId !== undefined) {
  27542. clearTimeout(timerId);
  27543. }
  27544. lastInvokeTime = 0;
  27545. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27546. }
  27547. function flush() {
  27548. return timerId === undefined ? result : trailingEdge(now());
  27549. }
  27550. function debounced() {
  27551. var time = now(),
  27552. isInvoking = shouldInvoke(time);
  27553. lastArgs = arguments;
  27554. lastThis = this;
  27555. lastCallTime = time;
  27556. if (isInvoking) {
  27557. if (timerId === undefined) {
  27558. return leadingEdge(lastCallTime);
  27559. }
  27560. if (maxing) {
  27561. // Handle invocations in a tight loop.
  27562. clearTimeout(timerId);
  27563. timerId = setTimeout(timerExpired, wait);
  27564. return invokeFunc(lastCallTime);
  27565. }
  27566. }
  27567. if (timerId === undefined) {
  27568. timerId = setTimeout(timerExpired, wait);
  27569. }
  27570. return result;
  27571. }
  27572. debounced.cancel = cancel;
  27573. debounced.flush = flush;
  27574. return debounced;
  27575. }
  27576. /**
  27577. * Defers invoking the `func` until the current call stack has cleared. Any
  27578. * additional arguments are provided to `func` when it's invoked.
  27579. *
  27580. * @static
  27581. * @memberOf _
  27582. * @since 0.1.0
  27583. * @category Function
  27584. * @param {Function} func The function to defer.
  27585. * @param {...*} [args] The arguments to invoke `func` with.
  27586. * @returns {number} Returns the timer id.
  27587. * @example
  27588. *
  27589. * _.defer(function(text) {
  27590. * console.log(text);
  27591. * }, 'deferred');
  27592. * // => Logs 'deferred' after one millisecond.
  27593. */
  27594. var defer = baseRest(function(func, args) {
  27595. return baseDelay(func, 1, args);
  27596. });
  27597. /**
  27598. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27599. * provided to `func` when it's invoked.
  27600. *
  27601. * @static
  27602. * @memberOf _
  27603. * @since 0.1.0
  27604. * @category Function
  27605. * @param {Function} func The function to delay.
  27606. * @param {number} wait The number of milliseconds to delay invocation.
  27607. * @param {...*} [args] The arguments to invoke `func` with.
  27608. * @returns {number} Returns the timer id.
  27609. * @example
  27610. *
  27611. * _.delay(function(text) {
  27612. * console.log(text);
  27613. * }, 1000, 'later');
  27614. * // => Logs 'later' after one second.
  27615. */
  27616. var delay = baseRest(function(func, wait, args) {
  27617. return baseDelay(func, toNumber(wait) || 0, args);
  27618. });
  27619. /**
  27620. * Creates a function that invokes `func` with arguments reversed.
  27621. *
  27622. * @static
  27623. * @memberOf _
  27624. * @since 4.0.0
  27625. * @category Function
  27626. * @param {Function} func The function to flip arguments for.
  27627. * @returns {Function} Returns the new flipped function.
  27628. * @example
  27629. *
  27630. * var flipped = _.flip(function() {
  27631. * return _.toArray(arguments);
  27632. * });
  27633. *
  27634. * flipped('a', 'b', 'c', 'd');
  27635. * // => ['d', 'c', 'b', 'a']
  27636. */
  27637. function flip(func) {
  27638. return createWrap(func, WRAP_FLIP_FLAG);
  27639. }
  27640. /**
  27641. * Creates a function that memoizes the result of `func`. If `resolver` is
  27642. * provided, it determines the cache key for storing the result based on the
  27643. * arguments provided to the memoized function. By default, the first argument
  27644. * provided to the memoized function is used as the map cache key. The `func`
  27645. * is invoked with the `this` binding of the memoized function.
  27646. *
  27647. * **Note:** The cache is exposed as the `cache` property on the memoized
  27648. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27649. * constructor with one whose instances implement the
  27650. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27651. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27652. *
  27653. * @static
  27654. * @memberOf _
  27655. * @since 0.1.0
  27656. * @category Function
  27657. * @param {Function} func The function to have its output memoized.
  27658. * @param {Function} [resolver] The function to resolve the cache key.
  27659. * @returns {Function} Returns the new memoized function.
  27660. * @example
  27661. *
  27662. * var object = { 'a': 1, 'b': 2 };
  27663. * var other = { 'c': 3, 'd': 4 };
  27664. *
  27665. * var values = _.memoize(_.values);
  27666. * values(object);
  27667. * // => [1, 2]
  27668. *
  27669. * values(other);
  27670. * // => [3, 4]
  27671. *
  27672. * object.a = 2;
  27673. * values(object);
  27674. * // => [1, 2]
  27675. *
  27676. * // Modify the result cache.
  27677. * values.cache.set(object, ['a', 'b']);
  27678. * values(object);
  27679. * // => ['a', 'b']
  27680. *
  27681. * // Replace `_.memoize.Cache`.
  27682. * _.memoize.Cache = WeakMap;
  27683. */
  27684. function memoize(func, resolver) {
  27685. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27686. throw new TypeError(FUNC_ERROR_TEXT);
  27687. }
  27688. var memoized = function() {
  27689. var args = arguments,
  27690. key = resolver ? resolver.apply(this, args) : args[0],
  27691. cache = memoized.cache;
  27692. if (cache.has(key)) {
  27693. return cache.get(key);
  27694. }
  27695. var result = func.apply(this, args);
  27696. memoized.cache = cache.set(key, result) || cache;
  27697. return result;
  27698. };
  27699. memoized.cache = new (memoize.Cache || MapCache);
  27700. return memoized;
  27701. }
  27702. // Expose `MapCache`.
  27703. memoize.Cache = MapCache;
  27704. /**
  27705. * Creates a function that negates the result of the predicate `func`. The
  27706. * `func` predicate is invoked with the `this` binding and arguments of the
  27707. * created function.
  27708. *
  27709. * @static
  27710. * @memberOf _
  27711. * @since 3.0.0
  27712. * @category Function
  27713. * @param {Function} predicate The predicate to negate.
  27714. * @returns {Function} Returns the new negated function.
  27715. * @example
  27716. *
  27717. * function isEven(n) {
  27718. * return n % 2 == 0;
  27719. * }
  27720. *
  27721. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27722. * // => [1, 3, 5]
  27723. */
  27724. function negate(predicate) {
  27725. if (typeof predicate != 'function') {
  27726. throw new TypeError(FUNC_ERROR_TEXT);
  27727. }
  27728. return function() {
  27729. var args = arguments;
  27730. switch (args.length) {
  27731. case 0: return !predicate.call(this);
  27732. case 1: return !predicate.call(this, args[0]);
  27733. case 2: return !predicate.call(this, args[0], args[1]);
  27734. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27735. }
  27736. return !predicate.apply(this, args);
  27737. };
  27738. }
  27739. /**
  27740. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27741. * to the function return the value of the first invocation. The `func` is
  27742. * invoked with the `this` binding and arguments of the created function.
  27743. *
  27744. * @static
  27745. * @memberOf _
  27746. * @since 0.1.0
  27747. * @category Function
  27748. * @param {Function} func The function to restrict.
  27749. * @returns {Function} Returns the new restricted function.
  27750. * @example
  27751. *
  27752. * var initialize = _.once(createApplication);
  27753. * initialize();
  27754. * initialize();
  27755. * // => `createApplication` is invoked once
  27756. */
  27757. function once(func) {
  27758. return before(2, func);
  27759. }
  27760. /**
  27761. * Creates a function that invokes `func` with its arguments transformed.
  27762. *
  27763. * @static
  27764. * @since 4.0.0
  27765. * @memberOf _
  27766. * @category Function
  27767. * @param {Function} func The function to wrap.
  27768. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27769. * The argument transforms.
  27770. * @returns {Function} Returns the new function.
  27771. * @example
  27772. *
  27773. * function doubled(n) {
  27774. * return n * 2;
  27775. * }
  27776. *
  27777. * function square(n) {
  27778. * return n * n;
  27779. * }
  27780. *
  27781. * var func = _.overArgs(function(x, y) {
  27782. * return [x, y];
  27783. * }, [square, doubled]);
  27784. *
  27785. * func(9, 3);
  27786. * // => [81, 6]
  27787. *
  27788. * func(10, 5);
  27789. * // => [100, 10]
  27790. */
  27791. var overArgs = castRest(function(func, transforms) {
  27792. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27793. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27794. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27795. var funcsLength = transforms.length;
  27796. return baseRest(function(args) {
  27797. var index = -1,
  27798. length = nativeMin(args.length, funcsLength);
  27799. while (++index < length) {
  27800. args[index] = transforms[index].call(this, args[index]);
  27801. }
  27802. return apply(func, this, args);
  27803. });
  27804. });
  27805. /**
  27806. * Creates a function that invokes `func` with `partials` prepended to the
  27807. * arguments it receives. This method is like `_.bind` except it does **not**
  27808. * alter the `this` binding.
  27809. *
  27810. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27811. * builds, may be used as a placeholder for partially applied arguments.
  27812. *
  27813. * **Note:** This method doesn't set the "length" property of partially
  27814. * applied functions.
  27815. *
  27816. * @static
  27817. * @memberOf _
  27818. * @since 0.2.0
  27819. * @category Function
  27820. * @param {Function} func The function to partially apply arguments to.
  27821. * @param {...*} [partials] The arguments to be partially applied.
  27822. * @returns {Function} Returns the new partially applied function.
  27823. * @example
  27824. *
  27825. * function greet(greeting, name) {
  27826. * return greeting + ' ' + name;
  27827. * }
  27828. *
  27829. * var sayHelloTo = _.partial(greet, 'hello');
  27830. * sayHelloTo('fred');
  27831. * // => 'hello fred'
  27832. *
  27833. * // Partially applied with placeholders.
  27834. * var greetFred = _.partial(greet, _, 'fred');
  27835. * greetFred('hi');
  27836. * // => 'hi fred'
  27837. */
  27838. var partial = baseRest(function(func, partials) {
  27839. var holders = replaceHolders(partials, getHolder(partial));
  27840. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27841. });
  27842. /**
  27843. * This method is like `_.partial` except that partially applied arguments
  27844. * are appended to the arguments it receives.
  27845. *
  27846. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27847. * builds, may be used as a placeholder for partially applied arguments.
  27848. *
  27849. * **Note:** This method doesn't set the "length" property of partially
  27850. * applied functions.
  27851. *
  27852. * @static
  27853. * @memberOf _
  27854. * @since 1.0.0
  27855. * @category Function
  27856. * @param {Function} func The function to partially apply arguments to.
  27857. * @param {...*} [partials] The arguments to be partially applied.
  27858. * @returns {Function} Returns the new partially applied function.
  27859. * @example
  27860. *
  27861. * function greet(greeting, name) {
  27862. * return greeting + ' ' + name;
  27863. * }
  27864. *
  27865. * var greetFred = _.partialRight(greet, 'fred');
  27866. * greetFred('hi');
  27867. * // => 'hi fred'
  27868. *
  27869. * // Partially applied with placeholders.
  27870. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27871. * sayHelloTo('fred');
  27872. * // => 'hello fred'
  27873. */
  27874. var partialRight = baseRest(function(func, partials) {
  27875. var holders = replaceHolders(partials, getHolder(partialRight));
  27876. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27877. });
  27878. /**
  27879. * Creates a function that invokes `func` with arguments arranged according
  27880. * to the specified `indexes` where the argument value at the first index is
  27881. * provided as the first argument, the argument value at the second index is
  27882. * provided as the second argument, and so on.
  27883. *
  27884. * @static
  27885. * @memberOf _
  27886. * @since 3.0.0
  27887. * @category Function
  27888. * @param {Function} func The function to rearrange arguments for.
  27889. * @param {...(number|number[])} indexes The arranged argument indexes.
  27890. * @returns {Function} Returns the new function.
  27891. * @example
  27892. *
  27893. * var rearged = _.rearg(function(a, b, c) {
  27894. * return [a, b, c];
  27895. * }, [2, 0, 1]);
  27896. *
  27897. * rearged('b', 'c', 'a')
  27898. * // => ['a', 'b', 'c']
  27899. */
  27900. var rearg = flatRest(function(func, indexes) {
  27901. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27902. });
  27903. /**
  27904. * Creates a function that invokes `func` with the `this` binding of the
  27905. * created function and arguments from `start` and beyond provided as
  27906. * an array.
  27907. *
  27908. * **Note:** This method is based on the
  27909. * [rest parameter](https://mdn.io/rest_parameters).
  27910. *
  27911. * @static
  27912. * @memberOf _
  27913. * @since 4.0.0
  27914. * @category Function
  27915. * @param {Function} func The function to apply a rest parameter to.
  27916. * @param {number} [start=func.length-1] The start position of the rest parameter.
  27917. * @returns {Function} Returns the new function.
  27918. * @example
  27919. *
  27920. * var say = _.rest(function(what, names) {
  27921. * return what + ' ' + _.initial(names).join(', ') +
  27922. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  27923. * });
  27924. *
  27925. * say('hello', 'fred', 'barney', 'pebbles');
  27926. * // => 'hello fred, barney, & pebbles'
  27927. */
  27928. function rest(func, start) {
  27929. if (typeof func != 'function') {
  27930. throw new TypeError(FUNC_ERROR_TEXT);
  27931. }
  27932. start = start === undefined ? start : toInteger(start);
  27933. return baseRest(func, start);
  27934. }
  27935. /**
  27936. * Creates a function that invokes `func` with the `this` binding of the
  27937. * create function and an array of arguments much like
  27938. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  27939. *
  27940. * **Note:** This method is based on the
  27941. * [spread operator](https://mdn.io/spread_operator).
  27942. *
  27943. * @static
  27944. * @memberOf _
  27945. * @since 3.2.0
  27946. * @category Function
  27947. * @param {Function} func The function to spread arguments over.
  27948. * @param {number} [start=0] The start position of the spread.
  27949. * @returns {Function} Returns the new function.
  27950. * @example
  27951. *
  27952. * var say = _.spread(function(who, what) {
  27953. * return who + ' says ' + what;
  27954. * });
  27955. *
  27956. * say(['fred', 'hello']);
  27957. * // => 'fred says hello'
  27958. *
  27959. * var numbers = Promise.all([
  27960. * Promise.resolve(40),
  27961. * Promise.resolve(36)
  27962. * ]);
  27963. *
  27964. * numbers.then(_.spread(function(x, y) {
  27965. * return x + y;
  27966. * }));
  27967. * // => a Promise of 76
  27968. */
  27969. function spread(func, start) {
  27970. if (typeof func != 'function') {
  27971. throw new TypeError(FUNC_ERROR_TEXT);
  27972. }
  27973. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  27974. return baseRest(function(args) {
  27975. var array = args[start],
  27976. otherArgs = castSlice(args, 0, start);
  27977. if (array) {
  27978. arrayPush(otherArgs, array);
  27979. }
  27980. return apply(func, this, otherArgs);
  27981. });
  27982. }
  27983. /**
  27984. * Creates a throttled function that only invokes `func` at most once per
  27985. * every `wait` milliseconds. The throttled function comes with a `cancel`
  27986. * method to cancel delayed `func` invocations and a `flush` method to
  27987. * immediately invoke them. Provide `options` to indicate whether `func`
  27988. * should be invoked on the leading and/or trailing edge of the `wait`
  27989. * timeout. The `func` is invoked with the last arguments provided to the
  27990. * throttled function. Subsequent calls to the throttled function return the
  27991. * result of the last `func` invocation.
  27992. *
  27993. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27994. * invoked on the trailing edge of the timeout only if the throttled function
  27995. * is invoked more than once during the `wait` timeout.
  27996. *
  27997. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27998. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27999. *
  28000. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28001. * for details over the differences between `_.throttle` and `_.debounce`.
  28002. *
  28003. * @static
  28004. * @memberOf _
  28005. * @since 0.1.0
  28006. * @category Function
  28007. * @param {Function} func The function to throttle.
  28008. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28009. * @param {Object} [options={}] The options object.
  28010. * @param {boolean} [options.leading=true]
  28011. * Specify invoking on the leading edge of the timeout.
  28012. * @param {boolean} [options.trailing=true]
  28013. * Specify invoking on the trailing edge of the timeout.
  28014. * @returns {Function} Returns the new throttled function.
  28015. * @example
  28016. *
  28017. * // Avoid excessively updating the position while scrolling.
  28018. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28019. *
  28020. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28021. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28022. * jQuery(element).on('click', throttled);
  28023. *
  28024. * // Cancel the trailing throttled invocation.
  28025. * jQuery(window).on('popstate', throttled.cancel);
  28026. */
  28027. function throttle(func, wait, options) {
  28028. var leading = true,
  28029. trailing = true;
  28030. if (typeof func != 'function') {
  28031. throw new TypeError(FUNC_ERROR_TEXT);
  28032. }
  28033. if (isObject(options)) {
  28034. leading = 'leading' in options ? !!options.leading : leading;
  28035. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28036. }
  28037. return debounce(func, wait, {
  28038. 'leading': leading,
  28039. 'maxWait': wait,
  28040. 'trailing': trailing
  28041. });
  28042. }
  28043. /**
  28044. * Creates a function that accepts up to one argument, ignoring any
  28045. * additional arguments.
  28046. *
  28047. * @static
  28048. * @memberOf _
  28049. * @since 4.0.0
  28050. * @category Function
  28051. * @param {Function} func The function to cap arguments for.
  28052. * @returns {Function} Returns the new capped function.
  28053. * @example
  28054. *
  28055. * _.map(['6', '8', '10'], _.unary(parseInt));
  28056. * // => [6, 8, 10]
  28057. */
  28058. function unary(func) {
  28059. return ary(func, 1);
  28060. }
  28061. /**
  28062. * Creates a function that provides `value` to `wrapper` as its first
  28063. * argument. Any additional arguments provided to the function are appended
  28064. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28065. * binding of the created function.
  28066. *
  28067. * @static
  28068. * @memberOf _
  28069. * @since 0.1.0
  28070. * @category Function
  28071. * @param {*} value The value to wrap.
  28072. * @param {Function} [wrapper=identity] The wrapper function.
  28073. * @returns {Function} Returns the new function.
  28074. * @example
  28075. *
  28076. * var p = _.wrap(_.escape, function(func, text) {
  28077. * return '<p>' + func(text) + '</p>';
  28078. * });
  28079. *
  28080. * p('fred, barney, & pebbles');
  28081. * // => '<p>fred, barney, &amp; pebbles</p>'
  28082. */
  28083. function wrap(value, wrapper) {
  28084. return partial(castFunction(wrapper), value);
  28085. }
  28086. /*------------------------------------------------------------------------*/
  28087. /**
  28088. * Casts `value` as an array if it's not one.
  28089. *
  28090. * @static
  28091. * @memberOf _
  28092. * @since 4.4.0
  28093. * @category Lang
  28094. * @param {*} value The value to inspect.
  28095. * @returns {Array} Returns the cast array.
  28096. * @example
  28097. *
  28098. * _.castArray(1);
  28099. * // => [1]
  28100. *
  28101. * _.castArray({ 'a': 1 });
  28102. * // => [{ 'a': 1 }]
  28103. *
  28104. * _.castArray('abc');
  28105. * // => ['abc']
  28106. *
  28107. * _.castArray(null);
  28108. * // => [null]
  28109. *
  28110. * _.castArray(undefined);
  28111. * // => [undefined]
  28112. *
  28113. * _.castArray();
  28114. * // => []
  28115. *
  28116. * var array = [1, 2, 3];
  28117. * console.log(_.castArray(array) === array);
  28118. * // => true
  28119. */
  28120. function castArray() {
  28121. if (!arguments.length) {
  28122. return [];
  28123. }
  28124. var value = arguments[0];
  28125. return isArray(value) ? value : [value];
  28126. }
  28127. /**
  28128. * Creates a shallow clone of `value`.
  28129. *
  28130. * **Note:** This method is loosely based on the
  28131. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28132. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28133. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28134. * arrays. The own enumerable properties of `arguments` objects are cloned
  28135. * as plain objects. An empty object is returned for uncloneable values such
  28136. * as error objects, functions, DOM nodes, and WeakMaps.
  28137. *
  28138. * @static
  28139. * @memberOf _
  28140. * @since 0.1.0
  28141. * @category Lang
  28142. * @param {*} value The value to clone.
  28143. * @returns {*} Returns the cloned value.
  28144. * @see _.cloneDeep
  28145. * @example
  28146. *
  28147. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28148. *
  28149. * var shallow = _.clone(objects);
  28150. * console.log(shallow[0] === objects[0]);
  28151. * // => true
  28152. */
  28153. function clone(value) {
  28154. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28155. }
  28156. /**
  28157. * This method is like `_.clone` except that it accepts `customizer` which
  28158. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28159. * cloning is handled by the method instead. The `customizer` is invoked with
  28160. * up to four arguments; (value [, index|key, object, stack]).
  28161. *
  28162. * @static
  28163. * @memberOf _
  28164. * @since 4.0.0
  28165. * @category Lang
  28166. * @param {*} value The value to clone.
  28167. * @param {Function} [customizer] The function to customize cloning.
  28168. * @returns {*} Returns the cloned value.
  28169. * @see _.cloneDeepWith
  28170. * @example
  28171. *
  28172. * function customizer(value) {
  28173. * if (_.isElement(value)) {
  28174. * return value.cloneNode(false);
  28175. * }
  28176. * }
  28177. *
  28178. * var el = _.cloneWith(document.body, customizer);
  28179. *
  28180. * console.log(el === document.body);
  28181. * // => false
  28182. * console.log(el.nodeName);
  28183. * // => 'BODY'
  28184. * console.log(el.childNodes.length);
  28185. * // => 0
  28186. */
  28187. function cloneWith(value, customizer) {
  28188. customizer = typeof customizer == 'function' ? customizer : undefined;
  28189. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28190. }
  28191. /**
  28192. * This method is like `_.clone` except that it recursively clones `value`.
  28193. *
  28194. * @static
  28195. * @memberOf _
  28196. * @since 1.0.0
  28197. * @category Lang
  28198. * @param {*} value The value to recursively clone.
  28199. * @returns {*} Returns the deep cloned value.
  28200. * @see _.clone
  28201. * @example
  28202. *
  28203. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28204. *
  28205. * var deep = _.cloneDeep(objects);
  28206. * console.log(deep[0] === objects[0]);
  28207. * // => false
  28208. */
  28209. function cloneDeep(value) {
  28210. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28211. }
  28212. /**
  28213. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28214. *
  28215. * @static
  28216. * @memberOf _
  28217. * @since 4.0.0
  28218. * @category Lang
  28219. * @param {*} value The value to recursively clone.
  28220. * @param {Function} [customizer] The function to customize cloning.
  28221. * @returns {*} Returns the deep cloned value.
  28222. * @see _.cloneWith
  28223. * @example
  28224. *
  28225. * function customizer(value) {
  28226. * if (_.isElement(value)) {
  28227. * return value.cloneNode(true);
  28228. * }
  28229. * }
  28230. *
  28231. * var el = _.cloneDeepWith(document.body, customizer);
  28232. *
  28233. * console.log(el === document.body);
  28234. * // => false
  28235. * console.log(el.nodeName);
  28236. * // => 'BODY'
  28237. * console.log(el.childNodes.length);
  28238. * // => 20
  28239. */
  28240. function cloneDeepWith(value, customizer) {
  28241. customizer = typeof customizer == 'function' ? customizer : undefined;
  28242. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28243. }
  28244. /**
  28245. * Checks if `object` conforms to `source` by invoking the predicate
  28246. * properties of `source` with the corresponding property values of `object`.
  28247. *
  28248. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28249. * partially applied.
  28250. *
  28251. * @static
  28252. * @memberOf _
  28253. * @since 4.14.0
  28254. * @category Lang
  28255. * @param {Object} object The object to inspect.
  28256. * @param {Object} source The object of property predicates to conform to.
  28257. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28258. * @example
  28259. *
  28260. * var object = { 'a': 1, 'b': 2 };
  28261. *
  28262. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28263. * // => true
  28264. *
  28265. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28266. * // => false
  28267. */
  28268. function conformsTo(object, source) {
  28269. return source == null || baseConformsTo(object, source, keys(source));
  28270. }
  28271. /**
  28272. * Performs a
  28273. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28274. * comparison between two values to determine if they are equivalent.
  28275. *
  28276. * @static
  28277. * @memberOf _
  28278. * @since 4.0.0
  28279. * @category Lang
  28280. * @param {*} value The value to compare.
  28281. * @param {*} other The other value to compare.
  28282. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28283. * @example
  28284. *
  28285. * var object = { 'a': 1 };
  28286. * var other = { 'a': 1 };
  28287. *
  28288. * _.eq(object, object);
  28289. * // => true
  28290. *
  28291. * _.eq(object, other);
  28292. * // => false
  28293. *
  28294. * _.eq('a', 'a');
  28295. * // => true
  28296. *
  28297. * _.eq('a', Object('a'));
  28298. * // => false
  28299. *
  28300. * _.eq(NaN, NaN);
  28301. * // => true
  28302. */
  28303. function eq(value, other) {
  28304. return value === other || (value !== value && other !== other);
  28305. }
  28306. /**
  28307. * Checks if `value` is greater than `other`.
  28308. *
  28309. * @static
  28310. * @memberOf _
  28311. * @since 3.9.0
  28312. * @category Lang
  28313. * @param {*} value The value to compare.
  28314. * @param {*} other The other value to compare.
  28315. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28316. * else `false`.
  28317. * @see _.lt
  28318. * @example
  28319. *
  28320. * _.gt(3, 1);
  28321. * // => true
  28322. *
  28323. * _.gt(3, 3);
  28324. * // => false
  28325. *
  28326. * _.gt(1, 3);
  28327. * // => false
  28328. */
  28329. var gt = createRelationalOperation(baseGt);
  28330. /**
  28331. * Checks if `value` is greater than or equal to `other`.
  28332. *
  28333. * @static
  28334. * @memberOf _
  28335. * @since 3.9.0
  28336. * @category Lang
  28337. * @param {*} value The value to compare.
  28338. * @param {*} other The other value to compare.
  28339. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28340. * `other`, else `false`.
  28341. * @see _.lte
  28342. * @example
  28343. *
  28344. * _.gte(3, 1);
  28345. * // => true
  28346. *
  28347. * _.gte(3, 3);
  28348. * // => true
  28349. *
  28350. * _.gte(1, 3);
  28351. * // => false
  28352. */
  28353. var gte = createRelationalOperation(function(value, other) {
  28354. return value >= other;
  28355. });
  28356. /**
  28357. * Checks if `value` is likely an `arguments` object.
  28358. *
  28359. * @static
  28360. * @memberOf _
  28361. * @since 0.1.0
  28362. * @category Lang
  28363. * @param {*} value The value to check.
  28364. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28365. * else `false`.
  28366. * @example
  28367. *
  28368. * _.isArguments(function() { return arguments; }());
  28369. * // => true
  28370. *
  28371. * _.isArguments([1, 2, 3]);
  28372. * // => false
  28373. */
  28374. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28375. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28376. !propertyIsEnumerable.call(value, 'callee');
  28377. };
  28378. /**
  28379. * Checks if `value` is classified as an `Array` object.
  28380. *
  28381. * @static
  28382. * @memberOf _
  28383. * @since 0.1.0
  28384. * @category Lang
  28385. * @param {*} value The value to check.
  28386. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28387. * @example
  28388. *
  28389. * _.isArray([1, 2, 3]);
  28390. * // => true
  28391. *
  28392. * _.isArray(document.body.children);
  28393. * // => false
  28394. *
  28395. * _.isArray('abc');
  28396. * // => false
  28397. *
  28398. * _.isArray(_.noop);
  28399. * // => false
  28400. */
  28401. var isArray = Array.isArray;
  28402. /**
  28403. * Checks if `value` is classified as an `ArrayBuffer` object.
  28404. *
  28405. * @static
  28406. * @memberOf _
  28407. * @since 4.3.0
  28408. * @category Lang
  28409. * @param {*} value The value to check.
  28410. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28411. * @example
  28412. *
  28413. * _.isArrayBuffer(new ArrayBuffer(2));
  28414. * // => true
  28415. *
  28416. * _.isArrayBuffer(new Array(2));
  28417. * // => false
  28418. */
  28419. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28420. /**
  28421. * Checks if `value` is array-like. A value is considered array-like if it's
  28422. * not a function and has a `value.length` that's an integer greater than or
  28423. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28424. *
  28425. * @static
  28426. * @memberOf _
  28427. * @since 4.0.0
  28428. * @category Lang
  28429. * @param {*} value The value to check.
  28430. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28431. * @example
  28432. *
  28433. * _.isArrayLike([1, 2, 3]);
  28434. * // => true
  28435. *
  28436. * _.isArrayLike(document.body.children);
  28437. * // => true
  28438. *
  28439. * _.isArrayLike('abc');
  28440. * // => true
  28441. *
  28442. * _.isArrayLike(_.noop);
  28443. * // => false
  28444. */
  28445. function isArrayLike(value) {
  28446. return value != null && isLength(value.length) && !isFunction(value);
  28447. }
  28448. /**
  28449. * This method is like `_.isArrayLike` except that it also checks if `value`
  28450. * is an object.
  28451. *
  28452. * @static
  28453. * @memberOf _
  28454. * @since 4.0.0
  28455. * @category Lang
  28456. * @param {*} value The value to check.
  28457. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28458. * else `false`.
  28459. * @example
  28460. *
  28461. * _.isArrayLikeObject([1, 2, 3]);
  28462. * // => true
  28463. *
  28464. * _.isArrayLikeObject(document.body.children);
  28465. * // => true
  28466. *
  28467. * _.isArrayLikeObject('abc');
  28468. * // => false
  28469. *
  28470. * _.isArrayLikeObject(_.noop);
  28471. * // => false
  28472. */
  28473. function isArrayLikeObject(value) {
  28474. return isObjectLike(value) && isArrayLike(value);
  28475. }
  28476. /**
  28477. * Checks if `value` is classified as a boolean primitive or object.
  28478. *
  28479. * @static
  28480. * @memberOf _
  28481. * @since 0.1.0
  28482. * @category Lang
  28483. * @param {*} value The value to check.
  28484. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28485. * @example
  28486. *
  28487. * _.isBoolean(false);
  28488. * // => true
  28489. *
  28490. * _.isBoolean(null);
  28491. * // => false
  28492. */
  28493. function isBoolean(value) {
  28494. return value === true || value === false ||
  28495. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28496. }
  28497. /**
  28498. * Checks if `value` is a buffer.
  28499. *
  28500. * @static
  28501. * @memberOf _
  28502. * @since 4.3.0
  28503. * @category Lang
  28504. * @param {*} value The value to check.
  28505. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28506. * @example
  28507. *
  28508. * _.isBuffer(new Buffer(2));
  28509. * // => true
  28510. *
  28511. * _.isBuffer(new Uint8Array(2));
  28512. * // => false
  28513. */
  28514. var isBuffer = nativeIsBuffer || stubFalse;
  28515. /**
  28516. * Checks if `value` is classified as a `Date` object.
  28517. *
  28518. * @static
  28519. * @memberOf _
  28520. * @since 0.1.0
  28521. * @category Lang
  28522. * @param {*} value The value to check.
  28523. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28524. * @example
  28525. *
  28526. * _.isDate(new Date);
  28527. * // => true
  28528. *
  28529. * _.isDate('Mon April 23 2012');
  28530. * // => false
  28531. */
  28532. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28533. /**
  28534. * Checks if `value` is likely a DOM element.
  28535. *
  28536. * @static
  28537. * @memberOf _
  28538. * @since 0.1.0
  28539. * @category Lang
  28540. * @param {*} value The value to check.
  28541. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28542. * @example
  28543. *
  28544. * _.isElement(document.body);
  28545. * // => true
  28546. *
  28547. * _.isElement('<body>');
  28548. * // => false
  28549. */
  28550. function isElement(value) {
  28551. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28552. }
  28553. /**
  28554. * Checks if `value` is an empty object, collection, map, or set.
  28555. *
  28556. * Objects are considered empty if they have no own enumerable string keyed
  28557. * properties.
  28558. *
  28559. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28560. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28561. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28562. *
  28563. * @static
  28564. * @memberOf _
  28565. * @since 0.1.0
  28566. * @category Lang
  28567. * @param {*} value The value to check.
  28568. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28569. * @example
  28570. *
  28571. * _.isEmpty(null);
  28572. * // => true
  28573. *
  28574. * _.isEmpty(true);
  28575. * // => true
  28576. *
  28577. * _.isEmpty(1);
  28578. * // => true
  28579. *
  28580. * _.isEmpty([1, 2, 3]);
  28581. * // => false
  28582. *
  28583. * _.isEmpty({ 'a': 1 });
  28584. * // => false
  28585. */
  28586. function isEmpty(value) {
  28587. if (value == null) {
  28588. return true;
  28589. }
  28590. if (isArrayLike(value) &&
  28591. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28592. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28593. return !value.length;
  28594. }
  28595. var tag = getTag(value);
  28596. if (tag == mapTag || tag == setTag) {
  28597. return !value.size;
  28598. }
  28599. if (isPrototype(value)) {
  28600. return !baseKeys(value).length;
  28601. }
  28602. for (var key in value) {
  28603. if (hasOwnProperty.call(value, key)) {
  28604. return false;
  28605. }
  28606. }
  28607. return true;
  28608. }
  28609. /**
  28610. * Performs a deep comparison between two values to determine if they are
  28611. * equivalent.
  28612. *
  28613. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28614. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28615. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28616. * by their own, not inherited, enumerable properties. Functions and DOM
  28617. * nodes are compared by strict equality, i.e. `===`.
  28618. *
  28619. * @static
  28620. * @memberOf _
  28621. * @since 0.1.0
  28622. * @category Lang
  28623. * @param {*} value The value to compare.
  28624. * @param {*} other The other value to compare.
  28625. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28626. * @example
  28627. *
  28628. * var object = { 'a': 1 };
  28629. * var other = { 'a': 1 };
  28630. *
  28631. * _.isEqual(object, other);
  28632. * // => true
  28633. *
  28634. * object === other;
  28635. * // => false
  28636. */
  28637. function isEqual(value, other) {
  28638. return baseIsEqual(value, other);
  28639. }
  28640. /**
  28641. * This method is like `_.isEqual` except that it accepts `customizer` which
  28642. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28643. * are handled by the method instead. The `customizer` is invoked with up to
  28644. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28645. *
  28646. * @static
  28647. * @memberOf _
  28648. * @since 4.0.0
  28649. * @category Lang
  28650. * @param {*} value The value to compare.
  28651. * @param {*} other The other value to compare.
  28652. * @param {Function} [customizer] The function to customize comparisons.
  28653. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28654. * @example
  28655. *
  28656. * function isGreeting(value) {
  28657. * return /^h(?:i|ello)$/.test(value);
  28658. * }
  28659. *
  28660. * function customizer(objValue, othValue) {
  28661. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28662. * return true;
  28663. * }
  28664. * }
  28665. *
  28666. * var array = ['hello', 'goodbye'];
  28667. * var other = ['hi', 'goodbye'];
  28668. *
  28669. * _.isEqualWith(array, other, customizer);
  28670. * // => true
  28671. */
  28672. function isEqualWith(value, other, customizer) {
  28673. customizer = typeof customizer == 'function' ? customizer : undefined;
  28674. var result = customizer ? customizer(value, other) : undefined;
  28675. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28676. }
  28677. /**
  28678. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28679. * `SyntaxError`, `TypeError`, or `URIError` object.
  28680. *
  28681. * @static
  28682. * @memberOf _
  28683. * @since 3.0.0
  28684. * @category Lang
  28685. * @param {*} value The value to check.
  28686. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28687. * @example
  28688. *
  28689. * _.isError(new Error);
  28690. * // => true
  28691. *
  28692. * _.isError(Error);
  28693. * // => false
  28694. */
  28695. function isError(value) {
  28696. if (!isObjectLike(value)) {
  28697. return false;
  28698. }
  28699. var tag = baseGetTag(value);
  28700. return tag == errorTag || tag == domExcTag ||
  28701. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28702. }
  28703. /**
  28704. * Checks if `value` is a finite primitive number.
  28705. *
  28706. * **Note:** This method is based on
  28707. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28708. *
  28709. * @static
  28710. * @memberOf _
  28711. * @since 0.1.0
  28712. * @category Lang
  28713. * @param {*} value The value to check.
  28714. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28715. * @example
  28716. *
  28717. * _.isFinite(3);
  28718. * // => true
  28719. *
  28720. * _.isFinite(Number.MIN_VALUE);
  28721. * // => true
  28722. *
  28723. * _.isFinite(Infinity);
  28724. * // => false
  28725. *
  28726. * _.isFinite('3');
  28727. * // => false
  28728. */
  28729. function isFinite(value) {
  28730. return typeof value == 'number' && nativeIsFinite(value);
  28731. }
  28732. /**
  28733. * Checks if `value` is classified as a `Function` object.
  28734. *
  28735. * @static
  28736. * @memberOf _
  28737. * @since 0.1.0
  28738. * @category Lang
  28739. * @param {*} value The value to check.
  28740. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28741. * @example
  28742. *
  28743. * _.isFunction(_);
  28744. * // => true
  28745. *
  28746. * _.isFunction(/abc/);
  28747. * // => false
  28748. */
  28749. function isFunction(value) {
  28750. if (!isObject(value)) {
  28751. return false;
  28752. }
  28753. // The use of `Object#toString` avoids issues with the `typeof` operator
  28754. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28755. var tag = baseGetTag(value);
  28756. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28757. }
  28758. /**
  28759. * Checks if `value` is an integer.
  28760. *
  28761. * **Note:** This method is based on
  28762. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28763. *
  28764. * @static
  28765. * @memberOf _
  28766. * @since 4.0.0
  28767. * @category Lang
  28768. * @param {*} value The value to check.
  28769. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28770. * @example
  28771. *
  28772. * _.isInteger(3);
  28773. * // => true
  28774. *
  28775. * _.isInteger(Number.MIN_VALUE);
  28776. * // => false
  28777. *
  28778. * _.isInteger(Infinity);
  28779. * // => false
  28780. *
  28781. * _.isInteger('3');
  28782. * // => false
  28783. */
  28784. function isInteger(value) {
  28785. return typeof value == 'number' && value == toInteger(value);
  28786. }
  28787. /**
  28788. * Checks if `value` is a valid array-like length.
  28789. *
  28790. * **Note:** This method is loosely based on
  28791. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28792. *
  28793. * @static
  28794. * @memberOf _
  28795. * @since 4.0.0
  28796. * @category Lang
  28797. * @param {*} value The value to check.
  28798. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28799. * @example
  28800. *
  28801. * _.isLength(3);
  28802. * // => true
  28803. *
  28804. * _.isLength(Number.MIN_VALUE);
  28805. * // => false
  28806. *
  28807. * _.isLength(Infinity);
  28808. * // => false
  28809. *
  28810. * _.isLength('3');
  28811. * // => false
  28812. */
  28813. function isLength(value) {
  28814. return typeof value == 'number' &&
  28815. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28816. }
  28817. /**
  28818. * Checks if `value` is the
  28819. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28820. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28821. *
  28822. * @static
  28823. * @memberOf _
  28824. * @since 0.1.0
  28825. * @category Lang
  28826. * @param {*} value The value to check.
  28827. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28828. * @example
  28829. *
  28830. * _.isObject({});
  28831. * // => true
  28832. *
  28833. * _.isObject([1, 2, 3]);
  28834. * // => true
  28835. *
  28836. * _.isObject(_.noop);
  28837. * // => true
  28838. *
  28839. * _.isObject(null);
  28840. * // => false
  28841. */
  28842. function isObject(value) {
  28843. var type = typeof value;
  28844. return value != null && (type == 'object' || type == 'function');
  28845. }
  28846. /**
  28847. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28848. * and has a `typeof` result of "object".
  28849. *
  28850. * @static
  28851. * @memberOf _
  28852. * @since 4.0.0
  28853. * @category Lang
  28854. * @param {*} value The value to check.
  28855. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28856. * @example
  28857. *
  28858. * _.isObjectLike({});
  28859. * // => true
  28860. *
  28861. * _.isObjectLike([1, 2, 3]);
  28862. * // => true
  28863. *
  28864. * _.isObjectLike(_.noop);
  28865. * // => false
  28866. *
  28867. * _.isObjectLike(null);
  28868. * // => false
  28869. */
  28870. function isObjectLike(value) {
  28871. return value != null && typeof value == 'object';
  28872. }
  28873. /**
  28874. * Checks if `value` is classified as a `Map` object.
  28875. *
  28876. * @static
  28877. * @memberOf _
  28878. * @since 4.3.0
  28879. * @category Lang
  28880. * @param {*} value The value to check.
  28881. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28882. * @example
  28883. *
  28884. * _.isMap(new Map);
  28885. * // => true
  28886. *
  28887. * _.isMap(new WeakMap);
  28888. * // => false
  28889. */
  28890. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28891. /**
  28892. * Performs a partial deep comparison between `object` and `source` to
  28893. * determine if `object` contains equivalent property values.
  28894. *
  28895. * **Note:** This method is equivalent to `_.matches` when `source` is
  28896. * partially applied.
  28897. *
  28898. * Partial comparisons will match empty array and empty object `source`
  28899. * values against any array or object value, respectively. See `_.isEqual`
  28900. * for a list of supported value comparisons.
  28901. *
  28902. * @static
  28903. * @memberOf _
  28904. * @since 3.0.0
  28905. * @category Lang
  28906. * @param {Object} object The object to inspect.
  28907. * @param {Object} source The object of property values to match.
  28908. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28909. * @example
  28910. *
  28911. * var object = { 'a': 1, 'b': 2 };
  28912. *
  28913. * _.isMatch(object, { 'b': 2 });
  28914. * // => true
  28915. *
  28916. * _.isMatch(object, { 'b': 1 });
  28917. * // => false
  28918. */
  28919. function isMatch(object, source) {
  28920. return object === source || baseIsMatch(object, source, getMatchData(source));
  28921. }
  28922. /**
  28923. * This method is like `_.isMatch` except that it accepts `customizer` which
  28924. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28925. * are handled by the method instead. The `customizer` is invoked with five
  28926. * arguments: (objValue, srcValue, index|key, object, source).
  28927. *
  28928. * @static
  28929. * @memberOf _
  28930. * @since 4.0.0
  28931. * @category Lang
  28932. * @param {Object} object The object to inspect.
  28933. * @param {Object} source The object of property values to match.
  28934. * @param {Function} [customizer] The function to customize comparisons.
  28935. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28936. * @example
  28937. *
  28938. * function isGreeting(value) {
  28939. * return /^h(?:i|ello)$/.test(value);
  28940. * }
  28941. *
  28942. * function customizer(objValue, srcValue) {
  28943. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  28944. * return true;
  28945. * }
  28946. * }
  28947. *
  28948. * var object = { 'greeting': 'hello' };
  28949. * var source = { 'greeting': 'hi' };
  28950. *
  28951. * _.isMatchWith(object, source, customizer);
  28952. * // => true
  28953. */
  28954. function isMatchWith(object, source, customizer) {
  28955. customizer = typeof customizer == 'function' ? customizer : undefined;
  28956. return baseIsMatch(object, source, getMatchData(source), customizer);
  28957. }
  28958. /**
  28959. * Checks if `value` is `NaN`.
  28960. *
  28961. * **Note:** This method is based on
  28962. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  28963. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  28964. * `undefined` and other non-number values.
  28965. *
  28966. * @static
  28967. * @memberOf _
  28968. * @since 0.1.0
  28969. * @category Lang
  28970. * @param {*} value The value to check.
  28971. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  28972. * @example
  28973. *
  28974. * _.isNaN(NaN);
  28975. * // => true
  28976. *
  28977. * _.isNaN(new Number(NaN));
  28978. * // => true
  28979. *
  28980. * isNaN(undefined);
  28981. * // => true
  28982. *
  28983. * _.isNaN(undefined);
  28984. * // => false
  28985. */
  28986. function isNaN(value) {
  28987. // An `NaN` primitive is the only value that is not equal to itself.
  28988. // Perform the `toStringTag` check first to avoid errors with some
  28989. // ActiveX objects in IE.
  28990. return isNumber(value) && value != +value;
  28991. }
  28992. /**
  28993. * Checks if `value` is a pristine native function.
  28994. *
  28995. * **Note:** This method can't reliably detect native functions in the presence
  28996. * of the core-js package because core-js circumvents this kind of detection.
  28997. * Despite multiple requests, the core-js maintainer has made it clear: any
  28998. * attempt to fix the detection will be obstructed. As a result, we're left
  28999. * with little choice but to throw an error. Unfortunately, this also affects
  29000. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29001. * which rely on core-js.
  29002. *
  29003. * @static
  29004. * @memberOf _
  29005. * @since 3.0.0
  29006. * @category Lang
  29007. * @param {*} value The value to check.
  29008. * @returns {boolean} Returns `true` if `value` is a native function,
  29009. * else `false`.
  29010. * @example
  29011. *
  29012. * _.isNative(Array.prototype.push);
  29013. * // => true
  29014. *
  29015. * _.isNative(_);
  29016. * // => false
  29017. */
  29018. function isNative(value) {
  29019. if (isMaskable(value)) {
  29020. throw new Error(CORE_ERROR_TEXT);
  29021. }
  29022. return baseIsNative(value);
  29023. }
  29024. /**
  29025. * Checks if `value` is `null`.
  29026. *
  29027. * @static
  29028. * @memberOf _
  29029. * @since 0.1.0
  29030. * @category Lang
  29031. * @param {*} value The value to check.
  29032. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29033. * @example
  29034. *
  29035. * _.isNull(null);
  29036. * // => true
  29037. *
  29038. * _.isNull(void 0);
  29039. * // => false
  29040. */
  29041. function isNull(value) {
  29042. return value === null;
  29043. }
  29044. /**
  29045. * Checks if `value` is `null` or `undefined`.
  29046. *
  29047. * @static
  29048. * @memberOf _
  29049. * @since 4.0.0
  29050. * @category Lang
  29051. * @param {*} value The value to check.
  29052. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29053. * @example
  29054. *
  29055. * _.isNil(null);
  29056. * // => true
  29057. *
  29058. * _.isNil(void 0);
  29059. * // => true
  29060. *
  29061. * _.isNil(NaN);
  29062. * // => false
  29063. */
  29064. function isNil(value) {
  29065. return value == null;
  29066. }
  29067. /**
  29068. * Checks if `value` is classified as a `Number` primitive or object.
  29069. *
  29070. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29071. * classified as numbers, use the `_.isFinite` method.
  29072. *
  29073. * @static
  29074. * @memberOf _
  29075. * @since 0.1.0
  29076. * @category Lang
  29077. * @param {*} value The value to check.
  29078. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29079. * @example
  29080. *
  29081. * _.isNumber(3);
  29082. * // => true
  29083. *
  29084. * _.isNumber(Number.MIN_VALUE);
  29085. * // => true
  29086. *
  29087. * _.isNumber(Infinity);
  29088. * // => true
  29089. *
  29090. * _.isNumber('3');
  29091. * // => false
  29092. */
  29093. function isNumber(value) {
  29094. return typeof value == 'number' ||
  29095. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29096. }
  29097. /**
  29098. * Checks if `value` is a plain object, that is, an object created by the
  29099. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29100. *
  29101. * @static
  29102. * @memberOf _
  29103. * @since 0.8.0
  29104. * @category Lang
  29105. * @param {*} value The value to check.
  29106. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29107. * @example
  29108. *
  29109. * function Foo() {
  29110. * this.a = 1;
  29111. * }
  29112. *
  29113. * _.isPlainObject(new Foo);
  29114. * // => false
  29115. *
  29116. * _.isPlainObject([1, 2, 3]);
  29117. * // => false
  29118. *
  29119. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29120. * // => true
  29121. *
  29122. * _.isPlainObject(Object.create(null));
  29123. * // => true
  29124. */
  29125. function isPlainObject(value) {
  29126. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29127. return false;
  29128. }
  29129. var proto = getPrototype(value);
  29130. if (proto === null) {
  29131. return true;
  29132. }
  29133. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29134. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29135. funcToString.call(Ctor) == objectCtorString;
  29136. }
  29137. /**
  29138. * Checks if `value` is classified as a `RegExp` object.
  29139. *
  29140. * @static
  29141. * @memberOf _
  29142. * @since 0.1.0
  29143. * @category Lang
  29144. * @param {*} value The value to check.
  29145. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29146. * @example
  29147. *
  29148. * _.isRegExp(/abc/);
  29149. * // => true
  29150. *
  29151. * _.isRegExp('/abc/');
  29152. * // => false
  29153. */
  29154. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29155. /**
  29156. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29157. * double precision number which isn't the result of a rounded unsafe integer.
  29158. *
  29159. * **Note:** This method is based on
  29160. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29161. *
  29162. * @static
  29163. * @memberOf _
  29164. * @since 4.0.0
  29165. * @category Lang
  29166. * @param {*} value The value to check.
  29167. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29168. * @example
  29169. *
  29170. * _.isSafeInteger(3);
  29171. * // => true
  29172. *
  29173. * _.isSafeInteger(Number.MIN_VALUE);
  29174. * // => false
  29175. *
  29176. * _.isSafeInteger(Infinity);
  29177. * // => false
  29178. *
  29179. * _.isSafeInteger('3');
  29180. * // => false
  29181. */
  29182. function isSafeInteger(value) {
  29183. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29184. }
  29185. /**
  29186. * Checks if `value` is classified as a `Set` object.
  29187. *
  29188. * @static
  29189. * @memberOf _
  29190. * @since 4.3.0
  29191. * @category Lang
  29192. * @param {*} value The value to check.
  29193. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29194. * @example
  29195. *
  29196. * _.isSet(new Set);
  29197. * // => true
  29198. *
  29199. * _.isSet(new WeakSet);
  29200. * // => false
  29201. */
  29202. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29203. /**
  29204. * Checks if `value` is classified as a `String` primitive or object.
  29205. *
  29206. * @static
  29207. * @since 0.1.0
  29208. * @memberOf _
  29209. * @category Lang
  29210. * @param {*} value The value to check.
  29211. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29212. * @example
  29213. *
  29214. * _.isString('abc');
  29215. * // => true
  29216. *
  29217. * _.isString(1);
  29218. * // => false
  29219. */
  29220. function isString(value) {
  29221. return typeof value == 'string' ||
  29222. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29223. }
  29224. /**
  29225. * Checks if `value` is classified as a `Symbol` primitive or object.
  29226. *
  29227. * @static
  29228. * @memberOf _
  29229. * @since 4.0.0
  29230. * @category Lang
  29231. * @param {*} value The value to check.
  29232. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29233. * @example
  29234. *
  29235. * _.isSymbol(Symbol.iterator);
  29236. * // => true
  29237. *
  29238. * _.isSymbol('abc');
  29239. * // => false
  29240. */
  29241. function isSymbol(value) {
  29242. return typeof value == 'symbol' ||
  29243. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29244. }
  29245. /**
  29246. * Checks if `value` is classified as a typed array.
  29247. *
  29248. * @static
  29249. * @memberOf _
  29250. * @since 3.0.0
  29251. * @category Lang
  29252. * @param {*} value The value to check.
  29253. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29254. * @example
  29255. *
  29256. * _.isTypedArray(new Uint8Array);
  29257. * // => true
  29258. *
  29259. * _.isTypedArray([]);
  29260. * // => false
  29261. */
  29262. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29263. /**
  29264. * Checks if `value` is `undefined`.
  29265. *
  29266. * @static
  29267. * @since 0.1.0
  29268. * @memberOf _
  29269. * @category Lang
  29270. * @param {*} value The value to check.
  29271. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29272. * @example
  29273. *
  29274. * _.isUndefined(void 0);
  29275. * // => true
  29276. *
  29277. * _.isUndefined(null);
  29278. * // => false
  29279. */
  29280. function isUndefined(value) {
  29281. return value === undefined;
  29282. }
  29283. /**
  29284. * Checks if `value` is classified as a `WeakMap` object.
  29285. *
  29286. * @static
  29287. * @memberOf _
  29288. * @since 4.3.0
  29289. * @category Lang
  29290. * @param {*} value The value to check.
  29291. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29292. * @example
  29293. *
  29294. * _.isWeakMap(new WeakMap);
  29295. * // => true
  29296. *
  29297. * _.isWeakMap(new Map);
  29298. * // => false
  29299. */
  29300. function isWeakMap(value) {
  29301. return isObjectLike(value) && getTag(value) == weakMapTag;
  29302. }
  29303. /**
  29304. * Checks if `value` is classified as a `WeakSet` object.
  29305. *
  29306. * @static
  29307. * @memberOf _
  29308. * @since 4.3.0
  29309. * @category Lang
  29310. * @param {*} value The value to check.
  29311. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29312. * @example
  29313. *
  29314. * _.isWeakSet(new WeakSet);
  29315. * // => true
  29316. *
  29317. * _.isWeakSet(new Set);
  29318. * // => false
  29319. */
  29320. function isWeakSet(value) {
  29321. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29322. }
  29323. /**
  29324. * Checks if `value` is less than `other`.
  29325. *
  29326. * @static
  29327. * @memberOf _
  29328. * @since 3.9.0
  29329. * @category Lang
  29330. * @param {*} value The value to compare.
  29331. * @param {*} other The other value to compare.
  29332. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29333. * else `false`.
  29334. * @see _.gt
  29335. * @example
  29336. *
  29337. * _.lt(1, 3);
  29338. * // => true
  29339. *
  29340. * _.lt(3, 3);
  29341. * // => false
  29342. *
  29343. * _.lt(3, 1);
  29344. * // => false
  29345. */
  29346. var lt = createRelationalOperation(baseLt);
  29347. /**
  29348. * Checks if `value` is less than or equal to `other`.
  29349. *
  29350. * @static
  29351. * @memberOf _
  29352. * @since 3.9.0
  29353. * @category Lang
  29354. * @param {*} value The value to compare.
  29355. * @param {*} other The other value to compare.
  29356. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29357. * `other`, else `false`.
  29358. * @see _.gte
  29359. * @example
  29360. *
  29361. * _.lte(1, 3);
  29362. * // => true
  29363. *
  29364. * _.lte(3, 3);
  29365. * // => true
  29366. *
  29367. * _.lte(3, 1);
  29368. * // => false
  29369. */
  29370. var lte = createRelationalOperation(function(value, other) {
  29371. return value <= other;
  29372. });
  29373. /**
  29374. * Converts `value` to an array.
  29375. *
  29376. * @static
  29377. * @since 0.1.0
  29378. * @memberOf _
  29379. * @category Lang
  29380. * @param {*} value The value to convert.
  29381. * @returns {Array} Returns the converted array.
  29382. * @example
  29383. *
  29384. * _.toArray({ 'a': 1, 'b': 2 });
  29385. * // => [1, 2]
  29386. *
  29387. * _.toArray('abc');
  29388. * // => ['a', 'b', 'c']
  29389. *
  29390. * _.toArray(1);
  29391. * // => []
  29392. *
  29393. * _.toArray(null);
  29394. * // => []
  29395. */
  29396. function toArray(value) {
  29397. if (!value) {
  29398. return [];
  29399. }
  29400. if (isArrayLike(value)) {
  29401. return isString(value) ? stringToArray(value) : copyArray(value);
  29402. }
  29403. if (symIterator && value[symIterator]) {
  29404. return iteratorToArray(value[symIterator]());
  29405. }
  29406. var tag = getTag(value),
  29407. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29408. return func(value);
  29409. }
  29410. /**
  29411. * Converts `value` to a finite number.
  29412. *
  29413. * @static
  29414. * @memberOf _
  29415. * @since 4.12.0
  29416. * @category Lang
  29417. * @param {*} value The value to convert.
  29418. * @returns {number} Returns the converted number.
  29419. * @example
  29420. *
  29421. * _.toFinite(3.2);
  29422. * // => 3.2
  29423. *
  29424. * _.toFinite(Number.MIN_VALUE);
  29425. * // => 5e-324
  29426. *
  29427. * _.toFinite(Infinity);
  29428. * // => 1.7976931348623157e+308
  29429. *
  29430. * _.toFinite('3.2');
  29431. * // => 3.2
  29432. */
  29433. function toFinite(value) {
  29434. if (!value) {
  29435. return value === 0 ? value : 0;
  29436. }
  29437. value = toNumber(value);
  29438. if (value === INFINITY || value === -INFINITY) {
  29439. var sign = (value < 0 ? -1 : 1);
  29440. return sign * MAX_INTEGER;
  29441. }
  29442. return value === value ? value : 0;
  29443. }
  29444. /**
  29445. * Converts `value` to an integer.
  29446. *
  29447. * **Note:** This method is loosely based on
  29448. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29449. *
  29450. * @static
  29451. * @memberOf _
  29452. * @since 4.0.0
  29453. * @category Lang
  29454. * @param {*} value The value to convert.
  29455. * @returns {number} Returns the converted integer.
  29456. * @example
  29457. *
  29458. * _.toInteger(3.2);
  29459. * // => 3
  29460. *
  29461. * _.toInteger(Number.MIN_VALUE);
  29462. * // => 0
  29463. *
  29464. * _.toInteger(Infinity);
  29465. * // => 1.7976931348623157e+308
  29466. *
  29467. * _.toInteger('3.2');
  29468. * // => 3
  29469. */
  29470. function toInteger(value) {
  29471. var result = toFinite(value),
  29472. remainder = result % 1;
  29473. return result === result ? (remainder ? result - remainder : result) : 0;
  29474. }
  29475. /**
  29476. * Converts `value` to an integer suitable for use as the length of an
  29477. * array-like object.
  29478. *
  29479. * **Note:** This method is based on
  29480. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29481. *
  29482. * @static
  29483. * @memberOf _
  29484. * @since 4.0.0
  29485. * @category Lang
  29486. * @param {*} value The value to convert.
  29487. * @returns {number} Returns the converted integer.
  29488. * @example
  29489. *
  29490. * _.toLength(3.2);
  29491. * // => 3
  29492. *
  29493. * _.toLength(Number.MIN_VALUE);
  29494. * // => 0
  29495. *
  29496. * _.toLength(Infinity);
  29497. * // => 4294967295
  29498. *
  29499. * _.toLength('3.2');
  29500. * // => 3
  29501. */
  29502. function toLength(value) {
  29503. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29504. }
  29505. /**
  29506. * Converts `value` to a number.
  29507. *
  29508. * @static
  29509. * @memberOf _
  29510. * @since 4.0.0
  29511. * @category Lang
  29512. * @param {*} value The value to process.
  29513. * @returns {number} Returns the number.
  29514. * @example
  29515. *
  29516. * _.toNumber(3.2);
  29517. * // => 3.2
  29518. *
  29519. * _.toNumber(Number.MIN_VALUE);
  29520. * // => 5e-324
  29521. *
  29522. * _.toNumber(Infinity);
  29523. * // => Infinity
  29524. *
  29525. * _.toNumber('3.2');
  29526. * // => 3.2
  29527. */
  29528. function toNumber(value) {
  29529. if (typeof value == 'number') {
  29530. return value;
  29531. }
  29532. if (isSymbol(value)) {
  29533. return NAN;
  29534. }
  29535. if (isObject(value)) {
  29536. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29537. value = isObject(other) ? (other + '') : other;
  29538. }
  29539. if (typeof value != 'string') {
  29540. return value === 0 ? value : +value;
  29541. }
  29542. value = value.replace(reTrim, '');
  29543. var isBinary = reIsBinary.test(value);
  29544. return (isBinary || reIsOctal.test(value))
  29545. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29546. : (reIsBadHex.test(value) ? NAN : +value);
  29547. }
  29548. /**
  29549. * Converts `value` to a plain object flattening inherited enumerable string
  29550. * keyed properties of `value` to own properties of the plain object.
  29551. *
  29552. * @static
  29553. * @memberOf _
  29554. * @since 3.0.0
  29555. * @category Lang
  29556. * @param {*} value The value to convert.
  29557. * @returns {Object} Returns the converted plain object.
  29558. * @example
  29559. *
  29560. * function Foo() {
  29561. * this.b = 2;
  29562. * }
  29563. *
  29564. * Foo.prototype.c = 3;
  29565. *
  29566. * _.assign({ 'a': 1 }, new Foo);
  29567. * // => { 'a': 1, 'b': 2 }
  29568. *
  29569. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29570. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29571. */
  29572. function toPlainObject(value) {
  29573. return copyObject(value, keysIn(value));
  29574. }
  29575. /**
  29576. * Converts `value` to a safe integer. A safe integer can be compared and
  29577. * represented correctly.
  29578. *
  29579. * @static
  29580. * @memberOf _
  29581. * @since 4.0.0
  29582. * @category Lang
  29583. * @param {*} value The value to convert.
  29584. * @returns {number} Returns the converted integer.
  29585. * @example
  29586. *
  29587. * _.toSafeInteger(3.2);
  29588. * // => 3
  29589. *
  29590. * _.toSafeInteger(Number.MIN_VALUE);
  29591. * // => 0
  29592. *
  29593. * _.toSafeInteger(Infinity);
  29594. * // => 9007199254740991
  29595. *
  29596. * _.toSafeInteger('3.2');
  29597. * // => 3
  29598. */
  29599. function toSafeInteger(value) {
  29600. return value
  29601. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29602. : (value === 0 ? value : 0);
  29603. }
  29604. /**
  29605. * Converts `value` to a string. An empty string is returned for `null`
  29606. * and `undefined` values. The sign of `-0` is preserved.
  29607. *
  29608. * @static
  29609. * @memberOf _
  29610. * @since 4.0.0
  29611. * @category Lang
  29612. * @param {*} value The value to convert.
  29613. * @returns {string} Returns the converted string.
  29614. * @example
  29615. *
  29616. * _.toString(null);
  29617. * // => ''
  29618. *
  29619. * _.toString(-0);
  29620. * // => '-0'
  29621. *
  29622. * _.toString([1, 2, 3]);
  29623. * // => '1,2,3'
  29624. */
  29625. function toString(value) {
  29626. return value == null ? '' : baseToString(value);
  29627. }
  29628. /*------------------------------------------------------------------------*/
  29629. /**
  29630. * Assigns own enumerable string keyed properties of source objects to the
  29631. * destination object. Source objects are applied from left to right.
  29632. * Subsequent sources overwrite property assignments of previous sources.
  29633. *
  29634. * **Note:** This method mutates `object` and is loosely based on
  29635. * [`Object.assign`](https://mdn.io/Object/assign).
  29636. *
  29637. * @static
  29638. * @memberOf _
  29639. * @since 0.10.0
  29640. * @category Object
  29641. * @param {Object} object The destination object.
  29642. * @param {...Object} [sources] The source objects.
  29643. * @returns {Object} Returns `object`.
  29644. * @see _.assignIn
  29645. * @example
  29646. *
  29647. * function Foo() {
  29648. * this.a = 1;
  29649. * }
  29650. *
  29651. * function Bar() {
  29652. * this.c = 3;
  29653. * }
  29654. *
  29655. * Foo.prototype.b = 2;
  29656. * Bar.prototype.d = 4;
  29657. *
  29658. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29659. * // => { 'a': 1, 'c': 3 }
  29660. */
  29661. var assign = createAssigner(function(object, source) {
  29662. if (isPrototype(source) || isArrayLike(source)) {
  29663. copyObject(source, keys(source), object);
  29664. return;
  29665. }
  29666. for (var key in source) {
  29667. if (hasOwnProperty.call(source, key)) {
  29668. assignValue(object, key, source[key]);
  29669. }
  29670. }
  29671. });
  29672. /**
  29673. * This method is like `_.assign` except that it iterates over own and
  29674. * inherited source properties.
  29675. *
  29676. * **Note:** This method mutates `object`.
  29677. *
  29678. * @static
  29679. * @memberOf _
  29680. * @since 4.0.0
  29681. * @alias extend
  29682. * @category Object
  29683. * @param {Object} object The destination object.
  29684. * @param {...Object} [sources] The source objects.
  29685. * @returns {Object} Returns `object`.
  29686. * @see _.assign
  29687. * @example
  29688. *
  29689. * function Foo() {
  29690. * this.a = 1;
  29691. * }
  29692. *
  29693. * function Bar() {
  29694. * this.c = 3;
  29695. * }
  29696. *
  29697. * Foo.prototype.b = 2;
  29698. * Bar.prototype.d = 4;
  29699. *
  29700. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29701. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29702. */
  29703. var assignIn = createAssigner(function(object, source) {
  29704. copyObject(source, keysIn(source), object);
  29705. });
  29706. /**
  29707. * This method is like `_.assignIn` except that it accepts `customizer`
  29708. * which is invoked to produce the assigned values. If `customizer` returns
  29709. * `undefined`, assignment is handled by the method instead. The `customizer`
  29710. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29711. *
  29712. * **Note:** This method mutates `object`.
  29713. *
  29714. * @static
  29715. * @memberOf _
  29716. * @since 4.0.0
  29717. * @alias extendWith
  29718. * @category Object
  29719. * @param {Object} object The destination object.
  29720. * @param {...Object} sources The source objects.
  29721. * @param {Function} [customizer] The function to customize assigned values.
  29722. * @returns {Object} Returns `object`.
  29723. * @see _.assignWith
  29724. * @example
  29725. *
  29726. * function customizer(objValue, srcValue) {
  29727. * return _.isUndefined(objValue) ? srcValue : objValue;
  29728. * }
  29729. *
  29730. * var defaults = _.partialRight(_.assignInWith, customizer);
  29731. *
  29732. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29733. * // => { 'a': 1, 'b': 2 }
  29734. */
  29735. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29736. copyObject(source, keysIn(source), object, customizer);
  29737. });
  29738. /**
  29739. * This method is like `_.assign` except that it accepts `customizer`
  29740. * which is invoked to produce the assigned values. If `customizer` returns
  29741. * `undefined`, assignment is handled by the method instead. The `customizer`
  29742. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29743. *
  29744. * **Note:** This method mutates `object`.
  29745. *
  29746. * @static
  29747. * @memberOf _
  29748. * @since 4.0.0
  29749. * @category Object
  29750. * @param {Object} object The destination object.
  29751. * @param {...Object} sources The source objects.
  29752. * @param {Function} [customizer] The function to customize assigned values.
  29753. * @returns {Object} Returns `object`.
  29754. * @see _.assignInWith
  29755. * @example
  29756. *
  29757. * function customizer(objValue, srcValue) {
  29758. * return _.isUndefined(objValue) ? srcValue : objValue;
  29759. * }
  29760. *
  29761. * var defaults = _.partialRight(_.assignWith, customizer);
  29762. *
  29763. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29764. * // => { 'a': 1, 'b': 2 }
  29765. */
  29766. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29767. copyObject(source, keys(source), object, customizer);
  29768. });
  29769. /**
  29770. * Creates an array of values corresponding to `paths` of `object`.
  29771. *
  29772. * @static
  29773. * @memberOf _
  29774. * @since 1.0.0
  29775. * @category Object
  29776. * @param {Object} object The object to iterate over.
  29777. * @param {...(string|string[])} [paths] The property paths to pick.
  29778. * @returns {Array} Returns the picked values.
  29779. * @example
  29780. *
  29781. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29782. *
  29783. * _.at(object, ['a[0].b.c', 'a[1]']);
  29784. * // => [3, 4]
  29785. */
  29786. var at = flatRest(baseAt);
  29787. /**
  29788. * Creates an object that inherits from the `prototype` object. If a
  29789. * `properties` object is given, its own enumerable string keyed properties
  29790. * are assigned to the created object.
  29791. *
  29792. * @static
  29793. * @memberOf _
  29794. * @since 2.3.0
  29795. * @category Object
  29796. * @param {Object} prototype The object to inherit from.
  29797. * @param {Object} [properties] The properties to assign to the object.
  29798. * @returns {Object} Returns the new object.
  29799. * @example
  29800. *
  29801. * function Shape() {
  29802. * this.x = 0;
  29803. * this.y = 0;
  29804. * }
  29805. *
  29806. * function Circle() {
  29807. * Shape.call(this);
  29808. * }
  29809. *
  29810. * Circle.prototype = _.create(Shape.prototype, {
  29811. * 'constructor': Circle
  29812. * });
  29813. *
  29814. * var circle = new Circle;
  29815. * circle instanceof Circle;
  29816. * // => true
  29817. *
  29818. * circle instanceof Shape;
  29819. * // => true
  29820. */
  29821. function create(prototype, properties) {
  29822. var result = baseCreate(prototype);
  29823. return properties == null ? result : baseAssign(result, properties);
  29824. }
  29825. /**
  29826. * Assigns own and inherited enumerable string keyed properties of source
  29827. * objects to the destination object for all destination properties that
  29828. * resolve to `undefined`. Source objects are applied from left to right.
  29829. * Once a property is set, additional values of the same property are ignored.
  29830. *
  29831. * **Note:** This method mutates `object`.
  29832. *
  29833. * @static
  29834. * @since 0.1.0
  29835. * @memberOf _
  29836. * @category Object
  29837. * @param {Object} object The destination object.
  29838. * @param {...Object} [sources] The source objects.
  29839. * @returns {Object} Returns `object`.
  29840. * @see _.defaultsDeep
  29841. * @example
  29842. *
  29843. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29844. * // => { 'a': 1, 'b': 2 }
  29845. */
  29846. var defaults = baseRest(function(object, sources) {
  29847. object = Object(object);
  29848. var index = -1;
  29849. var length = sources.length;
  29850. var guard = length > 2 ? sources[2] : undefined;
  29851. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29852. length = 1;
  29853. }
  29854. while (++index < length) {
  29855. var source = sources[index];
  29856. var props = keysIn(source);
  29857. var propsIndex = -1;
  29858. var propsLength = props.length;
  29859. while (++propsIndex < propsLength) {
  29860. var key = props[propsIndex];
  29861. var value = object[key];
  29862. if (value === undefined ||
  29863. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29864. object[key] = source[key];
  29865. }
  29866. }
  29867. }
  29868. return object;
  29869. });
  29870. /**
  29871. * This method is like `_.defaults` except that it recursively assigns
  29872. * default properties.
  29873. *
  29874. * **Note:** This method mutates `object`.
  29875. *
  29876. * @static
  29877. * @memberOf _
  29878. * @since 3.10.0
  29879. * @category Object
  29880. * @param {Object} object The destination object.
  29881. * @param {...Object} [sources] The source objects.
  29882. * @returns {Object} Returns `object`.
  29883. * @see _.defaults
  29884. * @example
  29885. *
  29886. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29887. * // => { 'a': { 'b': 2, 'c': 3 } }
  29888. */
  29889. var defaultsDeep = baseRest(function(args) {
  29890. args.push(undefined, customDefaultsMerge);
  29891. return apply(mergeWith, undefined, args);
  29892. });
  29893. /**
  29894. * This method is like `_.find` except that it returns the key of the first
  29895. * element `predicate` returns truthy for instead of the element itself.
  29896. *
  29897. * @static
  29898. * @memberOf _
  29899. * @since 1.1.0
  29900. * @category Object
  29901. * @param {Object} object The object to inspect.
  29902. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29903. * @returns {string|undefined} Returns the key of the matched element,
  29904. * else `undefined`.
  29905. * @example
  29906. *
  29907. * var users = {
  29908. * 'barney': { 'age': 36, 'active': true },
  29909. * 'fred': { 'age': 40, 'active': false },
  29910. * 'pebbles': { 'age': 1, 'active': true }
  29911. * };
  29912. *
  29913. * _.findKey(users, function(o) { return o.age < 40; });
  29914. * // => 'barney' (iteration order is not guaranteed)
  29915. *
  29916. * // The `_.matches` iteratee shorthand.
  29917. * _.findKey(users, { 'age': 1, 'active': true });
  29918. * // => 'pebbles'
  29919. *
  29920. * // The `_.matchesProperty` iteratee shorthand.
  29921. * _.findKey(users, ['active', false]);
  29922. * // => 'fred'
  29923. *
  29924. * // The `_.property` iteratee shorthand.
  29925. * _.findKey(users, 'active');
  29926. * // => 'barney'
  29927. */
  29928. function findKey(object, predicate) {
  29929. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  29930. }
  29931. /**
  29932. * This method is like `_.findKey` except that it iterates over elements of
  29933. * a collection in the opposite order.
  29934. *
  29935. * @static
  29936. * @memberOf _
  29937. * @since 2.0.0
  29938. * @category Object
  29939. * @param {Object} object The object to inspect.
  29940. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29941. * @returns {string|undefined} Returns the key of the matched element,
  29942. * else `undefined`.
  29943. * @example
  29944. *
  29945. * var users = {
  29946. * 'barney': { 'age': 36, 'active': true },
  29947. * 'fred': { 'age': 40, 'active': false },
  29948. * 'pebbles': { 'age': 1, 'active': true }
  29949. * };
  29950. *
  29951. * _.findLastKey(users, function(o) { return o.age < 40; });
  29952. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  29953. *
  29954. * // The `_.matches` iteratee shorthand.
  29955. * _.findLastKey(users, { 'age': 36, 'active': true });
  29956. * // => 'barney'
  29957. *
  29958. * // The `_.matchesProperty` iteratee shorthand.
  29959. * _.findLastKey(users, ['active', false]);
  29960. * // => 'fred'
  29961. *
  29962. * // The `_.property` iteratee shorthand.
  29963. * _.findLastKey(users, 'active');
  29964. * // => 'pebbles'
  29965. */
  29966. function findLastKey(object, predicate) {
  29967. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  29968. }
  29969. /**
  29970. * Iterates over own and inherited enumerable string keyed properties of an
  29971. * object and invokes `iteratee` for each property. The iteratee is invoked
  29972. * with three arguments: (value, key, object). Iteratee functions may exit
  29973. * iteration early by explicitly returning `false`.
  29974. *
  29975. * @static
  29976. * @memberOf _
  29977. * @since 0.3.0
  29978. * @category Object
  29979. * @param {Object} object The object to iterate over.
  29980. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29981. * @returns {Object} Returns `object`.
  29982. * @see _.forInRight
  29983. * @example
  29984. *
  29985. * function Foo() {
  29986. * this.a = 1;
  29987. * this.b = 2;
  29988. * }
  29989. *
  29990. * Foo.prototype.c = 3;
  29991. *
  29992. * _.forIn(new Foo, function(value, key) {
  29993. * console.log(key);
  29994. * });
  29995. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  29996. */
  29997. function forIn(object, iteratee) {
  29998. return object == null
  29999. ? object
  30000. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30001. }
  30002. /**
  30003. * This method is like `_.forIn` except that it iterates over properties of
  30004. * `object` in the opposite order.
  30005. *
  30006. * @static
  30007. * @memberOf _
  30008. * @since 2.0.0
  30009. * @category Object
  30010. * @param {Object} object The object to iterate over.
  30011. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30012. * @returns {Object} Returns `object`.
  30013. * @see _.forIn
  30014. * @example
  30015. *
  30016. * function Foo() {
  30017. * this.a = 1;
  30018. * this.b = 2;
  30019. * }
  30020. *
  30021. * Foo.prototype.c = 3;
  30022. *
  30023. * _.forInRight(new Foo, function(value, key) {
  30024. * console.log(key);
  30025. * });
  30026. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30027. */
  30028. function forInRight(object, iteratee) {
  30029. return object == null
  30030. ? object
  30031. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30032. }
  30033. /**
  30034. * Iterates over own enumerable string keyed properties of an object and
  30035. * invokes `iteratee` for each property. The iteratee is invoked with three
  30036. * arguments: (value, key, object). Iteratee functions may exit iteration
  30037. * early by explicitly returning `false`.
  30038. *
  30039. * @static
  30040. * @memberOf _
  30041. * @since 0.3.0
  30042. * @category Object
  30043. * @param {Object} object The object to iterate over.
  30044. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30045. * @returns {Object} Returns `object`.
  30046. * @see _.forOwnRight
  30047. * @example
  30048. *
  30049. * function Foo() {
  30050. * this.a = 1;
  30051. * this.b = 2;
  30052. * }
  30053. *
  30054. * Foo.prototype.c = 3;
  30055. *
  30056. * _.forOwn(new Foo, function(value, key) {
  30057. * console.log(key);
  30058. * });
  30059. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30060. */
  30061. function forOwn(object, iteratee) {
  30062. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30063. }
  30064. /**
  30065. * This method is like `_.forOwn` except that it iterates over properties of
  30066. * `object` in the opposite order.
  30067. *
  30068. * @static
  30069. * @memberOf _
  30070. * @since 2.0.0
  30071. * @category Object
  30072. * @param {Object} object The object to iterate over.
  30073. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30074. * @returns {Object} Returns `object`.
  30075. * @see _.forOwn
  30076. * @example
  30077. *
  30078. * function Foo() {
  30079. * this.a = 1;
  30080. * this.b = 2;
  30081. * }
  30082. *
  30083. * Foo.prototype.c = 3;
  30084. *
  30085. * _.forOwnRight(new Foo, function(value, key) {
  30086. * console.log(key);
  30087. * });
  30088. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30089. */
  30090. function forOwnRight(object, iteratee) {
  30091. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30092. }
  30093. /**
  30094. * Creates an array of function property names from own enumerable properties
  30095. * of `object`.
  30096. *
  30097. * @static
  30098. * @since 0.1.0
  30099. * @memberOf _
  30100. * @category Object
  30101. * @param {Object} object The object to inspect.
  30102. * @returns {Array} Returns the function names.
  30103. * @see _.functionsIn
  30104. * @example
  30105. *
  30106. * function Foo() {
  30107. * this.a = _.constant('a');
  30108. * this.b = _.constant('b');
  30109. * }
  30110. *
  30111. * Foo.prototype.c = _.constant('c');
  30112. *
  30113. * _.functions(new Foo);
  30114. * // => ['a', 'b']
  30115. */
  30116. function functions(object) {
  30117. return object == null ? [] : baseFunctions(object, keys(object));
  30118. }
  30119. /**
  30120. * Creates an array of function property names from own and inherited
  30121. * enumerable properties of `object`.
  30122. *
  30123. * @static
  30124. * @memberOf _
  30125. * @since 4.0.0
  30126. * @category Object
  30127. * @param {Object} object The object to inspect.
  30128. * @returns {Array} Returns the function names.
  30129. * @see _.functions
  30130. * @example
  30131. *
  30132. * function Foo() {
  30133. * this.a = _.constant('a');
  30134. * this.b = _.constant('b');
  30135. * }
  30136. *
  30137. * Foo.prototype.c = _.constant('c');
  30138. *
  30139. * _.functionsIn(new Foo);
  30140. * // => ['a', 'b', 'c']
  30141. */
  30142. function functionsIn(object) {
  30143. return object == null ? [] : baseFunctions(object, keysIn(object));
  30144. }
  30145. /**
  30146. * Gets the value at `path` of `object`. If the resolved value is
  30147. * `undefined`, the `defaultValue` is returned in its place.
  30148. *
  30149. * @static
  30150. * @memberOf _
  30151. * @since 3.7.0
  30152. * @category Object
  30153. * @param {Object} object The object to query.
  30154. * @param {Array|string} path The path of the property to get.
  30155. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30156. * @returns {*} Returns the resolved value.
  30157. * @example
  30158. *
  30159. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30160. *
  30161. * _.get(object, 'a[0].b.c');
  30162. * // => 3
  30163. *
  30164. * _.get(object, ['a', '0', 'b', 'c']);
  30165. * // => 3
  30166. *
  30167. * _.get(object, 'a.b.c', 'default');
  30168. * // => 'default'
  30169. */
  30170. function get(object, path, defaultValue) {
  30171. var result = object == null ? undefined : baseGet(object, path);
  30172. return result === undefined ? defaultValue : result;
  30173. }
  30174. /**
  30175. * Checks if `path` is a direct property of `object`.
  30176. *
  30177. * @static
  30178. * @since 0.1.0
  30179. * @memberOf _
  30180. * @category Object
  30181. * @param {Object} object The object to query.
  30182. * @param {Array|string} path The path to check.
  30183. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30184. * @example
  30185. *
  30186. * var object = { 'a': { 'b': 2 } };
  30187. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30188. *
  30189. * _.has(object, 'a');
  30190. * // => true
  30191. *
  30192. * _.has(object, 'a.b');
  30193. * // => true
  30194. *
  30195. * _.has(object, ['a', 'b']);
  30196. * // => true
  30197. *
  30198. * _.has(other, 'a');
  30199. * // => false
  30200. */
  30201. function has(object, path) {
  30202. return object != null && hasPath(object, path, baseHas);
  30203. }
  30204. /**
  30205. * Checks if `path` is a direct or inherited property of `object`.
  30206. *
  30207. * @static
  30208. * @memberOf _
  30209. * @since 4.0.0
  30210. * @category Object
  30211. * @param {Object} object The object to query.
  30212. * @param {Array|string} path The path to check.
  30213. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30214. * @example
  30215. *
  30216. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30217. *
  30218. * _.hasIn(object, 'a');
  30219. * // => true
  30220. *
  30221. * _.hasIn(object, 'a.b');
  30222. * // => true
  30223. *
  30224. * _.hasIn(object, ['a', 'b']);
  30225. * // => true
  30226. *
  30227. * _.hasIn(object, 'b');
  30228. * // => false
  30229. */
  30230. function hasIn(object, path) {
  30231. return object != null && hasPath(object, path, baseHasIn);
  30232. }
  30233. /**
  30234. * Creates an object composed of the inverted keys and values of `object`.
  30235. * If `object` contains duplicate values, subsequent values overwrite
  30236. * property assignments of previous values.
  30237. *
  30238. * @static
  30239. * @memberOf _
  30240. * @since 0.7.0
  30241. * @category Object
  30242. * @param {Object} object The object to invert.
  30243. * @returns {Object} Returns the new inverted object.
  30244. * @example
  30245. *
  30246. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30247. *
  30248. * _.invert(object);
  30249. * // => { '1': 'c', '2': 'b' }
  30250. */
  30251. var invert = createInverter(function(result, value, key) {
  30252. if (value != null &&
  30253. typeof value.toString != 'function') {
  30254. value = nativeObjectToString.call(value);
  30255. }
  30256. result[value] = key;
  30257. }, constant(identity));
  30258. /**
  30259. * This method is like `_.invert` except that the inverted object is generated
  30260. * from the results of running each element of `object` thru `iteratee`. The
  30261. * corresponding inverted value of each inverted key is an array of keys
  30262. * responsible for generating the inverted value. The iteratee is invoked
  30263. * with one argument: (value).
  30264. *
  30265. * @static
  30266. * @memberOf _
  30267. * @since 4.1.0
  30268. * @category Object
  30269. * @param {Object} object The object to invert.
  30270. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30271. * @returns {Object} Returns the new inverted object.
  30272. * @example
  30273. *
  30274. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30275. *
  30276. * _.invertBy(object);
  30277. * // => { '1': ['a', 'c'], '2': ['b'] }
  30278. *
  30279. * _.invertBy(object, function(value) {
  30280. * return 'group' + value;
  30281. * });
  30282. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30283. */
  30284. var invertBy = createInverter(function(result, value, key) {
  30285. if (value != null &&
  30286. typeof value.toString != 'function') {
  30287. value = nativeObjectToString.call(value);
  30288. }
  30289. if (hasOwnProperty.call(result, value)) {
  30290. result[value].push(key);
  30291. } else {
  30292. result[value] = [key];
  30293. }
  30294. }, getIteratee);
  30295. /**
  30296. * Invokes the method at `path` of `object`.
  30297. *
  30298. * @static
  30299. * @memberOf _
  30300. * @since 4.0.0
  30301. * @category Object
  30302. * @param {Object} object The object to query.
  30303. * @param {Array|string} path The path of the method to invoke.
  30304. * @param {...*} [args] The arguments to invoke the method with.
  30305. * @returns {*} Returns the result of the invoked method.
  30306. * @example
  30307. *
  30308. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30309. *
  30310. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30311. * // => [2, 3]
  30312. */
  30313. var invoke = baseRest(baseInvoke);
  30314. /**
  30315. * Creates an array of the own enumerable property names of `object`.
  30316. *
  30317. * **Note:** Non-object values are coerced to objects. See the
  30318. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30319. * for more details.
  30320. *
  30321. * @static
  30322. * @since 0.1.0
  30323. * @memberOf _
  30324. * @category Object
  30325. * @param {Object} object The object to query.
  30326. * @returns {Array} Returns the array of property names.
  30327. * @example
  30328. *
  30329. * function Foo() {
  30330. * this.a = 1;
  30331. * this.b = 2;
  30332. * }
  30333. *
  30334. * Foo.prototype.c = 3;
  30335. *
  30336. * _.keys(new Foo);
  30337. * // => ['a', 'b'] (iteration order is not guaranteed)
  30338. *
  30339. * _.keys('hi');
  30340. * // => ['0', '1']
  30341. */
  30342. function keys(object) {
  30343. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30344. }
  30345. /**
  30346. * Creates an array of the own and inherited enumerable property names of `object`.
  30347. *
  30348. * **Note:** Non-object values are coerced to objects.
  30349. *
  30350. * @static
  30351. * @memberOf _
  30352. * @since 3.0.0
  30353. * @category Object
  30354. * @param {Object} object The object to query.
  30355. * @returns {Array} Returns the array of property names.
  30356. * @example
  30357. *
  30358. * function Foo() {
  30359. * this.a = 1;
  30360. * this.b = 2;
  30361. * }
  30362. *
  30363. * Foo.prototype.c = 3;
  30364. *
  30365. * _.keysIn(new Foo);
  30366. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30367. */
  30368. function keysIn(object) {
  30369. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30370. }
  30371. /**
  30372. * The opposite of `_.mapValues`; this method creates an object with the
  30373. * same values as `object` and keys generated by running each own enumerable
  30374. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30375. * with three arguments: (value, key, object).
  30376. *
  30377. * @static
  30378. * @memberOf _
  30379. * @since 3.8.0
  30380. * @category Object
  30381. * @param {Object} object The object to iterate over.
  30382. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30383. * @returns {Object} Returns the new mapped object.
  30384. * @see _.mapValues
  30385. * @example
  30386. *
  30387. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30388. * return key + value;
  30389. * });
  30390. * // => { 'a1': 1, 'b2': 2 }
  30391. */
  30392. function mapKeys(object, iteratee) {
  30393. var result = {};
  30394. iteratee = getIteratee(iteratee, 3);
  30395. baseForOwn(object, function(value, key, object) {
  30396. baseAssignValue(result, iteratee(value, key, object), value);
  30397. });
  30398. return result;
  30399. }
  30400. /**
  30401. * Creates an object with the same keys as `object` and values generated
  30402. * by running each own enumerable string keyed property of `object` thru
  30403. * `iteratee`. The iteratee is invoked with three arguments:
  30404. * (value, key, object).
  30405. *
  30406. * @static
  30407. * @memberOf _
  30408. * @since 2.4.0
  30409. * @category Object
  30410. * @param {Object} object The object to iterate over.
  30411. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30412. * @returns {Object} Returns the new mapped object.
  30413. * @see _.mapKeys
  30414. * @example
  30415. *
  30416. * var users = {
  30417. * 'fred': { 'user': 'fred', 'age': 40 },
  30418. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30419. * };
  30420. *
  30421. * _.mapValues(users, function(o) { return o.age; });
  30422. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30423. *
  30424. * // The `_.property` iteratee shorthand.
  30425. * _.mapValues(users, 'age');
  30426. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30427. */
  30428. function mapValues(object, iteratee) {
  30429. var result = {};
  30430. iteratee = getIteratee(iteratee, 3);
  30431. baseForOwn(object, function(value, key, object) {
  30432. baseAssignValue(result, key, iteratee(value, key, object));
  30433. });
  30434. return result;
  30435. }
  30436. /**
  30437. * This method is like `_.assign` except that it recursively merges own and
  30438. * inherited enumerable string keyed properties of source objects into the
  30439. * destination object. Source properties that resolve to `undefined` are
  30440. * skipped if a destination value exists. Array and plain object properties
  30441. * are merged recursively. Other objects and value types are overridden by
  30442. * assignment. Source objects are applied from left to right. Subsequent
  30443. * sources overwrite property assignments of previous sources.
  30444. *
  30445. * **Note:** This method mutates `object`.
  30446. *
  30447. * @static
  30448. * @memberOf _
  30449. * @since 0.5.0
  30450. * @category Object
  30451. * @param {Object} object The destination object.
  30452. * @param {...Object} [sources] The source objects.
  30453. * @returns {Object} Returns `object`.
  30454. * @example
  30455. *
  30456. * var object = {
  30457. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30458. * };
  30459. *
  30460. * var other = {
  30461. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30462. * };
  30463. *
  30464. * _.merge(object, other);
  30465. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30466. */
  30467. var merge = createAssigner(function(object, source, srcIndex) {
  30468. baseMerge(object, source, srcIndex);
  30469. });
  30470. /**
  30471. * This method is like `_.merge` except that it accepts `customizer` which
  30472. * is invoked to produce the merged values of the destination and source
  30473. * properties. If `customizer` returns `undefined`, merging is handled by the
  30474. * method instead. The `customizer` is invoked with six arguments:
  30475. * (objValue, srcValue, key, object, source, stack).
  30476. *
  30477. * **Note:** This method mutates `object`.
  30478. *
  30479. * @static
  30480. * @memberOf _
  30481. * @since 4.0.0
  30482. * @category Object
  30483. * @param {Object} object The destination object.
  30484. * @param {...Object} sources The source objects.
  30485. * @param {Function} customizer The function to customize assigned values.
  30486. * @returns {Object} Returns `object`.
  30487. * @example
  30488. *
  30489. * function customizer(objValue, srcValue) {
  30490. * if (_.isArray(objValue)) {
  30491. * return objValue.concat(srcValue);
  30492. * }
  30493. * }
  30494. *
  30495. * var object = { 'a': [1], 'b': [2] };
  30496. * var other = { 'a': [3], 'b': [4] };
  30497. *
  30498. * _.mergeWith(object, other, customizer);
  30499. * // => { 'a': [1, 3], 'b': [2, 4] }
  30500. */
  30501. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30502. baseMerge(object, source, srcIndex, customizer);
  30503. });
  30504. /**
  30505. * The opposite of `_.pick`; this method creates an object composed of the
  30506. * own and inherited enumerable property paths of `object` that are not omitted.
  30507. *
  30508. * **Note:** This method is considerably slower than `_.pick`.
  30509. *
  30510. * @static
  30511. * @since 0.1.0
  30512. * @memberOf _
  30513. * @category Object
  30514. * @param {Object} object The source object.
  30515. * @param {...(string|string[])} [paths] The property paths to omit.
  30516. * @returns {Object} Returns the new object.
  30517. * @example
  30518. *
  30519. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30520. *
  30521. * _.omit(object, ['a', 'c']);
  30522. * // => { 'b': '2' }
  30523. */
  30524. var omit = flatRest(function(object, paths) {
  30525. var result = {};
  30526. if (object == null) {
  30527. return result;
  30528. }
  30529. var isDeep = false;
  30530. paths = arrayMap(paths, function(path) {
  30531. path = castPath(path, object);
  30532. isDeep || (isDeep = path.length > 1);
  30533. return path;
  30534. });
  30535. copyObject(object, getAllKeysIn(object), result);
  30536. if (isDeep) {
  30537. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30538. }
  30539. var length = paths.length;
  30540. while (length--) {
  30541. baseUnset(result, paths[length]);
  30542. }
  30543. return result;
  30544. });
  30545. /**
  30546. * The opposite of `_.pickBy`; this method creates an object composed of
  30547. * the own and inherited enumerable string keyed properties of `object` that
  30548. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30549. * arguments: (value, key).
  30550. *
  30551. * @static
  30552. * @memberOf _
  30553. * @since 4.0.0
  30554. * @category Object
  30555. * @param {Object} object The source object.
  30556. * @param {Function} [predicate=_.identity] The function invoked per property.
  30557. * @returns {Object} Returns the new object.
  30558. * @example
  30559. *
  30560. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30561. *
  30562. * _.omitBy(object, _.isNumber);
  30563. * // => { 'b': '2' }
  30564. */
  30565. function omitBy(object, predicate) {
  30566. return pickBy(object, negate(getIteratee(predicate)));
  30567. }
  30568. /**
  30569. * Creates an object composed of the picked `object` properties.
  30570. *
  30571. * @static
  30572. * @since 0.1.0
  30573. * @memberOf _
  30574. * @category Object
  30575. * @param {Object} object The source object.
  30576. * @param {...(string|string[])} [paths] The property paths to pick.
  30577. * @returns {Object} Returns the new object.
  30578. * @example
  30579. *
  30580. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30581. *
  30582. * _.pick(object, ['a', 'c']);
  30583. * // => { 'a': 1, 'c': 3 }
  30584. */
  30585. var pick = flatRest(function(object, paths) {
  30586. return object == null ? {} : basePick(object, paths);
  30587. });
  30588. /**
  30589. * Creates an object composed of the `object` properties `predicate` returns
  30590. * truthy for. The predicate is invoked with two arguments: (value, key).
  30591. *
  30592. * @static
  30593. * @memberOf _
  30594. * @since 4.0.0
  30595. * @category Object
  30596. * @param {Object} object The source object.
  30597. * @param {Function} [predicate=_.identity] The function invoked per property.
  30598. * @returns {Object} Returns the new object.
  30599. * @example
  30600. *
  30601. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30602. *
  30603. * _.pickBy(object, _.isNumber);
  30604. * // => { 'a': 1, 'c': 3 }
  30605. */
  30606. function pickBy(object, predicate) {
  30607. if (object == null) {
  30608. return {};
  30609. }
  30610. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30611. return [prop];
  30612. });
  30613. predicate = getIteratee(predicate);
  30614. return basePickBy(object, props, function(value, path) {
  30615. return predicate(value, path[0]);
  30616. });
  30617. }
  30618. /**
  30619. * This method is like `_.get` except that if the resolved value is a
  30620. * function it's invoked with the `this` binding of its parent object and
  30621. * its result is returned.
  30622. *
  30623. * @static
  30624. * @since 0.1.0
  30625. * @memberOf _
  30626. * @category Object
  30627. * @param {Object} object The object to query.
  30628. * @param {Array|string} path The path of the property to resolve.
  30629. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30630. * @returns {*} Returns the resolved value.
  30631. * @example
  30632. *
  30633. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30634. *
  30635. * _.result(object, 'a[0].b.c1');
  30636. * // => 3
  30637. *
  30638. * _.result(object, 'a[0].b.c2');
  30639. * // => 4
  30640. *
  30641. * _.result(object, 'a[0].b.c3', 'default');
  30642. * // => 'default'
  30643. *
  30644. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30645. * // => 'default'
  30646. */
  30647. function result(object, path, defaultValue) {
  30648. path = castPath(path, object);
  30649. var index = -1,
  30650. length = path.length;
  30651. // Ensure the loop is entered when path is empty.
  30652. if (!length) {
  30653. length = 1;
  30654. object = undefined;
  30655. }
  30656. while (++index < length) {
  30657. var value = object == null ? undefined : object[toKey(path[index])];
  30658. if (value === undefined) {
  30659. index = length;
  30660. value = defaultValue;
  30661. }
  30662. object = isFunction(value) ? value.call(object) : value;
  30663. }
  30664. return object;
  30665. }
  30666. /**
  30667. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30668. * it's created. Arrays are created for missing index properties while objects
  30669. * are created for all other missing properties. Use `_.setWith` to customize
  30670. * `path` creation.
  30671. *
  30672. * **Note:** This method mutates `object`.
  30673. *
  30674. * @static
  30675. * @memberOf _
  30676. * @since 3.7.0
  30677. * @category Object
  30678. * @param {Object} object The object to modify.
  30679. * @param {Array|string} path The path of the property to set.
  30680. * @param {*} value The value to set.
  30681. * @returns {Object} Returns `object`.
  30682. * @example
  30683. *
  30684. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30685. *
  30686. * _.set(object, 'a[0].b.c', 4);
  30687. * console.log(object.a[0].b.c);
  30688. * // => 4
  30689. *
  30690. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30691. * console.log(object.x[0].y.z);
  30692. * // => 5
  30693. */
  30694. function set(object, path, value) {
  30695. return object == null ? object : baseSet(object, path, value);
  30696. }
  30697. /**
  30698. * This method is like `_.set` except that it accepts `customizer` which is
  30699. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30700. * path creation is handled by the method instead. The `customizer` is invoked
  30701. * with three arguments: (nsValue, key, nsObject).
  30702. *
  30703. * **Note:** This method mutates `object`.
  30704. *
  30705. * @static
  30706. * @memberOf _
  30707. * @since 4.0.0
  30708. * @category Object
  30709. * @param {Object} object The object to modify.
  30710. * @param {Array|string} path The path of the property to set.
  30711. * @param {*} value The value to set.
  30712. * @param {Function} [customizer] The function to customize assigned values.
  30713. * @returns {Object} Returns `object`.
  30714. * @example
  30715. *
  30716. * var object = {};
  30717. *
  30718. * _.setWith(object, '[0][1]', 'a', Object);
  30719. * // => { '0': { '1': 'a' } }
  30720. */
  30721. function setWith(object, path, value, customizer) {
  30722. customizer = typeof customizer == 'function' ? customizer : undefined;
  30723. return object == null ? object : baseSet(object, path, value, customizer);
  30724. }
  30725. /**
  30726. * Creates an array of own enumerable string keyed-value pairs for `object`
  30727. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30728. * entries are returned.
  30729. *
  30730. * @static
  30731. * @memberOf _
  30732. * @since 4.0.0
  30733. * @alias entries
  30734. * @category Object
  30735. * @param {Object} object The object to query.
  30736. * @returns {Array} Returns the key-value pairs.
  30737. * @example
  30738. *
  30739. * function Foo() {
  30740. * this.a = 1;
  30741. * this.b = 2;
  30742. * }
  30743. *
  30744. * Foo.prototype.c = 3;
  30745. *
  30746. * _.toPairs(new Foo);
  30747. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30748. */
  30749. var toPairs = createToPairs(keys);
  30750. /**
  30751. * Creates an array of own and inherited enumerable string keyed-value pairs
  30752. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30753. * or set, its entries are returned.
  30754. *
  30755. * @static
  30756. * @memberOf _
  30757. * @since 4.0.0
  30758. * @alias entriesIn
  30759. * @category Object
  30760. * @param {Object} object The object to query.
  30761. * @returns {Array} Returns the key-value pairs.
  30762. * @example
  30763. *
  30764. * function Foo() {
  30765. * this.a = 1;
  30766. * this.b = 2;
  30767. * }
  30768. *
  30769. * Foo.prototype.c = 3;
  30770. *
  30771. * _.toPairsIn(new Foo);
  30772. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30773. */
  30774. var toPairsIn = createToPairs(keysIn);
  30775. /**
  30776. * An alternative to `_.reduce`; this method transforms `object` to a new
  30777. * `accumulator` object which is the result of running each of its own
  30778. * enumerable string keyed properties thru `iteratee`, with each invocation
  30779. * potentially mutating the `accumulator` object. If `accumulator` is not
  30780. * provided, a new object with the same `[[Prototype]]` will be used. The
  30781. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30782. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30783. *
  30784. * @static
  30785. * @memberOf _
  30786. * @since 1.3.0
  30787. * @category Object
  30788. * @param {Object} object The object to iterate over.
  30789. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30790. * @param {*} [accumulator] The custom accumulator value.
  30791. * @returns {*} Returns the accumulated value.
  30792. * @example
  30793. *
  30794. * _.transform([2, 3, 4], function(result, n) {
  30795. * result.push(n *= n);
  30796. * return n % 2 == 0;
  30797. * }, []);
  30798. * // => [4, 9]
  30799. *
  30800. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30801. * (result[value] || (result[value] = [])).push(key);
  30802. * }, {});
  30803. * // => { '1': ['a', 'c'], '2': ['b'] }
  30804. */
  30805. function transform(object, iteratee, accumulator) {
  30806. var isArr = isArray(object),
  30807. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30808. iteratee = getIteratee(iteratee, 4);
  30809. if (accumulator == null) {
  30810. var Ctor = object && object.constructor;
  30811. if (isArrLike) {
  30812. accumulator = isArr ? new Ctor : [];
  30813. }
  30814. else if (isObject(object)) {
  30815. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30816. }
  30817. else {
  30818. accumulator = {};
  30819. }
  30820. }
  30821. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30822. return iteratee(accumulator, value, index, object);
  30823. });
  30824. return accumulator;
  30825. }
  30826. /**
  30827. * Removes the property at `path` of `object`.
  30828. *
  30829. * **Note:** This method mutates `object`.
  30830. *
  30831. * @static
  30832. * @memberOf _
  30833. * @since 4.0.0
  30834. * @category Object
  30835. * @param {Object} object The object to modify.
  30836. * @param {Array|string} path The path of the property to unset.
  30837. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30838. * @example
  30839. *
  30840. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30841. * _.unset(object, 'a[0].b.c');
  30842. * // => true
  30843. *
  30844. * console.log(object);
  30845. * // => { 'a': [{ 'b': {} }] };
  30846. *
  30847. * _.unset(object, ['a', '0', 'b', 'c']);
  30848. * // => true
  30849. *
  30850. * console.log(object);
  30851. * // => { 'a': [{ 'b': {} }] };
  30852. */
  30853. function unset(object, path) {
  30854. return object == null ? true : baseUnset(object, path);
  30855. }
  30856. /**
  30857. * This method is like `_.set` except that accepts `updater` to produce the
  30858. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30859. * is invoked with one argument: (value).
  30860. *
  30861. * **Note:** This method mutates `object`.
  30862. *
  30863. * @static
  30864. * @memberOf _
  30865. * @since 4.6.0
  30866. * @category Object
  30867. * @param {Object} object The object to modify.
  30868. * @param {Array|string} path The path of the property to set.
  30869. * @param {Function} updater The function to produce the updated value.
  30870. * @returns {Object} Returns `object`.
  30871. * @example
  30872. *
  30873. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30874. *
  30875. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30876. * console.log(object.a[0].b.c);
  30877. * // => 9
  30878. *
  30879. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30880. * console.log(object.x[0].y.z);
  30881. * // => 0
  30882. */
  30883. function update(object, path, updater) {
  30884. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30885. }
  30886. /**
  30887. * This method is like `_.update` except that it accepts `customizer` which is
  30888. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30889. * path creation is handled by the method instead. The `customizer` is invoked
  30890. * with three arguments: (nsValue, key, nsObject).
  30891. *
  30892. * **Note:** This method mutates `object`.
  30893. *
  30894. * @static
  30895. * @memberOf _
  30896. * @since 4.6.0
  30897. * @category Object
  30898. * @param {Object} object The object to modify.
  30899. * @param {Array|string} path The path of the property to set.
  30900. * @param {Function} updater The function to produce the updated value.
  30901. * @param {Function} [customizer] The function to customize assigned values.
  30902. * @returns {Object} Returns `object`.
  30903. * @example
  30904. *
  30905. * var object = {};
  30906. *
  30907. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30908. * // => { '0': { '1': 'a' } }
  30909. */
  30910. function updateWith(object, path, updater, customizer) {
  30911. customizer = typeof customizer == 'function' ? customizer : undefined;
  30912. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  30913. }
  30914. /**
  30915. * Creates an array of the own enumerable string keyed property values of `object`.
  30916. *
  30917. * **Note:** Non-object values are coerced to objects.
  30918. *
  30919. * @static
  30920. * @since 0.1.0
  30921. * @memberOf _
  30922. * @category Object
  30923. * @param {Object} object The object to query.
  30924. * @returns {Array} Returns the array of property values.
  30925. * @example
  30926. *
  30927. * function Foo() {
  30928. * this.a = 1;
  30929. * this.b = 2;
  30930. * }
  30931. *
  30932. * Foo.prototype.c = 3;
  30933. *
  30934. * _.values(new Foo);
  30935. * // => [1, 2] (iteration order is not guaranteed)
  30936. *
  30937. * _.values('hi');
  30938. * // => ['h', 'i']
  30939. */
  30940. function values(object) {
  30941. return object == null ? [] : baseValues(object, keys(object));
  30942. }
  30943. /**
  30944. * Creates an array of the own and inherited enumerable string keyed property
  30945. * values of `object`.
  30946. *
  30947. * **Note:** Non-object values are coerced to objects.
  30948. *
  30949. * @static
  30950. * @memberOf _
  30951. * @since 3.0.0
  30952. * @category Object
  30953. * @param {Object} object The object to query.
  30954. * @returns {Array} Returns the array of property values.
  30955. * @example
  30956. *
  30957. * function Foo() {
  30958. * this.a = 1;
  30959. * this.b = 2;
  30960. * }
  30961. *
  30962. * Foo.prototype.c = 3;
  30963. *
  30964. * _.valuesIn(new Foo);
  30965. * // => [1, 2, 3] (iteration order is not guaranteed)
  30966. */
  30967. function valuesIn(object) {
  30968. return object == null ? [] : baseValues(object, keysIn(object));
  30969. }
  30970. /*------------------------------------------------------------------------*/
  30971. /**
  30972. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  30973. *
  30974. * @static
  30975. * @memberOf _
  30976. * @since 4.0.0
  30977. * @category Number
  30978. * @param {number} number The number to clamp.
  30979. * @param {number} [lower] The lower bound.
  30980. * @param {number} upper The upper bound.
  30981. * @returns {number} Returns the clamped number.
  30982. * @example
  30983. *
  30984. * _.clamp(-10, -5, 5);
  30985. * // => -5
  30986. *
  30987. * _.clamp(10, -5, 5);
  30988. * // => 5
  30989. */
  30990. function clamp(number, lower, upper) {
  30991. if (upper === undefined) {
  30992. upper = lower;
  30993. lower = undefined;
  30994. }
  30995. if (upper !== undefined) {
  30996. upper = toNumber(upper);
  30997. upper = upper === upper ? upper : 0;
  30998. }
  30999. if (lower !== undefined) {
  31000. lower = toNumber(lower);
  31001. lower = lower === lower ? lower : 0;
  31002. }
  31003. return baseClamp(toNumber(number), lower, upper);
  31004. }
  31005. /**
  31006. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31007. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31008. * If `start` is greater than `end` the params are swapped to support
  31009. * negative ranges.
  31010. *
  31011. * @static
  31012. * @memberOf _
  31013. * @since 3.3.0
  31014. * @category Number
  31015. * @param {number} number The number to check.
  31016. * @param {number} [start=0] The start of the range.
  31017. * @param {number} end The end of the range.
  31018. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31019. * @see _.range, _.rangeRight
  31020. * @example
  31021. *
  31022. * _.inRange(3, 2, 4);
  31023. * // => true
  31024. *
  31025. * _.inRange(4, 8);
  31026. * // => true
  31027. *
  31028. * _.inRange(4, 2);
  31029. * // => false
  31030. *
  31031. * _.inRange(2, 2);
  31032. * // => false
  31033. *
  31034. * _.inRange(1.2, 2);
  31035. * // => true
  31036. *
  31037. * _.inRange(5.2, 4);
  31038. * // => false
  31039. *
  31040. * _.inRange(-3, -2, -6);
  31041. * // => true
  31042. */
  31043. function inRange(number, start, end) {
  31044. start = toFinite(start);
  31045. if (end === undefined) {
  31046. end = start;
  31047. start = 0;
  31048. } else {
  31049. end = toFinite(end);
  31050. }
  31051. number = toNumber(number);
  31052. return baseInRange(number, start, end);
  31053. }
  31054. /**
  31055. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31056. * If only one argument is provided a number between `0` and the given number
  31057. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31058. * floats, a floating-point number is returned instead of an integer.
  31059. *
  31060. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31061. * floating-point values which can produce unexpected results.
  31062. *
  31063. * @static
  31064. * @memberOf _
  31065. * @since 0.7.0
  31066. * @category Number
  31067. * @param {number} [lower=0] The lower bound.
  31068. * @param {number} [upper=1] The upper bound.
  31069. * @param {boolean} [floating] Specify returning a floating-point number.
  31070. * @returns {number} Returns the random number.
  31071. * @example
  31072. *
  31073. * _.random(0, 5);
  31074. * // => an integer between 0 and 5
  31075. *
  31076. * _.random(5);
  31077. * // => also an integer between 0 and 5
  31078. *
  31079. * _.random(5, true);
  31080. * // => a floating-point number between 0 and 5
  31081. *
  31082. * _.random(1.2, 5.2);
  31083. * // => a floating-point number between 1.2 and 5.2
  31084. */
  31085. function random(lower, upper, floating) {
  31086. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31087. upper = floating = undefined;
  31088. }
  31089. if (floating === undefined) {
  31090. if (typeof upper == 'boolean') {
  31091. floating = upper;
  31092. upper = undefined;
  31093. }
  31094. else if (typeof lower == 'boolean') {
  31095. floating = lower;
  31096. lower = undefined;
  31097. }
  31098. }
  31099. if (lower === undefined && upper === undefined) {
  31100. lower = 0;
  31101. upper = 1;
  31102. }
  31103. else {
  31104. lower = toFinite(lower);
  31105. if (upper === undefined) {
  31106. upper = lower;
  31107. lower = 0;
  31108. } else {
  31109. upper = toFinite(upper);
  31110. }
  31111. }
  31112. if (lower > upper) {
  31113. var temp = lower;
  31114. lower = upper;
  31115. upper = temp;
  31116. }
  31117. if (floating || lower % 1 || upper % 1) {
  31118. var rand = nativeRandom();
  31119. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31120. }
  31121. return baseRandom(lower, upper);
  31122. }
  31123. /*------------------------------------------------------------------------*/
  31124. /**
  31125. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31126. *
  31127. * @static
  31128. * @memberOf _
  31129. * @since 3.0.0
  31130. * @category String
  31131. * @param {string} [string=''] The string to convert.
  31132. * @returns {string} Returns the camel cased string.
  31133. * @example
  31134. *
  31135. * _.camelCase('Foo Bar');
  31136. * // => 'fooBar'
  31137. *
  31138. * _.camelCase('--foo-bar--');
  31139. * // => 'fooBar'
  31140. *
  31141. * _.camelCase('__FOO_BAR__');
  31142. * // => 'fooBar'
  31143. */
  31144. var camelCase = createCompounder(function(result, word, index) {
  31145. word = word.toLowerCase();
  31146. return result + (index ? capitalize(word) : word);
  31147. });
  31148. /**
  31149. * Converts the first character of `string` to upper case and the remaining
  31150. * to lower case.
  31151. *
  31152. * @static
  31153. * @memberOf _
  31154. * @since 3.0.0
  31155. * @category String
  31156. * @param {string} [string=''] The string to capitalize.
  31157. * @returns {string} Returns the capitalized string.
  31158. * @example
  31159. *
  31160. * _.capitalize('FRED');
  31161. * // => 'Fred'
  31162. */
  31163. function capitalize(string) {
  31164. return upperFirst(toString(string).toLowerCase());
  31165. }
  31166. /**
  31167. * Deburrs `string` by converting
  31168. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31169. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31170. * letters to basic Latin letters and removing
  31171. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31172. *
  31173. * @static
  31174. * @memberOf _
  31175. * @since 3.0.0
  31176. * @category String
  31177. * @param {string} [string=''] The string to deburr.
  31178. * @returns {string} Returns the deburred string.
  31179. * @example
  31180. *
  31181. * _.deburr('déjà vu');
  31182. * // => 'deja vu'
  31183. */
  31184. function deburr(string) {
  31185. string = toString(string);
  31186. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31187. }
  31188. /**
  31189. * Checks if `string` ends with the given target string.
  31190. *
  31191. * @static
  31192. * @memberOf _
  31193. * @since 3.0.0
  31194. * @category String
  31195. * @param {string} [string=''] The string to inspect.
  31196. * @param {string} [target] The string to search for.
  31197. * @param {number} [position=string.length] The position to search up to.
  31198. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31199. * else `false`.
  31200. * @example
  31201. *
  31202. * _.endsWith('abc', 'c');
  31203. * // => true
  31204. *
  31205. * _.endsWith('abc', 'b');
  31206. * // => false
  31207. *
  31208. * _.endsWith('abc', 'b', 2);
  31209. * // => true
  31210. */
  31211. function endsWith(string, target, position) {
  31212. string = toString(string);
  31213. target = baseToString(target);
  31214. var length = string.length;
  31215. position = position === undefined
  31216. ? length
  31217. : baseClamp(toInteger(position), 0, length);
  31218. var end = position;
  31219. position -= target.length;
  31220. return position >= 0 && string.slice(position, end) == target;
  31221. }
  31222. /**
  31223. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31224. * corresponding HTML entities.
  31225. *
  31226. * **Note:** No other characters are escaped. To escape additional
  31227. * characters use a third-party library like [_he_](https://mths.be/he).
  31228. *
  31229. * Though the ">" character is escaped for symmetry, characters like
  31230. * ">" and "/" don't need escaping in HTML and have no special meaning
  31231. * unless they're part of a tag or unquoted attribute value. See
  31232. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31233. * (under "semi-related fun fact") for more details.
  31234. *
  31235. * When working with HTML you should always
  31236. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31237. * XSS vectors.
  31238. *
  31239. * @static
  31240. * @since 0.1.0
  31241. * @memberOf _
  31242. * @category String
  31243. * @param {string} [string=''] The string to escape.
  31244. * @returns {string} Returns the escaped string.
  31245. * @example
  31246. *
  31247. * _.escape('fred, barney, & pebbles');
  31248. * // => 'fred, barney, &amp; pebbles'
  31249. */
  31250. function escape(string) {
  31251. string = toString(string);
  31252. return (string && reHasUnescapedHtml.test(string))
  31253. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31254. : string;
  31255. }
  31256. /**
  31257. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31258. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31259. *
  31260. * @static
  31261. * @memberOf _
  31262. * @since 3.0.0
  31263. * @category String
  31264. * @param {string} [string=''] The string to escape.
  31265. * @returns {string} Returns the escaped string.
  31266. * @example
  31267. *
  31268. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31269. * // => '\[lodash\]\(https://lodash\.com/\)'
  31270. */
  31271. function escapeRegExp(string) {
  31272. string = toString(string);
  31273. return (string && reHasRegExpChar.test(string))
  31274. ? string.replace(reRegExpChar, '\\$&')
  31275. : string;
  31276. }
  31277. /**
  31278. * Converts `string` to
  31279. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31280. *
  31281. * @static
  31282. * @memberOf _
  31283. * @since 3.0.0
  31284. * @category String
  31285. * @param {string} [string=''] The string to convert.
  31286. * @returns {string} Returns the kebab cased string.
  31287. * @example
  31288. *
  31289. * _.kebabCase('Foo Bar');
  31290. * // => 'foo-bar'
  31291. *
  31292. * _.kebabCase('fooBar');
  31293. * // => 'foo-bar'
  31294. *
  31295. * _.kebabCase('__FOO_BAR__');
  31296. * // => 'foo-bar'
  31297. */
  31298. var kebabCase = createCompounder(function(result, word, index) {
  31299. return result + (index ? '-' : '') + word.toLowerCase();
  31300. });
  31301. /**
  31302. * Converts `string`, as space separated words, to lower case.
  31303. *
  31304. * @static
  31305. * @memberOf _
  31306. * @since 4.0.0
  31307. * @category String
  31308. * @param {string} [string=''] The string to convert.
  31309. * @returns {string} Returns the lower cased string.
  31310. * @example
  31311. *
  31312. * _.lowerCase('--Foo-Bar--');
  31313. * // => 'foo bar'
  31314. *
  31315. * _.lowerCase('fooBar');
  31316. * // => 'foo bar'
  31317. *
  31318. * _.lowerCase('__FOO_BAR__');
  31319. * // => 'foo bar'
  31320. */
  31321. var lowerCase = createCompounder(function(result, word, index) {
  31322. return result + (index ? ' ' : '') + word.toLowerCase();
  31323. });
  31324. /**
  31325. * Converts the first character of `string` to lower case.
  31326. *
  31327. * @static
  31328. * @memberOf _
  31329. * @since 4.0.0
  31330. * @category String
  31331. * @param {string} [string=''] The string to convert.
  31332. * @returns {string} Returns the converted string.
  31333. * @example
  31334. *
  31335. * _.lowerFirst('Fred');
  31336. * // => 'fred'
  31337. *
  31338. * _.lowerFirst('FRED');
  31339. * // => 'fRED'
  31340. */
  31341. var lowerFirst = createCaseFirst('toLowerCase');
  31342. /**
  31343. * Pads `string` on the left and right sides if it's shorter than `length`.
  31344. * Padding characters are truncated if they can't be evenly divided by `length`.
  31345. *
  31346. * @static
  31347. * @memberOf _
  31348. * @since 3.0.0
  31349. * @category String
  31350. * @param {string} [string=''] The string to pad.
  31351. * @param {number} [length=0] The padding length.
  31352. * @param {string} [chars=' '] The string used as padding.
  31353. * @returns {string} Returns the padded string.
  31354. * @example
  31355. *
  31356. * _.pad('abc', 8);
  31357. * // => ' abc '
  31358. *
  31359. * _.pad('abc', 8, '_-');
  31360. * // => '_-abc_-_'
  31361. *
  31362. * _.pad('abc', 3);
  31363. * // => 'abc'
  31364. */
  31365. function pad(string, length, chars) {
  31366. string = toString(string);
  31367. length = toInteger(length);
  31368. var strLength = length ? stringSize(string) : 0;
  31369. if (!length || strLength >= length) {
  31370. return string;
  31371. }
  31372. var mid = (length - strLength) / 2;
  31373. return (
  31374. createPadding(nativeFloor(mid), chars) +
  31375. string +
  31376. createPadding(nativeCeil(mid), chars)
  31377. );
  31378. }
  31379. /**
  31380. * Pads `string` on the right side if it's shorter than `length`. Padding
  31381. * characters are truncated if they exceed `length`.
  31382. *
  31383. * @static
  31384. * @memberOf _
  31385. * @since 4.0.0
  31386. * @category String
  31387. * @param {string} [string=''] The string to pad.
  31388. * @param {number} [length=0] The padding length.
  31389. * @param {string} [chars=' '] The string used as padding.
  31390. * @returns {string} Returns the padded string.
  31391. * @example
  31392. *
  31393. * _.padEnd('abc', 6);
  31394. * // => 'abc '
  31395. *
  31396. * _.padEnd('abc', 6, '_-');
  31397. * // => 'abc_-_'
  31398. *
  31399. * _.padEnd('abc', 3);
  31400. * // => 'abc'
  31401. */
  31402. function padEnd(string, length, chars) {
  31403. string = toString(string);
  31404. length = toInteger(length);
  31405. var strLength = length ? stringSize(string) : 0;
  31406. return (length && strLength < length)
  31407. ? (string + createPadding(length - strLength, chars))
  31408. : string;
  31409. }
  31410. /**
  31411. * Pads `string` on the left side if it's shorter than `length`. Padding
  31412. * characters are truncated if they exceed `length`.
  31413. *
  31414. * @static
  31415. * @memberOf _
  31416. * @since 4.0.0
  31417. * @category String
  31418. * @param {string} [string=''] The string to pad.
  31419. * @param {number} [length=0] The padding length.
  31420. * @param {string} [chars=' '] The string used as padding.
  31421. * @returns {string} Returns the padded string.
  31422. * @example
  31423. *
  31424. * _.padStart('abc', 6);
  31425. * // => ' abc'
  31426. *
  31427. * _.padStart('abc', 6, '_-');
  31428. * // => '_-_abc'
  31429. *
  31430. * _.padStart('abc', 3);
  31431. * // => 'abc'
  31432. */
  31433. function padStart(string, length, chars) {
  31434. string = toString(string);
  31435. length = toInteger(length);
  31436. var strLength = length ? stringSize(string) : 0;
  31437. return (length && strLength < length)
  31438. ? (createPadding(length - strLength, chars) + string)
  31439. : string;
  31440. }
  31441. /**
  31442. * Converts `string` to an integer of the specified radix. If `radix` is
  31443. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31444. * hexadecimal, in which case a `radix` of `16` is used.
  31445. *
  31446. * **Note:** This method aligns with the
  31447. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31448. *
  31449. * @static
  31450. * @memberOf _
  31451. * @since 1.1.0
  31452. * @category String
  31453. * @param {string} string The string to convert.
  31454. * @param {number} [radix=10] The radix to interpret `value` by.
  31455. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31456. * @returns {number} Returns the converted integer.
  31457. * @example
  31458. *
  31459. * _.parseInt('08');
  31460. * // => 8
  31461. *
  31462. * _.map(['6', '08', '10'], _.parseInt);
  31463. * // => [6, 8, 10]
  31464. */
  31465. function parseInt(string, radix, guard) {
  31466. if (guard || radix == null) {
  31467. radix = 0;
  31468. } else if (radix) {
  31469. radix = +radix;
  31470. }
  31471. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31472. }
  31473. /**
  31474. * Repeats the given string `n` times.
  31475. *
  31476. * @static
  31477. * @memberOf _
  31478. * @since 3.0.0
  31479. * @category String
  31480. * @param {string} [string=''] The string to repeat.
  31481. * @param {number} [n=1] The number of times to repeat the string.
  31482. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31483. * @returns {string} Returns the repeated string.
  31484. * @example
  31485. *
  31486. * _.repeat('*', 3);
  31487. * // => '***'
  31488. *
  31489. * _.repeat('abc', 2);
  31490. * // => 'abcabc'
  31491. *
  31492. * _.repeat('abc', 0);
  31493. * // => ''
  31494. */
  31495. function repeat(string, n, guard) {
  31496. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31497. n = 1;
  31498. } else {
  31499. n = toInteger(n);
  31500. }
  31501. return baseRepeat(toString(string), n);
  31502. }
  31503. /**
  31504. * Replaces matches for `pattern` in `string` with `replacement`.
  31505. *
  31506. * **Note:** This method is based on
  31507. * [`String#replace`](https://mdn.io/String/replace).
  31508. *
  31509. * @static
  31510. * @memberOf _
  31511. * @since 4.0.0
  31512. * @category String
  31513. * @param {string} [string=''] The string to modify.
  31514. * @param {RegExp|string} pattern The pattern to replace.
  31515. * @param {Function|string} replacement The match replacement.
  31516. * @returns {string} Returns the modified string.
  31517. * @example
  31518. *
  31519. * _.replace('Hi Fred', 'Fred', 'Barney');
  31520. * // => 'Hi Barney'
  31521. */
  31522. function replace() {
  31523. var args = arguments,
  31524. string = toString(args[0]);
  31525. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31526. }
  31527. /**
  31528. * Converts `string` to
  31529. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31530. *
  31531. * @static
  31532. * @memberOf _
  31533. * @since 3.0.0
  31534. * @category String
  31535. * @param {string} [string=''] The string to convert.
  31536. * @returns {string} Returns the snake cased string.
  31537. * @example
  31538. *
  31539. * _.snakeCase('Foo Bar');
  31540. * // => 'foo_bar'
  31541. *
  31542. * _.snakeCase('fooBar');
  31543. * // => 'foo_bar'
  31544. *
  31545. * _.snakeCase('--FOO-BAR--');
  31546. * // => 'foo_bar'
  31547. */
  31548. var snakeCase = createCompounder(function(result, word, index) {
  31549. return result + (index ? '_' : '') + word.toLowerCase();
  31550. });
  31551. /**
  31552. * Splits `string` by `separator`.
  31553. *
  31554. * **Note:** This method is based on
  31555. * [`String#split`](https://mdn.io/String/split).
  31556. *
  31557. * @static
  31558. * @memberOf _
  31559. * @since 4.0.0
  31560. * @category String
  31561. * @param {string} [string=''] The string to split.
  31562. * @param {RegExp|string} separator The separator pattern to split by.
  31563. * @param {number} [limit] The length to truncate results to.
  31564. * @returns {Array} Returns the string segments.
  31565. * @example
  31566. *
  31567. * _.split('a-b-c', '-', 2);
  31568. * // => ['a', 'b']
  31569. */
  31570. function split(string, separator, limit) {
  31571. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31572. separator = limit = undefined;
  31573. }
  31574. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31575. if (!limit) {
  31576. return [];
  31577. }
  31578. string = toString(string);
  31579. if (string && (
  31580. typeof separator == 'string' ||
  31581. (separator != null && !isRegExp(separator))
  31582. )) {
  31583. separator = baseToString(separator);
  31584. if (!separator && hasUnicode(string)) {
  31585. return castSlice(stringToArray(string), 0, limit);
  31586. }
  31587. }
  31588. return string.split(separator, limit);
  31589. }
  31590. /**
  31591. * Converts `string` to
  31592. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31593. *
  31594. * @static
  31595. * @memberOf _
  31596. * @since 3.1.0
  31597. * @category String
  31598. * @param {string} [string=''] The string to convert.
  31599. * @returns {string} Returns the start cased string.
  31600. * @example
  31601. *
  31602. * _.startCase('--foo-bar--');
  31603. * // => 'Foo Bar'
  31604. *
  31605. * _.startCase('fooBar');
  31606. * // => 'Foo Bar'
  31607. *
  31608. * _.startCase('__FOO_BAR__');
  31609. * // => 'FOO BAR'
  31610. */
  31611. var startCase = createCompounder(function(result, word, index) {
  31612. return result + (index ? ' ' : '') + upperFirst(word);
  31613. });
  31614. /**
  31615. * Checks if `string` starts with the given target string.
  31616. *
  31617. * @static
  31618. * @memberOf _
  31619. * @since 3.0.0
  31620. * @category String
  31621. * @param {string} [string=''] The string to inspect.
  31622. * @param {string} [target] The string to search for.
  31623. * @param {number} [position=0] The position to search from.
  31624. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31625. * else `false`.
  31626. * @example
  31627. *
  31628. * _.startsWith('abc', 'a');
  31629. * // => true
  31630. *
  31631. * _.startsWith('abc', 'b');
  31632. * // => false
  31633. *
  31634. * _.startsWith('abc', 'b', 1);
  31635. * // => true
  31636. */
  31637. function startsWith(string, target, position) {
  31638. string = toString(string);
  31639. position = position == null
  31640. ? 0
  31641. : baseClamp(toInteger(position), 0, string.length);
  31642. target = baseToString(target);
  31643. return string.slice(position, position + target.length) == target;
  31644. }
  31645. /**
  31646. * Creates a compiled template function that can interpolate data properties
  31647. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31648. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31649. * properties may be accessed as free variables in the template. If a setting
  31650. * object is given, it takes precedence over `_.templateSettings` values.
  31651. *
  31652. * **Note:** In the development build `_.template` utilizes
  31653. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31654. * for easier debugging.
  31655. *
  31656. * For more information on precompiling templates see
  31657. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31658. *
  31659. * For more information on Chrome extension sandboxes see
  31660. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31661. *
  31662. * @static
  31663. * @since 0.1.0
  31664. * @memberOf _
  31665. * @category String
  31666. * @param {string} [string=''] The template string.
  31667. * @param {Object} [options={}] The options object.
  31668. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31669. * The HTML "escape" delimiter.
  31670. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31671. * The "evaluate" delimiter.
  31672. * @param {Object} [options.imports=_.templateSettings.imports]
  31673. * An object to import into the template as free variables.
  31674. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31675. * The "interpolate" delimiter.
  31676. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31677. * The sourceURL of the compiled template.
  31678. * @param {string} [options.variable='obj']
  31679. * The data object variable name.
  31680. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31681. * @returns {Function} Returns the compiled template function.
  31682. * @example
  31683. *
  31684. * // Use the "interpolate" delimiter to create a compiled template.
  31685. * var compiled = _.template('hello <%= user %>!');
  31686. * compiled({ 'user': 'fred' });
  31687. * // => 'hello fred!'
  31688. *
  31689. * // Use the HTML "escape" delimiter to escape data property values.
  31690. * var compiled = _.template('<b><%- value %></b>');
  31691. * compiled({ 'value': '<script>' });
  31692. * // => '<b>&lt;script&gt;</b>'
  31693. *
  31694. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31695. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31696. * compiled({ 'users': ['fred', 'barney'] });
  31697. * // => '<li>fred</li><li>barney</li>'
  31698. *
  31699. * // Use the internal `print` function in "evaluate" delimiters.
  31700. * var compiled = _.template('<% print("hello " + user); %>!');
  31701. * compiled({ 'user': 'barney' });
  31702. * // => 'hello barney!'
  31703. *
  31704. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31705. * // Disable support by replacing the "interpolate" delimiter.
  31706. * var compiled = _.template('hello ${ user }!');
  31707. * compiled({ 'user': 'pebbles' });
  31708. * // => 'hello pebbles!'
  31709. *
  31710. * // Use backslashes to treat delimiters as plain text.
  31711. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31712. * compiled({ 'value': 'ignored' });
  31713. * // => '<%- value %>'
  31714. *
  31715. * // Use the `imports` option to import `jQuery` as `jq`.
  31716. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31717. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31718. * compiled({ 'users': ['fred', 'barney'] });
  31719. * // => '<li>fred</li><li>barney</li>'
  31720. *
  31721. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31722. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31723. * compiled(data);
  31724. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31725. *
  31726. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31727. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31728. * compiled.source;
  31729. * // => function(data) {
  31730. * // var __t, __p = '';
  31731. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31732. * // return __p;
  31733. * // }
  31734. *
  31735. * // Use custom template delimiters.
  31736. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31737. * var compiled = _.template('hello {{ user }}!');
  31738. * compiled({ 'user': 'mustache' });
  31739. * // => 'hello mustache!'
  31740. *
  31741. * // Use the `source` property to inline compiled templates for meaningful
  31742. * // line numbers in error messages and stack traces.
  31743. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31744. * var JST = {\
  31745. * "main": ' + _.template(mainText).source + '\
  31746. * };\
  31747. * ');
  31748. */
  31749. function template(string, options, guard) {
  31750. // Based on John Resig's `tmpl` implementation
  31751. // (http://ejohn.org/blog/javascript-micro-templating/)
  31752. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31753. var settings = lodash.templateSettings;
  31754. if (guard && isIterateeCall(string, options, guard)) {
  31755. options = undefined;
  31756. }
  31757. string = toString(string);
  31758. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31759. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31760. importsKeys = keys(imports),
  31761. importsValues = baseValues(imports, importsKeys);
  31762. var isEscaping,
  31763. isEvaluating,
  31764. index = 0,
  31765. interpolate = options.interpolate || reNoMatch,
  31766. source = "__p += '";
  31767. // Compile the regexp to match each delimiter.
  31768. var reDelimiters = RegExp(
  31769. (options.escape || reNoMatch).source + '|' +
  31770. interpolate.source + '|' +
  31771. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31772. (options.evaluate || reNoMatch).source + '|$'
  31773. , 'g');
  31774. // Use a sourceURL for easier debugging.
  31775. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31776. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31777. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31778. var sourceURL = '//# sourceURL=' +
  31779. (hasOwnProperty.call(options, 'sourceURL')
  31780. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31781. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31782. ) + '\n';
  31783. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31784. interpolateValue || (interpolateValue = esTemplateValue);
  31785. // Escape characters that can't be included in string literals.
  31786. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31787. // Replace delimiters with snippets.
  31788. if (escapeValue) {
  31789. isEscaping = true;
  31790. source += "' +\n__e(" + escapeValue + ") +\n'";
  31791. }
  31792. if (evaluateValue) {
  31793. isEvaluating = true;
  31794. source += "';\n" + evaluateValue + ";\n__p += '";
  31795. }
  31796. if (interpolateValue) {
  31797. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31798. }
  31799. index = offset + match.length;
  31800. // The JS engine embedded in Adobe products needs `match` returned in
  31801. // order to produce the correct `offset` value.
  31802. return match;
  31803. });
  31804. source += "';\n";
  31805. // If `variable` is not specified wrap a with-statement around the generated
  31806. // code to add the data object to the top of the scope chain.
  31807. // Like with sourceURL, we take care to not check the option's prototype,
  31808. // as this configuration is a code injection vector.
  31809. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31810. if (!variable) {
  31811. source = 'with (obj) {\n' + source + '\n}\n';
  31812. }
  31813. // Cleanup code by stripping empty strings.
  31814. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31815. .replace(reEmptyStringMiddle, '$1')
  31816. .replace(reEmptyStringTrailing, '$1;');
  31817. // Frame code as the function body.
  31818. source = 'function(' + (variable || 'obj') + ') {\n' +
  31819. (variable
  31820. ? ''
  31821. : 'obj || (obj = {});\n'
  31822. ) +
  31823. "var __t, __p = ''" +
  31824. (isEscaping
  31825. ? ', __e = _.escape'
  31826. : ''
  31827. ) +
  31828. (isEvaluating
  31829. ? ', __j = Array.prototype.join;\n' +
  31830. "function print() { __p += __j.call(arguments, '') }\n"
  31831. : ';\n'
  31832. ) +
  31833. source +
  31834. 'return __p\n}';
  31835. var result = attempt(function() {
  31836. return Function(importsKeys, sourceURL + 'return ' + source)
  31837. .apply(undefined, importsValues);
  31838. });
  31839. // Provide the compiled function's source by its `toString` method or
  31840. // the `source` property as a convenience for inlining compiled templates.
  31841. result.source = source;
  31842. if (isError(result)) {
  31843. throw result;
  31844. }
  31845. return result;
  31846. }
  31847. /**
  31848. * Converts `string`, as a whole, to lower case just like
  31849. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31850. *
  31851. * @static
  31852. * @memberOf _
  31853. * @since 4.0.0
  31854. * @category String
  31855. * @param {string} [string=''] The string to convert.
  31856. * @returns {string} Returns the lower cased string.
  31857. * @example
  31858. *
  31859. * _.toLower('--Foo-Bar--');
  31860. * // => '--foo-bar--'
  31861. *
  31862. * _.toLower('fooBar');
  31863. * // => 'foobar'
  31864. *
  31865. * _.toLower('__FOO_BAR__');
  31866. * // => '__foo_bar__'
  31867. */
  31868. function toLower(value) {
  31869. return toString(value).toLowerCase();
  31870. }
  31871. /**
  31872. * Converts `string`, as a whole, to upper case just like
  31873. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31874. *
  31875. * @static
  31876. * @memberOf _
  31877. * @since 4.0.0
  31878. * @category String
  31879. * @param {string} [string=''] The string to convert.
  31880. * @returns {string} Returns the upper cased string.
  31881. * @example
  31882. *
  31883. * _.toUpper('--foo-bar--');
  31884. * // => '--FOO-BAR--'
  31885. *
  31886. * _.toUpper('fooBar');
  31887. * // => 'FOOBAR'
  31888. *
  31889. * _.toUpper('__foo_bar__');
  31890. * // => '__FOO_BAR__'
  31891. */
  31892. function toUpper(value) {
  31893. return toString(value).toUpperCase();
  31894. }
  31895. /**
  31896. * Removes leading and trailing whitespace or specified characters from `string`.
  31897. *
  31898. * @static
  31899. * @memberOf _
  31900. * @since 3.0.0
  31901. * @category String
  31902. * @param {string} [string=''] The string to trim.
  31903. * @param {string} [chars=whitespace] The characters to trim.
  31904. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31905. * @returns {string} Returns the trimmed string.
  31906. * @example
  31907. *
  31908. * _.trim(' abc ');
  31909. * // => 'abc'
  31910. *
  31911. * _.trim('-_-abc-_-', '_-');
  31912. * // => 'abc'
  31913. *
  31914. * _.map([' foo ', ' bar '], _.trim);
  31915. * // => ['foo', 'bar']
  31916. */
  31917. function trim(string, chars, guard) {
  31918. string = toString(string);
  31919. if (string && (guard || chars === undefined)) {
  31920. return string.replace(reTrim, '');
  31921. }
  31922. if (!string || !(chars = baseToString(chars))) {
  31923. return string;
  31924. }
  31925. var strSymbols = stringToArray(string),
  31926. chrSymbols = stringToArray(chars),
  31927. start = charsStartIndex(strSymbols, chrSymbols),
  31928. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  31929. return castSlice(strSymbols, start, end).join('');
  31930. }
  31931. /**
  31932. * Removes trailing whitespace or specified characters from `string`.
  31933. *
  31934. * @static
  31935. * @memberOf _
  31936. * @since 4.0.0
  31937. * @category String
  31938. * @param {string} [string=''] The string to trim.
  31939. * @param {string} [chars=whitespace] The characters to trim.
  31940. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31941. * @returns {string} Returns the trimmed string.
  31942. * @example
  31943. *
  31944. * _.trimEnd(' abc ');
  31945. * // => ' abc'
  31946. *
  31947. * _.trimEnd('-_-abc-_-', '_-');
  31948. * // => '-_-abc'
  31949. */
  31950. function trimEnd(string, chars, guard) {
  31951. string = toString(string);
  31952. if (string && (guard || chars === undefined)) {
  31953. return string.replace(reTrimEnd, '');
  31954. }
  31955. if (!string || !(chars = baseToString(chars))) {
  31956. return string;
  31957. }
  31958. var strSymbols = stringToArray(string),
  31959. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  31960. return castSlice(strSymbols, 0, end).join('');
  31961. }
  31962. /**
  31963. * Removes leading whitespace or specified characters from `string`.
  31964. *
  31965. * @static
  31966. * @memberOf _
  31967. * @since 4.0.0
  31968. * @category String
  31969. * @param {string} [string=''] The string to trim.
  31970. * @param {string} [chars=whitespace] The characters to trim.
  31971. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31972. * @returns {string} Returns the trimmed string.
  31973. * @example
  31974. *
  31975. * _.trimStart(' abc ');
  31976. * // => 'abc '
  31977. *
  31978. * _.trimStart('-_-abc-_-', '_-');
  31979. * // => 'abc-_-'
  31980. */
  31981. function trimStart(string, chars, guard) {
  31982. string = toString(string);
  31983. if (string && (guard || chars === undefined)) {
  31984. return string.replace(reTrimStart, '');
  31985. }
  31986. if (!string || !(chars = baseToString(chars))) {
  31987. return string;
  31988. }
  31989. var strSymbols = stringToArray(string),
  31990. start = charsStartIndex(strSymbols, stringToArray(chars));
  31991. return castSlice(strSymbols, start).join('');
  31992. }
  31993. /**
  31994. * Truncates `string` if it's longer than the given maximum string length.
  31995. * The last characters of the truncated string are replaced with the omission
  31996. * string which defaults to "...".
  31997. *
  31998. * @static
  31999. * @memberOf _
  32000. * @since 4.0.0
  32001. * @category String
  32002. * @param {string} [string=''] The string to truncate.
  32003. * @param {Object} [options={}] The options object.
  32004. * @param {number} [options.length=30] The maximum string length.
  32005. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32006. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32007. * @returns {string} Returns the truncated string.
  32008. * @example
  32009. *
  32010. * _.truncate('hi-diddly-ho there, neighborino');
  32011. * // => 'hi-diddly-ho there, neighbo...'
  32012. *
  32013. * _.truncate('hi-diddly-ho there, neighborino', {
  32014. * 'length': 24,
  32015. * 'separator': ' '
  32016. * });
  32017. * // => 'hi-diddly-ho there,...'
  32018. *
  32019. * _.truncate('hi-diddly-ho there, neighborino', {
  32020. * 'length': 24,
  32021. * 'separator': /,? +/
  32022. * });
  32023. * // => 'hi-diddly-ho there...'
  32024. *
  32025. * _.truncate('hi-diddly-ho there, neighborino', {
  32026. * 'omission': ' [...]'
  32027. * });
  32028. * // => 'hi-diddly-ho there, neig [...]'
  32029. */
  32030. function truncate(string, options) {
  32031. var length = DEFAULT_TRUNC_LENGTH,
  32032. omission = DEFAULT_TRUNC_OMISSION;
  32033. if (isObject(options)) {
  32034. var separator = 'separator' in options ? options.separator : separator;
  32035. length = 'length' in options ? toInteger(options.length) : length;
  32036. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32037. }
  32038. string = toString(string);
  32039. var strLength = string.length;
  32040. if (hasUnicode(string)) {
  32041. var strSymbols = stringToArray(string);
  32042. strLength = strSymbols.length;
  32043. }
  32044. if (length >= strLength) {
  32045. return string;
  32046. }
  32047. var end = length - stringSize(omission);
  32048. if (end < 1) {
  32049. return omission;
  32050. }
  32051. var result = strSymbols
  32052. ? castSlice(strSymbols, 0, end).join('')
  32053. : string.slice(0, end);
  32054. if (separator === undefined) {
  32055. return result + omission;
  32056. }
  32057. if (strSymbols) {
  32058. end += (result.length - end);
  32059. }
  32060. if (isRegExp(separator)) {
  32061. if (string.slice(end).search(separator)) {
  32062. var match,
  32063. substring = result;
  32064. if (!separator.global) {
  32065. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32066. }
  32067. separator.lastIndex = 0;
  32068. while ((match = separator.exec(substring))) {
  32069. var newEnd = match.index;
  32070. }
  32071. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32072. }
  32073. } else if (string.indexOf(baseToString(separator), end) != end) {
  32074. var index = result.lastIndexOf(separator);
  32075. if (index > -1) {
  32076. result = result.slice(0, index);
  32077. }
  32078. }
  32079. return result + omission;
  32080. }
  32081. /**
  32082. * The inverse of `_.escape`; this method converts the HTML entities
  32083. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32084. * their corresponding characters.
  32085. *
  32086. * **Note:** No other HTML entities are unescaped. To unescape additional
  32087. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32088. *
  32089. * @static
  32090. * @memberOf _
  32091. * @since 0.6.0
  32092. * @category String
  32093. * @param {string} [string=''] The string to unescape.
  32094. * @returns {string} Returns the unescaped string.
  32095. * @example
  32096. *
  32097. * _.unescape('fred, barney, &amp; pebbles');
  32098. * // => 'fred, barney, & pebbles'
  32099. */
  32100. function unescape(string) {
  32101. string = toString(string);
  32102. return (string && reHasEscapedHtml.test(string))
  32103. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32104. : string;
  32105. }
  32106. /**
  32107. * Converts `string`, as space separated words, to upper case.
  32108. *
  32109. * @static
  32110. * @memberOf _
  32111. * @since 4.0.0
  32112. * @category String
  32113. * @param {string} [string=''] The string to convert.
  32114. * @returns {string} Returns the upper cased string.
  32115. * @example
  32116. *
  32117. * _.upperCase('--foo-bar');
  32118. * // => 'FOO BAR'
  32119. *
  32120. * _.upperCase('fooBar');
  32121. * // => 'FOO BAR'
  32122. *
  32123. * _.upperCase('__foo_bar__');
  32124. * // => 'FOO BAR'
  32125. */
  32126. var upperCase = createCompounder(function(result, word, index) {
  32127. return result + (index ? ' ' : '') + word.toUpperCase();
  32128. });
  32129. /**
  32130. * Converts the first character of `string` to upper case.
  32131. *
  32132. * @static
  32133. * @memberOf _
  32134. * @since 4.0.0
  32135. * @category String
  32136. * @param {string} [string=''] The string to convert.
  32137. * @returns {string} Returns the converted string.
  32138. * @example
  32139. *
  32140. * _.upperFirst('fred');
  32141. * // => 'Fred'
  32142. *
  32143. * _.upperFirst('FRED');
  32144. * // => 'FRED'
  32145. */
  32146. var upperFirst = createCaseFirst('toUpperCase');
  32147. /**
  32148. * Splits `string` into an array of its words.
  32149. *
  32150. * @static
  32151. * @memberOf _
  32152. * @since 3.0.0
  32153. * @category String
  32154. * @param {string} [string=''] The string to inspect.
  32155. * @param {RegExp|string} [pattern] The pattern to match words.
  32156. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32157. * @returns {Array} Returns the words of `string`.
  32158. * @example
  32159. *
  32160. * _.words('fred, barney, & pebbles');
  32161. * // => ['fred', 'barney', 'pebbles']
  32162. *
  32163. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32164. * // => ['fred', 'barney', '&', 'pebbles']
  32165. */
  32166. function words(string, pattern, guard) {
  32167. string = toString(string);
  32168. pattern = guard ? undefined : pattern;
  32169. if (pattern === undefined) {
  32170. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32171. }
  32172. return string.match(pattern) || [];
  32173. }
  32174. /*------------------------------------------------------------------------*/
  32175. /**
  32176. * Attempts to invoke `func`, returning either the result or the caught error
  32177. * object. Any additional arguments are provided to `func` when it's invoked.
  32178. *
  32179. * @static
  32180. * @memberOf _
  32181. * @since 3.0.0
  32182. * @category Util
  32183. * @param {Function} func The function to attempt.
  32184. * @param {...*} [args] The arguments to invoke `func` with.
  32185. * @returns {*} Returns the `func` result or error object.
  32186. * @example
  32187. *
  32188. * // Avoid throwing errors for invalid selectors.
  32189. * var elements = _.attempt(function(selector) {
  32190. * return document.querySelectorAll(selector);
  32191. * }, '>_>');
  32192. *
  32193. * if (_.isError(elements)) {
  32194. * elements = [];
  32195. * }
  32196. */
  32197. var attempt = baseRest(function(func, args) {
  32198. try {
  32199. return apply(func, undefined, args);
  32200. } catch (e) {
  32201. return isError(e) ? e : new Error(e);
  32202. }
  32203. });
  32204. /**
  32205. * Binds methods of an object to the object itself, overwriting the existing
  32206. * method.
  32207. *
  32208. * **Note:** This method doesn't set the "length" property of bound functions.
  32209. *
  32210. * @static
  32211. * @since 0.1.0
  32212. * @memberOf _
  32213. * @category Util
  32214. * @param {Object} object The object to bind and assign the bound methods to.
  32215. * @param {...(string|string[])} methodNames The object method names to bind.
  32216. * @returns {Object} Returns `object`.
  32217. * @example
  32218. *
  32219. * var view = {
  32220. * 'label': 'docs',
  32221. * 'click': function() {
  32222. * console.log('clicked ' + this.label);
  32223. * }
  32224. * };
  32225. *
  32226. * _.bindAll(view, ['click']);
  32227. * jQuery(element).on('click', view.click);
  32228. * // => Logs 'clicked docs' when clicked.
  32229. */
  32230. var bindAll = flatRest(function(object, methodNames) {
  32231. arrayEach(methodNames, function(key) {
  32232. key = toKey(key);
  32233. baseAssignValue(object, key, bind(object[key], object));
  32234. });
  32235. return object;
  32236. });
  32237. /**
  32238. * Creates a function that iterates over `pairs` and invokes the corresponding
  32239. * function of the first predicate to return truthy. The predicate-function
  32240. * pairs are invoked with the `this` binding and arguments of the created
  32241. * function.
  32242. *
  32243. * @static
  32244. * @memberOf _
  32245. * @since 4.0.0
  32246. * @category Util
  32247. * @param {Array} pairs The predicate-function pairs.
  32248. * @returns {Function} Returns the new composite function.
  32249. * @example
  32250. *
  32251. * var func = _.cond([
  32252. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32253. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32254. * [_.stubTrue, _.constant('no match')]
  32255. * ]);
  32256. *
  32257. * func({ 'a': 1, 'b': 2 });
  32258. * // => 'matches A'
  32259. *
  32260. * func({ 'a': 0, 'b': 1 });
  32261. * // => 'matches B'
  32262. *
  32263. * func({ 'a': '1', 'b': '2' });
  32264. * // => 'no match'
  32265. */
  32266. function cond(pairs) {
  32267. var length = pairs == null ? 0 : pairs.length,
  32268. toIteratee = getIteratee();
  32269. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32270. if (typeof pair[1] != 'function') {
  32271. throw new TypeError(FUNC_ERROR_TEXT);
  32272. }
  32273. return [toIteratee(pair[0]), pair[1]];
  32274. });
  32275. return baseRest(function(args) {
  32276. var index = -1;
  32277. while (++index < length) {
  32278. var pair = pairs[index];
  32279. if (apply(pair[0], this, args)) {
  32280. return apply(pair[1], this, args);
  32281. }
  32282. }
  32283. });
  32284. }
  32285. /**
  32286. * Creates a function that invokes the predicate properties of `source` with
  32287. * the corresponding property values of a given object, returning `true` if
  32288. * all predicates return truthy, else `false`.
  32289. *
  32290. * **Note:** The created function is equivalent to `_.conformsTo` with
  32291. * `source` partially applied.
  32292. *
  32293. * @static
  32294. * @memberOf _
  32295. * @since 4.0.0
  32296. * @category Util
  32297. * @param {Object} source The object of property predicates to conform to.
  32298. * @returns {Function} Returns the new spec function.
  32299. * @example
  32300. *
  32301. * var objects = [
  32302. * { 'a': 2, 'b': 1 },
  32303. * { 'a': 1, 'b': 2 }
  32304. * ];
  32305. *
  32306. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32307. * // => [{ 'a': 1, 'b': 2 }]
  32308. */
  32309. function conforms(source) {
  32310. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32311. }
  32312. /**
  32313. * Creates a function that returns `value`.
  32314. *
  32315. * @static
  32316. * @memberOf _
  32317. * @since 2.4.0
  32318. * @category Util
  32319. * @param {*} value The value to return from the new function.
  32320. * @returns {Function} Returns the new constant function.
  32321. * @example
  32322. *
  32323. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32324. *
  32325. * console.log(objects);
  32326. * // => [{ 'a': 1 }, { 'a': 1 }]
  32327. *
  32328. * console.log(objects[0] === objects[1]);
  32329. * // => true
  32330. */
  32331. function constant(value) {
  32332. return function() {
  32333. return value;
  32334. };
  32335. }
  32336. /**
  32337. * Checks `value` to determine whether a default value should be returned in
  32338. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32339. * or `undefined`.
  32340. *
  32341. * @static
  32342. * @memberOf _
  32343. * @since 4.14.0
  32344. * @category Util
  32345. * @param {*} value The value to check.
  32346. * @param {*} defaultValue The default value.
  32347. * @returns {*} Returns the resolved value.
  32348. * @example
  32349. *
  32350. * _.defaultTo(1, 10);
  32351. * // => 1
  32352. *
  32353. * _.defaultTo(undefined, 10);
  32354. * // => 10
  32355. */
  32356. function defaultTo(value, defaultValue) {
  32357. return (value == null || value !== value) ? defaultValue : value;
  32358. }
  32359. /**
  32360. * Creates a function that returns the result of invoking the given functions
  32361. * with the `this` binding of the created function, where each successive
  32362. * invocation is supplied the return value of the previous.
  32363. *
  32364. * @static
  32365. * @memberOf _
  32366. * @since 3.0.0
  32367. * @category Util
  32368. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32369. * @returns {Function} Returns the new composite function.
  32370. * @see _.flowRight
  32371. * @example
  32372. *
  32373. * function square(n) {
  32374. * return n * n;
  32375. * }
  32376. *
  32377. * var addSquare = _.flow([_.add, square]);
  32378. * addSquare(1, 2);
  32379. * // => 9
  32380. */
  32381. var flow = createFlow();
  32382. /**
  32383. * This method is like `_.flow` except that it creates a function that
  32384. * invokes the given functions from right to left.
  32385. *
  32386. * @static
  32387. * @since 3.0.0
  32388. * @memberOf _
  32389. * @category Util
  32390. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32391. * @returns {Function} Returns the new composite function.
  32392. * @see _.flow
  32393. * @example
  32394. *
  32395. * function square(n) {
  32396. * return n * n;
  32397. * }
  32398. *
  32399. * var addSquare = _.flowRight([square, _.add]);
  32400. * addSquare(1, 2);
  32401. * // => 9
  32402. */
  32403. var flowRight = createFlow(true);
  32404. /**
  32405. * This method returns the first argument it receives.
  32406. *
  32407. * @static
  32408. * @since 0.1.0
  32409. * @memberOf _
  32410. * @category Util
  32411. * @param {*} value Any value.
  32412. * @returns {*} Returns `value`.
  32413. * @example
  32414. *
  32415. * var object = { 'a': 1 };
  32416. *
  32417. * console.log(_.identity(object) === object);
  32418. * // => true
  32419. */
  32420. function identity(value) {
  32421. return value;
  32422. }
  32423. /**
  32424. * Creates a function that invokes `func` with the arguments of the created
  32425. * function. If `func` is a property name, the created function returns the
  32426. * property value for a given element. If `func` is an array or object, the
  32427. * created function returns `true` for elements that contain the equivalent
  32428. * source properties, otherwise it returns `false`.
  32429. *
  32430. * @static
  32431. * @since 4.0.0
  32432. * @memberOf _
  32433. * @category Util
  32434. * @param {*} [func=_.identity] The value to convert to a callback.
  32435. * @returns {Function} Returns the callback.
  32436. * @example
  32437. *
  32438. * var users = [
  32439. * { 'user': 'barney', 'age': 36, 'active': true },
  32440. * { 'user': 'fred', 'age': 40, 'active': false }
  32441. * ];
  32442. *
  32443. * // The `_.matches` iteratee shorthand.
  32444. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32445. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32446. *
  32447. * // The `_.matchesProperty` iteratee shorthand.
  32448. * _.filter(users, _.iteratee(['user', 'fred']));
  32449. * // => [{ 'user': 'fred', 'age': 40 }]
  32450. *
  32451. * // The `_.property` iteratee shorthand.
  32452. * _.map(users, _.iteratee('user'));
  32453. * // => ['barney', 'fred']
  32454. *
  32455. * // Create custom iteratee shorthands.
  32456. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32457. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32458. * return func.test(string);
  32459. * };
  32460. * });
  32461. *
  32462. * _.filter(['abc', 'def'], /ef/);
  32463. * // => ['def']
  32464. */
  32465. function iteratee(func) {
  32466. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32467. }
  32468. /**
  32469. * Creates a function that performs a partial deep comparison between a given
  32470. * object and `source`, returning `true` if the given object has equivalent
  32471. * property values, else `false`.
  32472. *
  32473. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32474. * partially applied.
  32475. *
  32476. * Partial comparisons will match empty array and empty object `source`
  32477. * values against any array or object value, respectively. See `_.isEqual`
  32478. * for a list of supported value comparisons.
  32479. *
  32480. * @static
  32481. * @memberOf _
  32482. * @since 3.0.0
  32483. * @category Util
  32484. * @param {Object} source The object of property values to match.
  32485. * @returns {Function} Returns the new spec function.
  32486. * @example
  32487. *
  32488. * var objects = [
  32489. * { 'a': 1, 'b': 2, 'c': 3 },
  32490. * { 'a': 4, 'b': 5, 'c': 6 }
  32491. * ];
  32492. *
  32493. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32494. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32495. */
  32496. function matches(source) {
  32497. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32498. }
  32499. /**
  32500. * Creates a function that performs a partial deep comparison between the
  32501. * value at `path` of a given object to `srcValue`, returning `true` if the
  32502. * object value is equivalent, else `false`.
  32503. *
  32504. * **Note:** Partial comparisons will match empty array and empty object
  32505. * `srcValue` values against any array or object value, respectively. See
  32506. * `_.isEqual` for a list of supported value comparisons.
  32507. *
  32508. * @static
  32509. * @memberOf _
  32510. * @since 3.2.0
  32511. * @category Util
  32512. * @param {Array|string} path The path of the property to get.
  32513. * @param {*} srcValue The value to match.
  32514. * @returns {Function} Returns the new spec function.
  32515. * @example
  32516. *
  32517. * var objects = [
  32518. * { 'a': 1, 'b': 2, 'c': 3 },
  32519. * { 'a': 4, 'b': 5, 'c': 6 }
  32520. * ];
  32521. *
  32522. * _.find(objects, _.matchesProperty('a', 4));
  32523. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32524. */
  32525. function matchesProperty(path, srcValue) {
  32526. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32527. }
  32528. /**
  32529. * Creates a function that invokes the method at `path` of a given object.
  32530. * Any additional arguments are provided to the invoked method.
  32531. *
  32532. * @static
  32533. * @memberOf _
  32534. * @since 3.7.0
  32535. * @category Util
  32536. * @param {Array|string} path The path of the method to invoke.
  32537. * @param {...*} [args] The arguments to invoke the method with.
  32538. * @returns {Function} Returns the new invoker function.
  32539. * @example
  32540. *
  32541. * var objects = [
  32542. * { 'a': { 'b': _.constant(2) } },
  32543. * { 'a': { 'b': _.constant(1) } }
  32544. * ];
  32545. *
  32546. * _.map(objects, _.method('a.b'));
  32547. * // => [2, 1]
  32548. *
  32549. * _.map(objects, _.method(['a', 'b']));
  32550. * // => [2, 1]
  32551. */
  32552. var method = baseRest(function(path, args) {
  32553. return function(object) {
  32554. return baseInvoke(object, path, args);
  32555. };
  32556. });
  32557. /**
  32558. * The opposite of `_.method`; this method creates a function that invokes
  32559. * the method at a given path of `object`. Any additional arguments are
  32560. * provided to the invoked method.
  32561. *
  32562. * @static
  32563. * @memberOf _
  32564. * @since 3.7.0
  32565. * @category Util
  32566. * @param {Object} object The object to query.
  32567. * @param {...*} [args] The arguments to invoke the method with.
  32568. * @returns {Function} Returns the new invoker function.
  32569. * @example
  32570. *
  32571. * var array = _.times(3, _.constant),
  32572. * object = { 'a': array, 'b': array, 'c': array };
  32573. *
  32574. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32575. * // => [2, 0]
  32576. *
  32577. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32578. * // => [2, 0]
  32579. */
  32580. var methodOf = baseRest(function(object, args) {
  32581. return function(path) {
  32582. return baseInvoke(object, path, args);
  32583. };
  32584. });
  32585. /**
  32586. * Adds all own enumerable string keyed function properties of a source
  32587. * object to the destination object. If `object` is a function, then methods
  32588. * are added to its prototype as well.
  32589. *
  32590. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32591. * avoid conflicts caused by modifying the original.
  32592. *
  32593. * @static
  32594. * @since 0.1.0
  32595. * @memberOf _
  32596. * @category Util
  32597. * @param {Function|Object} [object=lodash] The destination object.
  32598. * @param {Object} source The object of functions to add.
  32599. * @param {Object} [options={}] The options object.
  32600. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32601. * @returns {Function|Object} Returns `object`.
  32602. * @example
  32603. *
  32604. * function vowels(string) {
  32605. * return _.filter(string, function(v) {
  32606. * return /[aeiou]/i.test(v);
  32607. * });
  32608. * }
  32609. *
  32610. * _.mixin({ 'vowels': vowels });
  32611. * _.vowels('fred');
  32612. * // => ['e']
  32613. *
  32614. * _('fred').vowels().value();
  32615. * // => ['e']
  32616. *
  32617. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32618. * _('fred').vowels();
  32619. * // => ['e']
  32620. */
  32621. function mixin(object, source, options) {
  32622. var props = keys(source),
  32623. methodNames = baseFunctions(source, props);
  32624. if (options == null &&
  32625. !(isObject(source) && (methodNames.length || !props.length))) {
  32626. options = source;
  32627. source = object;
  32628. object = this;
  32629. methodNames = baseFunctions(source, keys(source));
  32630. }
  32631. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32632. isFunc = isFunction(object);
  32633. arrayEach(methodNames, function(methodName) {
  32634. var func = source[methodName];
  32635. object[methodName] = func;
  32636. if (isFunc) {
  32637. object.prototype[methodName] = function() {
  32638. var chainAll = this.__chain__;
  32639. if (chain || chainAll) {
  32640. var result = object(this.__wrapped__),
  32641. actions = result.__actions__ = copyArray(this.__actions__);
  32642. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32643. result.__chain__ = chainAll;
  32644. return result;
  32645. }
  32646. return func.apply(object, arrayPush([this.value()], arguments));
  32647. };
  32648. }
  32649. });
  32650. return object;
  32651. }
  32652. /**
  32653. * Reverts the `_` variable to its previous value and returns a reference to
  32654. * the `lodash` function.
  32655. *
  32656. * @static
  32657. * @since 0.1.0
  32658. * @memberOf _
  32659. * @category Util
  32660. * @returns {Function} Returns the `lodash` function.
  32661. * @example
  32662. *
  32663. * var lodash = _.noConflict();
  32664. */
  32665. function noConflict() {
  32666. if (root._ === this) {
  32667. root._ = oldDash;
  32668. }
  32669. return this;
  32670. }
  32671. /**
  32672. * This method returns `undefined`.
  32673. *
  32674. * @static
  32675. * @memberOf _
  32676. * @since 2.3.0
  32677. * @category Util
  32678. * @example
  32679. *
  32680. * _.times(2, _.noop);
  32681. * // => [undefined, undefined]
  32682. */
  32683. function noop() {
  32684. // No operation performed.
  32685. }
  32686. /**
  32687. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32688. * the nth argument from the end is returned.
  32689. *
  32690. * @static
  32691. * @memberOf _
  32692. * @since 4.0.0
  32693. * @category Util
  32694. * @param {number} [n=0] The index of the argument to return.
  32695. * @returns {Function} Returns the new pass-thru function.
  32696. * @example
  32697. *
  32698. * var func = _.nthArg(1);
  32699. * func('a', 'b', 'c', 'd');
  32700. * // => 'b'
  32701. *
  32702. * var func = _.nthArg(-2);
  32703. * func('a', 'b', 'c', 'd');
  32704. * // => 'c'
  32705. */
  32706. function nthArg(n) {
  32707. n = toInteger(n);
  32708. return baseRest(function(args) {
  32709. return baseNth(args, n);
  32710. });
  32711. }
  32712. /**
  32713. * Creates a function that invokes `iteratees` with the arguments it receives
  32714. * and returns their results.
  32715. *
  32716. * @static
  32717. * @memberOf _
  32718. * @since 4.0.0
  32719. * @category Util
  32720. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32721. * The iteratees to invoke.
  32722. * @returns {Function} Returns the new function.
  32723. * @example
  32724. *
  32725. * var func = _.over([Math.max, Math.min]);
  32726. *
  32727. * func(1, 2, 3, 4);
  32728. * // => [4, 1]
  32729. */
  32730. var over = createOver(arrayMap);
  32731. /**
  32732. * Creates a function that checks if **all** of the `predicates` return
  32733. * truthy when invoked with the arguments it receives.
  32734. *
  32735. * @static
  32736. * @memberOf _
  32737. * @since 4.0.0
  32738. * @category Util
  32739. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32740. * The predicates to check.
  32741. * @returns {Function} Returns the new function.
  32742. * @example
  32743. *
  32744. * var func = _.overEvery([Boolean, isFinite]);
  32745. *
  32746. * func('1');
  32747. * // => true
  32748. *
  32749. * func(null);
  32750. * // => false
  32751. *
  32752. * func(NaN);
  32753. * // => false
  32754. */
  32755. var overEvery = createOver(arrayEvery);
  32756. /**
  32757. * Creates a function that checks if **any** of the `predicates` return
  32758. * truthy when invoked with the arguments it receives.
  32759. *
  32760. * @static
  32761. * @memberOf _
  32762. * @since 4.0.0
  32763. * @category Util
  32764. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32765. * The predicates to check.
  32766. * @returns {Function} Returns the new function.
  32767. * @example
  32768. *
  32769. * var func = _.overSome([Boolean, isFinite]);
  32770. *
  32771. * func('1');
  32772. * // => true
  32773. *
  32774. * func(null);
  32775. * // => true
  32776. *
  32777. * func(NaN);
  32778. * // => false
  32779. */
  32780. var overSome = createOver(arraySome);
  32781. /**
  32782. * Creates a function that returns the value at `path` of a given object.
  32783. *
  32784. * @static
  32785. * @memberOf _
  32786. * @since 2.4.0
  32787. * @category Util
  32788. * @param {Array|string} path The path of the property to get.
  32789. * @returns {Function} Returns the new accessor function.
  32790. * @example
  32791. *
  32792. * var objects = [
  32793. * { 'a': { 'b': 2 } },
  32794. * { 'a': { 'b': 1 } }
  32795. * ];
  32796. *
  32797. * _.map(objects, _.property('a.b'));
  32798. * // => [2, 1]
  32799. *
  32800. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32801. * // => [1, 2]
  32802. */
  32803. function property(path) {
  32804. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32805. }
  32806. /**
  32807. * The opposite of `_.property`; this method creates a function that returns
  32808. * the value at a given path of `object`.
  32809. *
  32810. * @static
  32811. * @memberOf _
  32812. * @since 3.0.0
  32813. * @category Util
  32814. * @param {Object} object The object to query.
  32815. * @returns {Function} Returns the new accessor function.
  32816. * @example
  32817. *
  32818. * var array = [0, 1, 2],
  32819. * object = { 'a': array, 'b': array, 'c': array };
  32820. *
  32821. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32822. * // => [2, 0]
  32823. *
  32824. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32825. * // => [2, 0]
  32826. */
  32827. function propertyOf(object) {
  32828. return function(path) {
  32829. return object == null ? undefined : baseGet(object, path);
  32830. };
  32831. }
  32832. /**
  32833. * Creates an array of numbers (positive and/or negative) progressing from
  32834. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32835. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32836. * it's set to `start` with `start` then set to `0`.
  32837. *
  32838. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32839. * floating-point values which can produce unexpected results.
  32840. *
  32841. * @static
  32842. * @since 0.1.0
  32843. * @memberOf _
  32844. * @category Util
  32845. * @param {number} [start=0] The start of the range.
  32846. * @param {number} end The end of the range.
  32847. * @param {number} [step=1] The value to increment or decrement by.
  32848. * @returns {Array} Returns the range of numbers.
  32849. * @see _.inRange, _.rangeRight
  32850. * @example
  32851. *
  32852. * _.range(4);
  32853. * // => [0, 1, 2, 3]
  32854. *
  32855. * _.range(-4);
  32856. * // => [0, -1, -2, -3]
  32857. *
  32858. * _.range(1, 5);
  32859. * // => [1, 2, 3, 4]
  32860. *
  32861. * _.range(0, 20, 5);
  32862. * // => [0, 5, 10, 15]
  32863. *
  32864. * _.range(0, -4, -1);
  32865. * // => [0, -1, -2, -3]
  32866. *
  32867. * _.range(1, 4, 0);
  32868. * // => [1, 1, 1]
  32869. *
  32870. * _.range(0);
  32871. * // => []
  32872. */
  32873. var range = createRange();
  32874. /**
  32875. * This method is like `_.range` except that it populates values in
  32876. * descending order.
  32877. *
  32878. * @static
  32879. * @memberOf _
  32880. * @since 4.0.0
  32881. * @category Util
  32882. * @param {number} [start=0] The start of the range.
  32883. * @param {number} end The end of the range.
  32884. * @param {number} [step=1] The value to increment or decrement by.
  32885. * @returns {Array} Returns the range of numbers.
  32886. * @see _.inRange, _.range
  32887. * @example
  32888. *
  32889. * _.rangeRight(4);
  32890. * // => [3, 2, 1, 0]
  32891. *
  32892. * _.rangeRight(-4);
  32893. * // => [-3, -2, -1, 0]
  32894. *
  32895. * _.rangeRight(1, 5);
  32896. * // => [4, 3, 2, 1]
  32897. *
  32898. * _.rangeRight(0, 20, 5);
  32899. * // => [15, 10, 5, 0]
  32900. *
  32901. * _.rangeRight(0, -4, -1);
  32902. * // => [-3, -2, -1, 0]
  32903. *
  32904. * _.rangeRight(1, 4, 0);
  32905. * // => [1, 1, 1]
  32906. *
  32907. * _.rangeRight(0);
  32908. * // => []
  32909. */
  32910. var rangeRight = createRange(true);
  32911. /**
  32912. * This method returns a new empty array.
  32913. *
  32914. * @static
  32915. * @memberOf _
  32916. * @since 4.13.0
  32917. * @category Util
  32918. * @returns {Array} Returns the new empty array.
  32919. * @example
  32920. *
  32921. * var arrays = _.times(2, _.stubArray);
  32922. *
  32923. * console.log(arrays);
  32924. * // => [[], []]
  32925. *
  32926. * console.log(arrays[0] === arrays[1]);
  32927. * // => false
  32928. */
  32929. function stubArray() {
  32930. return [];
  32931. }
  32932. /**
  32933. * This method returns `false`.
  32934. *
  32935. * @static
  32936. * @memberOf _
  32937. * @since 4.13.0
  32938. * @category Util
  32939. * @returns {boolean} Returns `false`.
  32940. * @example
  32941. *
  32942. * _.times(2, _.stubFalse);
  32943. * // => [false, false]
  32944. */
  32945. function stubFalse() {
  32946. return false;
  32947. }
  32948. /**
  32949. * This method returns a new empty object.
  32950. *
  32951. * @static
  32952. * @memberOf _
  32953. * @since 4.13.0
  32954. * @category Util
  32955. * @returns {Object} Returns the new empty object.
  32956. * @example
  32957. *
  32958. * var objects = _.times(2, _.stubObject);
  32959. *
  32960. * console.log(objects);
  32961. * // => [{}, {}]
  32962. *
  32963. * console.log(objects[0] === objects[1]);
  32964. * // => false
  32965. */
  32966. function stubObject() {
  32967. return {};
  32968. }
  32969. /**
  32970. * This method returns an empty string.
  32971. *
  32972. * @static
  32973. * @memberOf _
  32974. * @since 4.13.0
  32975. * @category Util
  32976. * @returns {string} Returns the empty string.
  32977. * @example
  32978. *
  32979. * _.times(2, _.stubString);
  32980. * // => ['', '']
  32981. */
  32982. function stubString() {
  32983. return '';
  32984. }
  32985. /**
  32986. * This method returns `true`.
  32987. *
  32988. * @static
  32989. * @memberOf _
  32990. * @since 4.13.0
  32991. * @category Util
  32992. * @returns {boolean} Returns `true`.
  32993. * @example
  32994. *
  32995. * _.times(2, _.stubTrue);
  32996. * // => [true, true]
  32997. */
  32998. function stubTrue() {
  32999. return true;
  33000. }
  33001. /**
  33002. * Invokes the iteratee `n` times, returning an array of the results of
  33003. * each invocation. The iteratee is invoked with one argument; (index).
  33004. *
  33005. * @static
  33006. * @since 0.1.0
  33007. * @memberOf _
  33008. * @category Util
  33009. * @param {number} n The number of times to invoke `iteratee`.
  33010. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33011. * @returns {Array} Returns the array of results.
  33012. * @example
  33013. *
  33014. * _.times(3, String);
  33015. * // => ['0', '1', '2']
  33016. *
  33017. * _.times(4, _.constant(0));
  33018. * // => [0, 0, 0, 0]
  33019. */
  33020. function times(n, iteratee) {
  33021. n = toInteger(n);
  33022. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33023. return [];
  33024. }
  33025. var index = MAX_ARRAY_LENGTH,
  33026. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33027. iteratee = getIteratee(iteratee);
  33028. n -= MAX_ARRAY_LENGTH;
  33029. var result = baseTimes(length, iteratee);
  33030. while (++index < n) {
  33031. iteratee(index);
  33032. }
  33033. return result;
  33034. }
  33035. /**
  33036. * Converts `value` to a property path array.
  33037. *
  33038. * @static
  33039. * @memberOf _
  33040. * @since 4.0.0
  33041. * @category Util
  33042. * @param {*} value The value to convert.
  33043. * @returns {Array} Returns the new property path array.
  33044. * @example
  33045. *
  33046. * _.toPath('a.b.c');
  33047. * // => ['a', 'b', 'c']
  33048. *
  33049. * _.toPath('a[0].b.c');
  33050. * // => ['a', '0', 'b', 'c']
  33051. */
  33052. function toPath(value) {
  33053. if (isArray(value)) {
  33054. return arrayMap(value, toKey);
  33055. }
  33056. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33057. }
  33058. /**
  33059. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33060. *
  33061. * @static
  33062. * @since 0.1.0
  33063. * @memberOf _
  33064. * @category Util
  33065. * @param {string} [prefix=''] The value to prefix the ID with.
  33066. * @returns {string} Returns the unique ID.
  33067. * @example
  33068. *
  33069. * _.uniqueId('contact_');
  33070. * // => 'contact_104'
  33071. *
  33072. * _.uniqueId();
  33073. * // => '105'
  33074. */
  33075. function uniqueId(prefix) {
  33076. var id = ++idCounter;
  33077. return toString(prefix) + id;
  33078. }
  33079. /*------------------------------------------------------------------------*/
  33080. /**
  33081. * Adds two numbers.
  33082. *
  33083. * @static
  33084. * @memberOf _
  33085. * @since 3.4.0
  33086. * @category Math
  33087. * @param {number} augend The first number in an addition.
  33088. * @param {number} addend The second number in an addition.
  33089. * @returns {number} Returns the total.
  33090. * @example
  33091. *
  33092. * _.add(6, 4);
  33093. * // => 10
  33094. */
  33095. var add = createMathOperation(function(augend, addend) {
  33096. return augend + addend;
  33097. }, 0);
  33098. /**
  33099. * Computes `number` rounded up to `precision`.
  33100. *
  33101. * @static
  33102. * @memberOf _
  33103. * @since 3.10.0
  33104. * @category Math
  33105. * @param {number} number The number to round up.
  33106. * @param {number} [precision=0] The precision to round up to.
  33107. * @returns {number} Returns the rounded up number.
  33108. * @example
  33109. *
  33110. * _.ceil(4.006);
  33111. * // => 5
  33112. *
  33113. * _.ceil(6.004, 2);
  33114. * // => 6.01
  33115. *
  33116. * _.ceil(6040, -2);
  33117. * // => 6100
  33118. */
  33119. var ceil = createRound('ceil');
  33120. /**
  33121. * Divide two numbers.
  33122. *
  33123. * @static
  33124. * @memberOf _
  33125. * @since 4.7.0
  33126. * @category Math
  33127. * @param {number} dividend The first number in a division.
  33128. * @param {number} divisor The second number in a division.
  33129. * @returns {number} Returns the quotient.
  33130. * @example
  33131. *
  33132. * _.divide(6, 4);
  33133. * // => 1.5
  33134. */
  33135. var divide = createMathOperation(function(dividend, divisor) {
  33136. return dividend / divisor;
  33137. }, 1);
  33138. /**
  33139. * Computes `number` rounded down to `precision`.
  33140. *
  33141. * @static
  33142. * @memberOf _
  33143. * @since 3.10.0
  33144. * @category Math
  33145. * @param {number} number The number to round down.
  33146. * @param {number} [precision=0] The precision to round down to.
  33147. * @returns {number} Returns the rounded down number.
  33148. * @example
  33149. *
  33150. * _.floor(4.006);
  33151. * // => 4
  33152. *
  33153. * _.floor(0.046, 2);
  33154. * // => 0.04
  33155. *
  33156. * _.floor(4060, -2);
  33157. * // => 4000
  33158. */
  33159. var floor = createRound('floor');
  33160. /**
  33161. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33162. * `undefined` is returned.
  33163. *
  33164. * @static
  33165. * @since 0.1.0
  33166. * @memberOf _
  33167. * @category Math
  33168. * @param {Array} array The array to iterate over.
  33169. * @returns {*} Returns the maximum value.
  33170. * @example
  33171. *
  33172. * _.max([4, 2, 8, 6]);
  33173. * // => 8
  33174. *
  33175. * _.max([]);
  33176. * // => undefined
  33177. */
  33178. function max(array) {
  33179. return (array && array.length)
  33180. ? baseExtremum(array, identity, baseGt)
  33181. : undefined;
  33182. }
  33183. /**
  33184. * This method is like `_.max` except that it accepts `iteratee` which is
  33185. * invoked for each element in `array` to generate the criterion by which
  33186. * the value is ranked. The iteratee is invoked with one argument: (value).
  33187. *
  33188. * @static
  33189. * @memberOf _
  33190. * @since 4.0.0
  33191. * @category Math
  33192. * @param {Array} array The array to iterate over.
  33193. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33194. * @returns {*} Returns the maximum value.
  33195. * @example
  33196. *
  33197. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33198. *
  33199. * _.maxBy(objects, function(o) { return o.n; });
  33200. * // => { 'n': 2 }
  33201. *
  33202. * // The `_.property` iteratee shorthand.
  33203. * _.maxBy(objects, 'n');
  33204. * // => { 'n': 2 }
  33205. */
  33206. function maxBy(array, iteratee) {
  33207. return (array && array.length)
  33208. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33209. : undefined;
  33210. }
  33211. /**
  33212. * Computes the mean of the values in `array`.
  33213. *
  33214. * @static
  33215. * @memberOf _
  33216. * @since 4.0.0
  33217. * @category Math
  33218. * @param {Array} array The array to iterate over.
  33219. * @returns {number} Returns the mean.
  33220. * @example
  33221. *
  33222. * _.mean([4, 2, 8, 6]);
  33223. * // => 5
  33224. */
  33225. function mean(array) {
  33226. return baseMean(array, identity);
  33227. }
  33228. /**
  33229. * This method is like `_.mean` except that it accepts `iteratee` which is
  33230. * invoked for each element in `array` to generate the value to be averaged.
  33231. * The iteratee is invoked with one argument: (value).
  33232. *
  33233. * @static
  33234. * @memberOf _
  33235. * @since 4.7.0
  33236. * @category Math
  33237. * @param {Array} array The array to iterate over.
  33238. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33239. * @returns {number} Returns the mean.
  33240. * @example
  33241. *
  33242. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33243. *
  33244. * _.meanBy(objects, function(o) { return o.n; });
  33245. * // => 5
  33246. *
  33247. * // The `_.property` iteratee shorthand.
  33248. * _.meanBy(objects, 'n');
  33249. * // => 5
  33250. */
  33251. function meanBy(array, iteratee) {
  33252. return baseMean(array, getIteratee(iteratee, 2));
  33253. }
  33254. /**
  33255. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33256. * `undefined` is returned.
  33257. *
  33258. * @static
  33259. * @since 0.1.0
  33260. * @memberOf _
  33261. * @category Math
  33262. * @param {Array} array The array to iterate over.
  33263. * @returns {*} Returns the minimum value.
  33264. * @example
  33265. *
  33266. * _.min([4, 2, 8, 6]);
  33267. * // => 2
  33268. *
  33269. * _.min([]);
  33270. * // => undefined
  33271. */
  33272. function min(array) {
  33273. return (array && array.length)
  33274. ? baseExtremum(array, identity, baseLt)
  33275. : undefined;
  33276. }
  33277. /**
  33278. * This method is like `_.min` except that it accepts `iteratee` which is
  33279. * invoked for each element in `array` to generate the criterion by which
  33280. * the value is ranked. The iteratee is invoked with one argument: (value).
  33281. *
  33282. * @static
  33283. * @memberOf _
  33284. * @since 4.0.0
  33285. * @category Math
  33286. * @param {Array} array The array to iterate over.
  33287. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33288. * @returns {*} Returns the minimum value.
  33289. * @example
  33290. *
  33291. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33292. *
  33293. * _.minBy(objects, function(o) { return o.n; });
  33294. * // => { 'n': 1 }
  33295. *
  33296. * // The `_.property` iteratee shorthand.
  33297. * _.minBy(objects, 'n');
  33298. * // => { 'n': 1 }
  33299. */
  33300. function minBy(array, iteratee) {
  33301. return (array && array.length)
  33302. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33303. : undefined;
  33304. }
  33305. /**
  33306. * Multiply two numbers.
  33307. *
  33308. * @static
  33309. * @memberOf _
  33310. * @since 4.7.0
  33311. * @category Math
  33312. * @param {number} multiplier The first number in a multiplication.
  33313. * @param {number} multiplicand The second number in a multiplication.
  33314. * @returns {number} Returns the product.
  33315. * @example
  33316. *
  33317. * _.multiply(6, 4);
  33318. * // => 24
  33319. */
  33320. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33321. return multiplier * multiplicand;
  33322. }, 1);
  33323. /**
  33324. * Computes `number` rounded to `precision`.
  33325. *
  33326. * @static
  33327. * @memberOf _
  33328. * @since 3.10.0
  33329. * @category Math
  33330. * @param {number} number The number to round.
  33331. * @param {number} [precision=0] The precision to round to.
  33332. * @returns {number} Returns the rounded number.
  33333. * @example
  33334. *
  33335. * _.round(4.006);
  33336. * // => 4
  33337. *
  33338. * _.round(4.006, 2);
  33339. * // => 4.01
  33340. *
  33341. * _.round(4060, -2);
  33342. * // => 4100
  33343. */
  33344. var round = createRound('round');
  33345. /**
  33346. * Subtract two numbers.
  33347. *
  33348. * @static
  33349. * @memberOf _
  33350. * @since 4.0.0
  33351. * @category Math
  33352. * @param {number} minuend The first number in a subtraction.
  33353. * @param {number} subtrahend The second number in a subtraction.
  33354. * @returns {number} Returns the difference.
  33355. * @example
  33356. *
  33357. * _.subtract(6, 4);
  33358. * // => 2
  33359. */
  33360. var subtract = createMathOperation(function(minuend, subtrahend) {
  33361. return minuend - subtrahend;
  33362. }, 0);
  33363. /**
  33364. * Computes the sum of the values in `array`.
  33365. *
  33366. * @static
  33367. * @memberOf _
  33368. * @since 3.4.0
  33369. * @category Math
  33370. * @param {Array} array The array to iterate over.
  33371. * @returns {number} Returns the sum.
  33372. * @example
  33373. *
  33374. * _.sum([4, 2, 8, 6]);
  33375. * // => 20
  33376. */
  33377. function sum(array) {
  33378. return (array && array.length)
  33379. ? baseSum(array, identity)
  33380. : 0;
  33381. }
  33382. /**
  33383. * This method is like `_.sum` except that it accepts `iteratee` which is
  33384. * invoked for each element in `array` to generate the value to be summed.
  33385. * The iteratee is invoked with one argument: (value).
  33386. *
  33387. * @static
  33388. * @memberOf _
  33389. * @since 4.0.0
  33390. * @category Math
  33391. * @param {Array} array The array to iterate over.
  33392. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33393. * @returns {number} Returns the sum.
  33394. * @example
  33395. *
  33396. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33397. *
  33398. * _.sumBy(objects, function(o) { return o.n; });
  33399. * // => 20
  33400. *
  33401. * // The `_.property` iteratee shorthand.
  33402. * _.sumBy(objects, 'n');
  33403. * // => 20
  33404. */
  33405. function sumBy(array, iteratee) {
  33406. return (array && array.length)
  33407. ? baseSum(array, getIteratee(iteratee, 2))
  33408. : 0;
  33409. }
  33410. /*------------------------------------------------------------------------*/
  33411. // Add methods that return wrapped values in chain sequences.
  33412. lodash.after = after;
  33413. lodash.ary = ary;
  33414. lodash.assign = assign;
  33415. lodash.assignIn = assignIn;
  33416. lodash.assignInWith = assignInWith;
  33417. lodash.assignWith = assignWith;
  33418. lodash.at = at;
  33419. lodash.before = before;
  33420. lodash.bind = bind;
  33421. lodash.bindAll = bindAll;
  33422. lodash.bindKey = bindKey;
  33423. lodash.castArray = castArray;
  33424. lodash.chain = chain;
  33425. lodash.chunk = chunk;
  33426. lodash.compact = compact;
  33427. lodash.concat = concat;
  33428. lodash.cond = cond;
  33429. lodash.conforms = conforms;
  33430. lodash.constant = constant;
  33431. lodash.countBy = countBy;
  33432. lodash.create = create;
  33433. lodash.curry = curry;
  33434. lodash.curryRight = curryRight;
  33435. lodash.debounce = debounce;
  33436. lodash.defaults = defaults;
  33437. lodash.defaultsDeep = defaultsDeep;
  33438. lodash.defer = defer;
  33439. lodash.delay = delay;
  33440. lodash.difference = difference;
  33441. lodash.differenceBy = differenceBy;
  33442. lodash.differenceWith = differenceWith;
  33443. lodash.drop = drop;
  33444. lodash.dropRight = dropRight;
  33445. lodash.dropRightWhile = dropRightWhile;
  33446. lodash.dropWhile = dropWhile;
  33447. lodash.fill = fill;
  33448. lodash.filter = filter;
  33449. lodash.flatMap = flatMap;
  33450. lodash.flatMapDeep = flatMapDeep;
  33451. lodash.flatMapDepth = flatMapDepth;
  33452. lodash.flatten = flatten;
  33453. lodash.flattenDeep = flattenDeep;
  33454. lodash.flattenDepth = flattenDepth;
  33455. lodash.flip = flip;
  33456. lodash.flow = flow;
  33457. lodash.flowRight = flowRight;
  33458. lodash.fromPairs = fromPairs;
  33459. lodash.functions = functions;
  33460. lodash.functionsIn = functionsIn;
  33461. lodash.groupBy = groupBy;
  33462. lodash.initial = initial;
  33463. lodash.intersection = intersection;
  33464. lodash.intersectionBy = intersectionBy;
  33465. lodash.intersectionWith = intersectionWith;
  33466. lodash.invert = invert;
  33467. lodash.invertBy = invertBy;
  33468. lodash.invokeMap = invokeMap;
  33469. lodash.iteratee = iteratee;
  33470. lodash.keyBy = keyBy;
  33471. lodash.keys = keys;
  33472. lodash.keysIn = keysIn;
  33473. lodash.map = map;
  33474. lodash.mapKeys = mapKeys;
  33475. lodash.mapValues = mapValues;
  33476. lodash.matches = matches;
  33477. lodash.matchesProperty = matchesProperty;
  33478. lodash.memoize = memoize;
  33479. lodash.merge = merge;
  33480. lodash.mergeWith = mergeWith;
  33481. lodash.method = method;
  33482. lodash.methodOf = methodOf;
  33483. lodash.mixin = mixin;
  33484. lodash.negate = negate;
  33485. lodash.nthArg = nthArg;
  33486. lodash.omit = omit;
  33487. lodash.omitBy = omitBy;
  33488. lodash.once = once;
  33489. lodash.orderBy = orderBy;
  33490. lodash.over = over;
  33491. lodash.overArgs = overArgs;
  33492. lodash.overEvery = overEvery;
  33493. lodash.overSome = overSome;
  33494. lodash.partial = partial;
  33495. lodash.partialRight = partialRight;
  33496. lodash.partition = partition;
  33497. lodash.pick = pick;
  33498. lodash.pickBy = pickBy;
  33499. lodash.property = property;
  33500. lodash.propertyOf = propertyOf;
  33501. lodash.pull = pull;
  33502. lodash.pullAll = pullAll;
  33503. lodash.pullAllBy = pullAllBy;
  33504. lodash.pullAllWith = pullAllWith;
  33505. lodash.pullAt = pullAt;
  33506. lodash.range = range;
  33507. lodash.rangeRight = rangeRight;
  33508. lodash.rearg = rearg;
  33509. lodash.reject = reject;
  33510. lodash.remove = remove;
  33511. lodash.rest = rest;
  33512. lodash.reverse = reverse;
  33513. lodash.sampleSize = sampleSize;
  33514. lodash.set = set;
  33515. lodash.setWith = setWith;
  33516. lodash.shuffle = shuffle;
  33517. lodash.slice = slice;
  33518. lodash.sortBy = sortBy;
  33519. lodash.sortedUniq = sortedUniq;
  33520. lodash.sortedUniqBy = sortedUniqBy;
  33521. lodash.split = split;
  33522. lodash.spread = spread;
  33523. lodash.tail = tail;
  33524. lodash.take = take;
  33525. lodash.takeRight = takeRight;
  33526. lodash.takeRightWhile = takeRightWhile;
  33527. lodash.takeWhile = takeWhile;
  33528. lodash.tap = tap;
  33529. lodash.throttle = throttle;
  33530. lodash.thru = thru;
  33531. lodash.toArray = toArray;
  33532. lodash.toPairs = toPairs;
  33533. lodash.toPairsIn = toPairsIn;
  33534. lodash.toPath = toPath;
  33535. lodash.toPlainObject = toPlainObject;
  33536. lodash.transform = transform;
  33537. lodash.unary = unary;
  33538. lodash.union = union;
  33539. lodash.unionBy = unionBy;
  33540. lodash.unionWith = unionWith;
  33541. lodash.uniq = uniq;
  33542. lodash.uniqBy = uniqBy;
  33543. lodash.uniqWith = uniqWith;
  33544. lodash.unset = unset;
  33545. lodash.unzip = unzip;
  33546. lodash.unzipWith = unzipWith;
  33547. lodash.update = update;
  33548. lodash.updateWith = updateWith;
  33549. lodash.values = values;
  33550. lodash.valuesIn = valuesIn;
  33551. lodash.without = without;
  33552. lodash.words = words;
  33553. lodash.wrap = wrap;
  33554. lodash.xor = xor;
  33555. lodash.xorBy = xorBy;
  33556. lodash.xorWith = xorWith;
  33557. lodash.zip = zip;
  33558. lodash.zipObject = zipObject;
  33559. lodash.zipObjectDeep = zipObjectDeep;
  33560. lodash.zipWith = zipWith;
  33561. // Add aliases.
  33562. lodash.entries = toPairs;
  33563. lodash.entriesIn = toPairsIn;
  33564. lodash.extend = assignIn;
  33565. lodash.extendWith = assignInWith;
  33566. // Add methods to `lodash.prototype`.
  33567. mixin(lodash, lodash);
  33568. /*------------------------------------------------------------------------*/
  33569. // Add methods that return unwrapped values in chain sequences.
  33570. lodash.add = add;
  33571. lodash.attempt = attempt;
  33572. lodash.camelCase = camelCase;
  33573. lodash.capitalize = capitalize;
  33574. lodash.ceil = ceil;
  33575. lodash.clamp = clamp;
  33576. lodash.clone = clone;
  33577. lodash.cloneDeep = cloneDeep;
  33578. lodash.cloneDeepWith = cloneDeepWith;
  33579. lodash.cloneWith = cloneWith;
  33580. lodash.conformsTo = conformsTo;
  33581. lodash.deburr = deburr;
  33582. lodash.defaultTo = defaultTo;
  33583. lodash.divide = divide;
  33584. lodash.endsWith = endsWith;
  33585. lodash.eq = eq;
  33586. lodash.escape = escape;
  33587. lodash.escapeRegExp = escapeRegExp;
  33588. lodash.every = every;
  33589. lodash.find = find;
  33590. lodash.findIndex = findIndex;
  33591. lodash.findKey = findKey;
  33592. lodash.findLast = findLast;
  33593. lodash.findLastIndex = findLastIndex;
  33594. lodash.findLastKey = findLastKey;
  33595. lodash.floor = floor;
  33596. lodash.forEach = forEach;
  33597. lodash.forEachRight = forEachRight;
  33598. lodash.forIn = forIn;
  33599. lodash.forInRight = forInRight;
  33600. lodash.forOwn = forOwn;
  33601. lodash.forOwnRight = forOwnRight;
  33602. lodash.get = get;
  33603. lodash.gt = gt;
  33604. lodash.gte = gte;
  33605. lodash.has = has;
  33606. lodash.hasIn = hasIn;
  33607. lodash.head = head;
  33608. lodash.identity = identity;
  33609. lodash.includes = includes;
  33610. lodash.indexOf = indexOf;
  33611. lodash.inRange = inRange;
  33612. lodash.invoke = invoke;
  33613. lodash.isArguments = isArguments;
  33614. lodash.isArray = isArray;
  33615. lodash.isArrayBuffer = isArrayBuffer;
  33616. lodash.isArrayLike = isArrayLike;
  33617. lodash.isArrayLikeObject = isArrayLikeObject;
  33618. lodash.isBoolean = isBoolean;
  33619. lodash.isBuffer = isBuffer;
  33620. lodash.isDate = isDate;
  33621. lodash.isElement = isElement;
  33622. lodash.isEmpty = isEmpty;
  33623. lodash.isEqual = isEqual;
  33624. lodash.isEqualWith = isEqualWith;
  33625. lodash.isError = isError;
  33626. lodash.isFinite = isFinite;
  33627. lodash.isFunction = isFunction;
  33628. lodash.isInteger = isInteger;
  33629. lodash.isLength = isLength;
  33630. lodash.isMap = isMap;
  33631. lodash.isMatch = isMatch;
  33632. lodash.isMatchWith = isMatchWith;
  33633. lodash.isNaN = isNaN;
  33634. lodash.isNative = isNative;
  33635. lodash.isNil = isNil;
  33636. lodash.isNull = isNull;
  33637. lodash.isNumber = isNumber;
  33638. lodash.isObject = isObject;
  33639. lodash.isObjectLike = isObjectLike;
  33640. lodash.isPlainObject = isPlainObject;
  33641. lodash.isRegExp = isRegExp;
  33642. lodash.isSafeInteger = isSafeInteger;
  33643. lodash.isSet = isSet;
  33644. lodash.isString = isString;
  33645. lodash.isSymbol = isSymbol;
  33646. lodash.isTypedArray = isTypedArray;
  33647. lodash.isUndefined = isUndefined;
  33648. lodash.isWeakMap = isWeakMap;
  33649. lodash.isWeakSet = isWeakSet;
  33650. lodash.join = join;
  33651. lodash.kebabCase = kebabCase;
  33652. lodash.last = last;
  33653. lodash.lastIndexOf = lastIndexOf;
  33654. lodash.lowerCase = lowerCase;
  33655. lodash.lowerFirst = lowerFirst;
  33656. lodash.lt = lt;
  33657. lodash.lte = lte;
  33658. lodash.max = max;
  33659. lodash.maxBy = maxBy;
  33660. lodash.mean = mean;
  33661. lodash.meanBy = meanBy;
  33662. lodash.min = min;
  33663. lodash.minBy = minBy;
  33664. lodash.stubArray = stubArray;
  33665. lodash.stubFalse = stubFalse;
  33666. lodash.stubObject = stubObject;
  33667. lodash.stubString = stubString;
  33668. lodash.stubTrue = stubTrue;
  33669. lodash.multiply = multiply;
  33670. lodash.nth = nth;
  33671. lodash.noConflict = noConflict;
  33672. lodash.noop = noop;
  33673. lodash.now = now;
  33674. lodash.pad = pad;
  33675. lodash.padEnd = padEnd;
  33676. lodash.padStart = padStart;
  33677. lodash.parseInt = parseInt;
  33678. lodash.random = random;
  33679. lodash.reduce = reduce;
  33680. lodash.reduceRight = reduceRight;
  33681. lodash.repeat = repeat;
  33682. lodash.replace = replace;
  33683. lodash.result = result;
  33684. lodash.round = round;
  33685. lodash.runInContext = runInContext;
  33686. lodash.sample = sample;
  33687. lodash.size = size;
  33688. lodash.snakeCase = snakeCase;
  33689. lodash.some = some;
  33690. lodash.sortedIndex = sortedIndex;
  33691. lodash.sortedIndexBy = sortedIndexBy;
  33692. lodash.sortedIndexOf = sortedIndexOf;
  33693. lodash.sortedLastIndex = sortedLastIndex;
  33694. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33695. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33696. lodash.startCase = startCase;
  33697. lodash.startsWith = startsWith;
  33698. lodash.subtract = subtract;
  33699. lodash.sum = sum;
  33700. lodash.sumBy = sumBy;
  33701. lodash.template = template;
  33702. lodash.times = times;
  33703. lodash.toFinite = toFinite;
  33704. lodash.toInteger = toInteger;
  33705. lodash.toLength = toLength;
  33706. lodash.toLower = toLower;
  33707. lodash.toNumber = toNumber;
  33708. lodash.toSafeInteger = toSafeInteger;
  33709. lodash.toString = toString;
  33710. lodash.toUpper = toUpper;
  33711. lodash.trim = trim;
  33712. lodash.trimEnd = trimEnd;
  33713. lodash.trimStart = trimStart;
  33714. lodash.truncate = truncate;
  33715. lodash.unescape = unescape;
  33716. lodash.uniqueId = uniqueId;
  33717. lodash.upperCase = upperCase;
  33718. lodash.upperFirst = upperFirst;
  33719. // Add aliases.
  33720. lodash.each = forEach;
  33721. lodash.eachRight = forEachRight;
  33722. lodash.first = head;
  33723. mixin(lodash, (function() {
  33724. var source = {};
  33725. baseForOwn(lodash, function(func, methodName) {
  33726. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33727. source[methodName] = func;
  33728. }
  33729. });
  33730. return source;
  33731. }()), { 'chain': false });
  33732. /*------------------------------------------------------------------------*/
  33733. /**
  33734. * The semantic version number.
  33735. *
  33736. * @static
  33737. * @memberOf _
  33738. * @type {string}
  33739. */
  33740. lodash.VERSION = VERSION;
  33741. // Assign default placeholders.
  33742. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33743. lodash[methodName].placeholder = lodash;
  33744. });
  33745. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33746. arrayEach(['drop', 'take'], function(methodName, index) {
  33747. LazyWrapper.prototype[methodName] = function(n) {
  33748. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33749. var result = (this.__filtered__ && !index)
  33750. ? new LazyWrapper(this)
  33751. : this.clone();
  33752. if (result.__filtered__) {
  33753. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33754. } else {
  33755. result.__views__.push({
  33756. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33757. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33758. });
  33759. }
  33760. return result;
  33761. };
  33762. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33763. return this.reverse()[methodName](n).reverse();
  33764. };
  33765. });
  33766. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33767. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33768. var type = index + 1,
  33769. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33770. LazyWrapper.prototype[methodName] = function(iteratee) {
  33771. var result = this.clone();
  33772. result.__iteratees__.push({
  33773. 'iteratee': getIteratee(iteratee, 3),
  33774. 'type': type
  33775. });
  33776. result.__filtered__ = result.__filtered__ || isFilter;
  33777. return result;
  33778. };
  33779. });
  33780. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33781. arrayEach(['head', 'last'], function(methodName, index) {
  33782. var takeName = 'take' + (index ? 'Right' : '');
  33783. LazyWrapper.prototype[methodName] = function() {
  33784. return this[takeName](1).value()[0];
  33785. };
  33786. });
  33787. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33788. arrayEach(['initial', 'tail'], function(methodName, index) {
  33789. var dropName = 'drop' + (index ? '' : 'Right');
  33790. LazyWrapper.prototype[methodName] = function() {
  33791. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33792. };
  33793. });
  33794. LazyWrapper.prototype.compact = function() {
  33795. return this.filter(identity);
  33796. };
  33797. LazyWrapper.prototype.find = function(predicate) {
  33798. return this.filter(predicate).head();
  33799. };
  33800. LazyWrapper.prototype.findLast = function(predicate) {
  33801. return this.reverse().find(predicate);
  33802. };
  33803. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33804. if (typeof path == 'function') {
  33805. return new LazyWrapper(this);
  33806. }
  33807. return this.map(function(value) {
  33808. return baseInvoke(value, path, args);
  33809. });
  33810. });
  33811. LazyWrapper.prototype.reject = function(predicate) {
  33812. return this.filter(negate(getIteratee(predicate)));
  33813. };
  33814. LazyWrapper.prototype.slice = function(start, end) {
  33815. start = toInteger(start);
  33816. var result = this;
  33817. if (result.__filtered__ && (start > 0 || end < 0)) {
  33818. return new LazyWrapper(result);
  33819. }
  33820. if (start < 0) {
  33821. result = result.takeRight(-start);
  33822. } else if (start) {
  33823. result = result.drop(start);
  33824. }
  33825. if (end !== undefined) {
  33826. end = toInteger(end);
  33827. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33828. }
  33829. return result;
  33830. };
  33831. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33832. return this.reverse().takeWhile(predicate).reverse();
  33833. };
  33834. LazyWrapper.prototype.toArray = function() {
  33835. return this.take(MAX_ARRAY_LENGTH);
  33836. };
  33837. // Add `LazyWrapper` methods to `lodash.prototype`.
  33838. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33839. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33840. isTaker = /^(?:head|last)$/.test(methodName),
  33841. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33842. retUnwrapped = isTaker || /^find/.test(methodName);
  33843. if (!lodashFunc) {
  33844. return;
  33845. }
  33846. lodash.prototype[methodName] = function() {
  33847. var value = this.__wrapped__,
  33848. args = isTaker ? [1] : arguments,
  33849. isLazy = value instanceof LazyWrapper,
  33850. iteratee = args[0],
  33851. useLazy = isLazy || isArray(value);
  33852. var interceptor = function(value) {
  33853. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33854. return (isTaker && chainAll) ? result[0] : result;
  33855. };
  33856. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33857. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33858. isLazy = useLazy = false;
  33859. }
  33860. var chainAll = this.__chain__,
  33861. isHybrid = !!this.__actions__.length,
  33862. isUnwrapped = retUnwrapped && !chainAll,
  33863. onlyLazy = isLazy && !isHybrid;
  33864. if (!retUnwrapped && useLazy) {
  33865. value = onlyLazy ? value : new LazyWrapper(this);
  33866. var result = func.apply(value, args);
  33867. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33868. return new LodashWrapper(result, chainAll);
  33869. }
  33870. if (isUnwrapped && onlyLazy) {
  33871. return func.apply(this, args);
  33872. }
  33873. result = this.thru(interceptor);
  33874. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33875. };
  33876. });
  33877. // Add `Array` methods to `lodash.prototype`.
  33878. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33879. var func = arrayProto[methodName],
  33880. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33881. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33882. lodash.prototype[methodName] = function() {
  33883. var args = arguments;
  33884. if (retUnwrapped && !this.__chain__) {
  33885. var value = this.value();
  33886. return func.apply(isArray(value) ? value : [], args);
  33887. }
  33888. return this[chainName](function(value) {
  33889. return func.apply(isArray(value) ? value : [], args);
  33890. });
  33891. };
  33892. });
  33893. // Map minified method names to their real names.
  33894. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33895. var lodashFunc = lodash[methodName];
  33896. if (lodashFunc) {
  33897. var key = lodashFunc.name + '';
  33898. if (!hasOwnProperty.call(realNames, key)) {
  33899. realNames[key] = [];
  33900. }
  33901. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33902. }
  33903. });
  33904. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33905. 'name': 'wrapper',
  33906. 'func': undefined
  33907. }];
  33908. // Add methods to `LazyWrapper`.
  33909. LazyWrapper.prototype.clone = lazyClone;
  33910. LazyWrapper.prototype.reverse = lazyReverse;
  33911. LazyWrapper.prototype.value = lazyValue;
  33912. // Add chain sequence methods to the `lodash` wrapper.
  33913. lodash.prototype.at = wrapperAt;
  33914. lodash.prototype.chain = wrapperChain;
  33915. lodash.prototype.commit = wrapperCommit;
  33916. lodash.prototype.next = wrapperNext;
  33917. lodash.prototype.plant = wrapperPlant;
  33918. lodash.prototype.reverse = wrapperReverse;
  33919. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  33920. // Add lazy aliases.
  33921. lodash.prototype.first = lodash.prototype.head;
  33922. if (symIterator) {
  33923. lodash.prototype[symIterator] = wrapperToIterator;
  33924. }
  33925. return lodash;
  33926. });
  33927. /*--------------------------------------------------------------------------*/
  33928. // Export lodash.
  33929. var _ = runInContext();
  33930. // Some AMD build optimizers, like r.js, check for condition patterns like:
  33931. if (true) {
  33932. // Expose Lodash on the global object to prevent errors when Lodash is
  33933. // loaded by a script tag in the presence of an AMD loader.
  33934. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  33935. // Use `_.noConflict` to remove Lodash from the global object.
  33936. root._ = _;
  33937. // Define as an anonymous module so, through path mapping, it can be
  33938. // referenced as the "underscore" module.
  33939. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  33940. return _;
  33941. }).call(exports, __webpack_require__, exports, module),
  33942. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33943. }
  33944. // Check for `exports` after `define` in case a build optimizer adds it.
  33945. else {}
  33946. }.call(this));
  33947. /* 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)))
  33948. /***/ }),
  33949. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  33950. /*!***************************************************!*\
  33951. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  33952. \***************************************************/
  33953. /*! exports provided: default */
  33954. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  33955. "use strict";
  33956. __webpack_require__.r(__webpack_exports__);
  33957. /* WEBPACK VAR INJECTION */(function(global) {/**!
  33958. * @fileOverview Kickass library to create and place poppers near their reference elements.
  33959. * @version 1.16.1
  33960. * @license
  33961. * Copyright (c) 2016 Federico Zivolo and contributors
  33962. *
  33963. * Permission is hereby granted, free of charge, to any person obtaining a copy
  33964. * of this software and associated documentation files (the "Software"), to deal
  33965. * in the Software without restriction, including without limitation the rights
  33966. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  33967. * copies of the Software, and to permit persons to whom the Software is
  33968. * furnished to do so, subject to the following conditions:
  33969. *
  33970. * The above copyright notice and this permission notice shall be included in all
  33971. * copies or substantial portions of the Software.
  33972. *
  33973. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  33974. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33975. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  33976. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  33977. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33978. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  33979. * SOFTWARE.
  33980. */
  33981. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  33982. var timeoutDuration = function () {
  33983. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  33984. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  33985. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  33986. return 1;
  33987. }
  33988. }
  33989. return 0;
  33990. }();
  33991. function microtaskDebounce(fn) {
  33992. var called = false;
  33993. return function () {
  33994. if (called) {
  33995. return;
  33996. }
  33997. called = true;
  33998. window.Promise.resolve().then(function () {
  33999. called = false;
  34000. fn();
  34001. });
  34002. };
  34003. }
  34004. function taskDebounce(fn) {
  34005. var scheduled = false;
  34006. return function () {
  34007. if (!scheduled) {
  34008. scheduled = true;
  34009. setTimeout(function () {
  34010. scheduled = false;
  34011. fn();
  34012. }, timeoutDuration);
  34013. }
  34014. };
  34015. }
  34016. var supportsMicroTasks = isBrowser && window.Promise;
  34017. /**
  34018. * Create a debounced version of a method, that's asynchronously deferred
  34019. * but called in the minimum time possible.
  34020. *
  34021. * @method
  34022. * @memberof Popper.Utils
  34023. * @argument {Function} fn
  34024. * @returns {Function}
  34025. */
  34026. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34027. /**
  34028. * Check if the given variable is a function
  34029. * @method
  34030. * @memberof Popper.Utils
  34031. * @argument {Any} functionToCheck - variable to check
  34032. * @returns {Boolean} answer to: is a function?
  34033. */
  34034. function isFunction(functionToCheck) {
  34035. var getType = {};
  34036. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34037. }
  34038. /**
  34039. * Get CSS computed property of the given element
  34040. * @method
  34041. * @memberof Popper.Utils
  34042. * @argument {Eement} element
  34043. * @argument {String} property
  34044. */
  34045. function getStyleComputedProperty(element, property) {
  34046. if (element.nodeType !== 1) {
  34047. return [];
  34048. }
  34049. // NOTE: 1 DOM access here
  34050. var window = element.ownerDocument.defaultView;
  34051. var css = window.getComputedStyle(element, null);
  34052. return property ? css[property] : css;
  34053. }
  34054. /**
  34055. * Returns the parentNode or the host of the element
  34056. * @method
  34057. * @memberof Popper.Utils
  34058. * @argument {Element} element
  34059. * @returns {Element} parent
  34060. */
  34061. function getParentNode(element) {
  34062. if (element.nodeName === 'HTML') {
  34063. return element;
  34064. }
  34065. return element.parentNode || element.host;
  34066. }
  34067. /**
  34068. * Returns the scrolling parent of the given element
  34069. * @method
  34070. * @memberof Popper.Utils
  34071. * @argument {Element} element
  34072. * @returns {Element} scroll parent
  34073. */
  34074. function getScrollParent(element) {
  34075. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34076. if (!element) {
  34077. return document.body;
  34078. }
  34079. switch (element.nodeName) {
  34080. case 'HTML':
  34081. case 'BODY':
  34082. return element.ownerDocument.body;
  34083. case '#document':
  34084. return element.body;
  34085. }
  34086. // Firefox want us to check `-x` and `-y` variations as well
  34087. var _getStyleComputedProp = getStyleComputedProperty(element),
  34088. overflow = _getStyleComputedProp.overflow,
  34089. overflowX = _getStyleComputedProp.overflowX,
  34090. overflowY = _getStyleComputedProp.overflowY;
  34091. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34092. return element;
  34093. }
  34094. return getScrollParent(getParentNode(element));
  34095. }
  34096. /**
  34097. * Returns the reference node of the reference object, or the reference object itself.
  34098. * @method
  34099. * @memberof Popper.Utils
  34100. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34101. * @returns {Element} parent
  34102. */
  34103. function getReferenceNode(reference) {
  34104. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34105. }
  34106. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34107. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34108. /**
  34109. * Determines if the browser is Internet Explorer
  34110. * @method
  34111. * @memberof Popper.Utils
  34112. * @param {Number} version to check
  34113. * @returns {Boolean} isIE
  34114. */
  34115. function isIE(version) {
  34116. if (version === 11) {
  34117. return isIE11;
  34118. }
  34119. if (version === 10) {
  34120. return isIE10;
  34121. }
  34122. return isIE11 || isIE10;
  34123. }
  34124. /**
  34125. * Returns the offset parent of the given element
  34126. * @method
  34127. * @memberof Popper.Utils
  34128. * @argument {Element} element
  34129. * @returns {Element} offset parent
  34130. */
  34131. function getOffsetParent(element) {
  34132. if (!element) {
  34133. return document.documentElement;
  34134. }
  34135. var noOffsetParent = isIE(10) ? document.body : null;
  34136. // NOTE: 1 DOM access here
  34137. var offsetParent = element.offsetParent || null;
  34138. // Skip hidden elements which don't have an offsetParent
  34139. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34140. offsetParent = (element = element.nextElementSibling).offsetParent;
  34141. }
  34142. var nodeName = offsetParent && offsetParent.nodeName;
  34143. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34144. return element ? element.ownerDocument.documentElement : document.documentElement;
  34145. }
  34146. // .offsetParent will return the closest TH, TD or TABLE in case
  34147. // no offsetParent is present, I hate this job...
  34148. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34149. return getOffsetParent(offsetParent);
  34150. }
  34151. return offsetParent;
  34152. }
  34153. function isOffsetContainer(element) {
  34154. var nodeName = element.nodeName;
  34155. if (nodeName === 'BODY') {
  34156. return false;
  34157. }
  34158. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34159. }
  34160. /**
  34161. * Finds the root node (document, shadowDOM root) of the given element
  34162. * @method
  34163. * @memberof Popper.Utils
  34164. * @argument {Element} node
  34165. * @returns {Element} root node
  34166. */
  34167. function getRoot(node) {
  34168. if (node.parentNode !== null) {
  34169. return getRoot(node.parentNode);
  34170. }
  34171. return node;
  34172. }
  34173. /**
  34174. * Finds the offset parent common to the two provided nodes
  34175. * @method
  34176. * @memberof Popper.Utils
  34177. * @argument {Element} element1
  34178. * @argument {Element} element2
  34179. * @returns {Element} common offset parent
  34180. */
  34181. function findCommonOffsetParent(element1, element2) {
  34182. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34183. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34184. return document.documentElement;
  34185. }
  34186. // Here we make sure to give as "start" the element that comes first in the DOM
  34187. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34188. var start = order ? element1 : element2;
  34189. var end = order ? element2 : element1;
  34190. // Get common ancestor container
  34191. var range = document.createRange();
  34192. range.setStart(start, 0);
  34193. range.setEnd(end, 0);
  34194. var commonAncestorContainer = range.commonAncestorContainer;
  34195. // Both nodes are inside #document
  34196. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34197. if (isOffsetContainer(commonAncestorContainer)) {
  34198. return commonAncestorContainer;
  34199. }
  34200. return getOffsetParent(commonAncestorContainer);
  34201. }
  34202. // one of the nodes is inside shadowDOM, find which one
  34203. var element1root = getRoot(element1);
  34204. if (element1root.host) {
  34205. return findCommonOffsetParent(element1root.host, element2);
  34206. } else {
  34207. return findCommonOffsetParent(element1, getRoot(element2).host);
  34208. }
  34209. }
  34210. /**
  34211. * Gets the scroll value of the given element in the given side (top and left)
  34212. * @method
  34213. * @memberof Popper.Utils
  34214. * @argument {Element} element
  34215. * @argument {String} side `top` or `left`
  34216. * @returns {number} amount of scrolled pixels
  34217. */
  34218. function getScroll(element) {
  34219. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34220. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34221. var nodeName = element.nodeName;
  34222. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34223. var html = element.ownerDocument.documentElement;
  34224. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34225. return scrollingElement[upperSide];
  34226. }
  34227. return element[upperSide];
  34228. }
  34229. /*
  34230. * Sum or subtract the element scroll values (left and top) from a given rect object
  34231. * @method
  34232. * @memberof Popper.Utils
  34233. * @param {Object} rect - Rect object you want to change
  34234. * @param {HTMLElement} element - The element from the function reads the scroll values
  34235. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34236. * @return {Object} rect - The modifier rect object
  34237. */
  34238. function includeScroll(rect, element) {
  34239. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34240. var scrollTop = getScroll(element, 'top');
  34241. var scrollLeft = getScroll(element, 'left');
  34242. var modifier = subtract ? -1 : 1;
  34243. rect.top += scrollTop * modifier;
  34244. rect.bottom += scrollTop * modifier;
  34245. rect.left += scrollLeft * modifier;
  34246. rect.right += scrollLeft * modifier;
  34247. return rect;
  34248. }
  34249. /*
  34250. * Helper to detect borders of a given element
  34251. * @method
  34252. * @memberof Popper.Utils
  34253. * @param {CSSStyleDeclaration} styles
  34254. * Result of `getStyleComputedProperty` on the given element
  34255. * @param {String} axis - `x` or `y`
  34256. * @return {number} borders - The borders size of the given axis
  34257. */
  34258. function getBordersSize(styles, axis) {
  34259. var sideA = axis === 'x' ? 'Left' : 'Top';
  34260. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34261. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34262. }
  34263. function getSize(axis, body, html, computedStyle) {
  34264. 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);
  34265. }
  34266. function getWindowSizes(document) {
  34267. var body = document.body;
  34268. var html = document.documentElement;
  34269. var computedStyle = isIE(10) && getComputedStyle(html);
  34270. return {
  34271. height: getSize('Height', body, html, computedStyle),
  34272. width: getSize('Width', body, html, computedStyle)
  34273. };
  34274. }
  34275. var classCallCheck = function (instance, Constructor) {
  34276. if (!(instance instanceof Constructor)) {
  34277. throw new TypeError("Cannot call a class as a function");
  34278. }
  34279. };
  34280. var createClass = function () {
  34281. function defineProperties(target, props) {
  34282. for (var i = 0; i < props.length; i++) {
  34283. var descriptor = props[i];
  34284. descriptor.enumerable = descriptor.enumerable || false;
  34285. descriptor.configurable = true;
  34286. if ("value" in descriptor) descriptor.writable = true;
  34287. Object.defineProperty(target, descriptor.key, descriptor);
  34288. }
  34289. }
  34290. return function (Constructor, protoProps, staticProps) {
  34291. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34292. if (staticProps) defineProperties(Constructor, staticProps);
  34293. return Constructor;
  34294. };
  34295. }();
  34296. var defineProperty = function (obj, key, value) {
  34297. if (key in obj) {
  34298. Object.defineProperty(obj, key, {
  34299. value: value,
  34300. enumerable: true,
  34301. configurable: true,
  34302. writable: true
  34303. });
  34304. } else {
  34305. obj[key] = value;
  34306. }
  34307. return obj;
  34308. };
  34309. var _extends = Object.assign || function (target) {
  34310. for (var i = 1; i < arguments.length; i++) {
  34311. var source = arguments[i];
  34312. for (var key in source) {
  34313. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34314. target[key] = source[key];
  34315. }
  34316. }
  34317. }
  34318. return target;
  34319. };
  34320. /**
  34321. * Given element offsets, generate an output similar to getBoundingClientRect
  34322. * @method
  34323. * @memberof Popper.Utils
  34324. * @argument {Object} offsets
  34325. * @returns {Object} ClientRect like output
  34326. */
  34327. function getClientRect(offsets) {
  34328. return _extends({}, offsets, {
  34329. right: offsets.left + offsets.width,
  34330. bottom: offsets.top + offsets.height
  34331. });
  34332. }
  34333. /**
  34334. * Get bounding client rect of given element
  34335. * @method
  34336. * @memberof Popper.Utils
  34337. * @param {HTMLElement} element
  34338. * @return {Object} client rect
  34339. */
  34340. function getBoundingClientRect(element) {
  34341. var rect = {};
  34342. // IE10 10 FIX: Please, don't ask, the element isn't
  34343. // considered in DOM in some circumstances...
  34344. // This isn't reproducible in IE10 compatibility mode of IE11
  34345. try {
  34346. if (isIE(10)) {
  34347. rect = element.getBoundingClientRect();
  34348. var scrollTop = getScroll(element, 'top');
  34349. var scrollLeft = getScroll(element, 'left');
  34350. rect.top += scrollTop;
  34351. rect.left += scrollLeft;
  34352. rect.bottom += scrollTop;
  34353. rect.right += scrollLeft;
  34354. } else {
  34355. rect = element.getBoundingClientRect();
  34356. }
  34357. } catch (e) {}
  34358. var result = {
  34359. left: rect.left,
  34360. top: rect.top,
  34361. width: rect.right - rect.left,
  34362. height: rect.bottom - rect.top
  34363. };
  34364. // subtract scrollbar size from sizes
  34365. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34366. var width = sizes.width || element.clientWidth || result.width;
  34367. var height = sizes.height || element.clientHeight || result.height;
  34368. var horizScrollbar = element.offsetWidth - width;
  34369. var vertScrollbar = element.offsetHeight - height;
  34370. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34371. // we make this check conditional for performance reasons
  34372. if (horizScrollbar || vertScrollbar) {
  34373. var styles = getStyleComputedProperty(element);
  34374. horizScrollbar -= getBordersSize(styles, 'x');
  34375. vertScrollbar -= getBordersSize(styles, 'y');
  34376. result.width -= horizScrollbar;
  34377. result.height -= vertScrollbar;
  34378. }
  34379. return getClientRect(result);
  34380. }
  34381. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34382. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34383. var isIE10 = isIE(10);
  34384. var isHTML = parent.nodeName === 'HTML';
  34385. var childrenRect = getBoundingClientRect(children);
  34386. var parentRect = getBoundingClientRect(parent);
  34387. var scrollParent = getScrollParent(children);
  34388. var styles = getStyleComputedProperty(parent);
  34389. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34390. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34391. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34392. if (fixedPosition && isHTML) {
  34393. parentRect.top = Math.max(parentRect.top, 0);
  34394. parentRect.left = Math.max(parentRect.left, 0);
  34395. }
  34396. var offsets = getClientRect({
  34397. top: childrenRect.top - parentRect.top - borderTopWidth,
  34398. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34399. width: childrenRect.width,
  34400. height: childrenRect.height
  34401. });
  34402. offsets.marginTop = 0;
  34403. offsets.marginLeft = 0;
  34404. // Subtract margins of documentElement in case it's being used as parent
  34405. // we do this only on HTML because it's the only element that behaves
  34406. // differently when margins are applied to it. The margins are included in
  34407. // the box of the documentElement, in the other cases not.
  34408. if (!isIE10 && isHTML) {
  34409. var marginTop = parseFloat(styles.marginTop);
  34410. var marginLeft = parseFloat(styles.marginLeft);
  34411. offsets.top -= borderTopWidth - marginTop;
  34412. offsets.bottom -= borderTopWidth - marginTop;
  34413. offsets.left -= borderLeftWidth - marginLeft;
  34414. offsets.right -= borderLeftWidth - marginLeft;
  34415. // Attach marginTop and marginLeft because in some circumstances we may need them
  34416. offsets.marginTop = marginTop;
  34417. offsets.marginLeft = marginLeft;
  34418. }
  34419. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34420. offsets = includeScroll(offsets, parent);
  34421. }
  34422. return offsets;
  34423. }
  34424. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34425. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34426. var html = element.ownerDocument.documentElement;
  34427. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34428. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34429. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34430. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34431. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34432. var offset = {
  34433. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34434. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34435. width: width,
  34436. height: height
  34437. };
  34438. return getClientRect(offset);
  34439. }
  34440. /**
  34441. * Check if the given element is fixed or is inside a fixed parent
  34442. * @method
  34443. * @memberof Popper.Utils
  34444. * @argument {Element} element
  34445. * @argument {Element} customContainer
  34446. * @returns {Boolean} answer to "isFixed?"
  34447. */
  34448. function isFixed(element) {
  34449. var nodeName = element.nodeName;
  34450. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34451. return false;
  34452. }
  34453. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34454. return true;
  34455. }
  34456. var parentNode = getParentNode(element);
  34457. if (!parentNode) {
  34458. return false;
  34459. }
  34460. return isFixed(parentNode);
  34461. }
  34462. /**
  34463. * Finds the first parent of an element that has a transformed property defined
  34464. * @method
  34465. * @memberof Popper.Utils
  34466. * @argument {Element} element
  34467. * @returns {Element} first transformed parent or documentElement
  34468. */
  34469. function getFixedPositionOffsetParent(element) {
  34470. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34471. if (!element || !element.parentElement || isIE()) {
  34472. return document.documentElement;
  34473. }
  34474. var el = element.parentElement;
  34475. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34476. el = el.parentElement;
  34477. }
  34478. return el || document.documentElement;
  34479. }
  34480. /**
  34481. * Computed the boundaries limits and return them
  34482. * @method
  34483. * @memberof Popper.Utils
  34484. * @param {HTMLElement} popper
  34485. * @param {HTMLElement} reference
  34486. * @param {number} padding
  34487. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34488. * @param {Boolean} fixedPosition - Is in fixed position mode
  34489. * @returns {Object} Coordinates of the boundaries
  34490. */
  34491. function getBoundaries(popper, reference, padding, boundariesElement) {
  34492. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34493. // NOTE: 1 DOM access here
  34494. var boundaries = { top: 0, left: 0 };
  34495. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34496. // Handle viewport case
  34497. if (boundariesElement === 'viewport') {
  34498. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34499. } else {
  34500. // Handle other cases based on DOM element used as boundaries
  34501. var boundariesNode = void 0;
  34502. if (boundariesElement === 'scrollParent') {
  34503. boundariesNode = getScrollParent(getParentNode(reference));
  34504. if (boundariesNode.nodeName === 'BODY') {
  34505. boundariesNode = popper.ownerDocument.documentElement;
  34506. }
  34507. } else if (boundariesElement === 'window') {
  34508. boundariesNode = popper.ownerDocument.documentElement;
  34509. } else {
  34510. boundariesNode = boundariesElement;
  34511. }
  34512. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34513. // In case of HTML, we need a different computation
  34514. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34515. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34516. height = _getWindowSizes.height,
  34517. width = _getWindowSizes.width;
  34518. boundaries.top += offsets.top - offsets.marginTop;
  34519. boundaries.bottom = height + offsets.top;
  34520. boundaries.left += offsets.left - offsets.marginLeft;
  34521. boundaries.right = width + offsets.left;
  34522. } else {
  34523. // for all the other DOM elements, this one is good
  34524. boundaries = offsets;
  34525. }
  34526. }
  34527. // Add paddings
  34528. padding = padding || 0;
  34529. var isPaddingNumber = typeof padding === 'number';
  34530. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34531. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34532. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34533. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34534. return boundaries;
  34535. }
  34536. function getArea(_ref) {
  34537. var width = _ref.width,
  34538. height = _ref.height;
  34539. return width * height;
  34540. }
  34541. /**
  34542. * Utility used to transform the `auto` placement to the placement with more
  34543. * available space.
  34544. * @method
  34545. * @memberof Popper.Utils
  34546. * @argument {Object} data - The data object generated by update method
  34547. * @argument {Object} options - Modifiers configuration and options
  34548. * @returns {Object} The data object, properly modified
  34549. */
  34550. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34551. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34552. if (placement.indexOf('auto') === -1) {
  34553. return placement;
  34554. }
  34555. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34556. var rects = {
  34557. top: {
  34558. width: boundaries.width,
  34559. height: refRect.top - boundaries.top
  34560. },
  34561. right: {
  34562. width: boundaries.right - refRect.right,
  34563. height: boundaries.height
  34564. },
  34565. bottom: {
  34566. width: boundaries.width,
  34567. height: boundaries.bottom - refRect.bottom
  34568. },
  34569. left: {
  34570. width: refRect.left - boundaries.left,
  34571. height: boundaries.height
  34572. }
  34573. };
  34574. var sortedAreas = Object.keys(rects).map(function (key) {
  34575. return _extends({
  34576. key: key
  34577. }, rects[key], {
  34578. area: getArea(rects[key])
  34579. });
  34580. }).sort(function (a, b) {
  34581. return b.area - a.area;
  34582. });
  34583. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34584. var width = _ref2.width,
  34585. height = _ref2.height;
  34586. return width >= popper.clientWidth && height >= popper.clientHeight;
  34587. });
  34588. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34589. var variation = placement.split('-')[1];
  34590. return computedPlacement + (variation ? '-' + variation : '');
  34591. }
  34592. /**
  34593. * Get offsets to the reference element
  34594. * @method
  34595. * @memberof Popper.Utils
  34596. * @param {Object} state
  34597. * @param {Element} popper - the popper element
  34598. * @param {Element} reference - the reference element (the popper will be relative to this)
  34599. * @param {Element} fixedPosition - is in fixed position mode
  34600. * @returns {Object} An object containing the offsets which will be applied to the popper
  34601. */
  34602. function getReferenceOffsets(state, popper, reference) {
  34603. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34604. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34605. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34606. }
  34607. /**
  34608. * Get the outer sizes of the given element (offset size + margins)
  34609. * @method
  34610. * @memberof Popper.Utils
  34611. * @argument {Element} element
  34612. * @returns {Object} object containing width and height properties
  34613. */
  34614. function getOuterSizes(element) {
  34615. var window = element.ownerDocument.defaultView;
  34616. var styles = window.getComputedStyle(element);
  34617. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34618. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34619. var result = {
  34620. width: element.offsetWidth + y,
  34621. height: element.offsetHeight + x
  34622. };
  34623. return result;
  34624. }
  34625. /**
  34626. * Get the opposite placement of the given one
  34627. * @method
  34628. * @memberof Popper.Utils
  34629. * @argument {String} placement
  34630. * @returns {String} flipped placement
  34631. */
  34632. function getOppositePlacement(placement) {
  34633. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34634. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34635. return hash[matched];
  34636. });
  34637. }
  34638. /**
  34639. * Get offsets to the popper
  34640. * @method
  34641. * @memberof Popper.Utils
  34642. * @param {Object} position - CSS position the Popper will get applied
  34643. * @param {HTMLElement} popper - the popper element
  34644. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34645. * @param {String} placement - one of the valid placement options
  34646. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34647. */
  34648. function getPopperOffsets(popper, referenceOffsets, placement) {
  34649. placement = placement.split('-')[0];
  34650. // Get popper node sizes
  34651. var popperRect = getOuterSizes(popper);
  34652. // Add position, width and height to our offsets object
  34653. var popperOffsets = {
  34654. width: popperRect.width,
  34655. height: popperRect.height
  34656. };
  34657. // depending by the popper placement we have to compute its offsets slightly differently
  34658. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34659. var mainSide = isHoriz ? 'top' : 'left';
  34660. var secondarySide = isHoriz ? 'left' : 'top';
  34661. var measurement = isHoriz ? 'height' : 'width';
  34662. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34663. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34664. if (placement === secondarySide) {
  34665. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34666. } else {
  34667. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34668. }
  34669. return popperOffsets;
  34670. }
  34671. /**
  34672. * Mimics the `find` method of Array
  34673. * @method
  34674. * @memberof Popper.Utils
  34675. * @argument {Array} arr
  34676. * @argument prop
  34677. * @argument value
  34678. * @returns index or -1
  34679. */
  34680. function find(arr, check) {
  34681. // use native find if supported
  34682. if (Array.prototype.find) {
  34683. return arr.find(check);
  34684. }
  34685. // use `filter` to obtain the same behavior of `find`
  34686. return arr.filter(check)[0];
  34687. }
  34688. /**
  34689. * Return the index of the matching object
  34690. * @method
  34691. * @memberof Popper.Utils
  34692. * @argument {Array} arr
  34693. * @argument prop
  34694. * @argument value
  34695. * @returns index or -1
  34696. */
  34697. function findIndex(arr, prop, value) {
  34698. // use native findIndex if supported
  34699. if (Array.prototype.findIndex) {
  34700. return arr.findIndex(function (cur) {
  34701. return cur[prop] === value;
  34702. });
  34703. }
  34704. // use `find` + `indexOf` if `findIndex` isn't supported
  34705. var match = find(arr, function (obj) {
  34706. return obj[prop] === value;
  34707. });
  34708. return arr.indexOf(match);
  34709. }
  34710. /**
  34711. * Loop trough the list of modifiers and run them in order,
  34712. * each of them will then edit the data object.
  34713. * @method
  34714. * @memberof Popper.Utils
  34715. * @param {dataObject} data
  34716. * @param {Array} modifiers
  34717. * @param {String} ends - Optional modifier name used as stopper
  34718. * @returns {dataObject}
  34719. */
  34720. function runModifiers(modifiers, data, ends) {
  34721. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34722. modifiersToRun.forEach(function (modifier) {
  34723. if (modifier['function']) {
  34724. // eslint-disable-line dot-notation
  34725. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34726. }
  34727. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34728. if (modifier.enabled && isFunction(fn)) {
  34729. // Add properties to offsets to make them a complete clientRect object
  34730. // we do this before each modifier to make sure the previous one doesn't
  34731. // mess with these values
  34732. data.offsets.popper = getClientRect(data.offsets.popper);
  34733. data.offsets.reference = getClientRect(data.offsets.reference);
  34734. data = fn(data, modifier);
  34735. }
  34736. });
  34737. return data;
  34738. }
  34739. /**
  34740. * Updates the position of the popper, computing the new offsets and applying
  34741. * the new style.<br />
  34742. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34743. * @method
  34744. * @memberof Popper
  34745. */
  34746. function update() {
  34747. // if popper is destroyed, don't perform any further update
  34748. if (this.state.isDestroyed) {
  34749. return;
  34750. }
  34751. var data = {
  34752. instance: this,
  34753. styles: {},
  34754. arrowStyles: {},
  34755. attributes: {},
  34756. flipped: false,
  34757. offsets: {}
  34758. };
  34759. // compute reference element offsets
  34760. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34761. // compute auto placement, store placement inside the data object,
  34762. // modifiers will be able to edit `placement` if needed
  34763. // and refer to originalPlacement to know the original value
  34764. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34765. // store the computed placement inside `originalPlacement`
  34766. data.originalPlacement = data.placement;
  34767. data.positionFixed = this.options.positionFixed;
  34768. // compute the popper offsets
  34769. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34770. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34771. // run the modifiers
  34772. data = runModifiers(this.modifiers, data);
  34773. // the first `update` will call `onCreate` callback
  34774. // the other ones will call `onUpdate` callback
  34775. if (!this.state.isCreated) {
  34776. this.state.isCreated = true;
  34777. this.options.onCreate(data);
  34778. } else {
  34779. this.options.onUpdate(data);
  34780. }
  34781. }
  34782. /**
  34783. * Helper used to know if the given modifier is enabled.
  34784. * @method
  34785. * @memberof Popper.Utils
  34786. * @returns {Boolean}
  34787. */
  34788. function isModifierEnabled(modifiers, modifierName) {
  34789. return modifiers.some(function (_ref) {
  34790. var name = _ref.name,
  34791. enabled = _ref.enabled;
  34792. return enabled && name === modifierName;
  34793. });
  34794. }
  34795. /**
  34796. * Get the prefixed supported property name
  34797. * @method
  34798. * @memberof Popper.Utils
  34799. * @argument {String} property (camelCase)
  34800. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34801. */
  34802. function getSupportedPropertyName(property) {
  34803. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34804. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34805. for (var i = 0; i < prefixes.length; i++) {
  34806. var prefix = prefixes[i];
  34807. var toCheck = prefix ? '' + prefix + upperProp : property;
  34808. if (typeof document.body.style[toCheck] !== 'undefined') {
  34809. return toCheck;
  34810. }
  34811. }
  34812. return null;
  34813. }
  34814. /**
  34815. * Destroys the popper.
  34816. * @method
  34817. * @memberof Popper
  34818. */
  34819. function destroy() {
  34820. this.state.isDestroyed = true;
  34821. // touch DOM only if `applyStyle` modifier is enabled
  34822. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34823. this.popper.removeAttribute('x-placement');
  34824. this.popper.style.position = '';
  34825. this.popper.style.top = '';
  34826. this.popper.style.left = '';
  34827. this.popper.style.right = '';
  34828. this.popper.style.bottom = '';
  34829. this.popper.style.willChange = '';
  34830. this.popper.style[getSupportedPropertyName('transform')] = '';
  34831. }
  34832. this.disableEventListeners();
  34833. // remove the popper if user explicitly asked for the deletion on destroy
  34834. // do not use `remove` because IE11 doesn't support it
  34835. if (this.options.removeOnDestroy) {
  34836. this.popper.parentNode.removeChild(this.popper);
  34837. }
  34838. return this;
  34839. }
  34840. /**
  34841. * Get the window associated with the element
  34842. * @argument {Element} element
  34843. * @returns {Window}
  34844. */
  34845. function getWindow(element) {
  34846. var ownerDocument = element.ownerDocument;
  34847. return ownerDocument ? ownerDocument.defaultView : window;
  34848. }
  34849. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34850. var isBody = scrollParent.nodeName === 'BODY';
  34851. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34852. target.addEventListener(event, callback, { passive: true });
  34853. if (!isBody) {
  34854. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34855. }
  34856. scrollParents.push(target);
  34857. }
  34858. /**
  34859. * Setup needed event listeners used to update the popper position
  34860. * @method
  34861. * @memberof Popper.Utils
  34862. * @private
  34863. */
  34864. function setupEventListeners(reference, options, state, updateBound) {
  34865. // Resize event listener on window
  34866. state.updateBound = updateBound;
  34867. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34868. // Scroll event listener on scroll parents
  34869. var scrollElement = getScrollParent(reference);
  34870. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34871. state.scrollElement = scrollElement;
  34872. state.eventsEnabled = true;
  34873. return state;
  34874. }
  34875. /**
  34876. * It will add resize/scroll events and start recalculating
  34877. * position of the popper element when they are triggered.
  34878. * @method
  34879. * @memberof Popper
  34880. */
  34881. function enableEventListeners() {
  34882. if (!this.state.eventsEnabled) {
  34883. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34884. }
  34885. }
  34886. /**
  34887. * Remove event listeners used to update the popper position
  34888. * @method
  34889. * @memberof Popper.Utils
  34890. * @private
  34891. */
  34892. function removeEventListeners(reference, state) {
  34893. // Remove resize event listener on window
  34894. getWindow(reference).removeEventListener('resize', state.updateBound);
  34895. // Remove scroll event listener on scroll parents
  34896. state.scrollParents.forEach(function (target) {
  34897. target.removeEventListener('scroll', state.updateBound);
  34898. });
  34899. // Reset state
  34900. state.updateBound = null;
  34901. state.scrollParents = [];
  34902. state.scrollElement = null;
  34903. state.eventsEnabled = false;
  34904. return state;
  34905. }
  34906. /**
  34907. * It will remove resize/scroll events and won't recalculate popper position
  34908. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34909. * unless you call `update` method manually.
  34910. * @method
  34911. * @memberof Popper
  34912. */
  34913. function disableEventListeners() {
  34914. if (this.state.eventsEnabled) {
  34915. cancelAnimationFrame(this.scheduleUpdate);
  34916. this.state = removeEventListeners(this.reference, this.state);
  34917. }
  34918. }
  34919. /**
  34920. * Tells if a given input is a number
  34921. * @method
  34922. * @memberof Popper.Utils
  34923. * @param {*} input to check
  34924. * @return {Boolean}
  34925. */
  34926. function isNumeric(n) {
  34927. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  34928. }
  34929. /**
  34930. * Set the style to the given popper
  34931. * @method
  34932. * @memberof Popper.Utils
  34933. * @argument {Element} element - Element to apply the style to
  34934. * @argument {Object} styles
  34935. * Object with a list of properties and values which will be applied to the element
  34936. */
  34937. function setStyles(element, styles) {
  34938. Object.keys(styles).forEach(function (prop) {
  34939. var unit = '';
  34940. // add unit if the value is numeric and is one of the following
  34941. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  34942. unit = 'px';
  34943. }
  34944. element.style[prop] = styles[prop] + unit;
  34945. });
  34946. }
  34947. /**
  34948. * Set the attributes to the given popper
  34949. * @method
  34950. * @memberof Popper.Utils
  34951. * @argument {Element} element - Element to apply the attributes to
  34952. * @argument {Object} styles
  34953. * Object with a list of properties and values which will be applied to the element
  34954. */
  34955. function setAttributes(element, attributes) {
  34956. Object.keys(attributes).forEach(function (prop) {
  34957. var value = attributes[prop];
  34958. if (value !== false) {
  34959. element.setAttribute(prop, attributes[prop]);
  34960. } else {
  34961. element.removeAttribute(prop);
  34962. }
  34963. });
  34964. }
  34965. /**
  34966. * @function
  34967. * @memberof Modifiers
  34968. * @argument {Object} data - The data object generated by `update` method
  34969. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  34970. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  34971. * @argument {Object} options - Modifiers configuration and options
  34972. * @returns {Object} The same data object
  34973. */
  34974. function applyStyle(data) {
  34975. // any property present in `data.styles` will be applied to the popper,
  34976. // in this way we can make the 3rd party modifiers add custom styles to it
  34977. // Be aware, modifiers could override the properties defined in the previous
  34978. // lines of this modifier!
  34979. setStyles(data.instance.popper, data.styles);
  34980. // any property present in `data.attributes` will be applied to the popper,
  34981. // they will be set as HTML attributes of the element
  34982. setAttributes(data.instance.popper, data.attributes);
  34983. // if arrowElement is defined and arrowStyles has some properties
  34984. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  34985. setStyles(data.arrowElement, data.arrowStyles);
  34986. }
  34987. return data;
  34988. }
  34989. /**
  34990. * Set the x-placement attribute before everything else because it could be used
  34991. * to add margins to the popper margins needs to be calculated to get the
  34992. * correct popper offsets.
  34993. * @method
  34994. * @memberof Popper.modifiers
  34995. * @param {HTMLElement} reference - The reference element used to position the popper
  34996. * @param {HTMLElement} popper - The HTML element used as popper
  34997. * @param {Object} options - Popper.js options
  34998. */
  34999. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35000. // compute reference element offsets
  35001. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35002. // compute auto placement, store placement inside the data object,
  35003. // modifiers will be able to edit `placement` if needed
  35004. // and refer to originalPlacement to know the original value
  35005. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35006. popper.setAttribute('x-placement', placement);
  35007. // Apply `position` to popper before anything else because
  35008. // without the position applied we can't guarantee correct computations
  35009. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35010. return options;
  35011. }
  35012. /**
  35013. * @function
  35014. * @memberof Popper.Utils
  35015. * @argument {Object} data - The data object generated by `update` method
  35016. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35017. * @returns {Object} The popper's position offsets rounded
  35018. *
  35019. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35020. * good as it can be within reason.
  35021. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35022. *
  35023. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35024. * as well on High DPI screens).
  35025. *
  35026. * Firefox prefers no rounding for positioning and does not have blurriness on
  35027. * high DPI screens.
  35028. *
  35029. * Only horizontal placement and left/right values need to be considered.
  35030. */
  35031. function getRoundedOffsets(data, shouldRound) {
  35032. var _data$offsets = data.offsets,
  35033. popper = _data$offsets.popper,
  35034. reference = _data$offsets.reference;
  35035. var round = Math.round,
  35036. floor = Math.floor;
  35037. var noRound = function noRound(v) {
  35038. return v;
  35039. };
  35040. var referenceWidth = round(reference.width);
  35041. var popperWidth = round(popper.width);
  35042. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35043. var isVariation = data.placement.indexOf('-') !== -1;
  35044. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35045. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35046. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35047. var verticalToInteger = !shouldRound ? noRound : round;
  35048. return {
  35049. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35050. top: verticalToInteger(popper.top),
  35051. bottom: verticalToInteger(popper.bottom),
  35052. right: horizontalToInteger(popper.right)
  35053. };
  35054. }
  35055. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35056. /**
  35057. * @function
  35058. * @memberof Modifiers
  35059. * @argument {Object} data - The data object generated by `update` method
  35060. * @argument {Object} options - Modifiers configuration and options
  35061. * @returns {Object} The data object, properly modified
  35062. */
  35063. function computeStyle(data, options) {
  35064. var x = options.x,
  35065. y = options.y;
  35066. var popper = data.offsets.popper;
  35067. // Remove this legacy support in Popper.js v2
  35068. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35069. return modifier.name === 'applyStyle';
  35070. }).gpuAcceleration;
  35071. if (legacyGpuAccelerationOption !== undefined) {
  35072. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35073. }
  35074. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35075. var offsetParent = getOffsetParent(data.instance.popper);
  35076. var offsetParentRect = getBoundingClientRect(offsetParent);
  35077. // Styles
  35078. var styles = {
  35079. position: popper.position
  35080. };
  35081. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35082. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35083. var sideB = y === 'right' ? 'left' : 'right';
  35084. // if gpuAcceleration is set to `true` and transform is supported,
  35085. // we use `translate3d` to apply the position to the popper we
  35086. // automatically use the supported prefixed version if needed
  35087. var prefixedProperty = getSupportedPropertyName('transform');
  35088. // now, let's make a step back and look at this code closely (wtf?)
  35089. // If the content of the popper grows once it's been positioned, it
  35090. // may happen that the popper gets misplaced because of the new content
  35091. // overflowing its reference element
  35092. // To avoid this problem, we provide two options (x and y), which allow
  35093. // the consumer to define the offset origin.
  35094. // If we position a popper on top of a reference element, we can set
  35095. // `x` to `top` to make the popper grow towards its top instead of
  35096. // its bottom.
  35097. var left = void 0,
  35098. top = void 0;
  35099. if (sideA === 'bottom') {
  35100. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35101. // and not the bottom of the html element
  35102. if (offsetParent.nodeName === 'HTML') {
  35103. top = -offsetParent.clientHeight + offsets.bottom;
  35104. } else {
  35105. top = -offsetParentRect.height + offsets.bottom;
  35106. }
  35107. } else {
  35108. top = offsets.top;
  35109. }
  35110. if (sideB === 'right') {
  35111. if (offsetParent.nodeName === 'HTML') {
  35112. left = -offsetParent.clientWidth + offsets.right;
  35113. } else {
  35114. left = -offsetParentRect.width + offsets.right;
  35115. }
  35116. } else {
  35117. left = offsets.left;
  35118. }
  35119. if (gpuAcceleration && prefixedProperty) {
  35120. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35121. styles[sideA] = 0;
  35122. styles[sideB] = 0;
  35123. styles.willChange = 'transform';
  35124. } else {
  35125. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35126. var invertTop = sideA === 'bottom' ? -1 : 1;
  35127. var invertLeft = sideB === 'right' ? -1 : 1;
  35128. styles[sideA] = top * invertTop;
  35129. styles[sideB] = left * invertLeft;
  35130. styles.willChange = sideA + ', ' + sideB;
  35131. }
  35132. // Attributes
  35133. var attributes = {
  35134. 'x-placement': data.placement
  35135. };
  35136. // Update `data` attributes, styles and arrowStyles
  35137. data.attributes = _extends({}, attributes, data.attributes);
  35138. data.styles = _extends({}, styles, data.styles);
  35139. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35140. return data;
  35141. }
  35142. /**
  35143. * Helper used to know if the given modifier depends from another one.<br />
  35144. * It checks if the needed modifier is listed and enabled.
  35145. * @method
  35146. * @memberof Popper.Utils
  35147. * @param {Array} modifiers - list of modifiers
  35148. * @param {String} requestingName - name of requesting modifier
  35149. * @param {String} requestedName - name of requested modifier
  35150. * @returns {Boolean}
  35151. */
  35152. function isModifierRequired(modifiers, requestingName, requestedName) {
  35153. var requesting = find(modifiers, function (_ref) {
  35154. var name = _ref.name;
  35155. return name === requestingName;
  35156. });
  35157. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35158. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35159. });
  35160. if (!isRequired) {
  35161. var _requesting = '`' + requestingName + '`';
  35162. var requested = '`' + requestedName + '`';
  35163. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35164. }
  35165. return isRequired;
  35166. }
  35167. /**
  35168. * @function
  35169. * @memberof Modifiers
  35170. * @argument {Object} data - The data object generated by update method
  35171. * @argument {Object} options - Modifiers configuration and options
  35172. * @returns {Object} The data object, properly modified
  35173. */
  35174. function arrow(data, options) {
  35175. var _data$offsets$arrow;
  35176. // arrow depends on keepTogether in order to work
  35177. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35178. return data;
  35179. }
  35180. var arrowElement = options.element;
  35181. // if arrowElement is a string, suppose it's a CSS selector
  35182. if (typeof arrowElement === 'string') {
  35183. arrowElement = data.instance.popper.querySelector(arrowElement);
  35184. // if arrowElement is not found, don't run the modifier
  35185. if (!arrowElement) {
  35186. return data;
  35187. }
  35188. } else {
  35189. // if the arrowElement isn't a query selector we must check that the
  35190. // provided DOM node is child of its popper node
  35191. if (!data.instance.popper.contains(arrowElement)) {
  35192. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35193. return data;
  35194. }
  35195. }
  35196. var placement = data.placement.split('-')[0];
  35197. var _data$offsets = data.offsets,
  35198. popper = _data$offsets.popper,
  35199. reference = _data$offsets.reference;
  35200. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35201. var len = isVertical ? 'height' : 'width';
  35202. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35203. var side = sideCapitalized.toLowerCase();
  35204. var altSide = isVertical ? 'left' : 'top';
  35205. var opSide = isVertical ? 'bottom' : 'right';
  35206. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35207. //
  35208. // extends keepTogether behavior making sure the popper and its
  35209. // reference have enough pixels in conjunction
  35210. //
  35211. // top/left side
  35212. if (reference[opSide] - arrowElementSize < popper[side]) {
  35213. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35214. }
  35215. // bottom/right side
  35216. if (reference[side] + arrowElementSize > popper[opSide]) {
  35217. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35218. }
  35219. data.offsets.popper = getClientRect(data.offsets.popper);
  35220. // compute center of the popper
  35221. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35222. // Compute the sideValue using the updated popper offsets
  35223. // take popper margin in account because we don't have this info available
  35224. var css = getStyleComputedProperty(data.instance.popper);
  35225. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35226. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35227. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35228. // prevent arrowElement from being placed not contiguously to its popper
  35229. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35230. data.arrowElement = arrowElement;
  35231. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35232. return data;
  35233. }
  35234. /**
  35235. * Get the opposite placement variation of the given one
  35236. * @method
  35237. * @memberof Popper.Utils
  35238. * @argument {String} placement variation
  35239. * @returns {String} flipped placement variation
  35240. */
  35241. function getOppositeVariation(variation) {
  35242. if (variation === 'end') {
  35243. return 'start';
  35244. } else if (variation === 'start') {
  35245. return 'end';
  35246. }
  35247. return variation;
  35248. }
  35249. /**
  35250. * List of accepted placements to use as values of the `placement` option.<br />
  35251. * Valid placements are:
  35252. * - `auto`
  35253. * - `top`
  35254. * - `right`
  35255. * - `bottom`
  35256. * - `left`
  35257. *
  35258. * Each placement can have a variation from this list:
  35259. * - `-start`
  35260. * - `-end`
  35261. *
  35262. * Variations are interpreted easily if you think of them as the left to right
  35263. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35264. * is right.<br />
  35265. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35266. *
  35267. * Some valid examples are:
  35268. * - `top-end` (on top of reference, right aligned)
  35269. * - `right-start` (on right of reference, top aligned)
  35270. * - `bottom` (on bottom, centered)
  35271. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35272. *
  35273. * @static
  35274. * @type {Array}
  35275. * @enum {String}
  35276. * @readonly
  35277. * @method placements
  35278. * @memberof Popper
  35279. */
  35280. 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'];
  35281. // Get rid of `auto` `auto-start` and `auto-end`
  35282. var validPlacements = placements.slice(3);
  35283. /**
  35284. * Given an initial placement, returns all the subsequent placements
  35285. * clockwise (or counter-clockwise).
  35286. *
  35287. * @method
  35288. * @memberof Popper.Utils
  35289. * @argument {String} placement - A valid placement (it accepts variations)
  35290. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35291. * @returns {Array} placements including their variations
  35292. */
  35293. function clockwise(placement) {
  35294. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35295. var index = validPlacements.indexOf(placement);
  35296. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35297. return counter ? arr.reverse() : arr;
  35298. }
  35299. var BEHAVIORS = {
  35300. FLIP: 'flip',
  35301. CLOCKWISE: 'clockwise',
  35302. COUNTERCLOCKWISE: 'counterclockwise'
  35303. };
  35304. /**
  35305. * @function
  35306. * @memberof Modifiers
  35307. * @argument {Object} data - The data object generated by update method
  35308. * @argument {Object} options - Modifiers configuration and options
  35309. * @returns {Object} The data object, properly modified
  35310. */
  35311. function flip(data, options) {
  35312. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35313. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35314. return data;
  35315. }
  35316. if (data.flipped && data.placement === data.originalPlacement) {
  35317. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35318. return data;
  35319. }
  35320. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35321. var placement = data.placement.split('-')[0];
  35322. var placementOpposite = getOppositePlacement(placement);
  35323. var variation = data.placement.split('-')[1] || '';
  35324. var flipOrder = [];
  35325. switch (options.behavior) {
  35326. case BEHAVIORS.FLIP:
  35327. flipOrder = [placement, placementOpposite];
  35328. break;
  35329. case BEHAVIORS.CLOCKWISE:
  35330. flipOrder = clockwise(placement);
  35331. break;
  35332. case BEHAVIORS.COUNTERCLOCKWISE:
  35333. flipOrder = clockwise(placement, true);
  35334. break;
  35335. default:
  35336. flipOrder = options.behavior;
  35337. }
  35338. flipOrder.forEach(function (step, index) {
  35339. if (placement !== step || flipOrder.length === index + 1) {
  35340. return data;
  35341. }
  35342. placement = data.placement.split('-')[0];
  35343. placementOpposite = getOppositePlacement(placement);
  35344. var popperOffsets = data.offsets.popper;
  35345. var refOffsets = data.offsets.reference;
  35346. // using floor because the reference offsets may contain decimals we are not going to consider here
  35347. var floor = Math.floor;
  35348. 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);
  35349. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35350. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35351. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35352. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35353. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35354. // flip the variation if required
  35355. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35356. // flips variation if reference element overflows boundaries
  35357. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35358. // flips variation if popper content overflows boundaries
  35359. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35360. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35361. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35362. // this boolean to detect any flip loop
  35363. data.flipped = true;
  35364. if (overlapsRef || overflowsBoundaries) {
  35365. placement = flipOrder[index + 1];
  35366. }
  35367. if (flippedVariation) {
  35368. variation = getOppositeVariation(variation);
  35369. }
  35370. data.placement = placement + (variation ? '-' + variation : '');
  35371. // this object contains `position`, we want to preserve it along with
  35372. // any additional property we may add in the future
  35373. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35374. data = runModifiers(data.instance.modifiers, data, 'flip');
  35375. }
  35376. });
  35377. return data;
  35378. }
  35379. /**
  35380. * @function
  35381. * @memberof Modifiers
  35382. * @argument {Object} data - The data object generated by update method
  35383. * @argument {Object} options - Modifiers configuration and options
  35384. * @returns {Object} The data object, properly modified
  35385. */
  35386. function keepTogether(data) {
  35387. var _data$offsets = data.offsets,
  35388. popper = _data$offsets.popper,
  35389. reference = _data$offsets.reference;
  35390. var placement = data.placement.split('-')[0];
  35391. var floor = Math.floor;
  35392. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35393. var side = isVertical ? 'right' : 'bottom';
  35394. var opSide = isVertical ? 'left' : 'top';
  35395. var measurement = isVertical ? 'width' : 'height';
  35396. if (popper[side] < floor(reference[opSide])) {
  35397. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35398. }
  35399. if (popper[opSide] > floor(reference[side])) {
  35400. data.offsets.popper[opSide] = floor(reference[side]);
  35401. }
  35402. return data;
  35403. }
  35404. /**
  35405. * Converts a string containing value + unit into a px value number
  35406. * @function
  35407. * @memberof {modifiers~offset}
  35408. * @private
  35409. * @argument {String} str - Value + unit string
  35410. * @argument {String} measurement - `height` or `width`
  35411. * @argument {Object} popperOffsets
  35412. * @argument {Object} referenceOffsets
  35413. * @returns {Number|String}
  35414. * Value in pixels, or original string if no values were extracted
  35415. */
  35416. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35417. // separate value from unit
  35418. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35419. var value = +split[1];
  35420. var unit = split[2];
  35421. // If it's not a number it's an operator, I guess
  35422. if (!value) {
  35423. return str;
  35424. }
  35425. if (unit.indexOf('%') === 0) {
  35426. var element = void 0;
  35427. switch (unit) {
  35428. case '%p':
  35429. element = popperOffsets;
  35430. break;
  35431. case '%':
  35432. case '%r':
  35433. default:
  35434. element = referenceOffsets;
  35435. }
  35436. var rect = getClientRect(element);
  35437. return rect[measurement] / 100 * value;
  35438. } else if (unit === 'vh' || unit === 'vw') {
  35439. // if is a vh or vw, we calculate the size based on the viewport
  35440. var size = void 0;
  35441. if (unit === 'vh') {
  35442. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35443. } else {
  35444. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35445. }
  35446. return size / 100 * value;
  35447. } else {
  35448. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35449. // if is an implicit unit, it's px, and we return just the value
  35450. return value;
  35451. }
  35452. }
  35453. /**
  35454. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35455. * @function
  35456. * @memberof {modifiers~offset}
  35457. * @private
  35458. * @argument {String} offset
  35459. * @argument {Object} popperOffsets
  35460. * @argument {Object} referenceOffsets
  35461. * @argument {String} basePlacement
  35462. * @returns {Array} a two cells array with x and y offsets in numbers
  35463. */
  35464. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35465. var offsets = [0, 0];
  35466. // Use height if placement is left or right and index is 0 otherwise use width
  35467. // in this way the first offset will use an axis and the second one
  35468. // will use the other one
  35469. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35470. // Split the offset string to obtain a list of values and operands
  35471. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35472. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35473. return frag.trim();
  35474. });
  35475. // Detect if the offset string contains a pair of values or a single one
  35476. // they could be separated by comma or space
  35477. var divider = fragments.indexOf(find(fragments, function (frag) {
  35478. return frag.search(/,|\s/) !== -1;
  35479. }));
  35480. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35481. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35482. }
  35483. // If divider is found, we divide the list of values and operands to divide
  35484. // them by ofset X and Y.
  35485. var splitRegex = /\s*,\s*|\s+/;
  35486. 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];
  35487. // Convert the values with units to absolute pixels to allow our computations
  35488. ops = ops.map(function (op, index) {
  35489. // Most of the units rely on the orientation of the popper
  35490. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35491. var mergeWithPrevious = false;
  35492. return op
  35493. // This aggregates any `+` or `-` sign that aren't considered operators
  35494. // e.g.: 10 + +5 => [10, +, +5]
  35495. .reduce(function (a, b) {
  35496. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35497. a[a.length - 1] = b;
  35498. mergeWithPrevious = true;
  35499. return a;
  35500. } else if (mergeWithPrevious) {
  35501. a[a.length - 1] += b;
  35502. mergeWithPrevious = false;
  35503. return a;
  35504. } else {
  35505. return a.concat(b);
  35506. }
  35507. }, [])
  35508. // Here we convert the string values into number values (in px)
  35509. .map(function (str) {
  35510. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35511. });
  35512. });
  35513. // Loop trough the offsets arrays and execute the operations
  35514. ops.forEach(function (op, index) {
  35515. op.forEach(function (frag, index2) {
  35516. if (isNumeric(frag)) {
  35517. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35518. }
  35519. });
  35520. });
  35521. return offsets;
  35522. }
  35523. /**
  35524. * @function
  35525. * @memberof Modifiers
  35526. * @argument {Object} data - The data object generated by update method
  35527. * @argument {Object} options - Modifiers configuration and options
  35528. * @argument {Number|String} options.offset=0
  35529. * The offset value as described in the modifier description
  35530. * @returns {Object} The data object, properly modified
  35531. */
  35532. function offset(data, _ref) {
  35533. var offset = _ref.offset;
  35534. var placement = data.placement,
  35535. _data$offsets = data.offsets,
  35536. popper = _data$offsets.popper,
  35537. reference = _data$offsets.reference;
  35538. var basePlacement = placement.split('-')[0];
  35539. var offsets = void 0;
  35540. if (isNumeric(+offset)) {
  35541. offsets = [+offset, 0];
  35542. } else {
  35543. offsets = parseOffset(offset, popper, reference, basePlacement);
  35544. }
  35545. if (basePlacement === 'left') {
  35546. popper.top += offsets[0];
  35547. popper.left -= offsets[1];
  35548. } else if (basePlacement === 'right') {
  35549. popper.top += offsets[0];
  35550. popper.left += offsets[1];
  35551. } else if (basePlacement === 'top') {
  35552. popper.left += offsets[0];
  35553. popper.top -= offsets[1];
  35554. } else if (basePlacement === 'bottom') {
  35555. popper.left += offsets[0];
  35556. popper.top += offsets[1];
  35557. }
  35558. data.popper = popper;
  35559. return data;
  35560. }
  35561. /**
  35562. * @function
  35563. * @memberof Modifiers
  35564. * @argument {Object} data - The data object generated by `update` method
  35565. * @argument {Object} options - Modifiers configuration and options
  35566. * @returns {Object} The data object, properly modified
  35567. */
  35568. function preventOverflow(data, options) {
  35569. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35570. // If offsetParent is the reference element, we really want to
  35571. // go one step up and use the next offsetParent as reference to
  35572. // avoid to make this modifier completely useless and look like broken
  35573. if (data.instance.reference === boundariesElement) {
  35574. boundariesElement = getOffsetParent(boundariesElement);
  35575. }
  35576. // NOTE: DOM access here
  35577. // resets the popper's position so that the document size can be calculated excluding
  35578. // the size of the popper element itself
  35579. var transformProp = getSupportedPropertyName('transform');
  35580. var popperStyles = data.instance.popper.style; // assignment to help minification
  35581. var top = popperStyles.top,
  35582. left = popperStyles.left,
  35583. transform = popperStyles[transformProp];
  35584. popperStyles.top = '';
  35585. popperStyles.left = '';
  35586. popperStyles[transformProp] = '';
  35587. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35588. // NOTE: DOM access here
  35589. // restores the original style properties after the offsets have been computed
  35590. popperStyles.top = top;
  35591. popperStyles.left = left;
  35592. popperStyles[transformProp] = transform;
  35593. options.boundaries = boundaries;
  35594. var order = options.priority;
  35595. var popper = data.offsets.popper;
  35596. var check = {
  35597. primary: function primary(placement) {
  35598. var value = popper[placement];
  35599. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35600. value = Math.max(popper[placement], boundaries[placement]);
  35601. }
  35602. return defineProperty({}, placement, value);
  35603. },
  35604. secondary: function secondary(placement) {
  35605. var mainSide = placement === 'right' ? 'left' : 'top';
  35606. var value = popper[mainSide];
  35607. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35608. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35609. }
  35610. return defineProperty({}, mainSide, value);
  35611. }
  35612. };
  35613. order.forEach(function (placement) {
  35614. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35615. popper = _extends({}, popper, check[side](placement));
  35616. });
  35617. data.offsets.popper = popper;
  35618. return data;
  35619. }
  35620. /**
  35621. * @function
  35622. * @memberof Modifiers
  35623. * @argument {Object} data - The data object generated by `update` method
  35624. * @argument {Object} options - Modifiers configuration and options
  35625. * @returns {Object} The data object, properly modified
  35626. */
  35627. function shift(data) {
  35628. var placement = data.placement;
  35629. var basePlacement = placement.split('-')[0];
  35630. var shiftvariation = placement.split('-')[1];
  35631. // if shift shiftvariation is specified, run the modifier
  35632. if (shiftvariation) {
  35633. var _data$offsets = data.offsets,
  35634. reference = _data$offsets.reference,
  35635. popper = _data$offsets.popper;
  35636. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35637. var side = isVertical ? 'left' : 'top';
  35638. var measurement = isVertical ? 'width' : 'height';
  35639. var shiftOffsets = {
  35640. start: defineProperty({}, side, reference[side]),
  35641. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35642. };
  35643. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35644. }
  35645. return data;
  35646. }
  35647. /**
  35648. * @function
  35649. * @memberof Modifiers
  35650. * @argument {Object} data - The data object generated by update method
  35651. * @argument {Object} options - Modifiers configuration and options
  35652. * @returns {Object} The data object, properly modified
  35653. */
  35654. function hide(data) {
  35655. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35656. return data;
  35657. }
  35658. var refRect = data.offsets.reference;
  35659. var bound = find(data.instance.modifiers, function (modifier) {
  35660. return modifier.name === 'preventOverflow';
  35661. }).boundaries;
  35662. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35663. // Avoid unnecessary DOM access if visibility hasn't changed
  35664. if (data.hide === true) {
  35665. return data;
  35666. }
  35667. data.hide = true;
  35668. data.attributes['x-out-of-boundaries'] = '';
  35669. } else {
  35670. // Avoid unnecessary DOM access if visibility hasn't changed
  35671. if (data.hide === false) {
  35672. return data;
  35673. }
  35674. data.hide = false;
  35675. data.attributes['x-out-of-boundaries'] = false;
  35676. }
  35677. return data;
  35678. }
  35679. /**
  35680. * @function
  35681. * @memberof Modifiers
  35682. * @argument {Object} data - The data object generated by `update` method
  35683. * @argument {Object} options - Modifiers configuration and options
  35684. * @returns {Object} The data object, properly modified
  35685. */
  35686. function inner(data) {
  35687. var placement = data.placement;
  35688. var basePlacement = placement.split('-')[0];
  35689. var _data$offsets = data.offsets,
  35690. popper = _data$offsets.popper,
  35691. reference = _data$offsets.reference;
  35692. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35693. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35694. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35695. data.placement = getOppositePlacement(placement);
  35696. data.offsets.popper = getClientRect(popper);
  35697. return data;
  35698. }
  35699. /**
  35700. * Modifier function, each modifier can have a function of this type assigned
  35701. * to its `fn` property.<br />
  35702. * These functions will be called on each update, this means that you must
  35703. * make sure they are performant enough to avoid performance bottlenecks.
  35704. *
  35705. * @function ModifierFn
  35706. * @argument {dataObject} data - The data object generated by `update` method
  35707. * @argument {Object} options - Modifiers configuration and options
  35708. * @returns {dataObject} The data object, properly modified
  35709. */
  35710. /**
  35711. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35712. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35713. * needed by the library.
  35714. *
  35715. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35716. * All the other properties are configurations that could be tweaked.
  35717. * @namespace modifiers
  35718. */
  35719. var modifiers = {
  35720. /**
  35721. * Modifier used to shift the popper on the start or end of its reference
  35722. * element.<br />
  35723. * It will read the variation of the `placement` property.<br />
  35724. * It can be one either `-end` or `-start`.
  35725. * @memberof modifiers
  35726. * @inner
  35727. */
  35728. shift: {
  35729. /** @prop {number} order=100 - Index used to define the order of execution */
  35730. order: 100,
  35731. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35732. enabled: true,
  35733. /** @prop {ModifierFn} */
  35734. fn: shift
  35735. },
  35736. /**
  35737. * The `offset` modifier can shift your popper on both its axis.
  35738. *
  35739. * It accepts the following units:
  35740. * - `px` or unit-less, interpreted as pixels
  35741. * - `%` or `%r`, percentage relative to the length of the reference element
  35742. * - `%p`, percentage relative to the length of the popper element
  35743. * - `vw`, CSS viewport width unit
  35744. * - `vh`, CSS viewport height unit
  35745. *
  35746. * For length is intended the main axis relative to the placement of the popper.<br />
  35747. * This means that if the placement is `top` or `bottom`, the length will be the
  35748. * `width`. In case of `left` or `right`, it will be the `height`.
  35749. *
  35750. * You can provide a single value (as `Number` or `String`), or a pair of values
  35751. * as `String` divided by a comma or one (or more) white spaces.<br />
  35752. * The latter is a deprecated method because it leads to confusion and will be
  35753. * removed in v2.<br />
  35754. * Additionally, it accepts additions and subtractions between different units.
  35755. * Note that multiplications and divisions aren't supported.
  35756. *
  35757. * Valid examples are:
  35758. * ```
  35759. * 10
  35760. * '10%'
  35761. * '10, 10'
  35762. * '10%, 10'
  35763. * '10 + 10%'
  35764. * '10 - 5vh + 3%'
  35765. * '-10px + 5vh, 5px - 6%'
  35766. * ```
  35767. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35768. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35769. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35770. *
  35771. * @memberof modifiers
  35772. * @inner
  35773. */
  35774. offset: {
  35775. /** @prop {number} order=200 - Index used to define the order of execution */
  35776. order: 200,
  35777. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35778. enabled: true,
  35779. /** @prop {ModifierFn} */
  35780. fn: offset,
  35781. /** @prop {Number|String} offset=0
  35782. * The offset value as described in the modifier description
  35783. */
  35784. offset: 0
  35785. },
  35786. /**
  35787. * Modifier used to prevent the popper from being positioned outside the boundary.
  35788. *
  35789. * A scenario exists where the reference itself is not within the boundaries.<br />
  35790. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35791. * In this case we need to decide whether the popper should either:
  35792. *
  35793. * - detach from the reference and remain "trapped" in the boundaries, or
  35794. * - if it should ignore the boundary and "escape with its reference"
  35795. *
  35796. * When `escapeWithReference` is set to`true` and reference is completely
  35797. * outside its boundaries, the popper will overflow (or completely leave)
  35798. * the boundaries in order to remain attached to the edge of the reference.
  35799. *
  35800. * @memberof modifiers
  35801. * @inner
  35802. */
  35803. preventOverflow: {
  35804. /** @prop {number} order=300 - Index used to define the order of execution */
  35805. order: 300,
  35806. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35807. enabled: true,
  35808. /** @prop {ModifierFn} */
  35809. fn: preventOverflow,
  35810. /**
  35811. * @prop {Array} [priority=['left','right','top','bottom']]
  35812. * Popper will try to prevent overflow following these priorities by default,
  35813. * then, it could overflow on the left and on top of the `boundariesElement`
  35814. */
  35815. priority: ['left', 'right', 'top', 'bottom'],
  35816. /**
  35817. * @prop {number} padding=5
  35818. * Amount of pixel used to define a minimum distance between the boundaries
  35819. * and the popper. This makes sure the popper always has a little padding
  35820. * between the edges of its container
  35821. */
  35822. padding: 5,
  35823. /**
  35824. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35825. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35826. * `viewport` or any DOM element.
  35827. */
  35828. boundariesElement: 'scrollParent'
  35829. },
  35830. /**
  35831. * Modifier used to make sure the reference and its popper stay near each other
  35832. * without leaving any gap between the two. Especially useful when the arrow is
  35833. * enabled and you want to ensure that it points to its reference element.
  35834. * It cares only about the first axis. You can still have poppers with margin
  35835. * between the popper and its reference element.
  35836. * @memberof modifiers
  35837. * @inner
  35838. */
  35839. keepTogether: {
  35840. /** @prop {number} order=400 - Index used to define the order of execution */
  35841. order: 400,
  35842. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35843. enabled: true,
  35844. /** @prop {ModifierFn} */
  35845. fn: keepTogether
  35846. },
  35847. /**
  35848. * This modifier is used to move the `arrowElement` of the popper to make
  35849. * sure it is positioned between the reference element and its popper element.
  35850. * It will read the outer size of the `arrowElement` node to detect how many
  35851. * pixels of conjunction are needed.
  35852. *
  35853. * It has no effect if no `arrowElement` is provided.
  35854. * @memberof modifiers
  35855. * @inner
  35856. */
  35857. arrow: {
  35858. /** @prop {number} order=500 - Index used to define the order of execution */
  35859. order: 500,
  35860. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35861. enabled: true,
  35862. /** @prop {ModifierFn} */
  35863. fn: arrow,
  35864. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35865. element: '[x-arrow]'
  35866. },
  35867. /**
  35868. * Modifier used to flip the popper's placement when it starts to overlap its
  35869. * reference element.
  35870. *
  35871. * Requires the `preventOverflow` modifier before it in order to work.
  35872. *
  35873. * **NOTE:** this modifier will interrupt the current update cycle and will
  35874. * restart it if it detects the need to flip the placement.
  35875. * @memberof modifiers
  35876. * @inner
  35877. */
  35878. flip: {
  35879. /** @prop {number} order=600 - Index used to define the order of execution */
  35880. order: 600,
  35881. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35882. enabled: true,
  35883. /** @prop {ModifierFn} */
  35884. fn: flip,
  35885. /**
  35886. * @prop {String|Array} behavior='flip'
  35887. * The behavior used to change the popper's placement. It can be one of
  35888. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35889. * placements (with optional variations)
  35890. */
  35891. behavior: 'flip',
  35892. /**
  35893. * @prop {number} padding=5
  35894. * The popper will flip if it hits the edges of the `boundariesElement`
  35895. */
  35896. padding: 5,
  35897. /**
  35898. * @prop {String|HTMLElement} boundariesElement='viewport'
  35899. * The element which will define the boundaries of the popper position.
  35900. * The popper will never be placed outside of the defined boundaries
  35901. * (except if `keepTogether` is enabled)
  35902. */
  35903. boundariesElement: 'viewport',
  35904. /**
  35905. * @prop {Boolean} flipVariations=false
  35906. * The popper will switch placement variation between `-start` and `-end` when
  35907. * the reference element overlaps its boundaries.
  35908. *
  35909. * The original placement should have a set variation.
  35910. */
  35911. flipVariations: false,
  35912. /**
  35913. * @prop {Boolean} flipVariationsByContent=false
  35914. * The popper will switch placement variation between `-start` and `-end` when
  35915. * the popper element overlaps its reference boundaries.
  35916. *
  35917. * The original placement should have a set variation.
  35918. */
  35919. flipVariationsByContent: false
  35920. },
  35921. /**
  35922. * Modifier used to make the popper flow toward the inner of the reference element.
  35923. * By default, when this modifier is disabled, the popper will be placed outside
  35924. * the reference element.
  35925. * @memberof modifiers
  35926. * @inner
  35927. */
  35928. inner: {
  35929. /** @prop {number} order=700 - Index used to define the order of execution */
  35930. order: 700,
  35931. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  35932. enabled: false,
  35933. /** @prop {ModifierFn} */
  35934. fn: inner
  35935. },
  35936. /**
  35937. * Modifier used to hide the popper when its reference element is outside of the
  35938. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  35939. * be used to hide with a CSS selector the popper when its reference is
  35940. * out of boundaries.
  35941. *
  35942. * Requires the `preventOverflow` modifier before it in order to work.
  35943. * @memberof modifiers
  35944. * @inner
  35945. */
  35946. hide: {
  35947. /** @prop {number} order=800 - Index used to define the order of execution */
  35948. order: 800,
  35949. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35950. enabled: true,
  35951. /** @prop {ModifierFn} */
  35952. fn: hide
  35953. },
  35954. /**
  35955. * Computes the style that will be applied to the popper element to gets
  35956. * properly positioned.
  35957. *
  35958. * Note that this modifier will not touch the DOM, it just prepares the styles
  35959. * so that `applyStyle` modifier can apply it. This separation is useful
  35960. * in case you need to replace `applyStyle` with a custom implementation.
  35961. *
  35962. * This modifier has `850` as `order` value to maintain backward compatibility
  35963. * with previous versions of Popper.js. Expect the modifiers ordering method
  35964. * to change in future major versions of the library.
  35965. *
  35966. * @memberof modifiers
  35967. * @inner
  35968. */
  35969. computeStyle: {
  35970. /** @prop {number} order=850 - Index used to define the order of execution */
  35971. order: 850,
  35972. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35973. enabled: true,
  35974. /** @prop {ModifierFn} */
  35975. fn: computeStyle,
  35976. /**
  35977. * @prop {Boolean} gpuAcceleration=true
  35978. * If true, it uses the CSS 3D transformation to position the popper.
  35979. * Otherwise, it will use the `top` and `left` properties
  35980. */
  35981. gpuAcceleration: true,
  35982. /**
  35983. * @prop {string} [x='bottom']
  35984. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  35985. * Change this if your popper should grow in a direction different from `bottom`
  35986. */
  35987. x: 'bottom',
  35988. /**
  35989. * @prop {string} [x='left']
  35990. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  35991. * Change this if your popper should grow in a direction different from `right`
  35992. */
  35993. y: 'right'
  35994. },
  35995. /**
  35996. * Applies the computed styles to the popper element.
  35997. *
  35998. * All the DOM manipulations are limited to this modifier. This is useful in case
  35999. * you want to integrate Popper.js inside a framework or view library and you
  36000. * want to delegate all the DOM manipulations to it.
  36001. *
  36002. * Note that if you disable this modifier, you must make sure the popper element
  36003. * has its position set to `absolute` before Popper.js can do its work!
  36004. *
  36005. * Just disable this modifier and define your own to achieve the desired effect.
  36006. *
  36007. * @memberof modifiers
  36008. * @inner
  36009. */
  36010. applyStyle: {
  36011. /** @prop {number} order=900 - Index used to define the order of execution */
  36012. order: 900,
  36013. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36014. enabled: true,
  36015. /** @prop {ModifierFn} */
  36016. fn: applyStyle,
  36017. /** @prop {Function} */
  36018. onLoad: applyStyleOnLoad,
  36019. /**
  36020. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36021. * @prop {Boolean} gpuAcceleration=true
  36022. * If true, it uses the CSS 3D transformation to position the popper.
  36023. * Otherwise, it will use the `top` and `left` properties
  36024. */
  36025. gpuAcceleration: undefined
  36026. }
  36027. };
  36028. /**
  36029. * The `dataObject` is an object containing all the information used by Popper.js.
  36030. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36031. * @name dataObject
  36032. * @property {Object} data.instance The Popper.js instance
  36033. * @property {String} data.placement Placement applied to popper
  36034. * @property {String} data.originalPlacement Placement originally defined on init
  36035. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36036. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36037. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36038. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36039. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36040. * @property {Object} data.boundaries Offsets of the popper boundaries
  36041. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36042. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36043. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36044. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36045. */
  36046. /**
  36047. * Default options provided to Popper.js constructor.<br />
  36048. * These can be overridden using the `options` argument of Popper.js.<br />
  36049. * To override an option, simply pass an object with the same
  36050. * structure of the `options` object, as the 3rd argument. For example:
  36051. * ```
  36052. * new Popper(ref, pop, {
  36053. * modifiers: {
  36054. * preventOverflow: { enabled: false }
  36055. * }
  36056. * })
  36057. * ```
  36058. * @type {Object}
  36059. * @static
  36060. * @memberof Popper
  36061. */
  36062. var Defaults = {
  36063. /**
  36064. * Popper's placement.
  36065. * @prop {Popper.placements} placement='bottom'
  36066. */
  36067. placement: 'bottom',
  36068. /**
  36069. * Set this to true if you want popper to position it self in 'fixed' mode
  36070. * @prop {Boolean} positionFixed=false
  36071. */
  36072. positionFixed: false,
  36073. /**
  36074. * Whether events (resize, scroll) are initially enabled.
  36075. * @prop {Boolean} eventsEnabled=true
  36076. */
  36077. eventsEnabled: true,
  36078. /**
  36079. * Set to true if you want to automatically remove the popper when
  36080. * you call the `destroy` method.
  36081. * @prop {Boolean} removeOnDestroy=false
  36082. */
  36083. removeOnDestroy: false,
  36084. /**
  36085. * Callback called when the popper is created.<br />
  36086. * By default, it is set to no-op.<br />
  36087. * Access Popper.js instance with `data.instance`.
  36088. * @prop {onCreate}
  36089. */
  36090. onCreate: function onCreate() {},
  36091. /**
  36092. * Callback called when the popper is updated. This callback is not called
  36093. * on the initialization/creation of the popper, but only on subsequent
  36094. * updates.<br />
  36095. * By default, it is set to no-op.<br />
  36096. * Access Popper.js instance with `data.instance`.
  36097. * @prop {onUpdate}
  36098. */
  36099. onUpdate: function onUpdate() {},
  36100. /**
  36101. * List of modifiers used to modify the offsets before they are applied to the popper.
  36102. * They provide most of the functionalities of Popper.js.
  36103. * @prop {modifiers}
  36104. */
  36105. modifiers: modifiers
  36106. };
  36107. /**
  36108. * @callback onCreate
  36109. * @param {dataObject} data
  36110. */
  36111. /**
  36112. * @callback onUpdate
  36113. * @param {dataObject} data
  36114. */
  36115. // Utils
  36116. // Methods
  36117. var Popper = function () {
  36118. /**
  36119. * Creates a new Popper.js instance.
  36120. * @class Popper
  36121. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36122. * @param {Element} popper - The HTML / XML element used as the popper
  36123. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36124. * @return {Object} instance - The generated Popper.js instance
  36125. */
  36126. function Popper(reference, popper) {
  36127. var _this = this;
  36128. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36129. classCallCheck(this, Popper);
  36130. this.scheduleUpdate = function () {
  36131. return requestAnimationFrame(_this.update);
  36132. };
  36133. // make update() debounced, so that it only runs at most once-per-tick
  36134. this.update = debounce(this.update.bind(this));
  36135. // with {} we create a new object with the options inside it
  36136. this.options = _extends({}, Popper.Defaults, options);
  36137. // init state
  36138. this.state = {
  36139. isDestroyed: false,
  36140. isCreated: false,
  36141. scrollParents: []
  36142. };
  36143. // get reference and popper elements (allow jQuery wrappers)
  36144. this.reference = reference && reference.jquery ? reference[0] : reference;
  36145. this.popper = popper && popper.jquery ? popper[0] : popper;
  36146. // Deep merge modifiers options
  36147. this.options.modifiers = {};
  36148. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36149. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36150. });
  36151. // Refactoring modifiers' list (Object => Array)
  36152. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36153. return _extends({
  36154. name: name
  36155. }, _this.options.modifiers[name]);
  36156. })
  36157. // sort the modifiers by order
  36158. .sort(function (a, b) {
  36159. return a.order - b.order;
  36160. });
  36161. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36162. // such code is executed in the same order of its modifier
  36163. // they could add new properties to their options configuration
  36164. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36165. this.modifiers.forEach(function (modifierOptions) {
  36166. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36167. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36168. }
  36169. });
  36170. // fire the first update to position the popper in the right place
  36171. this.update();
  36172. var eventsEnabled = this.options.eventsEnabled;
  36173. if (eventsEnabled) {
  36174. // setup event listeners, they will take care of update the position in specific situations
  36175. this.enableEventListeners();
  36176. }
  36177. this.state.eventsEnabled = eventsEnabled;
  36178. }
  36179. // We can't use class properties because they don't get listed in the
  36180. // class prototype and break stuff like Sinon stubs
  36181. createClass(Popper, [{
  36182. key: 'update',
  36183. value: function update$$1() {
  36184. return update.call(this);
  36185. }
  36186. }, {
  36187. key: 'destroy',
  36188. value: function destroy$$1() {
  36189. return destroy.call(this);
  36190. }
  36191. }, {
  36192. key: 'enableEventListeners',
  36193. value: function enableEventListeners$$1() {
  36194. return enableEventListeners.call(this);
  36195. }
  36196. }, {
  36197. key: 'disableEventListeners',
  36198. value: function disableEventListeners$$1() {
  36199. return disableEventListeners.call(this);
  36200. }
  36201. /**
  36202. * Schedules an update. It will run on the next UI update available.
  36203. * @method scheduleUpdate
  36204. * @memberof Popper
  36205. */
  36206. /**
  36207. * Collection of utilities useful when writing custom modifiers.
  36208. * Starting from version 1.7, this method is available only if you
  36209. * include `popper-utils.js` before `popper.js`.
  36210. *
  36211. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36212. * and will be removed in v2! Use the PopperUtils module directly instead.
  36213. * Due to the high instability of the methods contained in Utils, we can't
  36214. * guarantee them to follow semver. Use them at your own risk!
  36215. * @static
  36216. * @private
  36217. * @type {Object}
  36218. * @deprecated since version 1.8
  36219. * @member Utils
  36220. * @memberof Popper
  36221. */
  36222. }]);
  36223. return Popper;
  36224. }();
  36225. /**
  36226. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36227. * and lets you use it as replacement of a real DOM node.<br />
  36228. * You can use this method to position a popper relatively to a set of coordinates
  36229. * in case you don't have a DOM node to use as reference.
  36230. *
  36231. * ```
  36232. * new Popper(referenceObject, popperNode);
  36233. * ```
  36234. *
  36235. * NB: This feature isn't supported in Internet Explorer 10.
  36236. * @name referenceObject
  36237. * @property {Function} data.getBoundingClientRect
  36238. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36239. * @property {number} data.clientWidth
  36240. * An ES6 getter that will return the width of the virtual reference element.
  36241. * @property {number} data.clientHeight
  36242. * An ES6 getter that will return the height of the virtual reference element.
  36243. */
  36244. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36245. Popper.placements = placements;
  36246. Popper.Defaults = Defaults;
  36247. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36248. //# sourceMappingURL=popper.js.map
  36249. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36250. /***/ }),
  36251. /***/ "./node_modules/process/browser.js":
  36252. /*!*****************************************!*\
  36253. !*** ./node_modules/process/browser.js ***!
  36254. \*****************************************/
  36255. /*! no static exports found */
  36256. /***/ (function(module, exports) {
  36257. // shim for using process in browser
  36258. var process = module.exports = {};
  36259. // cached from whatever global is present so that test runners that stub it
  36260. // don't break things. But we need to wrap it in a try catch in case it is
  36261. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36262. // function because try/catches deoptimize in certain engines.
  36263. var cachedSetTimeout;
  36264. var cachedClearTimeout;
  36265. function defaultSetTimout() {
  36266. throw new Error('setTimeout has not been defined');
  36267. }
  36268. function defaultClearTimeout () {
  36269. throw new Error('clearTimeout has not been defined');
  36270. }
  36271. (function () {
  36272. try {
  36273. if (typeof setTimeout === 'function') {
  36274. cachedSetTimeout = setTimeout;
  36275. } else {
  36276. cachedSetTimeout = defaultSetTimout;
  36277. }
  36278. } catch (e) {
  36279. cachedSetTimeout = defaultSetTimout;
  36280. }
  36281. try {
  36282. if (typeof clearTimeout === 'function') {
  36283. cachedClearTimeout = clearTimeout;
  36284. } else {
  36285. cachedClearTimeout = defaultClearTimeout;
  36286. }
  36287. } catch (e) {
  36288. cachedClearTimeout = defaultClearTimeout;
  36289. }
  36290. } ())
  36291. function runTimeout(fun) {
  36292. if (cachedSetTimeout === setTimeout) {
  36293. //normal enviroments in sane situations
  36294. return setTimeout(fun, 0);
  36295. }
  36296. // if setTimeout wasn't available but was latter defined
  36297. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36298. cachedSetTimeout = setTimeout;
  36299. return setTimeout(fun, 0);
  36300. }
  36301. try {
  36302. // when when somebody has screwed with setTimeout but no I.E. maddness
  36303. return cachedSetTimeout(fun, 0);
  36304. } catch(e){
  36305. try {
  36306. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36307. return cachedSetTimeout.call(null, fun, 0);
  36308. } catch(e){
  36309. // 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
  36310. return cachedSetTimeout.call(this, fun, 0);
  36311. }
  36312. }
  36313. }
  36314. function runClearTimeout(marker) {
  36315. if (cachedClearTimeout === clearTimeout) {
  36316. //normal enviroments in sane situations
  36317. return clearTimeout(marker);
  36318. }
  36319. // if clearTimeout wasn't available but was latter defined
  36320. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36321. cachedClearTimeout = clearTimeout;
  36322. return clearTimeout(marker);
  36323. }
  36324. try {
  36325. // when when somebody has screwed with setTimeout but no I.E. maddness
  36326. return cachedClearTimeout(marker);
  36327. } catch (e){
  36328. try {
  36329. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36330. return cachedClearTimeout.call(null, marker);
  36331. } catch (e){
  36332. // 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.
  36333. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36334. return cachedClearTimeout.call(this, marker);
  36335. }
  36336. }
  36337. }
  36338. var queue = [];
  36339. var draining = false;
  36340. var currentQueue;
  36341. var queueIndex = -1;
  36342. function cleanUpNextTick() {
  36343. if (!draining || !currentQueue) {
  36344. return;
  36345. }
  36346. draining = false;
  36347. if (currentQueue.length) {
  36348. queue = currentQueue.concat(queue);
  36349. } else {
  36350. queueIndex = -1;
  36351. }
  36352. if (queue.length) {
  36353. drainQueue();
  36354. }
  36355. }
  36356. function drainQueue() {
  36357. if (draining) {
  36358. return;
  36359. }
  36360. var timeout = runTimeout(cleanUpNextTick);
  36361. draining = true;
  36362. var len = queue.length;
  36363. while(len) {
  36364. currentQueue = queue;
  36365. queue = [];
  36366. while (++queueIndex < len) {
  36367. if (currentQueue) {
  36368. currentQueue[queueIndex].run();
  36369. }
  36370. }
  36371. queueIndex = -1;
  36372. len = queue.length;
  36373. }
  36374. currentQueue = null;
  36375. draining = false;
  36376. runClearTimeout(timeout);
  36377. }
  36378. process.nextTick = function (fun) {
  36379. var args = new Array(arguments.length - 1);
  36380. if (arguments.length > 1) {
  36381. for (var i = 1; i < arguments.length; i++) {
  36382. args[i - 1] = arguments[i];
  36383. }
  36384. }
  36385. queue.push(new Item(fun, args));
  36386. if (queue.length === 1 && !draining) {
  36387. runTimeout(drainQueue);
  36388. }
  36389. };
  36390. // v8 likes predictible objects
  36391. function Item(fun, array) {
  36392. this.fun = fun;
  36393. this.array = array;
  36394. }
  36395. Item.prototype.run = function () {
  36396. this.fun.apply(null, this.array);
  36397. };
  36398. process.title = 'browser';
  36399. process.browser = true;
  36400. process.env = {};
  36401. process.argv = [];
  36402. process.version = ''; // empty string to avoid regexp issues
  36403. process.versions = {};
  36404. function noop() {}
  36405. process.on = noop;
  36406. process.addListener = noop;
  36407. process.once = noop;
  36408. process.off = noop;
  36409. process.removeListener = noop;
  36410. process.removeAllListeners = noop;
  36411. process.emit = noop;
  36412. process.prependListener = noop;
  36413. process.prependOnceListener = noop;
  36414. process.listeners = function (name) { return [] }
  36415. process.binding = function (name) {
  36416. throw new Error('process.binding is not supported');
  36417. };
  36418. process.cwd = function () { return '/' };
  36419. process.chdir = function (dir) {
  36420. throw new Error('process.chdir is not supported');
  36421. };
  36422. process.umask = function() { return 0; };
  36423. /***/ }),
  36424. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36425. /*!***************************************************!*\
  36426. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36427. \***************************************************/
  36428. /*! no static exports found */
  36429. /***/ (function(module, exports, __webpack_require__) {
  36430. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36431. * Pusher JavaScript Library v5.0.3
  36432. * https://pusher.com/
  36433. *
  36434. * Copyright 2017, Pusher
  36435. * Released under the MIT licence.
  36436. */
  36437. (function webpackUniversalModuleDefinition(root, factory) {
  36438. if(true)
  36439. module.exports = factory();
  36440. else {}
  36441. })(window, function() {
  36442. return /******/ (function(modules) { // webpackBootstrap
  36443. /******/ // The module cache
  36444. /******/ var installedModules = {};
  36445. /******/
  36446. /******/ // The require function
  36447. /******/ function __webpack_require__(moduleId) {
  36448. /******/
  36449. /******/ // Check if module is in cache
  36450. /******/ if(installedModules[moduleId]) {
  36451. /******/ return installedModules[moduleId].exports;
  36452. /******/ }
  36453. /******/ // Create a new module (and put it into the cache)
  36454. /******/ var module = installedModules[moduleId] = {
  36455. /******/ i: moduleId,
  36456. /******/ l: false,
  36457. /******/ exports: {}
  36458. /******/ };
  36459. /******/
  36460. /******/ // Execute the module function
  36461. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36462. /******/
  36463. /******/ // Flag the module as loaded
  36464. /******/ module.l = true;
  36465. /******/
  36466. /******/ // Return the exports of the module
  36467. /******/ return module.exports;
  36468. /******/ }
  36469. /******/
  36470. /******/
  36471. /******/ // expose the modules object (__webpack_modules__)
  36472. /******/ __webpack_require__.m = modules;
  36473. /******/
  36474. /******/ // expose the module cache
  36475. /******/ __webpack_require__.c = installedModules;
  36476. /******/
  36477. /******/ // define getter function for harmony exports
  36478. /******/ __webpack_require__.d = function(exports, name, getter) {
  36479. /******/ if(!__webpack_require__.o(exports, name)) {
  36480. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36481. /******/ }
  36482. /******/ };
  36483. /******/
  36484. /******/ // define __esModule on exports
  36485. /******/ __webpack_require__.r = function(exports) {
  36486. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36487. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36488. /******/ }
  36489. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36490. /******/ };
  36491. /******/
  36492. /******/ // create a fake namespace object
  36493. /******/ // mode & 1: value is a module id, require it
  36494. /******/ // mode & 2: merge all properties of value into the ns
  36495. /******/ // mode & 4: return value when already ns object
  36496. /******/ // mode & 8|1: behave like require
  36497. /******/ __webpack_require__.t = function(value, mode) {
  36498. /******/ if(mode & 1) value = __webpack_require__(value);
  36499. /******/ if(mode & 8) return value;
  36500. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36501. /******/ var ns = Object.create(null);
  36502. /******/ __webpack_require__.r(ns);
  36503. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36504. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36505. /******/ return ns;
  36506. /******/ };
  36507. /******/
  36508. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36509. /******/ __webpack_require__.n = function(module) {
  36510. /******/ var getter = module && module.__esModule ?
  36511. /******/ function getDefault() { return module['default']; } :
  36512. /******/ function getModuleExports() { return module; };
  36513. /******/ __webpack_require__.d(getter, 'a', getter);
  36514. /******/ return getter;
  36515. /******/ };
  36516. /******/
  36517. /******/ // Object.prototype.hasOwnProperty.call
  36518. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36519. /******/
  36520. /******/ // __webpack_public_path__
  36521. /******/ __webpack_require__.p = "";
  36522. /******/
  36523. /******/
  36524. /******/ // Load entry module and return exports
  36525. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36526. /******/ })
  36527. /************************************************************************/
  36528. /******/ ([
  36529. /* 0 */
  36530. /***/ (function(module, exports, __webpack_require__) {
  36531. (function(nacl) {
  36532. 'use strict';
  36533. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36534. // Public domain.
  36535. //
  36536. // Implementation derived from TweetNaCl version 20140427.
  36537. // See for details: http://tweetnacl.cr.yp.to/
  36538. var gf = function(init) {
  36539. var i, r = new Float64Array(16);
  36540. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36541. return r;
  36542. };
  36543. // Pluggable, initialized in high-level API below.
  36544. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36545. var _0 = new Uint8Array(16);
  36546. var _9 = new Uint8Array(32); _9[0] = 9;
  36547. var gf0 = gf(),
  36548. gf1 = gf([1]),
  36549. _121665 = gf([0xdb41, 1]),
  36550. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36551. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36552. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36553. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36554. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36555. function ts64(x, i, h, l) {
  36556. x[i] = (h >> 24) & 0xff;
  36557. x[i+1] = (h >> 16) & 0xff;
  36558. x[i+2] = (h >> 8) & 0xff;
  36559. x[i+3] = h & 0xff;
  36560. x[i+4] = (l >> 24) & 0xff;
  36561. x[i+5] = (l >> 16) & 0xff;
  36562. x[i+6] = (l >> 8) & 0xff;
  36563. x[i+7] = l & 0xff;
  36564. }
  36565. function vn(x, xi, y, yi, n) {
  36566. var i,d = 0;
  36567. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36568. return (1 & ((d - 1) >>> 8)) - 1;
  36569. }
  36570. function crypto_verify_16(x, xi, y, yi) {
  36571. return vn(x,xi,y,yi,16);
  36572. }
  36573. function crypto_verify_32(x, xi, y, yi) {
  36574. return vn(x,xi,y,yi,32);
  36575. }
  36576. function core_salsa20(o, p, k, c) {
  36577. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36578. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36579. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36580. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36581. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36582. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36583. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36584. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36585. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36586. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36587. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36588. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36589. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36590. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36591. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36592. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36593. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36594. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36595. x15 = j15, u;
  36596. for (var i = 0; i < 20; i += 2) {
  36597. u = x0 + x12 | 0;
  36598. x4 ^= u<<7 | u>>>(32-7);
  36599. u = x4 + x0 | 0;
  36600. x8 ^= u<<9 | u>>>(32-9);
  36601. u = x8 + x4 | 0;
  36602. x12 ^= u<<13 | u>>>(32-13);
  36603. u = x12 + x8 | 0;
  36604. x0 ^= u<<18 | u>>>(32-18);
  36605. u = x5 + x1 | 0;
  36606. x9 ^= u<<7 | u>>>(32-7);
  36607. u = x9 + x5 | 0;
  36608. x13 ^= u<<9 | u>>>(32-9);
  36609. u = x13 + x9 | 0;
  36610. x1 ^= u<<13 | u>>>(32-13);
  36611. u = x1 + x13 | 0;
  36612. x5 ^= u<<18 | u>>>(32-18);
  36613. u = x10 + x6 | 0;
  36614. x14 ^= u<<7 | u>>>(32-7);
  36615. u = x14 + x10 | 0;
  36616. x2 ^= u<<9 | u>>>(32-9);
  36617. u = x2 + x14 | 0;
  36618. x6 ^= u<<13 | u>>>(32-13);
  36619. u = x6 + x2 | 0;
  36620. x10 ^= u<<18 | u>>>(32-18);
  36621. u = x15 + x11 | 0;
  36622. x3 ^= u<<7 | u>>>(32-7);
  36623. u = x3 + x15 | 0;
  36624. x7 ^= u<<9 | u>>>(32-9);
  36625. u = x7 + x3 | 0;
  36626. x11 ^= u<<13 | u>>>(32-13);
  36627. u = x11 + x7 | 0;
  36628. x15 ^= u<<18 | u>>>(32-18);
  36629. u = x0 + x3 | 0;
  36630. x1 ^= u<<7 | u>>>(32-7);
  36631. u = x1 + x0 | 0;
  36632. x2 ^= u<<9 | u>>>(32-9);
  36633. u = x2 + x1 | 0;
  36634. x3 ^= u<<13 | u>>>(32-13);
  36635. u = x3 + x2 | 0;
  36636. x0 ^= u<<18 | u>>>(32-18);
  36637. u = x5 + x4 | 0;
  36638. x6 ^= u<<7 | u>>>(32-7);
  36639. u = x6 + x5 | 0;
  36640. x7 ^= u<<9 | u>>>(32-9);
  36641. u = x7 + x6 | 0;
  36642. x4 ^= u<<13 | u>>>(32-13);
  36643. u = x4 + x7 | 0;
  36644. x5 ^= u<<18 | u>>>(32-18);
  36645. u = x10 + x9 | 0;
  36646. x11 ^= u<<7 | u>>>(32-7);
  36647. u = x11 + x10 | 0;
  36648. x8 ^= u<<9 | u>>>(32-9);
  36649. u = x8 + x11 | 0;
  36650. x9 ^= u<<13 | u>>>(32-13);
  36651. u = x9 + x8 | 0;
  36652. x10 ^= u<<18 | u>>>(32-18);
  36653. u = x15 + x14 | 0;
  36654. x12 ^= u<<7 | u>>>(32-7);
  36655. u = x12 + x15 | 0;
  36656. x13 ^= u<<9 | u>>>(32-9);
  36657. u = x13 + x12 | 0;
  36658. x14 ^= u<<13 | u>>>(32-13);
  36659. u = x14 + x13 | 0;
  36660. x15 ^= u<<18 | u>>>(32-18);
  36661. }
  36662. x0 = x0 + j0 | 0;
  36663. x1 = x1 + j1 | 0;
  36664. x2 = x2 + j2 | 0;
  36665. x3 = x3 + j3 | 0;
  36666. x4 = x4 + j4 | 0;
  36667. x5 = x5 + j5 | 0;
  36668. x6 = x6 + j6 | 0;
  36669. x7 = x7 + j7 | 0;
  36670. x8 = x8 + j8 | 0;
  36671. x9 = x9 + j9 | 0;
  36672. x10 = x10 + j10 | 0;
  36673. x11 = x11 + j11 | 0;
  36674. x12 = x12 + j12 | 0;
  36675. x13 = x13 + j13 | 0;
  36676. x14 = x14 + j14 | 0;
  36677. x15 = x15 + j15 | 0;
  36678. o[ 0] = x0 >>> 0 & 0xff;
  36679. o[ 1] = x0 >>> 8 & 0xff;
  36680. o[ 2] = x0 >>> 16 & 0xff;
  36681. o[ 3] = x0 >>> 24 & 0xff;
  36682. o[ 4] = x1 >>> 0 & 0xff;
  36683. o[ 5] = x1 >>> 8 & 0xff;
  36684. o[ 6] = x1 >>> 16 & 0xff;
  36685. o[ 7] = x1 >>> 24 & 0xff;
  36686. o[ 8] = x2 >>> 0 & 0xff;
  36687. o[ 9] = x2 >>> 8 & 0xff;
  36688. o[10] = x2 >>> 16 & 0xff;
  36689. o[11] = x2 >>> 24 & 0xff;
  36690. o[12] = x3 >>> 0 & 0xff;
  36691. o[13] = x3 >>> 8 & 0xff;
  36692. o[14] = x3 >>> 16 & 0xff;
  36693. o[15] = x3 >>> 24 & 0xff;
  36694. o[16] = x4 >>> 0 & 0xff;
  36695. o[17] = x4 >>> 8 & 0xff;
  36696. o[18] = x4 >>> 16 & 0xff;
  36697. o[19] = x4 >>> 24 & 0xff;
  36698. o[20] = x5 >>> 0 & 0xff;
  36699. o[21] = x5 >>> 8 & 0xff;
  36700. o[22] = x5 >>> 16 & 0xff;
  36701. o[23] = x5 >>> 24 & 0xff;
  36702. o[24] = x6 >>> 0 & 0xff;
  36703. o[25] = x6 >>> 8 & 0xff;
  36704. o[26] = x6 >>> 16 & 0xff;
  36705. o[27] = x6 >>> 24 & 0xff;
  36706. o[28] = x7 >>> 0 & 0xff;
  36707. o[29] = x7 >>> 8 & 0xff;
  36708. o[30] = x7 >>> 16 & 0xff;
  36709. o[31] = x7 >>> 24 & 0xff;
  36710. o[32] = x8 >>> 0 & 0xff;
  36711. o[33] = x8 >>> 8 & 0xff;
  36712. o[34] = x8 >>> 16 & 0xff;
  36713. o[35] = x8 >>> 24 & 0xff;
  36714. o[36] = x9 >>> 0 & 0xff;
  36715. o[37] = x9 >>> 8 & 0xff;
  36716. o[38] = x9 >>> 16 & 0xff;
  36717. o[39] = x9 >>> 24 & 0xff;
  36718. o[40] = x10 >>> 0 & 0xff;
  36719. o[41] = x10 >>> 8 & 0xff;
  36720. o[42] = x10 >>> 16 & 0xff;
  36721. o[43] = x10 >>> 24 & 0xff;
  36722. o[44] = x11 >>> 0 & 0xff;
  36723. o[45] = x11 >>> 8 & 0xff;
  36724. o[46] = x11 >>> 16 & 0xff;
  36725. o[47] = x11 >>> 24 & 0xff;
  36726. o[48] = x12 >>> 0 & 0xff;
  36727. o[49] = x12 >>> 8 & 0xff;
  36728. o[50] = x12 >>> 16 & 0xff;
  36729. o[51] = x12 >>> 24 & 0xff;
  36730. o[52] = x13 >>> 0 & 0xff;
  36731. o[53] = x13 >>> 8 & 0xff;
  36732. o[54] = x13 >>> 16 & 0xff;
  36733. o[55] = x13 >>> 24 & 0xff;
  36734. o[56] = x14 >>> 0 & 0xff;
  36735. o[57] = x14 >>> 8 & 0xff;
  36736. o[58] = x14 >>> 16 & 0xff;
  36737. o[59] = x14 >>> 24 & 0xff;
  36738. o[60] = x15 >>> 0 & 0xff;
  36739. o[61] = x15 >>> 8 & 0xff;
  36740. o[62] = x15 >>> 16 & 0xff;
  36741. o[63] = x15 >>> 24 & 0xff;
  36742. }
  36743. function core_hsalsa20(o,p,k,c) {
  36744. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36745. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36746. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36747. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36748. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36749. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36750. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36751. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36752. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36753. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36754. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36755. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36756. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36757. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36758. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36759. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36760. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36761. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36762. x15 = j15, u;
  36763. for (var i = 0; i < 20; i += 2) {
  36764. u = x0 + x12 | 0;
  36765. x4 ^= u<<7 | u>>>(32-7);
  36766. u = x4 + x0 | 0;
  36767. x8 ^= u<<9 | u>>>(32-9);
  36768. u = x8 + x4 | 0;
  36769. x12 ^= u<<13 | u>>>(32-13);
  36770. u = x12 + x8 | 0;
  36771. x0 ^= u<<18 | u>>>(32-18);
  36772. u = x5 + x1 | 0;
  36773. x9 ^= u<<7 | u>>>(32-7);
  36774. u = x9 + x5 | 0;
  36775. x13 ^= u<<9 | u>>>(32-9);
  36776. u = x13 + x9 | 0;
  36777. x1 ^= u<<13 | u>>>(32-13);
  36778. u = x1 + x13 | 0;
  36779. x5 ^= u<<18 | u>>>(32-18);
  36780. u = x10 + x6 | 0;
  36781. x14 ^= u<<7 | u>>>(32-7);
  36782. u = x14 + x10 | 0;
  36783. x2 ^= u<<9 | u>>>(32-9);
  36784. u = x2 + x14 | 0;
  36785. x6 ^= u<<13 | u>>>(32-13);
  36786. u = x6 + x2 | 0;
  36787. x10 ^= u<<18 | u>>>(32-18);
  36788. u = x15 + x11 | 0;
  36789. x3 ^= u<<7 | u>>>(32-7);
  36790. u = x3 + x15 | 0;
  36791. x7 ^= u<<9 | u>>>(32-9);
  36792. u = x7 + x3 | 0;
  36793. x11 ^= u<<13 | u>>>(32-13);
  36794. u = x11 + x7 | 0;
  36795. x15 ^= u<<18 | u>>>(32-18);
  36796. u = x0 + x3 | 0;
  36797. x1 ^= u<<7 | u>>>(32-7);
  36798. u = x1 + x0 | 0;
  36799. x2 ^= u<<9 | u>>>(32-9);
  36800. u = x2 + x1 | 0;
  36801. x3 ^= u<<13 | u>>>(32-13);
  36802. u = x3 + x2 | 0;
  36803. x0 ^= u<<18 | u>>>(32-18);
  36804. u = x5 + x4 | 0;
  36805. x6 ^= u<<7 | u>>>(32-7);
  36806. u = x6 + x5 | 0;
  36807. x7 ^= u<<9 | u>>>(32-9);
  36808. u = x7 + x6 | 0;
  36809. x4 ^= u<<13 | u>>>(32-13);
  36810. u = x4 + x7 | 0;
  36811. x5 ^= u<<18 | u>>>(32-18);
  36812. u = x10 + x9 | 0;
  36813. x11 ^= u<<7 | u>>>(32-7);
  36814. u = x11 + x10 | 0;
  36815. x8 ^= u<<9 | u>>>(32-9);
  36816. u = x8 + x11 | 0;
  36817. x9 ^= u<<13 | u>>>(32-13);
  36818. u = x9 + x8 | 0;
  36819. x10 ^= u<<18 | u>>>(32-18);
  36820. u = x15 + x14 | 0;
  36821. x12 ^= u<<7 | u>>>(32-7);
  36822. u = x12 + x15 | 0;
  36823. x13 ^= u<<9 | u>>>(32-9);
  36824. u = x13 + x12 | 0;
  36825. x14 ^= u<<13 | u>>>(32-13);
  36826. u = x14 + x13 | 0;
  36827. x15 ^= u<<18 | u>>>(32-18);
  36828. }
  36829. o[ 0] = x0 >>> 0 & 0xff;
  36830. o[ 1] = x0 >>> 8 & 0xff;
  36831. o[ 2] = x0 >>> 16 & 0xff;
  36832. o[ 3] = x0 >>> 24 & 0xff;
  36833. o[ 4] = x5 >>> 0 & 0xff;
  36834. o[ 5] = x5 >>> 8 & 0xff;
  36835. o[ 6] = x5 >>> 16 & 0xff;
  36836. o[ 7] = x5 >>> 24 & 0xff;
  36837. o[ 8] = x10 >>> 0 & 0xff;
  36838. o[ 9] = x10 >>> 8 & 0xff;
  36839. o[10] = x10 >>> 16 & 0xff;
  36840. o[11] = x10 >>> 24 & 0xff;
  36841. o[12] = x15 >>> 0 & 0xff;
  36842. o[13] = x15 >>> 8 & 0xff;
  36843. o[14] = x15 >>> 16 & 0xff;
  36844. o[15] = x15 >>> 24 & 0xff;
  36845. o[16] = x6 >>> 0 & 0xff;
  36846. o[17] = x6 >>> 8 & 0xff;
  36847. o[18] = x6 >>> 16 & 0xff;
  36848. o[19] = x6 >>> 24 & 0xff;
  36849. o[20] = x7 >>> 0 & 0xff;
  36850. o[21] = x7 >>> 8 & 0xff;
  36851. o[22] = x7 >>> 16 & 0xff;
  36852. o[23] = x7 >>> 24 & 0xff;
  36853. o[24] = x8 >>> 0 & 0xff;
  36854. o[25] = x8 >>> 8 & 0xff;
  36855. o[26] = x8 >>> 16 & 0xff;
  36856. o[27] = x8 >>> 24 & 0xff;
  36857. o[28] = x9 >>> 0 & 0xff;
  36858. o[29] = x9 >>> 8 & 0xff;
  36859. o[30] = x9 >>> 16 & 0xff;
  36860. o[31] = x9 >>> 24 & 0xff;
  36861. }
  36862. function crypto_core_salsa20(out,inp,k,c) {
  36863. core_salsa20(out,inp,k,c);
  36864. }
  36865. function crypto_core_hsalsa20(out,inp,k,c) {
  36866. core_hsalsa20(out,inp,k,c);
  36867. }
  36868. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36869. // "expand 32-byte k"
  36870. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36871. var z = new Uint8Array(16), x = new Uint8Array(64);
  36872. var u, i;
  36873. for (i = 0; i < 16; i++) z[i] = 0;
  36874. for (i = 0; i < 8; i++) z[i] = n[i];
  36875. while (b >= 64) {
  36876. crypto_core_salsa20(x,z,k,sigma);
  36877. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36878. u = 1;
  36879. for (i = 8; i < 16; i++) {
  36880. u = u + (z[i] & 0xff) | 0;
  36881. z[i] = u & 0xff;
  36882. u >>>= 8;
  36883. }
  36884. b -= 64;
  36885. cpos += 64;
  36886. mpos += 64;
  36887. }
  36888. if (b > 0) {
  36889. crypto_core_salsa20(x,z,k,sigma);
  36890. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36891. }
  36892. return 0;
  36893. }
  36894. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36895. var z = new Uint8Array(16), x = new Uint8Array(64);
  36896. var u, i;
  36897. for (i = 0; i < 16; i++) z[i] = 0;
  36898. for (i = 0; i < 8; i++) z[i] = n[i];
  36899. while (b >= 64) {
  36900. crypto_core_salsa20(x,z,k,sigma);
  36901. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36902. u = 1;
  36903. for (i = 8; i < 16; i++) {
  36904. u = u + (z[i] & 0xff) | 0;
  36905. z[i] = u & 0xff;
  36906. u >>>= 8;
  36907. }
  36908. b -= 64;
  36909. cpos += 64;
  36910. }
  36911. if (b > 0) {
  36912. crypto_core_salsa20(x,z,k,sigma);
  36913. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  36914. }
  36915. return 0;
  36916. }
  36917. function crypto_stream(c,cpos,d,n,k) {
  36918. var s = new Uint8Array(32);
  36919. crypto_core_hsalsa20(s,n,k,sigma);
  36920. var sn = new Uint8Array(8);
  36921. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36922. return crypto_stream_salsa20(c,cpos,d,sn,s);
  36923. }
  36924. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  36925. var s = new Uint8Array(32);
  36926. crypto_core_hsalsa20(s,n,k,sigma);
  36927. var sn = new Uint8Array(8);
  36928. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36929. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  36930. }
  36931. /*
  36932. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  36933. * https://github.com/floodyberry/poly1305-donna
  36934. */
  36935. var poly1305 = function(key) {
  36936. this.buffer = new Uint8Array(16);
  36937. this.r = new Uint16Array(10);
  36938. this.h = new Uint16Array(10);
  36939. this.pad = new Uint16Array(8);
  36940. this.leftover = 0;
  36941. this.fin = 0;
  36942. var t0, t1, t2, t3, t4, t5, t6, t7;
  36943. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  36944. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36945. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  36946. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36947. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  36948. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  36949. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36950. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  36951. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36952. this.r[9] = ((t7 >>> 5)) & 0x007f;
  36953. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  36954. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  36955. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  36956. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  36957. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  36958. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  36959. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  36960. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  36961. };
  36962. poly1305.prototype.blocks = function(m, mpos, bytes) {
  36963. var hibit = this.fin ? 0 : (1 << 11);
  36964. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  36965. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  36966. var h0 = this.h[0],
  36967. h1 = this.h[1],
  36968. h2 = this.h[2],
  36969. h3 = this.h[3],
  36970. h4 = this.h[4],
  36971. h5 = this.h[5],
  36972. h6 = this.h[6],
  36973. h7 = this.h[7],
  36974. h8 = this.h[8],
  36975. h9 = this.h[9];
  36976. var r0 = this.r[0],
  36977. r1 = this.r[1],
  36978. r2 = this.r[2],
  36979. r3 = this.r[3],
  36980. r4 = this.r[4],
  36981. r5 = this.r[5],
  36982. r6 = this.r[6],
  36983. r7 = this.r[7],
  36984. r8 = this.r[8],
  36985. r9 = this.r[9];
  36986. while (bytes >= 16) {
  36987. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  36988. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36989. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  36990. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36991. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  36992. h5 += ((t4 >>> 1)) & 0x1fff;
  36993. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36994. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  36995. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36996. h9 += ((t7 >>> 5)) | hibit;
  36997. c = 0;
  36998. d0 = c;
  36999. d0 += h0 * r0;
  37000. d0 += h1 * (5 * r9);
  37001. d0 += h2 * (5 * r8);
  37002. d0 += h3 * (5 * r7);
  37003. d0 += h4 * (5 * r6);
  37004. c = (d0 >>> 13); d0 &= 0x1fff;
  37005. d0 += h5 * (5 * r5);
  37006. d0 += h6 * (5 * r4);
  37007. d0 += h7 * (5 * r3);
  37008. d0 += h8 * (5 * r2);
  37009. d0 += h9 * (5 * r1);
  37010. c += (d0 >>> 13); d0 &= 0x1fff;
  37011. d1 = c;
  37012. d1 += h0 * r1;
  37013. d1 += h1 * r0;
  37014. d1 += h2 * (5 * r9);
  37015. d1 += h3 * (5 * r8);
  37016. d1 += h4 * (5 * r7);
  37017. c = (d1 >>> 13); d1 &= 0x1fff;
  37018. d1 += h5 * (5 * r6);
  37019. d1 += h6 * (5 * r5);
  37020. d1 += h7 * (5 * r4);
  37021. d1 += h8 * (5 * r3);
  37022. d1 += h9 * (5 * r2);
  37023. c += (d1 >>> 13); d1 &= 0x1fff;
  37024. d2 = c;
  37025. d2 += h0 * r2;
  37026. d2 += h1 * r1;
  37027. d2 += h2 * r0;
  37028. d2 += h3 * (5 * r9);
  37029. d2 += h4 * (5 * r8);
  37030. c = (d2 >>> 13); d2 &= 0x1fff;
  37031. d2 += h5 * (5 * r7);
  37032. d2 += h6 * (5 * r6);
  37033. d2 += h7 * (5 * r5);
  37034. d2 += h8 * (5 * r4);
  37035. d2 += h9 * (5 * r3);
  37036. c += (d2 >>> 13); d2 &= 0x1fff;
  37037. d3 = c;
  37038. d3 += h0 * r3;
  37039. d3 += h1 * r2;
  37040. d3 += h2 * r1;
  37041. d3 += h3 * r0;
  37042. d3 += h4 * (5 * r9);
  37043. c = (d3 >>> 13); d3 &= 0x1fff;
  37044. d3 += h5 * (5 * r8);
  37045. d3 += h6 * (5 * r7);
  37046. d3 += h7 * (5 * r6);
  37047. d3 += h8 * (5 * r5);
  37048. d3 += h9 * (5 * r4);
  37049. c += (d3 >>> 13); d3 &= 0x1fff;
  37050. d4 = c;
  37051. d4 += h0 * r4;
  37052. d4 += h1 * r3;
  37053. d4 += h2 * r2;
  37054. d4 += h3 * r1;
  37055. d4 += h4 * r0;
  37056. c = (d4 >>> 13); d4 &= 0x1fff;
  37057. d4 += h5 * (5 * r9);
  37058. d4 += h6 * (5 * r8);
  37059. d4 += h7 * (5 * r7);
  37060. d4 += h8 * (5 * r6);
  37061. d4 += h9 * (5 * r5);
  37062. c += (d4 >>> 13); d4 &= 0x1fff;
  37063. d5 = c;
  37064. d5 += h0 * r5;
  37065. d5 += h1 * r4;
  37066. d5 += h2 * r3;
  37067. d5 += h3 * r2;
  37068. d5 += h4 * r1;
  37069. c = (d5 >>> 13); d5 &= 0x1fff;
  37070. d5 += h5 * r0;
  37071. d5 += h6 * (5 * r9);
  37072. d5 += h7 * (5 * r8);
  37073. d5 += h8 * (5 * r7);
  37074. d5 += h9 * (5 * r6);
  37075. c += (d5 >>> 13); d5 &= 0x1fff;
  37076. d6 = c;
  37077. d6 += h0 * r6;
  37078. d6 += h1 * r5;
  37079. d6 += h2 * r4;
  37080. d6 += h3 * r3;
  37081. d6 += h4 * r2;
  37082. c = (d6 >>> 13); d6 &= 0x1fff;
  37083. d6 += h5 * r1;
  37084. d6 += h6 * r0;
  37085. d6 += h7 * (5 * r9);
  37086. d6 += h8 * (5 * r8);
  37087. d6 += h9 * (5 * r7);
  37088. c += (d6 >>> 13); d6 &= 0x1fff;
  37089. d7 = c;
  37090. d7 += h0 * r7;
  37091. d7 += h1 * r6;
  37092. d7 += h2 * r5;
  37093. d7 += h3 * r4;
  37094. d7 += h4 * r3;
  37095. c = (d7 >>> 13); d7 &= 0x1fff;
  37096. d7 += h5 * r2;
  37097. d7 += h6 * r1;
  37098. d7 += h7 * r0;
  37099. d7 += h8 * (5 * r9);
  37100. d7 += h9 * (5 * r8);
  37101. c += (d7 >>> 13); d7 &= 0x1fff;
  37102. d8 = c;
  37103. d8 += h0 * r8;
  37104. d8 += h1 * r7;
  37105. d8 += h2 * r6;
  37106. d8 += h3 * r5;
  37107. d8 += h4 * r4;
  37108. c = (d8 >>> 13); d8 &= 0x1fff;
  37109. d8 += h5 * r3;
  37110. d8 += h6 * r2;
  37111. d8 += h7 * r1;
  37112. d8 += h8 * r0;
  37113. d8 += h9 * (5 * r9);
  37114. c += (d8 >>> 13); d8 &= 0x1fff;
  37115. d9 = c;
  37116. d9 += h0 * r9;
  37117. d9 += h1 * r8;
  37118. d9 += h2 * r7;
  37119. d9 += h3 * r6;
  37120. d9 += h4 * r5;
  37121. c = (d9 >>> 13); d9 &= 0x1fff;
  37122. d9 += h5 * r4;
  37123. d9 += h6 * r3;
  37124. d9 += h7 * r2;
  37125. d9 += h8 * r1;
  37126. d9 += h9 * r0;
  37127. c += (d9 >>> 13); d9 &= 0x1fff;
  37128. c = (((c << 2) + c)) | 0;
  37129. c = (c + d0) | 0;
  37130. d0 = c & 0x1fff;
  37131. c = (c >>> 13);
  37132. d1 += c;
  37133. h0 = d0;
  37134. h1 = d1;
  37135. h2 = d2;
  37136. h3 = d3;
  37137. h4 = d4;
  37138. h5 = d5;
  37139. h6 = d6;
  37140. h7 = d7;
  37141. h8 = d8;
  37142. h9 = d9;
  37143. mpos += 16;
  37144. bytes -= 16;
  37145. }
  37146. this.h[0] = h0;
  37147. this.h[1] = h1;
  37148. this.h[2] = h2;
  37149. this.h[3] = h3;
  37150. this.h[4] = h4;
  37151. this.h[5] = h5;
  37152. this.h[6] = h6;
  37153. this.h[7] = h7;
  37154. this.h[8] = h8;
  37155. this.h[9] = h9;
  37156. };
  37157. poly1305.prototype.finish = function(mac, macpos) {
  37158. var g = new Uint16Array(10);
  37159. var c, mask, f, i;
  37160. if (this.leftover) {
  37161. i = this.leftover;
  37162. this.buffer[i++] = 1;
  37163. for (; i < 16; i++) this.buffer[i] = 0;
  37164. this.fin = 1;
  37165. this.blocks(this.buffer, 0, 16);
  37166. }
  37167. c = this.h[1] >>> 13;
  37168. this.h[1] &= 0x1fff;
  37169. for (i = 2; i < 10; i++) {
  37170. this.h[i] += c;
  37171. c = this.h[i] >>> 13;
  37172. this.h[i] &= 0x1fff;
  37173. }
  37174. this.h[0] += (c * 5);
  37175. c = this.h[0] >>> 13;
  37176. this.h[0] &= 0x1fff;
  37177. this.h[1] += c;
  37178. c = this.h[1] >>> 13;
  37179. this.h[1] &= 0x1fff;
  37180. this.h[2] += c;
  37181. g[0] = this.h[0] + 5;
  37182. c = g[0] >>> 13;
  37183. g[0] &= 0x1fff;
  37184. for (i = 1; i < 10; i++) {
  37185. g[i] = this.h[i] + c;
  37186. c = g[i] >>> 13;
  37187. g[i] &= 0x1fff;
  37188. }
  37189. g[9] -= (1 << 13);
  37190. mask = (c ^ 1) - 1;
  37191. for (i = 0; i < 10; i++) g[i] &= mask;
  37192. mask = ~mask;
  37193. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37194. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37195. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37196. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37197. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37198. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37199. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37200. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37201. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37202. f = this.h[0] + this.pad[0];
  37203. this.h[0] = f & 0xffff;
  37204. for (i = 1; i < 8; i++) {
  37205. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37206. this.h[i] = f & 0xffff;
  37207. }
  37208. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37209. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37210. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37211. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37212. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37213. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37214. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37215. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37216. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37217. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37218. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37219. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37220. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37221. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37222. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37223. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37224. };
  37225. poly1305.prototype.update = function(m, mpos, bytes) {
  37226. var i, want;
  37227. if (this.leftover) {
  37228. want = (16 - this.leftover);
  37229. if (want > bytes)
  37230. want = bytes;
  37231. for (i = 0; i < want; i++)
  37232. this.buffer[this.leftover + i] = m[mpos+i];
  37233. bytes -= want;
  37234. mpos += want;
  37235. this.leftover += want;
  37236. if (this.leftover < 16)
  37237. return;
  37238. this.blocks(this.buffer, 0, 16);
  37239. this.leftover = 0;
  37240. }
  37241. if (bytes >= 16) {
  37242. want = bytes - (bytes % 16);
  37243. this.blocks(m, mpos, want);
  37244. mpos += want;
  37245. bytes -= want;
  37246. }
  37247. if (bytes) {
  37248. for (i = 0; i < bytes; i++)
  37249. this.buffer[this.leftover + i] = m[mpos+i];
  37250. this.leftover += bytes;
  37251. }
  37252. };
  37253. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37254. var s = new poly1305(k);
  37255. s.update(m, mpos, n);
  37256. s.finish(out, outpos);
  37257. return 0;
  37258. }
  37259. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37260. var x = new Uint8Array(16);
  37261. crypto_onetimeauth(x,0,m,mpos,n,k);
  37262. return crypto_verify_16(h,hpos,x,0);
  37263. }
  37264. function crypto_secretbox(c,m,d,n,k) {
  37265. var i;
  37266. if (d < 32) return -1;
  37267. crypto_stream_xor(c,0,m,0,d,n,k);
  37268. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37269. for (i = 0; i < 16; i++) c[i] = 0;
  37270. return 0;
  37271. }
  37272. function crypto_secretbox_open(m,c,d,n,k) {
  37273. var i;
  37274. var x = new Uint8Array(32);
  37275. if (d < 32) return -1;
  37276. crypto_stream(x,0,32,n,k);
  37277. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37278. crypto_stream_xor(m,0,c,0,d,n,k);
  37279. for (i = 0; i < 32; i++) m[i] = 0;
  37280. return 0;
  37281. }
  37282. function set25519(r, a) {
  37283. var i;
  37284. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37285. }
  37286. function car25519(o) {
  37287. var i, v, c = 1;
  37288. for (i = 0; i < 16; i++) {
  37289. v = o[i] + c + 65535;
  37290. c = Math.floor(v / 65536);
  37291. o[i] = v - c * 65536;
  37292. }
  37293. o[0] += c-1 + 37 * (c-1);
  37294. }
  37295. function sel25519(p, q, b) {
  37296. var t, c = ~(b-1);
  37297. for (var i = 0; i < 16; i++) {
  37298. t = c & (p[i] ^ q[i]);
  37299. p[i] ^= t;
  37300. q[i] ^= t;
  37301. }
  37302. }
  37303. function pack25519(o, n) {
  37304. var i, j, b;
  37305. var m = gf(), t = gf();
  37306. for (i = 0; i < 16; i++) t[i] = n[i];
  37307. car25519(t);
  37308. car25519(t);
  37309. car25519(t);
  37310. for (j = 0; j < 2; j++) {
  37311. m[0] = t[0] - 0xffed;
  37312. for (i = 1; i < 15; i++) {
  37313. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37314. m[i-1] &= 0xffff;
  37315. }
  37316. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37317. b = (m[15]>>16) & 1;
  37318. m[14] &= 0xffff;
  37319. sel25519(t, m, 1-b);
  37320. }
  37321. for (i = 0; i < 16; i++) {
  37322. o[2*i] = t[i] & 0xff;
  37323. o[2*i+1] = t[i]>>8;
  37324. }
  37325. }
  37326. function neq25519(a, b) {
  37327. var c = new Uint8Array(32), d = new Uint8Array(32);
  37328. pack25519(c, a);
  37329. pack25519(d, b);
  37330. return crypto_verify_32(c, 0, d, 0);
  37331. }
  37332. function par25519(a) {
  37333. var d = new Uint8Array(32);
  37334. pack25519(d, a);
  37335. return d[0] & 1;
  37336. }
  37337. function unpack25519(o, n) {
  37338. var i;
  37339. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37340. o[15] &= 0x7fff;
  37341. }
  37342. function A(o, a, b) {
  37343. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37344. }
  37345. function Z(o, a, b) {
  37346. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37347. }
  37348. function M(o, a, b) {
  37349. var v, c,
  37350. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37351. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37352. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37353. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37354. b0 = b[0],
  37355. b1 = b[1],
  37356. b2 = b[2],
  37357. b3 = b[3],
  37358. b4 = b[4],
  37359. b5 = b[5],
  37360. b6 = b[6],
  37361. b7 = b[7],
  37362. b8 = b[8],
  37363. b9 = b[9],
  37364. b10 = b[10],
  37365. b11 = b[11],
  37366. b12 = b[12],
  37367. b13 = b[13],
  37368. b14 = b[14],
  37369. b15 = b[15];
  37370. v = a[0];
  37371. t0 += v * b0;
  37372. t1 += v * b1;
  37373. t2 += v * b2;
  37374. t3 += v * b3;
  37375. t4 += v * b4;
  37376. t5 += v * b5;
  37377. t6 += v * b6;
  37378. t7 += v * b7;
  37379. t8 += v * b8;
  37380. t9 += v * b9;
  37381. t10 += v * b10;
  37382. t11 += v * b11;
  37383. t12 += v * b12;
  37384. t13 += v * b13;
  37385. t14 += v * b14;
  37386. t15 += v * b15;
  37387. v = a[1];
  37388. t1 += v * b0;
  37389. t2 += v * b1;
  37390. t3 += v * b2;
  37391. t4 += v * b3;
  37392. t5 += v * b4;
  37393. t6 += v * b5;
  37394. t7 += v * b6;
  37395. t8 += v * b7;
  37396. t9 += v * b8;
  37397. t10 += v * b9;
  37398. t11 += v * b10;
  37399. t12 += v * b11;
  37400. t13 += v * b12;
  37401. t14 += v * b13;
  37402. t15 += v * b14;
  37403. t16 += v * b15;
  37404. v = a[2];
  37405. t2 += v * b0;
  37406. t3 += v * b1;
  37407. t4 += v * b2;
  37408. t5 += v * b3;
  37409. t6 += v * b4;
  37410. t7 += v * b5;
  37411. t8 += v * b6;
  37412. t9 += v * b7;
  37413. t10 += v * b8;
  37414. t11 += v * b9;
  37415. t12 += v * b10;
  37416. t13 += v * b11;
  37417. t14 += v * b12;
  37418. t15 += v * b13;
  37419. t16 += v * b14;
  37420. t17 += v * b15;
  37421. v = a[3];
  37422. t3 += v * b0;
  37423. t4 += v * b1;
  37424. t5 += v * b2;
  37425. t6 += v * b3;
  37426. t7 += v * b4;
  37427. t8 += v * b5;
  37428. t9 += v * b6;
  37429. t10 += v * b7;
  37430. t11 += v * b8;
  37431. t12 += v * b9;
  37432. t13 += v * b10;
  37433. t14 += v * b11;
  37434. t15 += v * b12;
  37435. t16 += v * b13;
  37436. t17 += v * b14;
  37437. t18 += v * b15;
  37438. v = a[4];
  37439. t4 += v * b0;
  37440. t5 += v * b1;
  37441. t6 += v * b2;
  37442. t7 += v * b3;
  37443. t8 += v * b4;
  37444. t9 += v * b5;
  37445. t10 += v * b6;
  37446. t11 += v * b7;
  37447. t12 += v * b8;
  37448. t13 += v * b9;
  37449. t14 += v * b10;
  37450. t15 += v * b11;
  37451. t16 += v * b12;
  37452. t17 += v * b13;
  37453. t18 += v * b14;
  37454. t19 += v * b15;
  37455. v = a[5];
  37456. t5 += v * b0;
  37457. t6 += v * b1;
  37458. t7 += v * b2;
  37459. t8 += v * b3;
  37460. t9 += v * b4;
  37461. t10 += v * b5;
  37462. t11 += v * b6;
  37463. t12 += v * b7;
  37464. t13 += v * b8;
  37465. t14 += v * b9;
  37466. t15 += v * b10;
  37467. t16 += v * b11;
  37468. t17 += v * b12;
  37469. t18 += v * b13;
  37470. t19 += v * b14;
  37471. t20 += v * b15;
  37472. v = a[6];
  37473. t6 += v * b0;
  37474. t7 += v * b1;
  37475. t8 += v * b2;
  37476. t9 += v * b3;
  37477. t10 += v * b4;
  37478. t11 += v * b5;
  37479. t12 += v * b6;
  37480. t13 += v * b7;
  37481. t14 += v * b8;
  37482. t15 += v * b9;
  37483. t16 += v * b10;
  37484. t17 += v * b11;
  37485. t18 += v * b12;
  37486. t19 += v * b13;
  37487. t20 += v * b14;
  37488. t21 += v * b15;
  37489. v = a[7];
  37490. t7 += v * b0;
  37491. t8 += v * b1;
  37492. t9 += v * b2;
  37493. t10 += v * b3;
  37494. t11 += v * b4;
  37495. t12 += v * b5;
  37496. t13 += v * b6;
  37497. t14 += v * b7;
  37498. t15 += v * b8;
  37499. t16 += v * b9;
  37500. t17 += v * b10;
  37501. t18 += v * b11;
  37502. t19 += v * b12;
  37503. t20 += v * b13;
  37504. t21 += v * b14;
  37505. t22 += v * b15;
  37506. v = a[8];
  37507. t8 += v * b0;
  37508. t9 += v * b1;
  37509. t10 += v * b2;
  37510. t11 += v * b3;
  37511. t12 += v * b4;
  37512. t13 += v * b5;
  37513. t14 += v * b6;
  37514. t15 += v * b7;
  37515. t16 += v * b8;
  37516. t17 += v * b9;
  37517. t18 += v * b10;
  37518. t19 += v * b11;
  37519. t20 += v * b12;
  37520. t21 += v * b13;
  37521. t22 += v * b14;
  37522. t23 += v * b15;
  37523. v = a[9];
  37524. t9 += v * b0;
  37525. t10 += v * b1;
  37526. t11 += v * b2;
  37527. t12 += v * b3;
  37528. t13 += v * b4;
  37529. t14 += v * b5;
  37530. t15 += v * b6;
  37531. t16 += v * b7;
  37532. t17 += v * b8;
  37533. t18 += v * b9;
  37534. t19 += v * b10;
  37535. t20 += v * b11;
  37536. t21 += v * b12;
  37537. t22 += v * b13;
  37538. t23 += v * b14;
  37539. t24 += v * b15;
  37540. v = a[10];
  37541. t10 += v * b0;
  37542. t11 += v * b1;
  37543. t12 += v * b2;
  37544. t13 += v * b3;
  37545. t14 += v * b4;
  37546. t15 += v * b5;
  37547. t16 += v * b6;
  37548. t17 += v * b7;
  37549. t18 += v * b8;
  37550. t19 += v * b9;
  37551. t20 += v * b10;
  37552. t21 += v * b11;
  37553. t22 += v * b12;
  37554. t23 += v * b13;
  37555. t24 += v * b14;
  37556. t25 += v * b15;
  37557. v = a[11];
  37558. t11 += v * b0;
  37559. t12 += v * b1;
  37560. t13 += v * b2;
  37561. t14 += v * b3;
  37562. t15 += v * b4;
  37563. t16 += v * b5;
  37564. t17 += v * b6;
  37565. t18 += v * b7;
  37566. t19 += v * b8;
  37567. t20 += v * b9;
  37568. t21 += v * b10;
  37569. t22 += v * b11;
  37570. t23 += v * b12;
  37571. t24 += v * b13;
  37572. t25 += v * b14;
  37573. t26 += v * b15;
  37574. v = a[12];
  37575. t12 += v * b0;
  37576. t13 += v * b1;
  37577. t14 += v * b2;
  37578. t15 += v * b3;
  37579. t16 += v * b4;
  37580. t17 += v * b5;
  37581. t18 += v * b6;
  37582. t19 += v * b7;
  37583. t20 += v * b8;
  37584. t21 += v * b9;
  37585. t22 += v * b10;
  37586. t23 += v * b11;
  37587. t24 += v * b12;
  37588. t25 += v * b13;
  37589. t26 += v * b14;
  37590. t27 += v * b15;
  37591. v = a[13];
  37592. t13 += v * b0;
  37593. t14 += v * b1;
  37594. t15 += v * b2;
  37595. t16 += v * b3;
  37596. t17 += v * b4;
  37597. t18 += v * b5;
  37598. t19 += v * b6;
  37599. t20 += v * b7;
  37600. t21 += v * b8;
  37601. t22 += v * b9;
  37602. t23 += v * b10;
  37603. t24 += v * b11;
  37604. t25 += v * b12;
  37605. t26 += v * b13;
  37606. t27 += v * b14;
  37607. t28 += v * b15;
  37608. v = a[14];
  37609. t14 += v * b0;
  37610. t15 += v * b1;
  37611. t16 += v * b2;
  37612. t17 += v * b3;
  37613. t18 += v * b4;
  37614. t19 += v * b5;
  37615. t20 += v * b6;
  37616. t21 += v * b7;
  37617. t22 += v * b8;
  37618. t23 += v * b9;
  37619. t24 += v * b10;
  37620. t25 += v * b11;
  37621. t26 += v * b12;
  37622. t27 += v * b13;
  37623. t28 += v * b14;
  37624. t29 += v * b15;
  37625. v = a[15];
  37626. t15 += v * b0;
  37627. t16 += v * b1;
  37628. t17 += v * b2;
  37629. t18 += v * b3;
  37630. t19 += v * b4;
  37631. t20 += v * b5;
  37632. t21 += v * b6;
  37633. t22 += v * b7;
  37634. t23 += v * b8;
  37635. t24 += v * b9;
  37636. t25 += v * b10;
  37637. t26 += v * b11;
  37638. t27 += v * b12;
  37639. t28 += v * b13;
  37640. t29 += v * b14;
  37641. t30 += v * b15;
  37642. t0 += 38 * t16;
  37643. t1 += 38 * t17;
  37644. t2 += 38 * t18;
  37645. t3 += 38 * t19;
  37646. t4 += 38 * t20;
  37647. t5 += 38 * t21;
  37648. t6 += 38 * t22;
  37649. t7 += 38 * t23;
  37650. t8 += 38 * t24;
  37651. t9 += 38 * t25;
  37652. t10 += 38 * t26;
  37653. t11 += 38 * t27;
  37654. t12 += 38 * t28;
  37655. t13 += 38 * t29;
  37656. t14 += 38 * t30;
  37657. // t15 left as is
  37658. // first car
  37659. c = 1;
  37660. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37661. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37662. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37663. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37664. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37665. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37666. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37667. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37668. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37669. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37670. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37671. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37672. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37673. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37674. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37675. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37676. t0 += c-1 + 37 * (c-1);
  37677. // second car
  37678. c = 1;
  37679. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37680. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37681. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37682. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37683. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37684. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37685. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37686. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37687. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37688. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37689. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37690. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37691. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37692. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37693. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37694. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37695. t0 += c-1 + 37 * (c-1);
  37696. o[ 0] = t0;
  37697. o[ 1] = t1;
  37698. o[ 2] = t2;
  37699. o[ 3] = t3;
  37700. o[ 4] = t4;
  37701. o[ 5] = t5;
  37702. o[ 6] = t6;
  37703. o[ 7] = t7;
  37704. o[ 8] = t8;
  37705. o[ 9] = t9;
  37706. o[10] = t10;
  37707. o[11] = t11;
  37708. o[12] = t12;
  37709. o[13] = t13;
  37710. o[14] = t14;
  37711. o[15] = t15;
  37712. }
  37713. function S(o, a) {
  37714. M(o, a, a);
  37715. }
  37716. function inv25519(o, i) {
  37717. var c = gf();
  37718. var a;
  37719. for (a = 0; a < 16; a++) c[a] = i[a];
  37720. for (a = 253; a >= 0; a--) {
  37721. S(c, c);
  37722. if(a !== 2 && a !== 4) M(c, c, i);
  37723. }
  37724. for (a = 0; a < 16; a++) o[a] = c[a];
  37725. }
  37726. function pow2523(o, i) {
  37727. var c = gf();
  37728. var a;
  37729. for (a = 0; a < 16; a++) c[a] = i[a];
  37730. for (a = 250; a >= 0; a--) {
  37731. S(c, c);
  37732. if(a !== 1) M(c, c, i);
  37733. }
  37734. for (a = 0; a < 16; a++) o[a] = c[a];
  37735. }
  37736. function crypto_scalarmult(q, n, p) {
  37737. var z = new Uint8Array(32);
  37738. var x = new Float64Array(80), r, i;
  37739. var a = gf(), b = gf(), c = gf(),
  37740. d = gf(), e = gf(), f = gf();
  37741. for (i = 0; i < 31; i++) z[i] = n[i];
  37742. z[31]=(n[31]&127)|64;
  37743. z[0]&=248;
  37744. unpack25519(x,p);
  37745. for (i = 0; i < 16; i++) {
  37746. b[i]=x[i];
  37747. d[i]=a[i]=c[i]=0;
  37748. }
  37749. a[0]=d[0]=1;
  37750. for (i=254; i>=0; --i) {
  37751. r=(z[i>>>3]>>>(i&7))&1;
  37752. sel25519(a,b,r);
  37753. sel25519(c,d,r);
  37754. A(e,a,c);
  37755. Z(a,a,c);
  37756. A(c,b,d);
  37757. Z(b,b,d);
  37758. S(d,e);
  37759. S(f,a);
  37760. M(a,c,a);
  37761. M(c,b,e);
  37762. A(e,a,c);
  37763. Z(a,a,c);
  37764. S(b,a);
  37765. Z(c,d,f);
  37766. M(a,c,_121665);
  37767. A(a,a,d);
  37768. M(c,c,a);
  37769. M(a,d,f);
  37770. M(d,b,x);
  37771. S(b,e);
  37772. sel25519(a,b,r);
  37773. sel25519(c,d,r);
  37774. }
  37775. for (i = 0; i < 16; i++) {
  37776. x[i+16]=a[i];
  37777. x[i+32]=c[i];
  37778. x[i+48]=b[i];
  37779. x[i+64]=d[i];
  37780. }
  37781. var x32 = x.subarray(32);
  37782. var x16 = x.subarray(16);
  37783. inv25519(x32,x32);
  37784. M(x16,x16,x32);
  37785. pack25519(q,x16);
  37786. return 0;
  37787. }
  37788. function crypto_scalarmult_base(q, n) {
  37789. return crypto_scalarmult(q, n, _9);
  37790. }
  37791. function crypto_box_keypair(y, x) {
  37792. randombytes(x, 32);
  37793. return crypto_scalarmult_base(y, x);
  37794. }
  37795. function crypto_box_beforenm(k, y, x) {
  37796. var s = new Uint8Array(32);
  37797. crypto_scalarmult(s, x, y);
  37798. return crypto_core_hsalsa20(k, _0, s, sigma);
  37799. }
  37800. var crypto_box_afternm = crypto_secretbox;
  37801. var crypto_box_open_afternm = crypto_secretbox_open;
  37802. function crypto_box(c, m, d, n, y, x) {
  37803. var k = new Uint8Array(32);
  37804. crypto_box_beforenm(k, y, x);
  37805. return crypto_box_afternm(c, m, d, n, k);
  37806. }
  37807. function crypto_box_open(m, c, d, n, y, x) {
  37808. var k = new Uint8Array(32);
  37809. crypto_box_beforenm(k, y, x);
  37810. return crypto_box_open_afternm(m, c, d, n, k);
  37811. }
  37812. var K = [
  37813. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37814. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37815. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37816. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37817. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37818. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37819. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37820. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37821. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37822. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37823. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37824. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37825. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37826. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37827. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37828. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37829. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37830. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37831. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37832. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37833. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37834. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37835. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37836. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37837. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37838. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37839. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37840. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37841. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37842. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37843. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37844. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37845. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37846. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37847. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37848. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37849. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37850. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37851. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37852. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37853. ];
  37854. function crypto_hashblocks_hl(hh, hl, m, n) {
  37855. var wh = new Int32Array(16), wl = new Int32Array(16),
  37856. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37857. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37858. th, tl, i, j, h, l, a, b, c, d;
  37859. var ah0 = hh[0],
  37860. ah1 = hh[1],
  37861. ah2 = hh[2],
  37862. ah3 = hh[3],
  37863. ah4 = hh[4],
  37864. ah5 = hh[5],
  37865. ah6 = hh[6],
  37866. ah7 = hh[7],
  37867. al0 = hl[0],
  37868. al1 = hl[1],
  37869. al2 = hl[2],
  37870. al3 = hl[3],
  37871. al4 = hl[4],
  37872. al5 = hl[5],
  37873. al6 = hl[6],
  37874. al7 = hl[7];
  37875. var pos = 0;
  37876. while (n >= 128) {
  37877. for (i = 0; i < 16; i++) {
  37878. j = 8 * i + pos;
  37879. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37880. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37881. }
  37882. for (i = 0; i < 80; i++) {
  37883. bh0 = ah0;
  37884. bh1 = ah1;
  37885. bh2 = ah2;
  37886. bh3 = ah3;
  37887. bh4 = ah4;
  37888. bh5 = ah5;
  37889. bh6 = ah6;
  37890. bh7 = ah7;
  37891. bl0 = al0;
  37892. bl1 = al1;
  37893. bl2 = al2;
  37894. bl3 = al3;
  37895. bl4 = al4;
  37896. bl5 = al5;
  37897. bl6 = al6;
  37898. bl7 = al7;
  37899. // add
  37900. h = ah7;
  37901. l = al7;
  37902. a = l & 0xffff; b = l >>> 16;
  37903. c = h & 0xffff; d = h >>> 16;
  37904. // Sigma1
  37905. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37906. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37907. a += l & 0xffff; b += l >>> 16;
  37908. c += h & 0xffff; d += h >>> 16;
  37909. // Ch
  37910. h = (ah4 & ah5) ^ (~ah4 & ah6);
  37911. l = (al4 & al5) ^ (~al4 & al6);
  37912. a += l & 0xffff; b += l >>> 16;
  37913. c += h & 0xffff; d += h >>> 16;
  37914. // K
  37915. h = K[i*2];
  37916. l = K[i*2+1];
  37917. a += l & 0xffff; b += l >>> 16;
  37918. c += h & 0xffff; d += h >>> 16;
  37919. // w
  37920. h = wh[i%16];
  37921. l = wl[i%16];
  37922. a += l & 0xffff; b += l >>> 16;
  37923. c += h & 0xffff; d += h >>> 16;
  37924. b += a >>> 16;
  37925. c += b >>> 16;
  37926. d += c >>> 16;
  37927. th = c & 0xffff | d << 16;
  37928. tl = a & 0xffff | b << 16;
  37929. // add
  37930. h = th;
  37931. l = tl;
  37932. a = l & 0xffff; b = l >>> 16;
  37933. c = h & 0xffff; d = h >>> 16;
  37934. // Sigma0
  37935. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  37936. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  37937. a += l & 0xffff; b += l >>> 16;
  37938. c += h & 0xffff; d += h >>> 16;
  37939. // Maj
  37940. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  37941. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  37942. a += l & 0xffff; b += l >>> 16;
  37943. c += h & 0xffff; d += h >>> 16;
  37944. b += a >>> 16;
  37945. c += b >>> 16;
  37946. d += c >>> 16;
  37947. bh7 = (c & 0xffff) | (d << 16);
  37948. bl7 = (a & 0xffff) | (b << 16);
  37949. // add
  37950. h = bh3;
  37951. l = bl3;
  37952. a = l & 0xffff; b = l >>> 16;
  37953. c = h & 0xffff; d = h >>> 16;
  37954. h = th;
  37955. l = tl;
  37956. a += l & 0xffff; b += l >>> 16;
  37957. c += h & 0xffff; d += h >>> 16;
  37958. b += a >>> 16;
  37959. c += b >>> 16;
  37960. d += c >>> 16;
  37961. bh3 = (c & 0xffff) | (d << 16);
  37962. bl3 = (a & 0xffff) | (b << 16);
  37963. ah1 = bh0;
  37964. ah2 = bh1;
  37965. ah3 = bh2;
  37966. ah4 = bh3;
  37967. ah5 = bh4;
  37968. ah6 = bh5;
  37969. ah7 = bh6;
  37970. ah0 = bh7;
  37971. al1 = bl0;
  37972. al2 = bl1;
  37973. al3 = bl2;
  37974. al4 = bl3;
  37975. al5 = bl4;
  37976. al6 = bl5;
  37977. al7 = bl6;
  37978. al0 = bl7;
  37979. if (i%16 === 15) {
  37980. for (j = 0; j < 16; j++) {
  37981. // add
  37982. h = wh[j];
  37983. l = wl[j];
  37984. a = l & 0xffff; b = l >>> 16;
  37985. c = h & 0xffff; d = h >>> 16;
  37986. h = wh[(j+9)%16];
  37987. l = wl[(j+9)%16];
  37988. a += l & 0xffff; b += l >>> 16;
  37989. c += h & 0xffff; d += h >>> 16;
  37990. // sigma0
  37991. th = wh[(j+1)%16];
  37992. tl = wl[(j+1)%16];
  37993. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  37994. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  37995. a += l & 0xffff; b += l >>> 16;
  37996. c += h & 0xffff; d += h >>> 16;
  37997. // sigma1
  37998. th = wh[(j+14)%16];
  37999. tl = wl[(j+14)%16];
  38000. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38001. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38002. a += l & 0xffff; b += l >>> 16;
  38003. c += h & 0xffff; d += h >>> 16;
  38004. b += a >>> 16;
  38005. c += b >>> 16;
  38006. d += c >>> 16;
  38007. wh[j] = (c & 0xffff) | (d << 16);
  38008. wl[j] = (a & 0xffff) | (b << 16);
  38009. }
  38010. }
  38011. }
  38012. // add
  38013. h = ah0;
  38014. l = al0;
  38015. a = l & 0xffff; b = l >>> 16;
  38016. c = h & 0xffff; d = h >>> 16;
  38017. h = hh[0];
  38018. l = hl[0];
  38019. a += l & 0xffff; b += l >>> 16;
  38020. c += h & 0xffff; d += h >>> 16;
  38021. b += a >>> 16;
  38022. c += b >>> 16;
  38023. d += c >>> 16;
  38024. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38025. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38026. h = ah1;
  38027. l = al1;
  38028. a = l & 0xffff; b = l >>> 16;
  38029. c = h & 0xffff; d = h >>> 16;
  38030. h = hh[1];
  38031. l = hl[1];
  38032. a += l & 0xffff; b += l >>> 16;
  38033. c += h & 0xffff; d += h >>> 16;
  38034. b += a >>> 16;
  38035. c += b >>> 16;
  38036. d += c >>> 16;
  38037. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38038. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38039. h = ah2;
  38040. l = al2;
  38041. a = l & 0xffff; b = l >>> 16;
  38042. c = h & 0xffff; d = h >>> 16;
  38043. h = hh[2];
  38044. l = hl[2];
  38045. a += l & 0xffff; b += l >>> 16;
  38046. c += h & 0xffff; d += h >>> 16;
  38047. b += a >>> 16;
  38048. c += b >>> 16;
  38049. d += c >>> 16;
  38050. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38051. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38052. h = ah3;
  38053. l = al3;
  38054. a = l & 0xffff; b = l >>> 16;
  38055. c = h & 0xffff; d = h >>> 16;
  38056. h = hh[3];
  38057. l = hl[3];
  38058. a += l & 0xffff; b += l >>> 16;
  38059. c += h & 0xffff; d += h >>> 16;
  38060. b += a >>> 16;
  38061. c += b >>> 16;
  38062. d += c >>> 16;
  38063. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38064. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38065. h = ah4;
  38066. l = al4;
  38067. a = l & 0xffff; b = l >>> 16;
  38068. c = h & 0xffff; d = h >>> 16;
  38069. h = hh[4];
  38070. l = hl[4];
  38071. a += l & 0xffff; b += l >>> 16;
  38072. c += h & 0xffff; d += h >>> 16;
  38073. b += a >>> 16;
  38074. c += b >>> 16;
  38075. d += c >>> 16;
  38076. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38077. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38078. h = ah5;
  38079. l = al5;
  38080. a = l & 0xffff; b = l >>> 16;
  38081. c = h & 0xffff; d = h >>> 16;
  38082. h = hh[5];
  38083. l = hl[5];
  38084. a += l & 0xffff; b += l >>> 16;
  38085. c += h & 0xffff; d += h >>> 16;
  38086. b += a >>> 16;
  38087. c += b >>> 16;
  38088. d += c >>> 16;
  38089. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38090. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38091. h = ah6;
  38092. l = al6;
  38093. a = l & 0xffff; b = l >>> 16;
  38094. c = h & 0xffff; d = h >>> 16;
  38095. h = hh[6];
  38096. l = hl[6];
  38097. a += l & 0xffff; b += l >>> 16;
  38098. c += h & 0xffff; d += h >>> 16;
  38099. b += a >>> 16;
  38100. c += b >>> 16;
  38101. d += c >>> 16;
  38102. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38103. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38104. h = ah7;
  38105. l = al7;
  38106. a = l & 0xffff; b = l >>> 16;
  38107. c = h & 0xffff; d = h >>> 16;
  38108. h = hh[7];
  38109. l = hl[7];
  38110. a += l & 0xffff; b += l >>> 16;
  38111. c += h & 0xffff; d += h >>> 16;
  38112. b += a >>> 16;
  38113. c += b >>> 16;
  38114. d += c >>> 16;
  38115. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38116. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38117. pos += 128;
  38118. n -= 128;
  38119. }
  38120. return n;
  38121. }
  38122. function crypto_hash(out, m, n) {
  38123. var hh = new Int32Array(8),
  38124. hl = new Int32Array(8),
  38125. x = new Uint8Array(256),
  38126. i, b = n;
  38127. hh[0] = 0x6a09e667;
  38128. hh[1] = 0xbb67ae85;
  38129. hh[2] = 0x3c6ef372;
  38130. hh[3] = 0xa54ff53a;
  38131. hh[4] = 0x510e527f;
  38132. hh[5] = 0x9b05688c;
  38133. hh[6] = 0x1f83d9ab;
  38134. hh[7] = 0x5be0cd19;
  38135. hl[0] = 0xf3bcc908;
  38136. hl[1] = 0x84caa73b;
  38137. hl[2] = 0xfe94f82b;
  38138. hl[3] = 0x5f1d36f1;
  38139. hl[4] = 0xade682d1;
  38140. hl[5] = 0x2b3e6c1f;
  38141. hl[6] = 0xfb41bd6b;
  38142. hl[7] = 0x137e2179;
  38143. crypto_hashblocks_hl(hh, hl, m, n);
  38144. n %= 128;
  38145. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38146. x[n] = 128;
  38147. n = 256-128*(n<112?1:0);
  38148. x[n-9] = 0;
  38149. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38150. crypto_hashblocks_hl(hh, hl, x, n);
  38151. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38152. return 0;
  38153. }
  38154. function add(p, q) {
  38155. var a = gf(), b = gf(), c = gf(),
  38156. d = gf(), e = gf(), f = gf(),
  38157. g = gf(), h = gf(), t = gf();
  38158. Z(a, p[1], p[0]);
  38159. Z(t, q[1], q[0]);
  38160. M(a, a, t);
  38161. A(b, p[0], p[1]);
  38162. A(t, q[0], q[1]);
  38163. M(b, b, t);
  38164. M(c, p[3], q[3]);
  38165. M(c, c, D2);
  38166. M(d, p[2], q[2]);
  38167. A(d, d, d);
  38168. Z(e, b, a);
  38169. Z(f, d, c);
  38170. A(g, d, c);
  38171. A(h, b, a);
  38172. M(p[0], e, f);
  38173. M(p[1], h, g);
  38174. M(p[2], g, f);
  38175. M(p[3], e, h);
  38176. }
  38177. function cswap(p, q, b) {
  38178. var i;
  38179. for (i = 0; i < 4; i++) {
  38180. sel25519(p[i], q[i], b);
  38181. }
  38182. }
  38183. function pack(r, p) {
  38184. var tx = gf(), ty = gf(), zi = gf();
  38185. inv25519(zi, p[2]);
  38186. M(tx, p[0], zi);
  38187. M(ty, p[1], zi);
  38188. pack25519(r, ty);
  38189. r[31] ^= par25519(tx) << 7;
  38190. }
  38191. function scalarmult(p, q, s) {
  38192. var b, i;
  38193. set25519(p[0], gf0);
  38194. set25519(p[1], gf1);
  38195. set25519(p[2], gf1);
  38196. set25519(p[3], gf0);
  38197. for (i = 255; i >= 0; --i) {
  38198. b = (s[(i/8)|0] >> (i&7)) & 1;
  38199. cswap(p, q, b);
  38200. add(q, p);
  38201. add(p, p);
  38202. cswap(p, q, b);
  38203. }
  38204. }
  38205. function scalarbase(p, s) {
  38206. var q = [gf(), gf(), gf(), gf()];
  38207. set25519(q[0], X);
  38208. set25519(q[1], Y);
  38209. set25519(q[2], gf1);
  38210. M(q[3], X, Y);
  38211. scalarmult(p, q, s);
  38212. }
  38213. function crypto_sign_keypair(pk, sk, seeded) {
  38214. var d = new Uint8Array(64);
  38215. var p = [gf(), gf(), gf(), gf()];
  38216. var i;
  38217. if (!seeded) randombytes(sk, 32);
  38218. crypto_hash(d, sk, 32);
  38219. d[0] &= 248;
  38220. d[31] &= 127;
  38221. d[31] |= 64;
  38222. scalarbase(p, d);
  38223. pack(pk, p);
  38224. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38225. return 0;
  38226. }
  38227. 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]);
  38228. function modL(r, x) {
  38229. var carry, i, j, k;
  38230. for (i = 63; i >= 32; --i) {
  38231. carry = 0;
  38232. for (j = i - 32, k = i - 12; j < k; ++j) {
  38233. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38234. carry = (x[j] + 128) >> 8;
  38235. x[j] -= carry * 256;
  38236. }
  38237. x[j] += carry;
  38238. x[i] = 0;
  38239. }
  38240. carry = 0;
  38241. for (j = 0; j < 32; j++) {
  38242. x[j] += carry - (x[31] >> 4) * L[j];
  38243. carry = x[j] >> 8;
  38244. x[j] &= 255;
  38245. }
  38246. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38247. for (i = 0; i < 32; i++) {
  38248. x[i+1] += x[i] >> 8;
  38249. r[i] = x[i] & 255;
  38250. }
  38251. }
  38252. function reduce(r) {
  38253. var x = new Float64Array(64), i;
  38254. for (i = 0; i < 64; i++) x[i] = r[i];
  38255. for (i = 0; i < 64; i++) r[i] = 0;
  38256. modL(r, x);
  38257. }
  38258. // Note: difference from C - smlen returned, not passed as argument.
  38259. function crypto_sign(sm, m, n, sk) {
  38260. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38261. var i, j, x = new Float64Array(64);
  38262. var p = [gf(), gf(), gf(), gf()];
  38263. crypto_hash(d, sk, 32);
  38264. d[0] &= 248;
  38265. d[31] &= 127;
  38266. d[31] |= 64;
  38267. var smlen = n + 64;
  38268. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38269. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38270. crypto_hash(r, sm.subarray(32), n+32);
  38271. reduce(r);
  38272. scalarbase(p, r);
  38273. pack(sm, p);
  38274. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38275. crypto_hash(h, sm, n + 64);
  38276. reduce(h);
  38277. for (i = 0; i < 64; i++) x[i] = 0;
  38278. for (i = 0; i < 32; i++) x[i] = r[i];
  38279. for (i = 0; i < 32; i++) {
  38280. for (j = 0; j < 32; j++) {
  38281. x[i+j] += h[i] * d[j];
  38282. }
  38283. }
  38284. modL(sm.subarray(32), x);
  38285. return smlen;
  38286. }
  38287. function unpackneg(r, p) {
  38288. var t = gf(), chk = gf(), num = gf(),
  38289. den = gf(), den2 = gf(), den4 = gf(),
  38290. den6 = gf();
  38291. set25519(r[2], gf1);
  38292. unpack25519(r[1], p);
  38293. S(num, r[1]);
  38294. M(den, num, D);
  38295. Z(num, num, r[2]);
  38296. A(den, r[2], den);
  38297. S(den2, den);
  38298. S(den4, den2);
  38299. M(den6, den4, den2);
  38300. M(t, den6, num);
  38301. M(t, t, den);
  38302. pow2523(t, t);
  38303. M(t, t, num);
  38304. M(t, t, den);
  38305. M(t, t, den);
  38306. M(r[0], t, den);
  38307. S(chk, r[0]);
  38308. M(chk, chk, den);
  38309. if (neq25519(chk, num)) M(r[0], r[0], I);
  38310. S(chk, r[0]);
  38311. M(chk, chk, den);
  38312. if (neq25519(chk, num)) return -1;
  38313. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38314. M(r[3], r[0], r[1]);
  38315. return 0;
  38316. }
  38317. function crypto_sign_open(m, sm, n, pk) {
  38318. var i, mlen;
  38319. var t = new Uint8Array(32), h = new Uint8Array(64);
  38320. var p = [gf(), gf(), gf(), gf()],
  38321. q = [gf(), gf(), gf(), gf()];
  38322. mlen = -1;
  38323. if (n < 64) return -1;
  38324. if (unpackneg(q, pk)) return -1;
  38325. for (i = 0; i < n; i++) m[i] = sm[i];
  38326. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38327. crypto_hash(h, m, n);
  38328. reduce(h);
  38329. scalarmult(p, q, h);
  38330. scalarbase(q, sm.subarray(32));
  38331. add(p, q);
  38332. pack(t, p);
  38333. n -= 64;
  38334. if (crypto_verify_32(sm, 0, t, 0)) {
  38335. for (i = 0; i < n; i++) m[i] = 0;
  38336. return -1;
  38337. }
  38338. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38339. mlen = n;
  38340. return mlen;
  38341. }
  38342. var crypto_secretbox_KEYBYTES = 32,
  38343. crypto_secretbox_NONCEBYTES = 24,
  38344. crypto_secretbox_ZEROBYTES = 32,
  38345. crypto_secretbox_BOXZEROBYTES = 16,
  38346. crypto_scalarmult_BYTES = 32,
  38347. crypto_scalarmult_SCALARBYTES = 32,
  38348. crypto_box_PUBLICKEYBYTES = 32,
  38349. crypto_box_SECRETKEYBYTES = 32,
  38350. crypto_box_BEFORENMBYTES = 32,
  38351. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38352. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38353. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38354. crypto_sign_BYTES = 64,
  38355. crypto_sign_PUBLICKEYBYTES = 32,
  38356. crypto_sign_SECRETKEYBYTES = 64,
  38357. crypto_sign_SEEDBYTES = 32,
  38358. crypto_hash_BYTES = 64;
  38359. nacl.lowlevel = {
  38360. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38361. crypto_stream_xor: crypto_stream_xor,
  38362. crypto_stream: crypto_stream,
  38363. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38364. crypto_stream_salsa20: crypto_stream_salsa20,
  38365. crypto_onetimeauth: crypto_onetimeauth,
  38366. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38367. crypto_verify_16: crypto_verify_16,
  38368. crypto_verify_32: crypto_verify_32,
  38369. crypto_secretbox: crypto_secretbox,
  38370. crypto_secretbox_open: crypto_secretbox_open,
  38371. crypto_scalarmult: crypto_scalarmult,
  38372. crypto_scalarmult_base: crypto_scalarmult_base,
  38373. crypto_box_beforenm: crypto_box_beforenm,
  38374. crypto_box_afternm: crypto_box_afternm,
  38375. crypto_box: crypto_box,
  38376. crypto_box_open: crypto_box_open,
  38377. crypto_box_keypair: crypto_box_keypair,
  38378. crypto_hash: crypto_hash,
  38379. crypto_sign: crypto_sign,
  38380. crypto_sign_keypair: crypto_sign_keypair,
  38381. crypto_sign_open: crypto_sign_open,
  38382. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38383. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38384. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38385. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38386. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38387. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38388. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38389. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38390. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38391. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38392. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38393. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38394. crypto_sign_BYTES: crypto_sign_BYTES,
  38395. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38396. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38397. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38398. crypto_hash_BYTES: crypto_hash_BYTES
  38399. };
  38400. /* High-level API */
  38401. function checkLengths(k, n) {
  38402. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38403. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38404. }
  38405. function checkBoxLengths(pk, sk) {
  38406. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38407. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38408. }
  38409. function checkArrayTypes() {
  38410. for (var i = 0; i < arguments.length; i++) {
  38411. if (!(arguments[i] instanceof Uint8Array))
  38412. throw new TypeError('unexpected type, use Uint8Array');
  38413. }
  38414. }
  38415. function cleanup(arr) {
  38416. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38417. }
  38418. nacl.randomBytes = function(n) {
  38419. var b = new Uint8Array(n);
  38420. randombytes(b, n);
  38421. return b;
  38422. };
  38423. nacl.secretbox = function(msg, nonce, key) {
  38424. checkArrayTypes(msg, nonce, key);
  38425. checkLengths(key, nonce);
  38426. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38427. var c = new Uint8Array(m.length);
  38428. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38429. crypto_secretbox(c, m, m.length, nonce, key);
  38430. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38431. };
  38432. nacl.secretbox.open = function(box, nonce, key) {
  38433. checkArrayTypes(box, nonce, key);
  38434. checkLengths(key, nonce);
  38435. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38436. var m = new Uint8Array(c.length);
  38437. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38438. if (c.length < 32) return null;
  38439. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38440. return m.subarray(crypto_secretbox_ZEROBYTES);
  38441. };
  38442. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38443. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38444. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38445. nacl.scalarMult = function(n, p) {
  38446. checkArrayTypes(n, p);
  38447. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38448. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38449. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38450. crypto_scalarmult(q, n, p);
  38451. return q;
  38452. };
  38453. nacl.scalarMult.base = function(n) {
  38454. checkArrayTypes(n);
  38455. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38456. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38457. crypto_scalarmult_base(q, n);
  38458. return q;
  38459. };
  38460. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38461. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38462. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38463. var k = nacl.box.before(publicKey, secretKey);
  38464. return nacl.secretbox(msg, nonce, k);
  38465. };
  38466. nacl.box.before = function(publicKey, secretKey) {
  38467. checkArrayTypes(publicKey, secretKey);
  38468. checkBoxLengths(publicKey, secretKey);
  38469. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38470. crypto_box_beforenm(k, publicKey, secretKey);
  38471. return k;
  38472. };
  38473. nacl.box.after = nacl.secretbox;
  38474. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38475. var k = nacl.box.before(publicKey, secretKey);
  38476. return nacl.secretbox.open(msg, nonce, k);
  38477. };
  38478. nacl.box.open.after = nacl.secretbox.open;
  38479. nacl.box.keyPair = function() {
  38480. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38481. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38482. crypto_box_keypair(pk, sk);
  38483. return {publicKey: pk, secretKey: sk};
  38484. };
  38485. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38486. checkArrayTypes(secretKey);
  38487. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38488. throw new Error('bad secret key size');
  38489. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38490. crypto_scalarmult_base(pk, secretKey);
  38491. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38492. };
  38493. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38494. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38495. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38496. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38497. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38498. nacl.sign = function(msg, secretKey) {
  38499. checkArrayTypes(msg, secretKey);
  38500. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38501. throw new Error('bad secret key size');
  38502. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38503. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38504. return signedMsg;
  38505. };
  38506. nacl.sign.open = function(signedMsg, publicKey) {
  38507. checkArrayTypes(signedMsg, publicKey);
  38508. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38509. throw new Error('bad public key size');
  38510. var tmp = new Uint8Array(signedMsg.length);
  38511. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38512. if (mlen < 0) return null;
  38513. var m = new Uint8Array(mlen);
  38514. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38515. return m;
  38516. };
  38517. nacl.sign.detached = function(msg, secretKey) {
  38518. var signedMsg = nacl.sign(msg, secretKey);
  38519. var sig = new Uint8Array(crypto_sign_BYTES);
  38520. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38521. return sig;
  38522. };
  38523. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38524. checkArrayTypes(msg, sig, publicKey);
  38525. if (sig.length !== crypto_sign_BYTES)
  38526. throw new Error('bad signature size');
  38527. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38528. throw new Error('bad public key size');
  38529. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38530. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38531. var i;
  38532. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38533. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38534. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38535. };
  38536. nacl.sign.keyPair = function() {
  38537. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38538. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38539. crypto_sign_keypair(pk, sk);
  38540. return {publicKey: pk, secretKey: sk};
  38541. };
  38542. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38543. checkArrayTypes(secretKey);
  38544. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38545. throw new Error('bad secret key size');
  38546. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38547. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38548. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38549. };
  38550. nacl.sign.keyPair.fromSeed = function(seed) {
  38551. checkArrayTypes(seed);
  38552. if (seed.length !== crypto_sign_SEEDBYTES)
  38553. throw new Error('bad seed size');
  38554. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38555. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38556. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38557. crypto_sign_keypair(pk, sk, true);
  38558. return {publicKey: pk, secretKey: sk};
  38559. };
  38560. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38561. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38562. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38563. nacl.sign.signatureLength = crypto_sign_BYTES;
  38564. nacl.hash = function(msg) {
  38565. checkArrayTypes(msg);
  38566. var h = new Uint8Array(crypto_hash_BYTES);
  38567. crypto_hash(h, msg, msg.length);
  38568. return h;
  38569. };
  38570. nacl.hash.hashLength = crypto_hash_BYTES;
  38571. nacl.verify = function(x, y) {
  38572. checkArrayTypes(x, y);
  38573. // Zero length arguments are considered not equal.
  38574. if (x.length === 0 || y.length === 0) return false;
  38575. if (x.length !== y.length) return false;
  38576. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38577. };
  38578. nacl.setPRNG = function(fn) {
  38579. randombytes = fn;
  38580. };
  38581. (function() {
  38582. // Initialize PRNG if environment provides CSPRNG.
  38583. // If not, methods calling randombytes will throw.
  38584. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38585. if (crypto && crypto.getRandomValues) {
  38586. // Browsers.
  38587. var QUOTA = 65536;
  38588. nacl.setPRNG(function(x, n) {
  38589. var i, v = new Uint8Array(n);
  38590. for (i = 0; i < n; i += QUOTA) {
  38591. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38592. }
  38593. for (i = 0; i < n; i++) x[i] = v[i];
  38594. cleanup(v);
  38595. });
  38596. } else if (true) {
  38597. // Node.js.
  38598. crypto = __webpack_require__(3);
  38599. if (crypto && crypto.randomBytes) {
  38600. nacl.setPRNG(function(x, n) {
  38601. var i, v = crypto.randomBytes(n);
  38602. for (i = 0; i < n; i++) x[i] = v[i];
  38603. cleanup(v);
  38604. });
  38605. }
  38606. }
  38607. })();
  38608. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38609. /***/ }),
  38610. /* 1 */
  38611. /***/ (function(module, exports, __webpack_require__) {
  38612. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38613. // Public domain.
  38614. (function(root, f) {
  38615. 'use strict';
  38616. if ( true && module.exports) module.exports = f();
  38617. else if (root.nacl) root.nacl.util = f();
  38618. else {
  38619. root.nacl = {};
  38620. root.nacl.util = f();
  38621. }
  38622. }(this, function() {
  38623. 'use strict';
  38624. var util = {};
  38625. function validateBase64(s) {
  38626. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38627. throw new TypeError('invalid encoding');
  38628. }
  38629. }
  38630. util.decodeUTF8 = function(s) {
  38631. if (typeof s !== 'string') throw new TypeError('expected string');
  38632. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38633. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38634. return b;
  38635. };
  38636. util.encodeUTF8 = function(arr) {
  38637. var i, s = [];
  38638. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38639. return decodeURIComponent(escape(s.join('')));
  38640. };
  38641. if (typeof atob === 'undefined') {
  38642. // Node.js
  38643. if (typeof Buffer.from !== 'undefined') {
  38644. // Node v6 and later
  38645. util.encodeBase64 = function (arr) { // v6 and later
  38646. return Buffer.from(arr).toString('base64');
  38647. };
  38648. util.decodeBase64 = function (s) {
  38649. validateBase64(s);
  38650. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38651. };
  38652. } else {
  38653. // Node earlier than v6
  38654. util.encodeBase64 = function (arr) { // v6 and later
  38655. return (new Buffer(arr)).toString('base64');
  38656. };
  38657. util.decodeBase64 = function(s) {
  38658. validateBase64(s);
  38659. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38660. };
  38661. }
  38662. } else {
  38663. // Browsers
  38664. util.encodeBase64 = function(arr) {
  38665. var i, s = [], len = arr.length;
  38666. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38667. return btoa(s.join(''));
  38668. };
  38669. util.decodeBase64 = function(s) {
  38670. validateBase64(s);
  38671. var i, d = atob(s), b = new Uint8Array(d.length);
  38672. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38673. return b;
  38674. };
  38675. }
  38676. return util;
  38677. }));
  38678. /***/ }),
  38679. /* 2 */
  38680. /***/ (function(module, exports, __webpack_require__) {
  38681. // required so we don't have to do require('pusher').default etc.
  38682. module.exports = __webpack_require__(4).default;
  38683. /***/ }),
  38684. /* 3 */
  38685. /***/ (function(module, exports) {
  38686. /* (ignored) */
  38687. /***/ }),
  38688. /* 4 */
  38689. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38690. "use strict";
  38691. __webpack_require__.r(__webpack_exports__);
  38692. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38693. var ScriptReceiverFactory = (function () {
  38694. function ScriptReceiverFactory(prefix, name) {
  38695. this.lastId = 0;
  38696. this.prefix = prefix;
  38697. this.name = name;
  38698. }
  38699. ScriptReceiverFactory.prototype.create = function (callback) {
  38700. this.lastId++;
  38701. var number = this.lastId;
  38702. var id = this.prefix + number;
  38703. var name = this.name + "[" + number + "]";
  38704. var called = false;
  38705. var callbackWrapper = function () {
  38706. if (!called) {
  38707. callback.apply(null, arguments);
  38708. called = true;
  38709. }
  38710. };
  38711. this[number] = callbackWrapper;
  38712. return { number: number, id: id, name: name, callback: callbackWrapper };
  38713. };
  38714. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38715. delete this[receiver.number];
  38716. };
  38717. return ScriptReceiverFactory;
  38718. }());
  38719. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38720. // CONCATENATED MODULE: ./src/core/defaults.ts
  38721. var Defaults = {
  38722. VERSION: "5.0.3",
  38723. PROTOCOL: 7,
  38724. host: 'ws.pusherapp.com',
  38725. ws_port: 80,
  38726. wss_port: 443,
  38727. ws_path: '',
  38728. sockjs_host: 'sockjs.pusher.com',
  38729. sockjs_http_port: 80,
  38730. sockjs_https_port: 443,
  38731. sockjs_path: '/pusher',
  38732. stats_host: 'stats.pusher.com',
  38733. channel_auth_endpoint: '/pusher/auth',
  38734. channel_auth_transport: 'ajax',
  38735. activity_timeout: 120000,
  38736. pong_timeout: 30000,
  38737. unavailable_timeout: 10000,
  38738. cdn_http: "http://js.pusher.com",
  38739. cdn_https: "https://js.pusher.com",
  38740. dependency_suffix: ""
  38741. };
  38742. /* harmony default export */ var defaults = (Defaults);
  38743. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38744. var dependency_loader_DependencyLoader = (function () {
  38745. function DependencyLoader(options) {
  38746. this.options = options;
  38747. this.receivers = options.receivers || ScriptReceivers;
  38748. this.loading = {};
  38749. }
  38750. DependencyLoader.prototype.load = function (name, options, callback) {
  38751. var self = this;
  38752. if (self.loading[name] && self.loading[name].length > 0) {
  38753. self.loading[name].push(callback);
  38754. }
  38755. else {
  38756. self.loading[name] = [callback];
  38757. var request = runtime.createScriptRequest(self.getPath(name, options));
  38758. var receiver = self.receivers.create(function (error) {
  38759. self.receivers.remove(receiver);
  38760. if (self.loading[name]) {
  38761. var callbacks = self.loading[name];
  38762. delete self.loading[name];
  38763. var successCallback = function (wasSuccessful) {
  38764. if (!wasSuccessful) {
  38765. request.cleanup();
  38766. }
  38767. };
  38768. for (var i = 0; i < callbacks.length; i++) {
  38769. callbacks[i](error, successCallback);
  38770. }
  38771. }
  38772. });
  38773. request.send(receiver);
  38774. }
  38775. };
  38776. DependencyLoader.prototype.getRoot = function (options) {
  38777. var cdn;
  38778. var protocol = runtime.getDocument().location.protocol;
  38779. if ((options && options.useTLS) || protocol === "https:") {
  38780. cdn = this.options.cdn_https;
  38781. }
  38782. else {
  38783. cdn = this.options.cdn_http;
  38784. }
  38785. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38786. };
  38787. DependencyLoader.prototype.getPath = function (name, options) {
  38788. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38789. };
  38790. ;
  38791. return DependencyLoader;
  38792. }());
  38793. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38794. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38795. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38796. var Dependencies = new dependency_loader({
  38797. cdn_http: defaults.cdn_http,
  38798. cdn_https: defaults.cdn_https,
  38799. version: defaults.VERSION,
  38800. suffix: defaults.dependency_suffix,
  38801. receivers: DependenciesReceivers
  38802. });
  38803. // CONCATENATED MODULE: ./src/core/base64.ts
  38804. function encode(s) {
  38805. return btoa(utob(s));
  38806. }
  38807. var fromCharCode = String.fromCharCode;
  38808. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38809. var b64tab = {};
  38810. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38811. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38812. }
  38813. var cb_utob = function (c) {
  38814. var cc = c.charCodeAt(0);
  38815. return cc < 0x80
  38816. ? c
  38817. : cc < 0x800
  38818. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38819. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38820. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38821. fromCharCode(0x80 | (cc & 0x3f));
  38822. };
  38823. var utob = function (u) {
  38824. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38825. };
  38826. var cb_encode = function (ccc) {
  38827. var padlen = [0, 2, 1][ccc.length % 3];
  38828. var ord = (ccc.charCodeAt(0) << 16) |
  38829. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38830. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38831. var chars = [
  38832. b64chars.charAt(ord >>> 18),
  38833. b64chars.charAt((ord >>> 12) & 63),
  38834. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38835. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38836. ];
  38837. return chars.join('');
  38838. };
  38839. var btoa = window.btoa ||
  38840. function (b) {
  38841. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38842. };
  38843. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38844. var Timer = (function () {
  38845. function Timer(set, clear, delay, callback) {
  38846. var _this = this;
  38847. this.clear = clear;
  38848. this.timer = set(function () {
  38849. if (_this.timer) {
  38850. _this.timer = callback(_this.timer);
  38851. }
  38852. }, delay);
  38853. }
  38854. Timer.prototype.isRunning = function () {
  38855. return this.timer !== null;
  38856. };
  38857. Timer.prototype.ensureAborted = function () {
  38858. if (this.timer) {
  38859. this.clear(this.timer);
  38860. this.timer = null;
  38861. }
  38862. };
  38863. return Timer;
  38864. }());
  38865. /* harmony default export */ var abstract_timer = (Timer);
  38866. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38867. var __extends = (undefined && undefined.__extends) || (function () {
  38868. var extendStatics = function (d, b) {
  38869. extendStatics = Object.setPrototypeOf ||
  38870. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38871. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38872. return extendStatics(d, b);
  38873. };
  38874. return function (d, b) {
  38875. extendStatics(d, b);
  38876. function __() { this.constructor = d; }
  38877. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38878. };
  38879. })();
  38880. function timers_clearTimeout(timer) {
  38881. window.clearTimeout(timer);
  38882. }
  38883. function timers_clearInterval(timer) {
  38884. window.clearInterval(timer);
  38885. }
  38886. var OneOffTimer = (function (_super) {
  38887. __extends(OneOffTimer, _super);
  38888. function OneOffTimer(delay, callback) {
  38889. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38890. callback();
  38891. return null;
  38892. }) || this;
  38893. }
  38894. return OneOffTimer;
  38895. }(abstract_timer));
  38896. var PeriodicTimer = (function (_super) {
  38897. __extends(PeriodicTimer, _super);
  38898. function PeriodicTimer(delay, callback) {
  38899. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38900. callback();
  38901. return timer;
  38902. }) || this;
  38903. }
  38904. return PeriodicTimer;
  38905. }(abstract_timer));
  38906. // CONCATENATED MODULE: ./src/core/util.ts
  38907. var Util = {
  38908. now: function () {
  38909. if (Date.now) {
  38910. return Date.now();
  38911. }
  38912. else {
  38913. return new Date().valueOf();
  38914. }
  38915. },
  38916. defer: function (callback) {
  38917. return new OneOffTimer(0, callback);
  38918. },
  38919. method: function (name) {
  38920. var args = [];
  38921. for (var _i = 1; _i < arguments.length; _i++) {
  38922. args[_i - 1] = arguments[_i];
  38923. }
  38924. var boundArguments = Array.prototype.slice.call(arguments, 1);
  38925. return function (object) {
  38926. return object[name].apply(object, boundArguments.concat(arguments));
  38927. };
  38928. }
  38929. };
  38930. /* harmony default export */ var util = (Util);
  38931. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  38932. function extend(target) {
  38933. var sources = [];
  38934. for (var _i = 1; _i < arguments.length; _i++) {
  38935. sources[_i - 1] = arguments[_i];
  38936. }
  38937. for (var i = 0; i < sources.length; i++) {
  38938. var extensions = sources[i];
  38939. for (var property in extensions) {
  38940. if (extensions[property] && extensions[property].constructor &&
  38941. extensions[property].constructor === Object) {
  38942. target[property] = extend(target[property] || {}, extensions[property]);
  38943. }
  38944. else {
  38945. target[property] = extensions[property];
  38946. }
  38947. }
  38948. }
  38949. return target;
  38950. }
  38951. function stringify() {
  38952. var m = ["Pusher"];
  38953. for (var i = 0; i < arguments.length; i++) {
  38954. if (typeof arguments[i] === "string") {
  38955. m.push(arguments[i]);
  38956. }
  38957. else {
  38958. m.push(safeJSONStringify(arguments[i]));
  38959. }
  38960. }
  38961. return m.join(" : ");
  38962. }
  38963. function arrayIndexOf(array, item) {
  38964. var nativeIndexOf = Array.prototype.indexOf;
  38965. if (array === null) {
  38966. return -1;
  38967. }
  38968. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  38969. return array.indexOf(item);
  38970. }
  38971. for (var i = 0, l = array.length; i < l; i++) {
  38972. if (array[i] === item) {
  38973. return i;
  38974. }
  38975. }
  38976. return -1;
  38977. }
  38978. function objectApply(object, f) {
  38979. for (var key in object) {
  38980. if (Object.prototype.hasOwnProperty.call(object, key)) {
  38981. f(object[key], key, object);
  38982. }
  38983. }
  38984. }
  38985. function keys(object) {
  38986. var keys = [];
  38987. objectApply(object, function (_, key) {
  38988. keys.push(key);
  38989. });
  38990. return keys;
  38991. }
  38992. function values(object) {
  38993. var values = [];
  38994. objectApply(object, function (value) {
  38995. values.push(value);
  38996. });
  38997. return values;
  38998. }
  38999. function apply(array, f, context) {
  39000. for (var i = 0; i < array.length; i++) {
  39001. f.call(context || window, array[i], i, array);
  39002. }
  39003. }
  39004. function map(array, f) {
  39005. var result = [];
  39006. for (var i = 0; i < array.length; i++) {
  39007. result.push(f(array[i], i, array, result));
  39008. }
  39009. return result;
  39010. }
  39011. function mapObject(object, f) {
  39012. var result = {};
  39013. objectApply(object, function (value, key) {
  39014. result[key] = f(value);
  39015. });
  39016. return result;
  39017. }
  39018. function filter(array, test) {
  39019. test = test || function (value) { return !!value; };
  39020. var result = [];
  39021. for (var i = 0; i < array.length; i++) {
  39022. if (test(array[i], i, array, result)) {
  39023. result.push(array[i]);
  39024. }
  39025. }
  39026. return result;
  39027. }
  39028. function filterObject(object, test) {
  39029. var result = {};
  39030. objectApply(object, function (value, key) {
  39031. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39032. result[key] = value;
  39033. }
  39034. });
  39035. return result;
  39036. }
  39037. function flatten(object) {
  39038. var result = [];
  39039. objectApply(object, function (value, key) {
  39040. result.push([key, value]);
  39041. });
  39042. return result;
  39043. }
  39044. function any(array, test) {
  39045. for (var i = 0; i < array.length; i++) {
  39046. if (test(array[i], i, array)) {
  39047. return true;
  39048. }
  39049. }
  39050. return false;
  39051. }
  39052. function collections_all(array, test) {
  39053. for (var i = 0; i < array.length; i++) {
  39054. if (!test(array[i], i, array)) {
  39055. return false;
  39056. }
  39057. }
  39058. return true;
  39059. }
  39060. function encodeParamsObject(data) {
  39061. return mapObject(data, function (value) {
  39062. if (typeof value === "object") {
  39063. value = safeJSONStringify(value);
  39064. }
  39065. return encodeURIComponent(encode(value.toString()));
  39066. });
  39067. }
  39068. function buildQueryString(data) {
  39069. var params = filterObject(data, function (value) {
  39070. return value !== undefined;
  39071. });
  39072. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39073. return query;
  39074. }
  39075. function decycleObject(object) {
  39076. var objects = [], paths = [];
  39077. return (function derez(value, path) {
  39078. var i, name, nu;
  39079. switch (typeof value) {
  39080. case 'object':
  39081. if (!value) {
  39082. return null;
  39083. }
  39084. for (i = 0; i < objects.length; i += 1) {
  39085. if (objects[i] === value) {
  39086. return { $ref: paths[i] };
  39087. }
  39088. }
  39089. objects.push(value);
  39090. paths.push(path);
  39091. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39092. nu = [];
  39093. for (i = 0; i < value.length; i += 1) {
  39094. nu[i] = derez(value[i], path + '[' + i + ']');
  39095. }
  39096. }
  39097. else {
  39098. nu = {};
  39099. for (name in value) {
  39100. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39101. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39102. }
  39103. }
  39104. }
  39105. return nu;
  39106. case 'number':
  39107. case 'string':
  39108. case 'boolean':
  39109. return value;
  39110. }
  39111. }(object, '$'));
  39112. }
  39113. function safeJSONStringify(source) {
  39114. try {
  39115. return JSON.stringify(source);
  39116. }
  39117. catch (e) {
  39118. return JSON.stringify(decycleObject(source));
  39119. }
  39120. }
  39121. // CONCATENATED MODULE: ./src/core/logger.ts
  39122. var logger_Logger = (function () {
  39123. function Logger() {
  39124. this.globalLog = function (message) {
  39125. if (window.console && window.console.log) {
  39126. window.console.log(message);
  39127. }
  39128. };
  39129. }
  39130. Logger.prototype.debug = function () {
  39131. var args = [];
  39132. for (var _i = 0; _i < arguments.length; _i++) {
  39133. args[_i] = arguments[_i];
  39134. }
  39135. this.log(this.globalLog, args);
  39136. };
  39137. Logger.prototype.warn = function () {
  39138. var args = [];
  39139. for (var _i = 0; _i < arguments.length; _i++) {
  39140. args[_i] = arguments[_i];
  39141. }
  39142. this.log(this.globalLogWarn, args);
  39143. };
  39144. Logger.prototype.error = function () {
  39145. var args = [];
  39146. for (var _i = 0; _i < arguments.length; _i++) {
  39147. args[_i] = arguments[_i];
  39148. }
  39149. this.log(this.globalLogError, args);
  39150. };
  39151. Logger.prototype.globalLogWarn = function (message) {
  39152. if (window.console && window.console.warn) {
  39153. window.console.warn(message);
  39154. }
  39155. else {
  39156. this.globalLog(message);
  39157. }
  39158. };
  39159. Logger.prototype.globalLogError = function (message) {
  39160. if (window.console && window.console.error) {
  39161. window.console.error(message);
  39162. }
  39163. else {
  39164. this.globalLogWarn(message);
  39165. }
  39166. };
  39167. Logger.prototype.log = function (defaultLoggingFunction) {
  39168. var args = [];
  39169. for (var _i = 1; _i < arguments.length; _i++) {
  39170. args[_i - 1] = arguments[_i];
  39171. }
  39172. var message = stringify.apply(this, arguments);
  39173. if (core_pusher.log) {
  39174. core_pusher.log(message);
  39175. }
  39176. else if (core_pusher.logToConsole) {
  39177. var log = defaultLoggingFunction.bind(this);
  39178. log(message);
  39179. }
  39180. };
  39181. return Logger;
  39182. }());
  39183. /* harmony default export */ var logger = (new logger_Logger());
  39184. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39185. var urlStore = {
  39186. baseUrl: "https://pusher.com",
  39187. urls: {
  39188. authenticationEndpoint: {
  39189. path: "/docs/authenticating_users",
  39190. },
  39191. javascriptQuickStart: {
  39192. path: "/docs/javascript_quick_start"
  39193. },
  39194. triggeringClientEvents: {
  39195. path: "/docs/client_api_guide/client_events#trigger-events"
  39196. }
  39197. }
  39198. };
  39199. var buildLogSuffix = function (key) {
  39200. var urlPrefix = "See:";
  39201. var urlObj = urlStore.urls[key];
  39202. if (!urlObj)
  39203. return "";
  39204. var url;
  39205. if (urlObj.fullUrl) {
  39206. url = urlObj.fullUrl;
  39207. }
  39208. else if (urlObj.path) {
  39209. url = urlStore.baseUrl + urlObj.path;
  39210. }
  39211. if (!url)
  39212. return "";
  39213. return urlPrefix + " " + url;
  39214. };
  39215. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39216. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39217. var ajax = function (context, socketId, callback) {
  39218. var self = this, xhr;
  39219. xhr = runtime.createXHR();
  39220. xhr.open("POST", self.options.authEndpoint, true);
  39221. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39222. for (var headerName in this.authOptions.headers) {
  39223. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39224. }
  39225. xhr.onreadystatechange = function () {
  39226. if (xhr.readyState === 4) {
  39227. if (xhr.status === 200) {
  39228. var data, parsed = false;
  39229. try {
  39230. data = JSON.parse(xhr.responseText);
  39231. parsed = true;
  39232. }
  39233. catch (e) {
  39234. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39235. }
  39236. if (parsed) {
  39237. callback(false, data);
  39238. }
  39239. }
  39240. else {
  39241. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39242. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39243. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39244. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39245. callback(true, xhr.status);
  39246. }
  39247. }
  39248. };
  39249. xhr.send(this.composeQuery(socketId));
  39250. return xhr;
  39251. };
  39252. /* harmony default export */ var xhr_auth = (ajax);
  39253. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39254. var jsonp = function (context, socketId, callback) {
  39255. if (this.authOptions.headers !== undefined) {
  39256. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39257. }
  39258. var callbackName = context.nextAuthCallbackID.toString();
  39259. context.nextAuthCallbackID++;
  39260. var document = context.getDocument();
  39261. var script = document.createElement("script");
  39262. context.auth_callbacks[callbackName] = function (data) {
  39263. callback(false, data);
  39264. };
  39265. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39266. script.src = this.options.authEndpoint +
  39267. '?callback=' +
  39268. encodeURIComponent(callback_name) +
  39269. '&' +
  39270. this.composeQuery(socketId);
  39271. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39272. head.insertBefore(script, head.firstChild);
  39273. };
  39274. /* harmony default export */ var jsonp_auth = (jsonp);
  39275. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39276. var ScriptRequest = (function () {
  39277. function ScriptRequest(src) {
  39278. this.src = src;
  39279. }
  39280. ScriptRequest.prototype.send = function (receiver) {
  39281. var self = this;
  39282. var errorString = "Error loading " + self.src;
  39283. self.script = document.createElement("script");
  39284. self.script.id = receiver.id;
  39285. self.script.src = self.src;
  39286. self.script.type = "text/javascript";
  39287. self.script.charset = "UTF-8";
  39288. if (self.script.addEventListener) {
  39289. self.script.onerror = function () {
  39290. receiver.callback(errorString);
  39291. };
  39292. self.script.onload = function () {
  39293. receiver.callback(null);
  39294. };
  39295. }
  39296. else {
  39297. self.script.onreadystatechange = function () {
  39298. if (self.script.readyState === 'loaded' ||
  39299. self.script.readyState === 'complete') {
  39300. receiver.callback(null);
  39301. }
  39302. };
  39303. }
  39304. if (self.script.async === undefined && document.attachEvent &&
  39305. /opera/i.test(navigator.userAgent)) {
  39306. self.errorScript = document.createElement("script");
  39307. self.errorScript.id = receiver.id + "_error";
  39308. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39309. self.script.async = self.errorScript.async = false;
  39310. }
  39311. else {
  39312. self.script.async = true;
  39313. }
  39314. var head = document.getElementsByTagName('head')[0];
  39315. head.insertBefore(self.script, head.firstChild);
  39316. if (self.errorScript) {
  39317. head.insertBefore(self.errorScript, self.script.nextSibling);
  39318. }
  39319. };
  39320. ScriptRequest.prototype.cleanup = function () {
  39321. if (this.script) {
  39322. this.script.onload = this.script.onerror = null;
  39323. this.script.onreadystatechange = null;
  39324. }
  39325. if (this.script && this.script.parentNode) {
  39326. this.script.parentNode.removeChild(this.script);
  39327. }
  39328. if (this.errorScript && this.errorScript.parentNode) {
  39329. this.errorScript.parentNode.removeChild(this.errorScript);
  39330. }
  39331. this.script = null;
  39332. this.errorScript = null;
  39333. };
  39334. return ScriptRequest;
  39335. }());
  39336. /* harmony default export */ var script_request = (ScriptRequest);
  39337. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39338. var jsonp_request_JSONPRequest = (function () {
  39339. function JSONPRequest(url, data) {
  39340. this.url = url;
  39341. this.data = data;
  39342. }
  39343. JSONPRequest.prototype.send = function (receiver) {
  39344. if (this.request) {
  39345. return;
  39346. }
  39347. var query = buildQueryString(this.data);
  39348. var url = this.url + "/" + receiver.number + "?" + query;
  39349. this.request = runtime.createScriptRequest(url);
  39350. this.request.send(receiver);
  39351. };
  39352. JSONPRequest.prototype.cleanup = function () {
  39353. if (this.request) {
  39354. this.request.cleanup();
  39355. }
  39356. };
  39357. return JSONPRequest;
  39358. }());
  39359. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39360. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39361. var getAgent = function (sender, useTLS) {
  39362. return function (data, callback) {
  39363. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39364. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39365. var request = runtime.createJSONPRequest(url, data);
  39366. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39367. ScriptReceivers.remove(receiver);
  39368. request.cleanup();
  39369. if (result && result.host) {
  39370. sender.host = result.host;
  39371. }
  39372. if (callback) {
  39373. callback(error, result);
  39374. }
  39375. });
  39376. request.send(receiver);
  39377. };
  39378. };
  39379. var jsonp_timeline_jsonp = {
  39380. name: 'jsonp',
  39381. getAgent: getAgent
  39382. };
  39383. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39384. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39385. function getGenericURL(baseScheme, params, path) {
  39386. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39387. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39388. return scheme + "://" + host + path;
  39389. }
  39390. function getGenericPath(key, queryString) {
  39391. var path = "/app/" + key;
  39392. var query = "?protocol=" + defaults.PROTOCOL +
  39393. "&client=js" +
  39394. "&version=" + defaults.VERSION +
  39395. (queryString ? ("&" + queryString) : "");
  39396. return path + query;
  39397. }
  39398. var ws = {
  39399. getInitial: function (key, params) {
  39400. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39401. return getGenericURL("ws", params, path);
  39402. }
  39403. };
  39404. var http = {
  39405. getInitial: function (key, params) {
  39406. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39407. return getGenericURL("http", params, path);
  39408. }
  39409. };
  39410. var sockjs = {
  39411. getInitial: function (key, params) {
  39412. return getGenericURL("http", params, params.httpPath || "/pusher");
  39413. },
  39414. getPath: function (key, params) {
  39415. return getGenericPath(key);
  39416. }
  39417. };
  39418. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39419. var callback_registry_CallbackRegistry = (function () {
  39420. function CallbackRegistry() {
  39421. this._callbacks = {};
  39422. }
  39423. CallbackRegistry.prototype.get = function (name) {
  39424. return this._callbacks[prefix(name)];
  39425. };
  39426. CallbackRegistry.prototype.add = function (name, callback, context) {
  39427. var prefixedEventName = prefix(name);
  39428. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39429. this._callbacks[prefixedEventName].push({
  39430. fn: callback,
  39431. context: context
  39432. });
  39433. };
  39434. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39435. if (!name && !callback && !context) {
  39436. this._callbacks = {};
  39437. return;
  39438. }
  39439. var names = name ? [prefix(name)] : keys(this._callbacks);
  39440. if (callback || context) {
  39441. this.removeCallback(names, callback, context);
  39442. }
  39443. else {
  39444. this.removeAllCallbacks(names);
  39445. }
  39446. };
  39447. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39448. apply(names, function (name) {
  39449. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39450. return (callback && callback !== binding.fn) ||
  39451. (context && context !== binding.context);
  39452. });
  39453. if (this._callbacks[name].length === 0) {
  39454. delete this._callbacks[name];
  39455. }
  39456. }, this);
  39457. };
  39458. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39459. apply(names, function (name) {
  39460. delete this._callbacks[name];
  39461. }, this);
  39462. };
  39463. return CallbackRegistry;
  39464. }());
  39465. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39466. function prefix(name) {
  39467. return "_" + name;
  39468. }
  39469. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39470. var dispatcher_Dispatcher = (function () {
  39471. function Dispatcher(failThrough) {
  39472. this.callbacks = new callback_registry();
  39473. this.global_callbacks = [];
  39474. this.failThrough = failThrough;
  39475. }
  39476. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39477. this.callbacks.add(eventName, callback, context);
  39478. return this;
  39479. };
  39480. Dispatcher.prototype.bind_global = function (callback) {
  39481. this.global_callbacks.push(callback);
  39482. return this;
  39483. };
  39484. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39485. this.callbacks.remove(eventName, callback, context);
  39486. return this;
  39487. };
  39488. Dispatcher.prototype.unbind_global = function (callback) {
  39489. if (!callback) {
  39490. this.global_callbacks = [];
  39491. return this;
  39492. }
  39493. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39494. return this;
  39495. };
  39496. Dispatcher.prototype.unbind_all = function () {
  39497. this.unbind();
  39498. this.unbind_global();
  39499. return this;
  39500. };
  39501. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39502. for (var i = 0; i < this.global_callbacks.length; i++) {
  39503. this.global_callbacks[i](eventName, data);
  39504. }
  39505. var callbacks = this.callbacks.get(eventName);
  39506. var args = [];
  39507. if (metadata) {
  39508. args.push(data, metadata);
  39509. }
  39510. else if (data) {
  39511. args.push(data);
  39512. }
  39513. if (callbacks && callbacks.length > 0) {
  39514. for (var i = 0; i < callbacks.length; i++) {
  39515. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39516. }
  39517. }
  39518. else if (this.failThrough) {
  39519. this.failThrough(eventName, data);
  39520. }
  39521. return this;
  39522. };
  39523. return Dispatcher;
  39524. }());
  39525. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39526. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39527. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39528. var extendStatics = function (d, b) {
  39529. extendStatics = Object.setPrototypeOf ||
  39530. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39531. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39532. return extendStatics(d, b);
  39533. };
  39534. return function (d, b) {
  39535. extendStatics(d, b);
  39536. function __() { this.constructor = d; }
  39537. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39538. };
  39539. })();
  39540. var transport_connection_TransportConnection = (function (_super) {
  39541. transport_connection_extends(TransportConnection, _super);
  39542. function TransportConnection(hooks, name, priority, key, options) {
  39543. var _this = _super.call(this) || this;
  39544. _this.initialize = runtime.transportConnectionInitializer;
  39545. _this.hooks = hooks;
  39546. _this.name = name;
  39547. _this.priority = priority;
  39548. _this.key = key;
  39549. _this.options = options;
  39550. _this.state = "new";
  39551. _this.timeline = options.timeline;
  39552. _this.activityTimeout = options.activityTimeout;
  39553. _this.id = _this.timeline.generateUniqueID();
  39554. return _this;
  39555. }
  39556. TransportConnection.prototype.handlesActivityChecks = function () {
  39557. return Boolean(this.hooks.handlesActivityChecks);
  39558. };
  39559. TransportConnection.prototype.supportsPing = function () {
  39560. return Boolean(this.hooks.supportsPing);
  39561. };
  39562. TransportConnection.prototype.connect = function () {
  39563. var _this = this;
  39564. if (this.socket || this.state !== "initialized") {
  39565. return false;
  39566. }
  39567. var url = this.hooks.urls.getInitial(this.key, this.options);
  39568. try {
  39569. this.socket = this.hooks.getSocket(url, this.options);
  39570. }
  39571. catch (e) {
  39572. util.defer(function () {
  39573. _this.onError(e);
  39574. _this.changeState("closed");
  39575. });
  39576. return false;
  39577. }
  39578. this.bindListeners();
  39579. logger.debug("Connecting", { transport: this.name, url: url });
  39580. this.changeState("connecting");
  39581. return true;
  39582. };
  39583. TransportConnection.prototype.close = function () {
  39584. if (this.socket) {
  39585. this.socket.close();
  39586. return true;
  39587. }
  39588. else {
  39589. return false;
  39590. }
  39591. };
  39592. TransportConnection.prototype.send = function (data) {
  39593. var _this = this;
  39594. if (this.state === "open") {
  39595. util.defer(function () {
  39596. if (_this.socket) {
  39597. _this.socket.send(data);
  39598. }
  39599. });
  39600. return true;
  39601. }
  39602. else {
  39603. return false;
  39604. }
  39605. };
  39606. TransportConnection.prototype.ping = function () {
  39607. if (this.state === "open" && this.supportsPing()) {
  39608. this.socket.ping();
  39609. }
  39610. };
  39611. TransportConnection.prototype.onOpen = function () {
  39612. if (this.hooks.beforeOpen) {
  39613. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39614. }
  39615. this.changeState("open");
  39616. this.socket.onopen = undefined;
  39617. };
  39618. TransportConnection.prototype.onError = function (error) {
  39619. this.emit("error", { type: 'WebSocketError', error: error });
  39620. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39621. };
  39622. TransportConnection.prototype.onClose = function (closeEvent) {
  39623. if (closeEvent) {
  39624. this.changeState("closed", {
  39625. code: closeEvent.code,
  39626. reason: closeEvent.reason,
  39627. wasClean: closeEvent.wasClean
  39628. });
  39629. }
  39630. else {
  39631. this.changeState("closed");
  39632. }
  39633. this.unbindListeners();
  39634. this.socket = undefined;
  39635. };
  39636. TransportConnection.prototype.onMessage = function (message) {
  39637. this.emit("message", message);
  39638. };
  39639. TransportConnection.prototype.onActivity = function () {
  39640. this.emit("activity");
  39641. };
  39642. TransportConnection.prototype.bindListeners = function () {
  39643. var _this = this;
  39644. this.socket.onopen = function () {
  39645. _this.onOpen();
  39646. };
  39647. this.socket.onerror = function (error) {
  39648. _this.onError(error);
  39649. };
  39650. this.socket.onclose = function (closeEvent) {
  39651. _this.onClose(closeEvent);
  39652. };
  39653. this.socket.onmessage = function (message) {
  39654. _this.onMessage(message);
  39655. };
  39656. if (this.supportsPing()) {
  39657. this.socket.onactivity = function () { _this.onActivity(); };
  39658. }
  39659. };
  39660. TransportConnection.prototype.unbindListeners = function () {
  39661. if (this.socket) {
  39662. this.socket.onopen = undefined;
  39663. this.socket.onerror = undefined;
  39664. this.socket.onclose = undefined;
  39665. this.socket.onmessage = undefined;
  39666. if (this.supportsPing()) {
  39667. this.socket.onactivity = undefined;
  39668. }
  39669. }
  39670. };
  39671. TransportConnection.prototype.changeState = function (state, params) {
  39672. this.state = state;
  39673. this.timeline.info(this.buildTimelineMessage({
  39674. state: state,
  39675. params: params
  39676. }));
  39677. this.emit(state, params);
  39678. };
  39679. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39680. return extend({ cid: this.id }, message);
  39681. };
  39682. return TransportConnection;
  39683. }(dispatcher));
  39684. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39685. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39686. var transport_Transport = (function () {
  39687. function Transport(hooks) {
  39688. this.hooks = hooks;
  39689. }
  39690. Transport.prototype.isSupported = function (environment) {
  39691. return this.hooks.isSupported(environment);
  39692. };
  39693. Transport.prototype.createConnection = function (name, priority, key, options) {
  39694. return new transport_connection(this.hooks, name, priority, key, options);
  39695. };
  39696. return Transport;
  39697. }());
  39698. /* harmony default export */ var transports_transport = (transport_Transport);
  39699. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39700. var WSTransport = new transports_transport({
  39701. urls: ws,
  39702. handlesActivityChecks: false,
  39703. supportsPing: false,
  39704. isInitialized: function () {
  39705. return Boolean(runtime.getWebSocketAPI());
  39706. },
  39707. isSupported: function () {
  39708. return Boolean(runtime.getWebSocketAPI());
  39709. },
  39710. getSocket: function (url) {
  39711. return runtime.createWebSocket(url);
  39712. }
  39713. });
  39714. var httpConfiguration = {
  39715. urls: http,
  39716. handlesActivityChecks: false,
  39717. supportsPing: true,
  39718. isInitialized: function () {
  39719. return true;
  39720. }
  39721. };
  39722. var streamingConfiguration = extend({ getSocket: function (url) {
  39723. return runtime.HTTPFactory.createStreamingSocket(url);
  39724. }
  39725. }, httpConfiguration);
  39726. var pollingConfiguration = extend({ getSocket: function (url) {
  39727. return runtime.HTTPFactory.createPollingSocket(url);
  39728. }
  39729. }, httpConfiguration);
  39730. var xhrConfiguration = {
  39731. isSupported: function () {
  39732. return runtime.isXHRSupported();
  39733. }
  39734. };
  39735. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39736. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39737. var Transports = {
  39738. ws: WSTransport,
  39739. xhr_streaming: XHRStreamingTransport,
  39740. xhr_polling: XHRPollingTransport
  39741. };
  39742. /* harmony default export */ var transports = (Transports);
  39743. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39744. var SockJSTransport = new transports_transport({
  39745. file: "sockjs",
  39746. urls: sockjs,
  39747. handlesActivityChecks: true,
  39748. supportsPing: false,
  39749. isSupported: function () {
  39750. return true;
  39751. },
  39752. isInitialized: function () {
  39753. return window.SockJS !== undefined;
  39754. },
  39755. getSocket: function (url, options) {
  39756. return new window.SockJS(url, null, {
  39757. js_path: Dependencies.getPath("sockjs", {
  39758. useTLS: options.useTLS
  39759. }),
  39760. ignore_null_origin: options.ignoreNullOrigin
  39761. });
  39762. },
  39763. beforeOpen: function (socket, path) {
  39764. socket.send(JSON.stringify({
  39765. path: path
  39766. }));
  39767. }
  39768. });
  39769. var xdrConfiguration = {
  39770. isSupported: function (environment) {
  39771. var yes = runtime.isXDRSupported(environment.useTLS);
  39772. return yes;
  39773. }
  39774. };
  39775. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39776. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39777. transports.xdr_streaming = XDRStreamingTransport;
  39778. transports.xdr_polling = XDRPollingTransport;
  39779. transports.sockjs = SockJSTransport;
  39780. /* harmony default export */ var transports_transports = (transports);
  39781. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39782. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39783. var extendStatics = function (d, b) {
  39784. extendStatics = Object.setPrototypeOf ||
  39785. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39786. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39787. return extendStatics(d, b);
  39788. };
  39789. return function (d, b) {
  39790. extendStatics(d, b);
  39791. function __() { this.constructor = d; }
  39792. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39793. };
  39794. })();
  39795. var NetInfo = (function (_super) {
  39796. net_info_extends(NetInfo, _super);
  39797. function NetInfo() {
  39798. var _this = _super.call(this) || this;
  39799. var self = _this;
  39800. if (window.addEventListener !== undefined) {
  39801. window.addEventListener("online", function () {
  39802. self.emit('online');
  39803. }, false);
  39804. window.addEventListener("offline", function () {
  39805. self.emit('offline');
  39806. }, false);
  39807. }
  39808. return _this;
  39809. }
  39810. NetInfo.prototype.isOnline = function () {
  39811. if (window.navigator.onLine === undefined) {
  39812. return true;
  39813. }
  39814. else {
  39815. return window.navigator.onLine;
  39816. }
  39817. };
  39818. return NetInfo;
  39819. }(dispatcher));
  39820. var net_info_Network = new NetInfo();
  39821. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39822. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39823. function AssistantToTheTransportManager(manager, transport, options) {
  39824. this.manager = manager;
  39825. this.transport = transport;
  39826. this.minPingDelay = options.minPingDelay;
  39827. this.maxPingDelay = options.maxPingDelay;
  39828. this.pingDelay = undefined;
  39829. }
  39830. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39831. var _this = this;
  39832. options = extend({}, options, {
  39833. activityTimeout: this.pingDelay
  39834. });
  39835. var connection = this.transport.createConnection(name, priority, key, options);
  39836. var openTimestamp = null;
  39837. var onOpen = function () {
  39838. connection.unbind("open", onOpen);
  39839. connection.bind("closed", onClosed);
  39840. openTimestamp = util.now();
  39841. };
  39842. var onClosed = function (closeEvent) {
  39843. connection.unbind("closed", onClosed);
  39844. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39845. _this.manager.reportDeath();
  39846. }
  39847. else if (!closeEvent.wasClean && openTimestamp) {
  39848. var lifespan = util.now() - openTimestamp;
  39849. if (lifespan < 2 * _this.maxPingDelay) {
  39850. _this.manager.reportDeath();
  39851. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39852. }
  39853. }
  39854. };
  39855. connection.bind("open", onOpen);
  39856. return connection;
  39857. };
  39858. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39859. return this.manager.isAlive() && this.transport.isSupported(environment);
  39860. };
  39861. return AssistantToTheTransportManager;
  39862. }());
  39863. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39864. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39865. var Protocol = {
  39866. decodeMessage: function (messageEvent) {
  39867. try {
  39868. var messageData = JSON.parse(messageEvent.data);
  39869. var pusherEventData = messageData.data;
  39870. if (typeof pusherEventData === 'string') {
  39871. try {
  39872. pusherEventData = JSON.parse(messageData.data);
  39873. }
  39874. catch (e) { }
  39875. }
  39876. var pusherEvent = {
  39877. event: messageData.event,
  39878. channel: messageData.channel,
  39879. data: pusherEventData,
  39880. };
  39881. if (messageData.user_id) {
  39882. pusherEvent.user_id = messageData.user_id;
  39883. }
  39884. return pusherEvent;
  39885. }
  39886. catch (e) {
  39887. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39888. }
  39889. },
  39890. encodeMessage: function (event) {
  39891. return JSON.stringify(event);
  39892. },
  39893. processHandshake: function (messageEvent) {
  39894. var message = Protocol.decodeMessage(messageEvent);
  39895. if (message.event === "pusher:connection_established") {
  39896. if (!message.data.activity_timeout) {
  39897. throw "No activity timeout specified in handshake";
  39898. }
  39899. return {
  39900. action: "connected",
  39901. id: message.data.socket_id,
  39902. activityTimeout: message.data.activity_timeout * 1000
  39903. };
  39904. }
  39905. else if (message.event === "pusher:error") {
  39906. return {
  39907. action: this.getCloseAction(message.data),
  39908. error: this.getCloseError(message.data)
  39909. };
  39910. }
  39911. else {
  39912. throw "Invalid handshake";
  39913. }
  39914. },
  39915. getCloseAction: function (closeEvent) {
  39916. if (closeEvent.code < 4000) {
  39917. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  39918. return "backoff";
  39919. }
  39920. else {
  39921. return null;
  39922. }
  39923. }
  39924. else if (closeEvent.code === 4000) {
  39925. return "tls_only";
  39926. }
  39927. else if (closeEvent.code < 4100) {
  39928. return "refused";
  39929. }
  39930. else if (closeEvent.code < 4200) {
  39931. return "backoff";
  39932. }
  39933. else if (closeEvent.code < 4300) {
  39934. return "retry";
  39935. }
  39936. else {
  39937. return "refused";
  39938. }
  39939. },
  39940. getCloseError: function (closeEvent) {
  39941. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  39942. return {
  39943. type: 'PusherError',
  39944. data: {
  39945. code: closeEvent.code,
  39946. message: closeEvent.reason || closeEvent.message
  39947. }
  39948. };
  39949. }
  39950. else {
  39951. return null;
  39952. }
  39953. }
  39954. };
  39955. /* harmony default export */ var protocol_protocol = (Protocol);
  39956. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  39957. var connection_extends = (undefined && undefined.__extends) || (function () {
  39958. var extendStatics = function (d, b) {
  39959. extendStatics = Object.setPrototypeOf ||
  39960. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39961. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39962. return extendStatics(d, b);
  39963. };
  39964. return function (d, b) {
  39965. extendStatics(d, b);
  39966. function __() { this.constructor = d; }
  39967. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39968. };
  39969. })();
  39970. var connection_Connection = (function (_super) {
  39971. connection_extends(Connection, _super);
  39972. function Connection(id, transport) {
  39973. var _this = _super.call(this) || this;
  39974. _this.id = id;
  39975. _this.transport = transport;
  39976. _this.activityTimeout = transport.activityTimeout;
  39977. _this.bindListeners();
  39978. return _this;
  39979. }
  39980. Connection.prototype.handlesActivityChecks = function () {
  39981. return this.transport.handlesActivityChecks();
  39982. };
  39983. Connection.prototype.send = function (data) {
  39984. return this.transport.send(data);
  39985. };
  39986. Connection.prototype.send_event = function (name, data, channel) {
  39987. var event = { event: name, data: data };
  39988. if (channel) {
  39989. event.channel = channel;
  39990. }
  39991. logger.debug('Event sent', event);
  39992. return this.send(protocol_protocol.encodeMessage(event));
  39993. };
  39994. Connection.prototype.ping = function () {
  39995. if (this.transport.supportsPing()) {
  39996. this.transport.ping();
  39997. }
  39998. else {
  39999. this.send_event('pusher:ping', {});
  40000. }
  40001. };
  40002. Connection.prototype.close = function () {
  40003. this.transport.close();
  40004. };
  40005. Connection.prototype.bindListeners = function () {
  40006. var _this = this;
  40007. var listeners = {
  40008. message: function (messageEvent) {
  40009. var pusherEvent;
  40010. try {
  40011. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40012. }
  40013. catch (e) {
  40014. _this.emit('error', {
  40015. type: 'MessageParseError',
  40016. error: e,
  40017. data: messageEvent.data
  40018. });
  40019. }
  40020. if (pusherEvent !== undefined) {
  40021. logger.debug('Event recd', pusherEvent);
  40022. switch (pusherEvent.event) {
  40023. case 'pusher:error':
  40024. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40025. break;
  40026. case 'pusher:ping':
  40027. _this.emit("ping");
  40028. break;
  40029. case 'pusher:pong':
  40030. _this.emit("pong");
  40031. break;
  40032. }
  40033. _this.emit('message', pusherEvent);
  40034. }
  40035. },
  40036. activity: function () {
  40037. _this.emit("activity");
  40038. },
  40039. error: function (error) {
  40040. _this.emit("error", { type: "WebSocketError", error: error });
  40041. },
  40042. closed: function (closeEvent) {
  40043. unbindListeners();
  40044. if (closeEvent && closeEvent.code) {
  40045. _this.handleCloseEvent(closeEvent);
  40046. }
  40047. _this.transport = null;
  40048. _this.emit("closed");
  40049. }
  40050. };
  40051. var unbindListeners = function () {
  40052. objectApply(listeners, function (listener, event) {
  40053. _this.transport.unbind(event, listener);
  40054. });
  40055. };
  40056. objectApply(listeners, function (listener, event) {
  40057. _this.transport.bind(event, listener);
  40058. });
  40059. };
  40060. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40061. var action = protocol_protocol.getCloseAction(closeEvent);
  40062. var error = protocol_protocol.getCloseError(closeEvent);
  40063. if (error) {
  40064. this.emit('error', error);
  40065. }
  40066. if (action) {
  40067. this.emit(action, { action: action, error: error });
  40068. }
  40069. };
  40070. return Connection;
  40071. }(dispatcher));
  40072. /* harmony default export */ var connection_connection = (connection_Connection);
  40073. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40074. var handshake_Handshake = (function () {
  40075. function Handshake(transport, callback) {
  40076. this.transport = transport;
  40077. this.callback = callback;
  40078. this.bindListeners();
  40079. }
  40080. Handshake.prototype.close = function () {
  40081. this.unbindListeners();
  40082. this.transport.close();
  40083. };
  40084. Handshake.prototype.bindListeners = function () {
  40085. var _this = this;
  40086. this.onMessage = function (m) {
  40087. _this.unbindListeners();
  40088. var result;
  40089. try {
  40090. result = protocol_protocol.processHandshake(m);
  40091. }
  40092. catch (e) {
  40093. _this.finish("error", { error: e });
  40094. _this.transport.close();
  40095. return;
  40096. }
  40097. if (result.action === "connected") {
  40098. _this.finish("connected", {
  40099. connection: new connection_connection(result.id, _this.transport),
  40100. activityTimeout: result.activityTimeout
  40101. });
  40102. }
  40103. else {
  40104. _this.finish(result.action, { error: result.error });
  40105. _this.transport.close();
  40106. }
  40107. };
  40108. this.onClosed = function (closeEvent) {
  40109. _this.unbindListeners();
  40110. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40111. var error = protocol_protocol.getCloseError(closeEvent);
  40112. _this.finish(action, { error: error });
  40113. };
  40114. this.transport.bind("message", this.onMessage);
  40115. this.transport.bind("closed", this.onClosed);
  40116. };
  40117. Handshake.prototype.unbindListeners = function () {
  40118. this.transport.unbind("message", this.onMessage);
  40119. this.transport.unbind("closed", this.onClosed);
  40120. };
  40121. Handshake.prototype.finish = function (action, params) {
  40122. this.callback(extend({ transport: this.transport, action: action }, params));
  40123. };
  40124. return Handshake;
  40125. }());
  40126. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40127. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40128. var pusher_authorizer_PusherAuthorizer = (function () {
  40129. function PusherAuthorizer(channel, options) {
  40130. this.channel = channel;
  40131. var authTransport = options.authTransport;
  40132. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40133. throw "'" + authTransport + "' is not a recognized auth transport";
  40134. }
  40135. this.type = authTransport;
  40136. this.options = options;
  40137. this.authOptions = (options || {}).auth || {};
  40138. }
  40139. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40140. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40141. '&channel_name=' + encodeURIComponent(this.channel.name);
  40142. for (var i in this.authOptions.params) {
  40143. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40144. }
  40145. return query;
  40146. };
  40147. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40148. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40149. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40150. };
  40151. return PusherAuthorizer;
  40152. }());
  40153. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40154. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40155. var timeline_sender_TimelineSender = (function () {
  40156. function TimelineSender(timeline, options) {
  40157. this.timeline = timeline;
  40158. this.options = options || {};
  40159. }
  40160. TimelineSender.prototype.send = function (useTLS, callback) {
  40161. if (this.timeline.isEmpty()) {
  40162. return;
  40163. }
  40164. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40165. };
  40166. return TimelineSender;
  40167. }());
  40168. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40169. // CONCATENATED MODULE: ./src/core/errors.ts
  40170. var errors_extends = (undefined && undefined.__extends) || (function () {
  40171. var extendStatics = function (d, b) {
  40172. extendStatics = Object.setPrototypeOf ||
  40173. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40174. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40175. return extendStatics(d, b);
  40176. };
  40177. return function (d, b) {
  40178. extendStatics(d, b);
  40179. function __() { this.constructor = d; }
  40180. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40181. };
  40182. })();
  40183. var BadEventName = (function (_super) {
  40184. errors_extends(BadEventName, _super);
  40185. function BadEventName(msg) {
  40186. var _newTarget = this.constructor;
  40187. var _this = _super.call(this, msg) || this;
  40188. Object.setPrototypeOf(_this, _newTarget.prototype);
  40189. return _this;
  40190. }
  40191. return BadEventName;
  40192. }(Error));
  40193. var RequestTimedOut = (function (_super) {
  40194. errors_extends(RequestTimedOut, _super);
  40195. function RequestTimedOut(msg) {
  40196. var _newTarget = this.constructor;
  40197. var _this = _super.call(this, msg) || this;
  40198. Object.setPrototypeOf(_this, _newTarget.prototype);
  40199. return _this;
  40200. }
  40201. return RequestTimedOut;
  40202. }(Error));
  40203. var TransportPriorityTooLow = (function (_super) {
  40204. errors_extends(TransportPriorityTooLow, _super);
  40205. function TransportPriorityTooLow(msg) {
  40206. var _newTarget = this.constructor;
  40207. var _this = _super.call(this, msg) || this;
  40208. Object.setPrototypeOf(_this, _newTarget.prototype);
  40209. return _this;
  40210. }
  40211. return TransportPriorityTooLow;
  40212. }(Error));
  40213. var TransportClosed = (function (_super) {
  40214. errors_extends(TransportClosed, _super);
  40215. function TransportClosed(msg) {
  40216. var _newTarget = this.constructor;
  40217. var _this = _super.call(this, msg) || this;
  40218. Object.setPrototypeOf(_this, _newTarget.prototype);
  40219. return _this;
  40220. }
  40221. return TransportClosed;
  40222. }(Error));
  40223. var UnsupportedFeature = (function (_super) {
  40224. errors_extends(UnsupportedFeature, _super);
  40225. function UnsupportedFeature(msg) {
  40226. var _newTarget = this.constructor;
  40227. var _this = _super.call(this, msg) || this;
  40228. Object.setPrototypeOf(_this, _newTarget.prototype);
  40229. return _this;
  40230. }
  40231. return UnsupportedFeature;
  40232. }(Error));
  40233. var UnsupportedTransport = (function (_super) {
  40234. errors_extends(UnsupportedTransport, _super);
  40235. function UnsupportedTransport(msg) {
  40236. var _newTarget = this.constructor;
  40237. var _this = _super.call(this, msg) || this;
  40238. Object.setPrototypeOf(_this, _newTarget.prototype);
  40239. return _this;
  40240. }
  40241. return UnsupportedTransport;
  40242. }(Error));
  40243. var UnsupportedStrategy = (function (_super) {
  40244. errors_extends(UnsupportedStrategy, _super);
  40245. function UnsupportedStrategy(msg) {
  40246. var _newTarget = this.constructor;
  40247. var _this = _super.call(this, msg) || this;
  40248. Object.setPrototypeOf(_this, _newTarget.prototype);
  40249. return _this;
  40250. }
  40251. return UnsupportedStrategy;
  40252. }(Error));
  40253. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40254. var channel_extends = (undefined && undefined.__extends) || (function () {
  40255. var extendStatics = function (d, b) {
  40256. extendStatics = Object.setPrototypeOf ||
  40257. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40258. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40259. return extendStatics(d, b);
  40260. };
  40261. return function (d, b) {
  40262. extendStatics(d, b);
  40263. function __() { this.constructor = d; }
  40264. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40265. };
  40266. })();
  40267. var channel_Channel = (function (_super) {
  40268. channel_extends(Channel, _super);
  40269. function Channel(name, pusher) {
  40270. var _this = _super.call(this, function (event, data) {
  40271. logger.debug('No callbacks on ' + name + ' for ' + event);
  40272. }) || this;
  40273. _this.name = name;
  40274. _this.pusher = pusher;
  40275. _this.subscribed = false;
  40276. _this.subscriptionPending = false;
  40277. _this.subscriptionCancelled = false;
  40278. return _this;
  40279. }
  40280. Channel.prototype.authorize = function (socketId, callback) {
  40281. return callback(false, {});
  40282. };
  40283. Channel.prototype.trigger = function (event, data) {
  40284. if (event.indexOf("client-") !== 0) {
  40285. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40286. }
  40287. if (!this.subscribed) {
  40288. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40289. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40290. }
  40291. return this.pusher.send_event(event, data, this.name);
  40292. };
  40293. Channel.prototype.disconnect = function () {
  40294. this.subscribed = false;
  40295. this.subscriptionPending = false;
  40296. };
  40297. Channel.prototype.handleEvent = function (event) {
  40298. var eventName = event.event;
  40299. var data = event.data;
  40300. if (eventName === "pusher_internal:subscription_succeeded") {
  40301. this.handleSubscriptionSucceededEvent(event);
  40302. }
  40303. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40304. var metadata = {};
  40305. this.emit(eventName, data, metadata);
  40306. }
  40307. };
  40308. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40309. this.subscriptionPending = false;
  40310. this.subscribed = true;
  40311. if (this.subscriptionCancelled) {
  40312. this.pusher.unsubscribe(this.name);
  40313. }
  40314. else {
  40315. this.emit("pusher:subscription_succeeded", event.data);
  40316. }
  40317. };
  40318. Channel.prototype.subscribe = function () {
  40319. var _this = this;
  40320. if (this.subscribed) {
  40321. return;
  40322. }
  40323. this.subscriptionPending = true;
  40324. this.subscriptionCancelled = false;
  40325. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40326. if (error) {
  40327. logger.error(data);
  40328. _this.emit('pusher:subscription_error', data);
  40329. }
  40330. else {
  40331. _this.pusher.send_event('pusher:subscribe', {
  40332. auth: data.auth,
  40333. channel_data: data.channel_data,
  40334. channel: _this.name
  40335. });
  40336. }
  40337. });
  40338. };
  40339. Channel.prototype.unsubscribe = function () {
  40340. this.subscribed = false;
  40341. this.pusher.send_event('pusher:unsubscribe', {
  40342. channel: this.name
  40343. });
  40344. };
  40345. Channel.prototype.cancelSubscription = function () {
  40346. this.subscriptionCancelled = true;
  40347. };
  40348. Channel.prototype.reinstateSubscription = function () {
  40349. this.subscriptionCancelled = false;
  40350. };
  40351. return Channel;
  40352. }(dispatcher));
  40353. /* harmony default export */ var channels_channel = (channel_Channel);
  40354. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40355. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40356. var extendStatics = function (d, b) {
  40357. extendStatics = Object.setPrototypeOf ||
  40358. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40359. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40360. return extendStatics(d, b);
  40361. };
  40362. return function (d, b) {
  40363. extendStatics(d, b);
  40364. function __() { this.constructor = d; }
  40365. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40366. };
  40367. })();
  40368. var private_channel_PrivateChannel = (function (_super) {
  40369. private_channel_extends(PrivateChannel, _super);
  40370. function PrivateChannel() {
  40371. return _super !== null && _super.apply(this, arguments) || this;
  40372. }
  40373. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40374. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40375. return authorizer.authorize(socketId, callback);
  40376. };
  40377. return PrivateChannel;
  40378. }(channels_channel));
  40379. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40380. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40381. var members_Members = (function () {
  40382. function Members() {
  40383. this.reset();
  40384. }
  40385. Members.prototype.get = function (id) {
  40386. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40387. return {
  40388. id: id,
  40389. info: this.members[id]
  40390. };
  40391. }
  40392. else {
  40393. return null;
  40394. }
  40395. };
  40396. Members.prototype.each = function (callback) {
  40397. var _this = this;
  40398. objectApply(this.members, function (member, id) {
  40399. callback(_this.get(id));
  40400. });
  40401. };
  40402. Members.prototype.setMyID = function (id) {
  40403. this.myID = id;
  40404. };
  40405. Members.prototype.onSubscription = function (subscriptionData) {
  40406. this.members = subscriptionData.presence.hash;
  40407. this.count = subscriptionData.presence.count;
  40408. this.me = this.get(this.myID);
  40409. };
  40410. Members.prototype.addMember = function (memberData) {
  40411. if (this.get(memberData.user_id) === null) {
  40412. this.count++;
  40413. }
  40414. this.members[memberData.user_id] = memberData.user_info;
  40415. return this.get(memberData.user_id);
  40416. };
  40417. Members.prototype.removeMember = function (memberData) {
  40418. var member = this.get(memberData.user_id);
  40419. if (member) {
  40420. delete this.members[memberData.user_id];
  40421. this.count--;
  40422. }
  40423. return member;
  40424. };
  40425. Members.prototype.reset = function () {
  40426. this.members = {};
  40427. this.count = 0;
  40428. this.myID = null;
  40429. this.me = null;
  40430. };
  40431. return Members;
  40432. }());
  40433. /* harmony default export */ var members = (members_Members);
  40434. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40435. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40436. var extendStatics = function (d, b) {
  40437. extendStatics = Object.setPrototypeOf ||
  40438. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40439. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40440. return extendStatics(d, b);
  40441. };
  40442. return function (d, b) {
  40443. extendStatics(d, b);
  40444. function __() { this.constructor = d; }
  40445. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40446. };
  40447. })();
  40448. var presence_channel_PresenceChannel = (function (_super) {
  40449. presence_channel_extends(PresenceChannel, _super);
  40450. function PresenceChannel(name, pusher) {
  40451. var _this = _super.call(this, name, pusher) || this;
  40452. _this.members = new members();
  40453. return _this;
  40454. }
  40455. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40456. var _this = this;
  40457. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40458. if (!error) {
  40459. if (authData.channel_data === undefined) {
  40460. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40461. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40462. ("expected 'channel_data' field. " + suffix));
  40463. callback("Invalid auth response");
  40464. return;
  40465. }
  40466. var channelData = JSON.parse(authData.channel_data);
  40467. _this.members.setMyID(channelData.user_id);
  40468. }
  40469. callback(error, authData);
  40470. });
  40471. };
  40472. PresenceChannel.prototype.handleEvent = function (event) {
  40473. var eventName = event.event;
  40474. if (eventName.indexOf("pusher_internal:") === 0) {
  40475. this.handleInternalEvent(event);
  40476. }
  40477. else {
  40478. var data = event.data;
  40479. var metadata = {};
  40480. if (event.user_id) {
  40481. metadata.user_id = event.user_id;
  40482. }
  40483. this.emit(eventName, data, metadata);
  40484. }
  40485. };
  40486. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40487. var eventName = event.event;
  40488. var data = event.data;
  40489. switch (eventName) {
  40490. case "pusher_internal:subscription_succeeded":
  40491. this.handleSubscriptionSucceededEvent(event);
  40492. break;
  40493. case "pusher_internal:member_added":
  40494. var addedMember = this.members.addMember(data);
  40495. this.emit('pusher:member_added', addedMember);
  40496. break;
  40497. case "pusher_internal:member_removed":
  40498. var removedMember = this.members.removeMember(data);
  40499. if (removedMember) {
  40500. this.emit('pusher:member_removed', removedMember);
  40501. }
  40502. break;
  40503. }
  40504. };
  40505. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40506. this.subscriptionPending = false;
  40507. this.subscribed = true;
  40508. if (this.subscriptionCancelled) {
  40509. this.pusher.unsubscribe(this.name);
  40510. }
  40511. else {
  40512. this.members.onSubscription(event.data);
  40513. this.emit("pusher:subscription_succeeded", this.members);
  40514. }
  40515. };
  40516. PresenceChannel.prototype.disconnect = function () {
  40517. this.members.reset();
  40518. _super.prototype.disconnect.call(this);
  40519. };
  40520. return PresenceChannel;
  40521. }(private_channel));
  40522. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40523. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40524. var nacl_fast = __webpack_require__(0);
  40525. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40526. var nacl_util = __webpack_require__(1);
  40527. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40528. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40529. var extendStatics = function (d, b) {
  40530. extendStatics = Object.setPrototypeOf ||
  40531. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40532. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40533. return extendStatics(d, b);
  40534. };
  40535. return function (d, b) {
  40536. extendStatics(d, b);
  40537. function __() { this.constructor = d; }
  40538. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40539. };
  40540. })();
  40541. var encrypted_channel_EncryptedChannel = (function (_super) {
  40542. encrypted_channel_extends(EncryptedChannel, _super);
  40543. function EncryptedChannel() {
  40544. var _this = _super !== null && _super.apply(this, arguments) || this;
  40545. _this.key = null;
  40546. return _this;
  40547. }
  40548. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40549. var _this = this;
  40550. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40551. if (error) {
  40552. callback(true, authData);
  40553. return;
  40554. }
  40555. var sharedSecret = authData["shared_secret"];
  40556. if (!sharedSecret) {
  40557. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40558. callback(true, errorMsg);
  40559. return;
  40560. }
  40561. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40562. delete authData["shared_secret"];
  40563. callback(false, authData);
  40564. });
  40565. };
  40566. EncryptedChannel.prototype.trigger = function (event, data) {
  40567. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40568. };
  40569. EncryptedChannel.prototype.handleEvent = function (event) {
  40570. var eventName = event.event;
  40571. var data = event.data;
  40572. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40573. _super.prototype.handleEvent.call(this, event);
  40574. return;
  40575. }
  40576. this.handleEncryptedEvent(eventName, data);
  40577. };
  40578. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40579. var _this = this;
  40580. if (!this.key) {
  40581. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40582. return;
  40583. }
  40584. if (!data.ciphertext || !data.nonce) {
  40585. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40586. return;
  40587. }
  40588. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40589. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40590. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40591. return;
  40592. }
  40593. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40594. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40595. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40596. return;
  40597. }
  40598. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40599. if (bytes === null) {
  40600. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40601. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40602. if (error) {
  40603. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40604. return;
  40605. }
  40606. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40607. if (bytes === null) {
  40608. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40609. return;
  40610. }
  40611. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40612. return;
  40613. });
  40614. return;
  40615. }
  40616. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40617. };
  40618. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40619. try {
  40620. this.emit(eventName, JSON.parse(data));
  40621. }
  40622. catch (e) {
  40623. this.emit(eventName, data);
  40624. }
  40625. return this;
  40626. };
  40627. return EncryptedChannel;
  40628. }(private_channel));
  40629. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40630. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40631. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40632. var extendStatics = function (d, b) {
  40633. extendStatics = Object.setPrototypeOf ||
  40634. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40635. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40636. return extendStatics(d, b);
  40637. };
  40638. return function (d, b) {
  40639. extendStatics(d, b);
  40640. function __() { this.constructor = d; }
  40641. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40642. };
  40643. })();
  40644. var connection_manager_ConnectionManager = (function (_super) {
  40645. connection_manager_extends(ConnectionManager, _super);
  40646. function ConnectionManager(key, options) {
  40647. var _this = _super.call(this) || this;
  40648. _this.key = key;
  40649. _this.options = options || {};
  40650. _this.state = "initialized";
  40651. _this.connection = null;
  40652. _this.usingTLS = !!options.useTLS;
  40653. _this.timeline = _this.options.timeline;
  40654. _this.errorCallbacks = _this.buildErrorCallbacks();
  40655. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40656. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40657. var Network = runtime.getNetwork();
  40658. Network.bind("online", function () {
  40659. _this.timeline.info({ netinfo: "online" });
  40660. if (_this.state === "connecting" || _this.state === "unavailable") {
  40661. _this.retryIn(0);
  40662. }
  40663. });
  40664. Network.bind("offline", function () {
  40665. _this.timeline.info({ netinfo: "offline" });
  40666. if (_this.connection) {
  40667. _this.sendActivityCheck();
  40668. }
  40669. });
  40670. _this.updateStrategy();
  40671. return _this;
  40672. }
  40673. ConnectionManager.prototype.connect = function () {
  40674. if (this.connection || this.runner) {
  40675. return;
  40676. }
  40677. if (!this.strategy.isSupported()) {
  40678. this.updateState("failed");
  40679. return;
  40680. }
  40681. this.updateState("connecting");
  40682. this.startConnecting();
  40683. this.setUnavailableTimer();
  40684. };
  40685. ;
  40686. ConnectionManager.prototype.send = function (data) {
  40687. if (this.connection) {
  40688. return this.connection.send(data);
  40689. }
  40690. else {
  40691. return false;
  40692. }
  40693. };
  40694. ;
  40695. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40696. if (this.connection) {
  40697. return this.connection.send_event(name, data, channel);
  40698. }
  40699. else {
  40700. return false;
  40701. }
  40702. };
  40703. ;
  40704. ConnectionManager.prototype.disconnect = function () {
  40705. this.disconnectInternally();
  40706. this.updateState("disconnected");
  40707. };
  40708. ;
  40709. ConnectionManager.prototype.isUsingTLS = function () {
  40710. return this.usingTLS;
  40711. };
  40712. ;
  40713. ConnectionManager.prototype.startConnecting = function () {
  40714. var _this = this;
  40715. var callback = function (error, handshake) {
  40716. if (error) {
  40717. _this.runner = _this.strategy.connect(0, callback);
  40718. }
  40719. else {
  40720. if (handshake.action === "error") {
  40721. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40722. _this.timeline.error({ handshakeError: handshake.error });
  40723. }
  40724. else {
  40725. _this.abortConnecting();
  40726. _this.handshakeCallbacks[handshake.action](handshake);
  40727. }
  40728. }
  40729. };
  40730. this.runner = this.strategy.connect(0, callback);
  40731. };
  40732. ;
  40733. ConnectionManager.prototype.abortConnecting = function () {
  40734. if (this.runner) {
  40735. this.runner.abort();
  40736. this.runner = null;
  40737. }
  40738. };
  40739. ;
  40740. ConnectionManager.prototype.disconnectInternally = function () {
  40741. this.abortConnecting();
  40742. this.clearRetryTimer();
  40743. this.clearUnavailableTimer();
  40744. if (this.connection) {
  40745. var connection = this.abandonConnection();
  40746. connection.close();
  40747. }
  40748. };
  40749. ;
  40750. ConnectionManager.prototype.updateStrategy = function () {
  40751. this.strategy = this.options.getStrategy({
  40752. key: this.key,
  40753. timeline: this.timeline,
  40754. useTLS: this.usingTLS
  40755. });
  40756. };
  40757. ;
  40758. ConnectionManager.prototype.retryIn = function (delay) {
  40759. var _this = this;
  40760. this.timeline.info({ action: "retry", delay: delay });
  40761. if (delay > 0) {
  40762. this.emit("connecting_in", Math.round(delay / 1000));
  40763. }
  40764. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40765. _this.disconnectInternally();
  40766. _this.connect();
  40767. });
  40768. };
  40769. ;
  40770. ConnectionManager.prototype.clearRetryTimer = function () {
  40771. if (this.retryTimer) {
  40772. this.retryTimer.ensureAborted();
  40773. this.retryTimer = null;
  40774. }
  40775. };
  40776. ;
  40777. ConnectionManager.prototype.setUnavailableTimer = function () {
  40778. var _this = this;
  40779. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40780. _this.updateState("unavailable");
  40781. });
  40782. };
  40783. ;
  40784. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40785. if (this.unavailableTimer) {
  40786. this.unavailableTimer.ensureAborted();
  40787. }
  40788. };
  40789. ;
  40790. ConnectionManager.prototype.sendActivityCheck = function () {
  40791. var _this = this;
  40792. this.stopActivityCheck();
  40793. this.connection.ping();
  40794. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40795. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40796. _this.retryIn(0);
  40797. });
  40798. };
  40799. ;
  40800. ConnectionManager.prototype.resetActivityCheck = function () {
  40801. var _this = this;
  40802. this.stopActivityCheck();
  40803. if (this.connection && !this.connection.handlesActivityChecks()) {
  40804. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40805. _this.sendActivityCheck();
  40806. });
  40807. }
  40808. };
  40809. ;
  40810. ConnectionManager.prototype.stopActivityCheck = function () {
  40811. if (this.activityTimer) {
  40812. this.activityTimer.ensureAborted();
  40813. }
  40814. };
  40815. ;
  40816. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40817. var _this = this;
  40818. return extend({}, errorCallbacks, {
  40819. message: function (message) {
  40820. _this.resetActivityCheck();
  40821. _this.emit('message', message);
  40822. },
  40823. ping: function () {
  40824. _this.send_event('pusher:pong', {});
  40825. },
  40826. activity: function () {
  40827. _this.resetActivityCheck();
  40828. },
  40829. error: function (error) {
  40830. _this.emit("error", { type: "WebSocketError", error: error });
  40831. },
  40832. closed: function () {
  40833. _this.abandonConnection();
  40834. if (_this.shouldRetry()) {
  40835. _this.retryIn(1000);
  40836. }
  40837. }
  40838. });
  40839. };
  40840. ;
  40841. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40842. var _this = this;
  40843. return extend({}, errorCallbacks, {
  40844. connected: function (handshake) {
  40845. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40846. _this.clearUnavailableTimer();
  40847. _this.setConnection(handshake.connection);
  40848. _this.socket_id = _this.connection.id;
  40849. _this.updateState("connected", { socket_id: _this.socket_id });
  40850. }
  40851. });
  40852. };
  40853. ;
  40854. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40855. var _this = this;
  40856. var withErrorEmitted = function (callback) {
  40857. return function (result) {
  40858. if (result.error) {
  40859. _this.emit("error", { type: "WebSocketError", error: result.error });
  40860. }
  40861. callback(result);
  40862. };
  40863. };
  40864. return {
  40865. tls_only: withErrorEmitted(function () {
  40866. _this.usingTLS = true;
  40867. _this.updateStrategy();
  40868. _this.retryIn(0);
  40869. }),
  40870. refused: withErrorEmitted(function () {
  40871. _this.disconnect();
  40872. }),
  40873. backoff: withErrorEmitted(function () {
  40874. _this.retryIn(1000);
  40875. }),
  40876. retry: withErrorEmitted(function () {
  40877. _this.retryIn(0);
  40878. })
  40879. };
  40880. };
  40881. ;
  40882. ConnectionManager.prototype.setConnection = function (connection) {
  40883. this.connection = connection;
  40884. for (var event in this.connectionCallbacks) {
  40885. this.connection.bind(event, this.connectionCallbacks[event]);
  40886. }
  40887. this.resetActivityCheck();
  40888. };
  40889. ;
  40890. ConnectionManager.prototype.abandonConnection = function () {
  40891. if (!this.connection) {
  40892. return;
  40893. }
  40894. this.stopActivityCheck();
  40895. for (var event in this.connectionCallbacks) {
  40896. this.connection.unbind(event, this.connectionCallbacks[event]);
  40897. }
  40898. var connection = this.connection;
  40899. this.connection = null;
  40900. return connection;
  40901. };
  40902. ConnectionManager.prototype.updateState = function (newState, data) {
  40903. var previousState = this.state;
  40904. this.state = newState;
  40905. if (previousState !== newState) {
  40906. var newStateDescription = newState;
  40907. if (newStateDescription === "connected") {
  40908. newStateDescription += " with new socket ID " + data.socket_id;
  40909. }
  40910. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  40911. this.timeline.info({ state: newState, params: data });
  40912. this.emit('state_change', { previous: previousState, current: newState });
  40913. this.emit(newState, data);
  40914. }
  40915. };
  40916. ConnectionManager.prototype.shouldRetry = function () {
  40917. return this.state === "connecting" || this.state === "connected";
  40918. };
  40919. return ConnectionManager;
  40920. }(dispatcher));
  40921. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  40922. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  40923. var channels_Channels = (function () {
  40924. function Channels() {
  40925. this.channels = {};
  40926. }
  40927. Channels.prototype.add = function (name, pusher) {
  40928. if (!this.channels[name]) {
  40929. this.channels[name] = createChannel(name, pusher);
  40930. }
  40931. return this.channels[name];
  40932. };
  40933. Channels.prototype.all = function () {
  40934. return values(this.channels);
  40935. };
  40936. Channels.prototype.find = function (name) {
  40937. return this.channels[name];
  40938. };
  40939. Channels.prototype.remove = function (name) {
  40940. var channel = this.channels[name];
  40941. delete this.channels[name];
  40942. return channel;
  40943. };
  40944. Channels.prototype.disconnect = function () {
  40945. objectApply(this.channels, function (channel) {
  40946. channel.disconnect();
  40947. });
  40948. };
  40949. return Channels;
  40950. }());
  40951. /* harmony default export */ var channels = (channels_Channels);
  40952. function createChannel(name, pusher) {
  40953. if (name.indexOf('private-encrypted-') === 0) {
  40954. if (false) { var errorMsg; }
  40955. return factory.createEncryptedChannel(name, pusher);
  40956. }
  40957. else if (name.indexOf('private-') === 0) {
  40958. return factory.createPrivateChannel(name, pusher);
  40959. }
  40960. else if (name.indexOf('presence-') === 0) {
  40961. return factory.createPresenceChannel(name, pusher);
  40962. }
  40963. else {
  40964. return factory.createChannel(name, pusher);
  40965. }
  40966. }
  40967. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  40968. var Factory = {
  40969. createChannels: function () {
  40970. return new channels();
  40971. },
  40972. createConnectionManager: function (key, options) {
  40973. return new connection_manager(key, options);
  40974. },
  40975. createChannel: function (name, pusher) {
  40976. return new channels_channel(name, pusher);
  40977. },
  40978. createPrivateChannel: function (name, pusher) {
  40979. return new private_channel(name, pusher);
  40980. },
  40981. createPresenceChannel: function (name, pusher) {
  40982. return new presence_channel(name, pusher);
  40983. },
  40984. createEncryptedChannel: function (name, pusher) {
  40985. return new encrypted_channel(name, pusher);
  40986. },
  40987. createTimelineSender: function (timeline, options) {
  40988. return new timeline_sender(timeline, options);
  40989. },
  40990. createAuthorizer: function (channel, options) {
  40991. if (options.authorizer) {
  40992. return options.authorizer(channel, options);
  40993. }
  40994. return new pusher_authorizer(channel, options);
  40995. },
  40996. createHandshake: function (transport, callback) {
  40997. return new connection_handshake(transport, callback);
  40998. },
  40999. createAssistantToTheTransportManager: function (manager, transport, options) {
  41000. return new assistant_to_the_transport_manager(manager, transport, options);
  41001. }
  41002. };
  41003. /* harmony default export */ var factory = (Factory);
  41004. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41005. var transport_manager_TransportManager = (function () {
  41006. function TransportManager(options) {
  41007. this.options = options || {};
  41008. this.livesLeft = this.options.lives || Infinity;
  41009. }
  41010. TransportManager.prototype.getAssistant = function (transport) {
  41011. return factory.createAssistantToTheTransportManager(this, transport, {
  41012. minPingDelay: this.options.minPingDelay,
  41013. maxPingDelay: this.options.maxPingDelay
  41014. });
  41015. };
  41016. TransportManager.prototype.isAlive = function () {
  41017. return this.livesLeft > 0;
  41018. };
  41019. TransportManager.prototype.reportDeath = function () {
  41020. this.livesLeft -= 1;
  41021. };
  41022. return TransportManager;
  41023. }());
  41024. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41025. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41026. var sequential_strategy_SequentialStrategy = (function () {
  41027. function SequentialStrategy(strategies, options) {
  41028. this.strategies = strategies;
  41029. this.loop = Boolean(options.loop);
  41030. this.failFast = Boolean(options.failFast);
  41031. this.timeout = options.timeout;
  41032. this.timeoutLimit = options.timeoutLimit;
  41033. }
  41034. SequentialStrategy.prototype.isSupported = function () {
  41035. return any(this.strategies, util.method("isSupported"));
  41036. };
  41037. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41038. var _this = this;
  41039. var strategies = this.strategies;
  41040. var current = 0;
  41041. var timeout = this.timeout;
  41042. var runner = null;
  41043. var tryNextStrategy = function (error, handshake) {
  41044. if (handshake) {
  41045. callback(null, handshake);
  41046. }
  41047. else {
  41048. current = current + 1;
  41049. if (_this.loop) {
  41050. current = current % strategies.length;
  41051. }
  41052. if (current < strategies.length) {
  41053. if (timeout) {
  41054. timeout = timeout * 2;
  41055. if (_this.timeoutLimit) {
  41056. timeout = Math.min(timeout, _this.timeoutLimit);
  41057. }
  41058. }
  41059. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41060. }
  41061. else {
  41062. callback(true);
  41063. }
  41064. }
  41065. };
  41066. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41067. return {
  41068. abort: function () {
  41069. runner.abort();
  41070. },
  41071. forceMinPriority: function (p) {
  41072. minPriority = p;
  41073. if (runner) {
  41074. runner.forceMinPriority(p);
  41075. }
  41076. }
  41077. };
  41078. };
  41079. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41080. var timer = null;
  41081. var runner = null;
  41082. if (options.timeout > 0) {
  41083. timer = new OneOffTimer(options.timeout, function () {
  41084. runner.abort();
  41085. callback(true);
  41086. });
  41087. }
  41088. runner = strategy.connect(minPriority, function (error, handshake) {
  41089. if (error && timer && timer.isRunning() && !options.failFast) {
  41090. return;
  41091. }
  41092. if (timer) {
  41093. timer.ensureAborted();
  41094. }
  41095. callback(error, handshake);
  41096. });
  41097. return {
  41098. abort: function () {
  41099. if (timer) {
  41100. timer.ensureAborted();
  41101. }
  41102. runner.abort();
  41103. },
  41104. forceMinPriority: function (p) {
  41105. runner.forceMinPriority(p);
  41106. }
  41107. };
  41108. };
  41109. return SequentialStrategy;
  41110. }());
  41111. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41112. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41113. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41114. function BestConnectedEverStrategy(strategies) {
  41115. this.strategies = strategies;
  41116. }
  41117. BestConnectedEverStrategy.prototype.isSupported = function () {
  41118. return any(this.strategies, util.method("isSupported"));
  41119. };
  41120. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41121. return connect(this.strategies, minPriority, function (i, runners) {
  41122. return function (error, handshake) {
  41123. runners[i].error = error;
  41124. if (error) {
  41125. if (allRunnersFailed(runners)) {
  41126. callback(true);
  41127. }
  41128. return;
  41129. }
  41130. apply(runners, function (runner) {
  41131. runner.forceMinPriority(handshake.transport.priority);
  41132. });
  41133. callback(null, handshake);
  41134. };
  41135. });
  41136. };
  41137. return BestConnectedEverStrategy;
  41138. }());
  41139. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41140. function connect(strategies, minPriority, callbackBuilder) {
  41141. var runners = map(strategies, function (strategy, i, _, rs) {
  41142. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41143. });
  41144. return {
  41145. abort: function () {
  41146. apply(runners, abortRunner);
  41147. },
  41148. forceMinPriority: function (p) {
  41149. apply(runners, function (runner) {
  41150. runner.forceMinPriority(p);
  41151. });
  41152. }
  41153. };
  41154. }
  41155. function allRunnersFailed(runners) {
  41156. return collections_all(runners, function (runner) {
  41157. return Boolean(runner.error);
  41158. });
  41159. }
  41160. function abortRunner(runner) {
  41161. if (!runner.error && !runner.aborted) {
  41162. runner.abort();
  41163. runner.aborted = true;
  41164. }
  41165. }
  41166. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41167. var cached_strategy_CachedStrategy = (function () {
  41168. function CachedStrategy(strategy, transports, options) {
  41169. this.strategy = strategy;
  41170. this.transports = transports;
  41171. this.ttl = options.ttl || 1800 * 1000;
  41172. this.usingTLS = options.useTLS;
  41173. this.timeline = options.timeline;
  41174. }
  41175. CachedStrategy.prototype.isSupported = function () {
  41176. return this.strategy.isSupported();
  41177. };
  41178. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41179. var usingTLS = this.usingTLS;
  41180. var info = fetchTransportCache(usingTLS);
  41181. var strategies = [this.strategy];
  41182. if (info && info.timestamp + this.ttl >= util.now()) {
  41183. var transport = this.transports[info.transport];
  41184. if (transport) {
  41185. this.timeline.info({
  41186. cached: true,
  41187. transport: info.transport,
  41188. latency: info.latency
  41189. });
  41190. strategies.push(new sequential_strategy([transport], {
  41191. timeout: info.latency * 2 + 1000,
  41192. failFast: true
  41193. }));
  41194. }
  41195. }
  41196. var startTimestamp = util.now();
  41197. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41198. if (error) {
  41199. flushTransportCache(usingTLS);
  41200. if (strategies.length > 0) {
  41201. startTimestamp = util.now();
  41202. runner = strategies.pop().connect(minPriority, cb);
  41203. }
  41204. else {
  41205. callback(error);
  41206. }
  41207. }
  41208. else {
  41209. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41210. callback(null, handshake);
  41211. }
  41212. });
  41213. return {
  41214. abort: function () {
  41215. runner.abort();
  41216. },
  41217. forceMinPriority: function (p) {
  41218. minPriority = p;
  41219. if (runner) {
  41220. runner.forceMinPriority(p);
  41221. }
  41222. }
  41223. };
  41224. };
  41225. return CachedStrategy;
  41226. }());
  41227. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41228. function getTransportCacheKey(usingTLS) {
  41229. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41230. }
  41231. function fetchTransportCache(usingTLS) {
  41232. var storage = runtime.getLocalStorage();
  41233. if (storage) {
  41234. try {
  41235. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41236. if (serializedCache) {
  41237. return JSON.parse(serializedCache);
  41238. }
  41239. }
  41240. catch (e) {
  41241. flushTransportCache(usingTLS);
  41242. }
  41243. }
  41244. return null;
  41245. }
  41246. function storeTransportCache(usingTLS, transport, latency) {
  41247. var storage = runtime.getLocalStorage();
  41248. if (storage) {
  41249. try {
  41250. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41251. timestamp: util.now(),
  41252. transport: transport,
  41253. latency: latency
  41254. });
  41255. }
  41256. catch (e) {
  41257. }
  41258. }
  41259. }
  41260. function flushTransportCache(usingTLS) {
  41261. var storage = runtime.getLocalStorage();
  41262. if (storage) {
  41263. try {
  41264. delete storage[getTransportCacheKey(usingTLS)];
  41265. }
  41266. catch (e) {
  41267. }
  41268. }
  41269. }
  41270. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41271. var delayed_strategy_DelayedStrategy = (function () {
  41272. function DelayedStrategy(strategy, _a) {
  41273. var number = _a.delay;
  41274. this.strategy = strategy;
  41275. this.options = { delay: number };
  41276. }
  41277. DelayedStrategy.prototype.isSupported = function () {
  41278. return this.strategy.isSupported();
  41279. };
  41280. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41281. var strategy = this.strategy;
  41282. var runner;
  41283. var timer = new OneOffTimer(this.options.delay, function () {
  41284. runner = strategy.connect(minPriority, callback);
  41285. });
  41286. return {
  41287. abort: function () {
  41288. timer.ensureAborted();
  41289. if (runner) {
  41290. runner.abort();
  41291. }
  41292. },
  41293. forceMinPriority: function (p) {
  41294. minPriority = p;
  41295. if (runner) {
  41296. runner.forceMinPriority(p);
  41297. }
  41298. }
  41299. };
  41300. };
  41301. return DelayedStrategy;
  41302. }());
  41303. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41304. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41305. var IfStrategy = (function () {
  41306. function IfStrategy(test, trueBranch, falseBranch) {
  41307. this.test = test;
  41308. this.trueBranch = trueBranch;
  41309. this.falseBranch = falseBranch;
  41310. }
  41311. IfStrategy.prototype.isSupported = function () {
  41312. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41313. return branch.isSupported();
  41314. };
  41315. IfStrategy.prototype.connect = function (minPriority, callback) {
  41316. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41317. return branch.connect(minPriority, callback);
  41318. };
  41319. return IfStrategy;
  41320. }());
  41321. /* harmony default export */ var if_strategy = (IfStrategy);
  41322. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41323. var FirstConnectedStrategy = (function () {
  41324. function FirstConnectedStrategy(strategy) {
  41325. this.strategy = strategy;
  41326. }
  41327. FirstConnectedStrategy.prototype.isSupported = function () {
  41328. return this.strategy.isSupported();
  41329. };
  41330. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41331. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41332. if (handshake) {
  41333. runner.abort();
  41334. }
  41335. callback(error, handshake);
  41336. });
  41337. return runner;
  41338. };
  41339. return FirstConnectedStrategy;
  41340. }());
  41341. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41342. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41343. function testSupportsStrategy(strategy) {
  41344. return function () {
  41345. return strategy.isSupported();
  41346. };
  41347. }
  41348. var getDefaultStrategy = function (config, defineTransport) {
  41349. var definedTransports = {};
  41350. function defineTransportStrategy(name, type, priority, options, manager) {
  41351. var transport = defineTransport(config, name, type, priority, options, manager);
  41352. definedTransports[name] = transport;
  41353. return transport;
  41354. }
  41355. var ws_options = {
  41356. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41357. hostTLS: config.wsHost + ":" + config.wssPort,
  41358. httpPath: config.wsPath
  41359. };
  41360. var wss_options = extend({}, ws_options, {
  41361. useTLS: true
  41362. });
  41363. var sockjs_options = {
  41364. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41365. hostTLS: config.httpHost + ":" + config.httpsPort,
  41366. httpPath: config.httpPath
  41367. };
  41368. var timeouts = {
  41369. loop: true,
  41370. timeout: 15000,
  41371. timeoutLimit: 60000
  41372. };
  41373. var ws_manager = new transport_manager({
  41374. lives: 2,
  41375. minPingDelay: 10000,
  41376. maxPingDelay: config.activity_timeout
  41377. });
  41378. var streaming_manager = new transport_manager({
  41379. lives: 2,
  41380. minPingDelay: 10000,
  41381. maxPingDelay: config.activity_timeout
  41382. });
  41383. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41384. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41385. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41386. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41387. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41388. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41389. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41390. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41391. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41392. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41393. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41394. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41395. 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);
  41396. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41397. var wsStrategy;
  41398. if (config.useTLS) {
  41399. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41400. }
  41401. else {
  41402. wsStrategy = new best_connected_ever_strategy([
  41403. ws_loop,
  41404. new delayed_strategy(wss_loop, { delay: 2000 }),
  41405. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41406. ]);
  41407. }
  41408. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41409. ttl: 1800000,
  41410. timeline: config.timeline,
  41411. useTLS: config.useTLS
  41412. });
  41413. };
  41414. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41415. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41416. /* harmony default export */ var transport_connection_initializer = (function () {
  41417. var self = this;
  41418. self.timeline.info(self.buildTimelineMessage({
  41419. transport: self.name + (self.options.useTLS ? "s" : "")
  41420. }));
  41421. if (self.hooks.isInitialized()) {
  41422. self.changeState("initialized");
  41423. }
  41424. else if (self.hooks.file) {
  41425. self.changeState("initializing");
  41426. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41427. if (self.hooks.isInitialized()) {
  41428. self.changeState("initialized");
  41429. callback(true);
  41430. }
  41431. else {
  41432. if (error) {
  41433. self.onError(error);
  41434. }
  41435. self.onClose();
  41436. callback(false);
  41437. }
  41438. });
  41439. }
  41440. else {
  41441. self.onClose();
  41442. }
  41443. });
  41444. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41445. var http_xdomain_request_hooks = {
  41446. getRequest: function (socket) {
  41447. var xdr = new window.XDomainRequest();
  41448. xdr.ontimeout = function () {
  41449. socket.emit("error", new RequestTimedOut());
  41450. socket.close();
  41451. };
  41452. xdr.onerror = function (e) {
  41453. socket.emit("error", e);
  41454. socket.close();
  41455. };
  41456. xdr.onprogress = function () {
  41457. if (xdr.responseText && xdr.responseText.length > 0) {
  41458. socket.onChunk(200, xdr.responseText);
  41459. }
  41460. };
  41461. xdr.onload = function () {
  41462. if (xdr.responseText && xdr.responseText.length > 0) {
  41463. socket.onChunk(200, xdr.responseText);
  41464. }
  41465. socket.emit("finished", 200);
  41466. socket.close();
  41467. };
  41468. return xdr;
  41469. },
  41470. abortRequest: function (xdr) {
  41471. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41472. xdr.abort();
  41473. }
  41474. };
  41475. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41476. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41477. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41478. var extendStatics = function (d, b) {
  41479. extendStatics = Object.setPrototypeOf ||
  41480. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41481. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41482. return extendStatics(d, b);
  41483. };
  41484. return function (d, b) {
  41485. extendStatics(d, b);
  41486. function __() { this.constructor = d; }
  41487. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41488. };
  41489. })();
  41490. var MAX_BUFFER_LENGTH = 256 * 1024;
  41491. var http_request_HTTPRequest = (function (_super) {
  41492. http_request_extends(HTTPRequest, _super);
  41493. function HTTPRequest(hooks, method, url) {
  41494. var _this = _super.call(this) || this;
  41495. _this.hooks = hooks;
  41496. _this.method = method;
  41497. _this.url = url;
  41498. return _this;
  41499. }
  41500. HTTPRequest.prototype.start = function (payload) {
  41501. var _this = this;
  41502. this.position = 0;
  41503. this.xhr = this.hooks.getRequest(this);
  41504. this.unloader = function () {
  41505. _this.close();
  41506. };
  41507. runtime.addUnloadListener(this.unloader);
  41508. this.xhr.open(this.method, this.url, true);
  41509. if (this.xhr.setRequestHeader) {
  41510. this.xhr.setRequestHeader("Content-Type", "application/json");
  41511. }
  41512. this.xhr.send(payload);
  41513. };
  41514. HTTPRequest.prototype.close = function () {
  41515. if (this.unloader) {
  41516. runtime.removeUnloadListener(this.unloader);
  41517. this.unloader = null;
  41518. }
  41519. if (this.xhr) {
  41520. this.hooks.abortRequest(this.xhr);
  41521. this.xhr = null;
  41522. }
  41523. };
  41524. HTTPRequest.prototype.onChunk = function (status, data) {
  41525. while (true) {
  41526. var chunk = this.advanceBuffer(data);
  41527. if (chunk) {
  41528. this.emit("chunk", { status: status, data: chunk });
  41529. }
  41530. else {
  41531. break;
  41532. }
  41533. }
  41534. if (this.isBufferTooLong(data)) {
  41535. this.emit("buffer_too_long");
  41536. }
  41537. };
  41538. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41539. var unreadData = buffer.slice(this.position);
  41540. var endOfLinePosition = unreadData.indexOf("\n");
  41541. if (endOfLinePosition !== -1) {
  41542. this.position += endOfLinePosition + 1;
  41543. return unreadData.slice(0, endOfLinePosition);
  41544. }
  41545. else {
  41546. return null;
  41547. }
  41548. };
  41549. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41550. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41551. };
  41552. return HTTPRequest;
  41553. }(dispatcher));
  41554. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41555. // CONCATENATED MODULE: ./src/core/http/state.ts
  41556. var State;
  41557. (function (State) {
  41558. State[State["CONNECTING"] = 0] = "CONNECTING";
  41559. State[State["OPEN"] = 1] = "OPEN";
  41560. State[State["CLOSED"] = 3] = "CLOSED";
  41561. })(State || (State = {}));
  41562. /* harmony default export */ var state = (State);
  41563. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41564. var autoIncrement = 1;
  41565. var http_socket_HTTPSocket = (function () {
  41566. function HTTPSocket(hooks, url) {
  41567. this.hooks = hooks;
  41568. this.session = randomNumber(1000) + "/" + randomString(8);
  41569. this.location = getLocation(url);
  41570. this.readyState = state.CONNECTING;
  41571. this.openStream();
  41572. }
  41573. HTTPSocket.prototype.send = function (payload) {
  41574. return this.sendRaw(JSON.stringify([payload]));
  41575. };
  41576. HTTPSocket.prototype.ping = function () {
  41577. this.hooks.sendHeartbeat(this);
  41578. };
  41579. HTTPSocket.prototype.close = function (code, reason) {
  41580. this.onClose(code, reason, true);
  41581. };
  41582. HTTPSocket.prototype.sendRaw = function (payload) {
  41583. if (this.readyState === state.OPEN) {
  41584. try {
  41585. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41586. return true;
  41587. }
  41588. catch (e) {
  41589. return false;
  41590. }
  41591. }
  41592. else {
  41593. return false;
  41594. }
  41595. };
  41596. HTTPSocket.prototype.reconnect = function () {
  41597. this.closeStream();
  41598. this.openStream();
  41599. };
  41600. ;
  41601. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41602. this.closeStream();
  41603. this.readyState = state.CLOSED;
  41604. if (this.onclose) {
  41605. this.onclose({
  41606. code: code,
  41607. reason: reason,
  41608. wasClean: wasClean
  41609. });
  41610. }
  41611. };
  41612. HTTPSocket.prototype.onChunk = function (chunk) {
  41613. if (chunk.status !== 200) {
  41614. return;
  41615. }
  41616. if (this.readyState === state.OPEN) {
  41617. this.onActivity();
  41618. }
  41619. var payload;
  41620. var type = chunk.data.slice(0, 1);
  41621. switch (type) {
  41622. case 'o':
  41623. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41624. this.onOpen(payload);
  41625. break;
  41626. case 'a':
  41627. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41628. for (var i = 0; i < payload.length; i++) {
  41629. this.onEvent(payload[i]);
  41630. }
  41631. break;
  41632. case 'm':
  41633. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41634. this.onEvent(payload);
  41635. break;
  41636. case 'h':
  41637. this.hooks.onHeartbeat(this);
  41638. break;
  41639. case 'c':
  41640. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41641. this.onClose(payload[0], payload[1], true);
  41642. break;
  41643. }
  41644. };
  41645. HTTPSocket.prototype.onOpen = function (options) {
  41646. if (this.readyState === state.CONNECTING) {
  41647. if (options && options.hostname) {
  41648. this.location.base = replaceHost(this.location.base, options.hostname);
  41649. }
  41650. this.readyState = state.OPEN;
  41651. if (this.onopen) {
  41652. this.onopen();
  41653. }
  41654. }
  41655. else {
  41656. this.onClose(1006, "Server lost session", true);
  41657. }
  41658. };
  41659. HTTPSocket.prototype.onEvent = function (event) {
  41660. if (this.readyState === state.OPEN && this.onmessage) {
  41661. this.onmessage({ data: event });
  41662. }
  41663. };
  41664. HTTPSocket.prototype.onActivity = function () {
  41665. if (this.onactivity) {
  41666. this.onactivity();
  41667. }
  41668. };
  41669. HTTPSocket.prototype.onError = function (error) {
  41670. if (this.onerror) {
  41671. this.onerror(error);
  41672. }
  41673. };
  41674. HTTPSocket.prototype.openStream = function () {
  41675. var _this = this;
  41676. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41677. this.stream.bind("chunk", function (chunk) {
  41678. _this.onChunk(chunk);
  41679. });
  41680. this.stream.bind("finished", function (status) {
  41681. _this.hooks.onFinished(_this, status);
  41682. });
  41683. this.stream.bind("buffer_too_long", function () {
  41684. _this.reconnect();
  41685. });
  41686. try {
  41687. this.stream.start();
  41688. }
  41689. catch (error) {
  41690. util.defer(function () {
  41691. _this.onError(error);
  41692. _this.onClose(1006, "Could not start streaming", false);
  41693. });
  41694. }
  41695. };
  41696. HTTPSocket.prototype.closeStream = function () {
  41697. if (this.stream) {
  41698. this.stream.unbind_all();
  41699. this.stream.close();
  41700. this.stream = null;
  41701. }
  41702. };
  41703. return HTTPSocket;
  41704. }());
  41705. function getLocation(url) {
  41706. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41707. return {
  41708. base: parts[1],
  41709. queryString: parts[2]
  41710. };
  41711. }
  41712. function getSendURL(url, session) {
  41713. return url.base + "/" + session + "/xhr_send";
  41714. }
  41715. function getUniqueURL(url) {
  41716. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41717. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41718. }
  41719. function replaceHost(url, hostname) {
  41720. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41721. return urlParts[1] + hostname + urlParts[3];
  41722. }
  41723. function randomNumber(max) {
  41724. return Math.floor(Math.random() * max);
  41725. }
  41726. function randomString(length) {
  41727. var result = [];
  41728. for (var i = 0; i < length; i++) {
  41729. result.push(randomNumber(32).toString(32));
  41730. }
  41731. return result.join('');
  41732. }
  41733. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41734. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41735. var http_streaming_socket_hooks = {
  41736. getReceiveURL: function (url, session) {
  41737. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41738. },
  41739. onHeartbeat: function (socket) {
  41740. socket.sendRaw("[]");
  41741. },
  41742. sendHeartbeat: function (socket) {
  41743. socket.sendRaw("[]");
  41744. },
  41745. onFinished: function (socket, status) {
  41746. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41747. }
  41748. };
  41749. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41750. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41751. var http_polling_socket_hooks = {
  41752. getReceiveURL: function (url, session) {
  41753. return url.base + "/" + session + "/xhr" + url.queryString;
  41754. },
  41755. onHeartbeat: function () {
  41756. },
  41757. sendHeartbeat: function (socket) {
  41758. socket.sendRaw("[]");
  41759. },
  41760. onFinished: function (socket, status) {
  41761. if (status === 200) {
  41762. socket.reconnect();
  41763. }
  41764. else {
  41765. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41766. }
  41767. }
  41768. };
  41769. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41770. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41771. var http_xhr_request_hooks = {
  41772. getRequest: function (socket) {
  41773. var Constructor = runtime.getXHRAPI();
  41774. var xhr = new Constructor();
  41775. xhr.onreadystatechange = xhr.onprogress = function () {
  41776. switch (xhr.readyState) {
  41777. case 3:
  41778. if (xhr.responseText && xhr.responseText.length > 0) {
  41779. socket.onChunk(xhr.status, xhr.responseText);
  41780. }
  41781. break;
  41782. case 4:
  41783. if (xhr.responseText && xhr.responseText.length > 0) {
  41784. socket.onChunk(xhr.status, xhr.responseText);
  41785. }
  41786. socket.emit("finished", xhr.status);
  41787. socket.close();
  41788. break;
  41789. }
  41790. };
  41791. return xhr;
  41792. },
  41793. abortRequest: function (xhr) {
  41794. xhr.onreadystatechange = null;
  41795. xhr.abort();
  41796. }
  41797. };
  41798. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41799. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41800. var HTTP = {
  41801. createStreamingSocket: function (url) {
  41802. return this.createSocket(http_streaming_socket, url);
  41803. },
  41804. createPollingSocket: function (url) {
  41805. return this.createSocket(http_polling_socket, url);
  41806. },
  41807. createSocket: function (hooks, url) {
  41808. return new http_socket(hooks, url);
  41809. },
  41810. createXHR: function (method, url) {
  41811. return this.createRequest(http_xhr_request, method, url);
  41812. },
  41813. createRequest: function (hooks, method, url) {
  41814. return new http_request(hooks, method, url);
  41815. }
  41816. };
  41817. /* harmony default export */ var http_http = (HTTP);
  41818. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41819. http_http.createXDR = function (method, url) {
  41820. return this.createRequest(http_xdomain_request, method, url);
  41821. };
  41822. /* harmony default export */ var web_http_http = (http_http);
  41823. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41824. var Runtime = {
  41825. nextAuthCallbackID: 1,
  41826. auth_callbacks: {},
  41827. ScriptReceivers: ScriptReceivers,
  41828. DependenciesReceivers: DependenciesReceivers,
  41829. getDefaultStrategy: default_strategy,
  41830. Transports: transports_transports,
  41831. transportConnectionInitializer: transport_connection_initializer,
  41832. HTTPFactory: web_http_http,
  41833. TimelineTransport: jsonp_timeline,
  41834. getXHRAPI: function () {
  41835. return window.XMLHttpRequest;
  41836. },
  41837. getWebSocketAPI: function () {
  41838. return window.WebSocket || window.MozWebSocket;
  41839. },
  41840. setup: function (PusherClass) {
  41841. var _this = this;
  41842. window.Pusher = PusherClass;
  41843. var initializeOnDocumentBody = function () {
  41844. _this.onDocumentBody(PusherClass.ready);
  41845. };
  41846. if (!window.JSON) {
  41847. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41848. }
  41849. else {
  41850. initializeOnDocumentBody();
  41851. }
  41852. },
  41853. getDocument: function () {
  41854. return document;
  41855. },
  41856. getProtocol: function () {
  41857. return this.getDocument().location.protocol;
  41858. },
  41859. getAuthorizers: function () {
  41860. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41861. },
  41862. onDocumentBody: function (callback) {
  41863. var _this = this;
  41864. if (document.body) {
  41865. callback();
  41866. }
  41867. else {
  41868. setTimeout(function () {
  41869. _this.onDocumentBody(callback);
  41870. }, 0);
  41871. }
  41872. },
  41873. createJSONPRequest: function (url, data) {
  41874. return new jsonp_request(url, data);
  41875. },
  41876. createScriptRequest: function (src) {
  41877. return new script_request(src);
  41878. },
  41879. getLocalStorage: function () {
  41880. try {
  41881. return window.localStorage;
  41882. }
  41883. catch (e) {
  41884. return undefined;
  41885. }
  41886. },
  41887. createXHR: function () {
  41888. if (this.getXHRAPI()) {
  41889. return this.createXMLHttpRequest();
  41890. }
  41891. else {
  41892. return this.createMicrosoftXHR();
  41893. }
  41894. },
  41895. createXMLHttpRequest: function () {
  41896. var Constructor = this.getXHRAPI();
  41897. return new Constructor();
  41898. },
  41899. createMicrosoftXHR: function () {
  41900. return new ActiveXObject("Microsoft.XMLHTTP");
  41901. },
  41902. getNetwork: function () {
  41903. return net_info_Network;
  41904. },
  41905. createWebSocket: function (url) {
  41906. var Constructor = this.getWebSocketAPI();
  41907. return new Constructor(url);
  41908. },
  41909. createSocketRequest: function (method, url) {
  41910. if (this.isXHRSupported()) {
  41911. return this.HTTPFactory.createXHR(method, url);
  41912. }
  41913. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  41914. return this.HTTPFactory.createXDR(method, url);
  41915. }
  41916. else {
  41917. throw "Cross-origin HTTP requests are not supported";
  41918. }
  41919. },
  41920. isXHRSupported: function () {
  41921. var Constructor = this.getXHRAPI();
  41922. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  41923. },
  41924. isXDRSupported: function (useTLS) {
  41925. var protocol = useTLS ? "https:" : "http:";
  41926. var documentProtocol = this.getProtocol();
  41927. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  41928. },
  41929. addUnloadListener: function (listener) {
  41930. if (window.addEventListener !== undefined) {
  41931. window.addEventListener("unload", listener, false);
  41932. }
  41933. else if (window.attachEvent !== undefined) {
  41934. window.attachEvent("onunload", listener);
  41935. }
  41936. },
  41937. removeUnloadListener: function (listener) {
  41938. if (window.addEventListener !== undefined) {
  41939. window.removeEventListener("unload", listener, false);
  41940. }
  41941. else if (window.detachEvent !== undefined) {
  41942. window.detachEvent("onunload", listener);
  41943. }
  41944. }
  41945. };
  41946. /* harmony default export */ var runtime = (Runtime);
  41947. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  41948. var TimelineLevel;
  41949. (function (TimelineLevel) {
  41950. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  41951. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  41952. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  41953. })(TimelineLevel || (TimelineLevel = {}));
  41954. /* harmony default export */ var timeline_level = (TimelineLevel);
  41955. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  41956. var timeline_Timeline = (function () {
  41957. function Timeline(key, session, options) {
  41958. this.key = key;
  41959. this.session = session;
  41960. this.events = [];
  41961. this.options = options || {};
  41962. this.sent = 0;
  41963. this.uniqueID = 0;
  41964. }
  41965. Timeline.prototype.log = function (level, event) {
  41966. if (level <= this.options.level) {
  41967. this.events.push(extend({}, event, { timestamp: util.now() }));
  41968. if (this.options.limit && this.events.length > this.options.limit) {
  41969. this.events.shift();
  41970. }
  41971. }
  41972. };
  41973. Timeline.prototype.error = function (event) {
  41974. this.log(timeline_level.ERROR, event);
  41975. };
  41976. Timeline.prototype.info = function (event) {
  41977. this.log(timeline_level.INFO, event);
  41978. };
  41979. Timeline.prototype.debug = function (event) {
  41980. this.log(timeline_level.DEBUG, event);
  41981. };
  41982. Timeline.prototype.isEmpty = function () {
  41983. return this.events.length === 0;
  41984. };
  41985. Timeline.prototype.send = function (sendfn, callback) {
  41986. var _this = this;
  41987. var data = extend({
  41988. session: this.session,
  41989. bundle: this.sent + 1,
  41990. key: this.key,
  41991. lib: "js",
  41992. version: this.options.version,
  41993. cluster: this.options.cluster,
  41994. features: this.options.features,
  41995. timeline: this.events
  41996. }, this.options.params);
  41997. this.events = [];
  41998. sendfn(data, function (error, result) {
  41999. if (!error) {
  42000. _this.sent++;
  42001. }
  42002. if (callback) {
  42003. callback(error, result);
  42004. }
  42005. });
  42006. return true;
  42007. };
  42008. Timeline.prototype.generateUniqueID = function () {
  42009. this.uniqueID++;
  42010. return this.uniqueID;
  42011. };
  42012. return Timeline;
  42013. }());
  42014. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42015. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42016. var transport_strategy_TransportStrategy = (function () {
  42017. function TransportStrategy(name, priority, transport, options) {
  42018. this.name = name;
  42019. this.priority = priority;
  42020. this.transport = transport;
  42021. this.options = options || {};
  42022. }
  42023. TransportStrategy.prototype.isSupported = function () {
  42024. return this.transport.isSupported({
  42025. useTLS: this.options.useTLS
  42026. });
  42027. };
  42028. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42029. var _this = this;
  42030. if (!this.isSupported()) {
  42031. return failAttempt(new UnsupportedStrategy(), callback);
  42032. }
  42033. else if (this.priority < minPriority) {
  42034. return failAttempt(new TransportPriorityTooLow(), callback);
  42035. }
  42036. var connected = false;
  42037. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42038. var handshake = null;
  42039. var onInitialized = function () {
  42040. transport.unbind("initialized", onInitialized);
  42041. transport.connect();
  42042. };
  42043. var onOpen = function () {
  42044. handshake = factory.createHandshake(transport, function (result) {
  42045. connected = true;
  42046. unbindListeners();
  42047. callback(null, result);
  42048. });
  42049. };
  42050. var onError = function (error) {
  42051. unbindListeners();
  42052. callback(error);
  42053. };
  42054. var onClosed = function () {
  42055. unbindListeners();
  42056. var serializedTransport;
  42057. serializedTransport = safeJSONStringify(transport);
  42058. callback(new TransportClosed(serializedTransport));
  42059. };
  42060. var unbindListeners = function () {
  42061. transport.unbind("initialized", onInitialized);
  42062. transport.unbind("open", onOpen);
  42063. transport.unbind("error", onError);
  42064. transport.unbind("closed", onClosed);
  42065. };
  42066. transport.bind("initialized", onInitialized);
  42067. transport.bind("open", onOpen);
  42068. transport.bind("error", onError);
  42069. transport.bind("closed", onClosed);
  42070. transport.initialize();
  42071. return {
  42072. abort: function () {
  42073. if (connected) {
  42074. return;
  42075. }
  42076. unbindListeners();
  42077. if (handshake) {
  42078. handshake.close();
  42079. }
  42080. else {
  42081. transport.close();
  42082. }
  42083. },
  42084. forceMinPriority: function (p) {
  42085. if (connected) {
  42086. return;
  42087. }
  42088. if (_this.priority < p) {
  42089. if (handshake) {
  42090. handshake.close();
  42091. }
  42092. else {
  42093. transport.close();
  42094. }
  42095. }
  42096. }
  42097. };
  42098. };
  42099. return TransportStrategy;
  42100. }());
  42101. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42102. function failAttempt(error, callback) {
  42103. util.defer(function () {
  42104. callback(error);
  42105. });
  42106. return {
  42107. abort: function () { },
  42108. forceMinPriority: function () { }
  42109. };
  42110. }
  42111. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42112. var strategy_builder_Transports = runtime.Transports;
  42113. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42114. var transportClass = strategy_builder_Transports[type];
  42115. if (!transportClass) {
  42116. throw new UnsupportedTransport(type);
  42117. }
  42118. var enabled = (!config.enabledTransports ||
  42119. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42120. (!config.disabledTransports ||
  42121. arrayIndexOf(config.disabledTransports, name) === -1);
  42122. var transport;
  42123. if (enabled) {
  42124. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42125. key: config.key,
  42126. useTLS: config.useTLS,
  42127. timeline: config.timeline,
  42128. ignoreNullOrigin: config.ignoreNullOrigin
  42129. }, options));
  42130. }
  42131. else {
  42132. transport = strategy_builder_UnsupportedStrategy;
  42133. }
  42134. return transport;
  42135. };
  42136. var strategy_builder_UnsupportedStrategy = {
  42137. isSupported: function () {
  42138. return false;
  42139. },
  42140. connect: function (_, callback) {
  42141. var deferred = util.defer(function () {
  42142. callback(new UnsupportedStrategy());
  42143. });
  42144. return {
  42145. abort: function () {
  42146. deferred.ensureAborted();
  42147. },
  42148. forceMinPriority: function () { }
  42149. };
  42150. }
  42151. };
  42152. // CONCATENATED MODULE: ./src/core/config.ts
  42153. var getGlobalConfig = function () {
  42154. return {
  42155. wsHost: defaults.host,
  42156. wsPort: defaults.ws_port,
  42157. wssPort: defaults.wss_port,
  42158. wsPath: defaults.ws_path,
  42159. httpHost: defaults.sockjs_host,
  42160. httpPort: defaults.sockjs_http_port,
  42161. httpsPort: defaults.sockjs_https_port,
  42162. httpPath: defaults.sockjs_path,
  42163. statsHost: defaults.stats_host,
  42164. authEndpoint: defaults.channel_auth_endpoint,
  42165. authTransport: defaults.channel_auth_transport,
  42166. activity_timeout: defaults.activity_timeout,
  42167. pong_timeout: defaults.pong_timeout,
  42168. unavailable_timeout: defaults.unavailable_timeout
  42169. };
  42170. };
  42171. var getClusterConfig = function (clusterName) {
  42172. return {
  42173. wsHost: 'ws-' + clusterName + '.pusher.com',
  42174. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42175. };
  42176. };
  42177. // CONCATENATED MODULE: ./src/core/pusher.ts
  42178. var pusher_Pusher = (function () {
  42179. function Pusher(app_key, options) {
  42180. var _this = this;
  42181. checkAppKey(app_key);
  42182. options = options || {};
  42183. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42184. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42185. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42186. }
  42187. this.key = app_key;
  42188. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42189. this.channels = factory.createChannels();
  42190. this.global_emitter = new dispatcher();
  42191. this.sessionID = Math.floor(Math.random() * 1000000000);
  42192. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42193. cluster: this.config.cluster,
  42194. features: Pusher.getClientFeatures(),
  42195. params: this.config.timelineParams || {},
  42196. limit: 50,
  42197. level: timeline_level.INFO,
  42198. version: defaults.VERSION
  42199. });
  42200. if (!this.config.disableStats) {
  42201. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42202. host: this.config.statsHost,
  42203. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42204. });
  42205. }
  42206. var getStrategy = function (options) {
  42207. var config = extend({}, _this.config, options);
  42208. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42209. };
  42210. this.connection = factory.createConnectionManager(this.key, extend({
  42211. getStrategy: getStrategy,
  42212. timeline: this.timeline,
  42213. activityTimeout: this.config.activity_timeout,
  42214. pongTimeout: this.config.pong_timeout,
  42215. unavailableTimeout: this.config.unavailable_timeout
  42216. }, this.config, { useTLS: this.shouldUseTLS() }));
  42217. this.connection.bind('connected', function () {
  42218. _this.subscribeAll();
  42219. if (_this.timelineSender) {
  42220. _this.timelineSender.send(_this.connection.isUsingTLS());
  42221. }
  42222. });
  42223. this.connection.bind('message', function (event) {
  42224. var eventName = event.event;
  42225. var internal = eventName.indexOf('pusher_internal:') === 0;
  42226. if (event.channel) {
  42227. var channel = _this.channel(event.channel);
  42228. if (channel) {
  42229. channel.handleEvent(event);
  42230. }
  42231. }
  42232. if (!internal) {
  42233. _this.global_emitter.emit(event.event, event.data);
  42234. }
  42235. });
  42236. this.connection.bind('connecting', function () {
  42237. _this.channels.disconnect();
  42238. });
  42239. this.connection.bind('disconnected', function () {
  42240. _this.channels.disconnect();
  42241. });
  42242. this.connection.bind('error', function (err) {
  42243. logger.warn(err);
  42244. });
  42245. Pusher.instances.push(this);
  42246. this.timeline.info({ instances: Pusher.instances.length });
  42247. if (Pusher.isReady) {
  42248. this.connect();
  42249. }
  42250. }
  42251. Pusher.ready = function () {
  42252. Pusher.isReady = true;
  42253. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42254. Pusher.instances[i].connect();
  42255. }
  42256. };
  42257. Pusher.getClientFeatures = function () {
  42258. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42259. return t.isSupported({});
  42260. }));
  42261. };
  42262. Pusher.prototype.channel = function (name) {
  42263. return this.channels.find(name);
  42264. };
  42265. Pusher.prototype.allChannels = function () {
  42266. return this.channels.all();
  42267. };
  42268. Pusher.prototype.connect = function () {
  42269. this.connection.connect();
  42270. if (this.timelineSender) {
  42271. if (!this.timelineSenderTimer) {
  42272. var usingTLS = this.connection.isUsingTLS();
  42273. var timelineSender = this.timelineSender;
  42274. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42275. timelineSender.send(usingTLS);
  42276. });
  42277. }
  42278. }
  42279. };
  42280. Pusher.prototype.disconnect = function () {
  42281. this.connection.disconnect();
  42282. if (this.timelineSenderTimer) {
  42283. this.timelineSenderTimer.ensureAborted();
  42284. this.timelineSenderTimer = null;
  42285. }
  42286. };
  42287. Pusher.prototype.bind = function (event_name, callback, context) {
  42288. this.global_emitter.bind(event_name, callback, context);
  42289. return this;
  42290. };
  42291. Pusher.prototype.unbind = function (event_name, callback, context) {
  42292. this.global_emitter.unbind(event_name, callback, context);
  42293. return this;
  42294. };
  42295. Pusher.prototype.bind_global = function (callback) {
  42296. this.global_emitter.bind_global(callback);
  42297. return this;
  42298. };
  42299. Pusher.prototype.unbind_global = function (callback) {
  42300. this.global_emitter.unbind_global(callback);
  42301. return this;
  42302. };
  42303. Pusher.prototype.unbind_all = function (callback) {
  42304. this.global_emitter.unbind_all();
  42305. return this;
  42306. };
  42307. Pusher.prototype.subscribeAll = function () {
  42308. var channelName;
  42309. for (channelName in this.channels.channels) {
  42310. if (this.channels.channels.hasOwnProperty(channelName)) {
  42311. this.subscribe(channelName);
  42312. }
  42313. }
  42314. };
  42315. Pusher.prototype.subscribe = function (channel_name) {
  42316. var channel = this.channels.add(channel_name, this);
  42317. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42318. channel.reinstateSubscription();
  42319. }
  42320. else if (!channel.subscriptionPending &&
  42321. this.connection.state === 'connected') {
  42322. channel.subscribe();
  42323. }
  42324. return channel;
  42325. };
  42326. Pusher.prototype.unsubscribe = function (channel_name) {
  42327. var channel = this.channels.find(channel_name);
  42328. if (channel && channel.subscriptionPending) {
  42329. channel.cancelSubscription();
  42330. }
  42331. else {
  42332. channel = this.channels.remove(channel_name);
  42333. if (channel && this.connection.state === 'connected') {
  42334. channel.unsubscribe();
  42335. }
  42336. }
  42337. };
  42338. Pusher.prototype.send_event = function (event_name, data, channel) {
  42339. return this.connection.send_event(event_name, data, channel);
  42340. };
  42341. Pusher.prototype.shouldUseTLS = function () {
  42342. if (runtime.getProtocol() === 'https:') {
  42343. return true;
  42344. }
  42345. else if (this.config.forceTLS === true) {
  42346. return true;
  42347. }
  42348. else {
  42349. return Boolean(this.config.encrypted);
  42350. }
  42351. };
  42352. Pusher.instances = [];
  42353. Pusher.isReady = false;
  42354. Pusher.logToConsole = false;
  42355. Pusher.Runtime = runtime;
  42356. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42357. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42358. Pusher.auth_callbacks = runtime.auth_callbacks;
  42359. return Pusher;
  42360. }());
  42361. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42362. function checkAppKey(key) {
  42363. if (key === null || key === undefined) {
  42364. throw 'You must pass your app key when you instantiate Pusher.';
  42365. }
  42366. }
  42367. runtime.setup(pusher_Pusher);
  42368. /***/ })
  42369. /******/ ]);
  42370. });
  42371. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42372. /***/ }),
  42373. /***/ "./node_modules/setimmediate/setImmediate.js":
  42374. /*!***************************************************!*\
  42375. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42376. \***************************************************/
  42377. /*! no static exports found */
  42378. /***/ (function(module, exports, __webpack_require__) {
  42379. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42380. "use strict";
  42381. if (global.setImmediate) {
  42382. return;
  42383. }
  42384. var nextHandle = 1; // Spec says greater than zero
  42385. var tasksByHandle = {};
  42386. var currentlyRunningATask = false;
  42387. var doc = global.document;
  42388. var registerImmediate;
  42389. function setImmediate(callback) {
  42390. // Callback can either be a function or a string
  42391. if (typeof callback !== "function") {
  42392. callback = new Function("" + callback);
  42393. }
  42394. // Copy function arguments
  42395. var args = new Array(arguments.length - 1);
  42396. for (var i = 0; i < args.length; i++) {
  42397. args[i] = arguments[i + 1];
  42398. }
  42399. // Store and register the task
  42400. var task = { callback: callback, args: args };
  42401. tasksByHandle[nextHandle] = task;
  42402. registerImmediate(nextHandle);
  42403. return nextHandle++;
  42404. }
  42405. function clearImmediate(handle) {
  42406. delete tasksByHandle[handle];
  42407. }
  42408. function run(task) {
  42409. var callback = task.callback;
  42410. var args = task.args;
  42411. switch (args.length) {
  42412. case 0:
  42413. callback();
  42414. break;
  42415. case 1:
  42416. callback(args[0]);
  42417. break;
  42418. case 2:
  42419. callback(args[0], args[1]);
  42420. break;
  42421. case 3:
  42422. callback(args[0], args[1], args[2]);
  42423. break;
  42424. default:
  42425. callback.apply(undefined, args);
  42426. break;
  42427. }
  42428. }
  42429. function runIfPresent(handle) {
  42430. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42431. // So if we're currently running a task, we'll need to delay this invocation.
  42432. if (currentlyRunningATask) {
  42433. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42434. // "too much recursion" error.
  42435. setTimeout(runIfPresent, 0, handle);
  42436. } else {
  42437. var task = tasksByHandle[handle];
  42438. if (task) {
  42439. currentlyRunningATask = true;
  42440. try {
  42441. run(task);
  42442. } finally {
  42443. clearImmediate(handle);
  42444. currentlyRunningATask = false;
  42445. }
  42446. }
  42447. }
  42448. }
  42449. function installNextTickImplementation() {
  42450. registerImmediate = function(handle) {
  42451. process.nextTick(function () { runIfPresent(handle); });
  42452. };
  42453. }
  42454. function canUsePostMessage() {
  42455. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42456. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42457. if (global.postMessage && !global.importScripts) {
  42458. var postMessageIsAsynchronous = true;
  42459. var oldOnMessage = global.onmessage;
  42460. global.onmessage = function() {
  42461. postMessageIsAsynchronous = false;
  42462. };
  42463. global.postMessage("", "*");
  42464. global.onmessage = oldOnMessage;
  42465. return postMessageIsAsynchronous;
  42466. }
  42467. }
  42468. function installPostMessageImplementation() {
  42469. // Installs an event handler on `global` for the `message` event: see
  42470. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42471. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42472. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42473. var onGlobalMessage = function(event) {
  42474. if (event.source === global &&
  42475. typeof event.data === "string" &&
  42476. event.data.indexOf(messagePrefix) === 0) {
  42477. runIfPresent(+event.data.slice(messagePrefix.length));
  42478. }
  42479. };
  42480. if (global.addEventListener) {
  42481. global.addEventListener("message", onGlobalMessage, false);
  42482. } else {
  42483. global.attachEvent("onmessage", onGlobalMessage);
  42484. }
  42485. registerImmediate = function(handle) {
  42486. global.postMessage(messagePrefix + handle, "*");
  42487. };
  42488. }
  42489. function installMessageChannelImplementation() {
  42490. var channel = new MessageChannel();
  42491. channel.port1.onmessage = function(event) {
  42492. var handle = event.data;
  42493. runIfPresent(handle);
  42494. };
  42495. registerImmediate = function(handle) {
  42496. channel.port2.postMessage(handle);
  42497. };
  42498. }
  42499. function installReadyStateChangeImplementation() {
  42500. var html = doc.documentElement;
  42501. registerImmediate = function(handle) {
  42502. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42503. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42504. var script = doc.createElement("script");
  42505. script.onreadystatechange = function () {
  42506. runIfPresent(handle);
  42507. script.onreadystatechange = null;
  42508. html.removeChild(script);
  42509. script = null;
  42510. };
  42511. html.appendChild(script);
  42512. };
  42513. }
  42514. function installSetTimeoutImplementation() {
  42515. registerImmediate = function(handle) {
  42516. setTimeout(runIfPresent, 0, handle);
  42517. };
  42518. }
  42519. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42520. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42521. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42522. // Don't get fooled by e.g. browserify environments.
  42523. if ({}.toString.call(global.process) === "[object process]") {
  42524. // For Node.js before 0.9
  42525. installNextTickImplementation();
  42526. } else if (canUsePostMessage()) {
  42527. // For non-IE10 modern browsers
  42528. installPostMessageImplementation();
  42529. } else if (global.MessageChannel) {
  42530. // For web workers, where supported
  42531. installMessageChannelImplementation();
  42532. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42533. // For IE 6–8
  42534. installReadyStateChangeImplementation();
  42535. } else {
  42536. // For older browsers
  42537. installSetTimeoutImplementation();
  42538. }
  42539. attachTo.setImmediate = setImmediate;
  42540. attachTo.clearImmediate = clearImmediate;
  42541. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42542. /* 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")))
  42543. /***/ }),
  42544. /***/ "./node_modules/timers-browserify/main.js":
  42545. /*!************************************************!*\
  42546. !*** ./node_modules/timers-browserify/main.js ***!
  42547. \************************************************/
  42548. /*! no static exports found */
  42549. /***/ (function(module, exports, __webpack_require__) {
  42550. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42551. (typeof self !== "undefined" && self) ||
  42552. window;
  42553. var apply = Function.prototype.apply;
  42554. // DOM APIs, for completeness
  42555. exports.setTimeout = function() {
  42556. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42557. };
  42558. exports.setInterval = function() {
  42559. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42560. };
  42561. exports.clearTimeout =
  42562. exports.clearInterval = function(timeout) {
  42563. if (timeout) {
  42564. timeout.close();
  42565. }
  42566. };
  42567. function Timeout(id, clearFn) {
  42568. this._id = id;
  42569. this._clearFn = clearFn;
  42570. }
  42571. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42572. Timeout.prototype.close = function() {
  42573. this._clearFn.call(scope, this._id);
  42574. };
  42575. // Does not start the time, just sets up the members needed.
  42576. exports.enroll = function(item, msecs) {
  42577. clearTimeout(item._idleTimeoutId);
  42578. item._idleTimeout = msecs;
  42579. };
  42580. exports.unenroll = function(item) {
  42581. clearTimeout(item._idleTimeoutId);
  42582. item._idleTimeout = -1;
  42583. };
  42584. exports._unrefActive = exports.active = function(item) {
  42585. clearTimeout(item._idleTimeoutId);
  42586. var msecs = item._idleTimeout;
  42587. if (msecs >= 0) {
  42588. item._idleTimeoutId = setTimeout(function onTimeout() {
  42589. if (item._onTimeout)
  42590. item._onTimeout();
  42591. }, msecs);
  42592. }
  42593. };
  42594. // setimmediate attaches itself to the global object
  42595. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42596. // On some exotic environments, it's not clear which object `setimmediate` was
  42597. // able to install onto. Search each possibility in the same order as the
  42598. // `setimmediate` library.
  42599. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42600. (typeof global !== "undefined" && global.setImmediate) ||
  42601. (this && this.setImmediate);
  42602. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42603. (typeof global !== "undefined" && global.clearImmediate) ||
  42604. (this && this.clearImmediate);
  42605. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42606. /***/ }),
  42607. /***/ "./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&":
  42608. /*!*******************************************************************************************************************************************************************************************************************!*\
  42609. !*** ./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& ***!
  42610. \*******************************************************************************************************************************************************************************************************************/
  42611. /*! exports provided: render, staticRenderFns */
  42612. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42613. "use strict";
  42614. __webpack_require__.r(__webpack_exports__);
  42615. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42616. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42617. var render = function() {
  42618. var _vm = this
  42619. var _h = _vm.$createElement
  42620. var _c = _vm._self._c || _h
  42621. return _vm._m(0)
  42622. }
  42623. var staticRenderFns = [
  42624. function() {
  42625. var _vm = this
  42626. var _h = _vm.$createElement
  42627. var _c = _vm._self._c || _h
  42628. return _c("div", { staticClass: "container" }, [
  42629. _c("div", { staticClass: "row justify-content-center" }, [
  42630. _c("div", { staticClass: "col-md-8" }, [
  42631. _c("div", { staticClass: "card" }, [
  42632. _c("div", { staticClass: "card-header" }, [
  42633. _vm._v("Example Component")
  42634. ]),
  42635. _vm._v(" "),
  42636. _c("div", { staticClass: "card-body" }, [
  42637. _vm._v(
  42638. "\n I'm an example component.\n "
  42639. )
  42640. ])
  42641. ])
  42642. ])
  42643. ])
  42644. ])
  42645. }
  42646. ]
  42647. render._withStripped = true
  42648. /***/ }),
  42649. /***/ "./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&":
  42650. /*!************************************************************************************************************************************************************************************************************!*\
  42651. !*** ./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& ***!
  42652. \************************************************************************************************************************************************************************************************************/
  42653. /*! exports provided: render, staticRenderFns */
  42654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42655. "use strict";
  42656. __webpack_require__.r(__webpack_exports__);
  42657. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42658. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42659. var render = function() {
  42660. var _vm = this
  42661. var _h = _vm.$createElement
  42662. var _c = _vm._self._c || _h
  42663. return _c(
  42664. "div",
  42665. [
  42666. _c(
  42667. "modal",
  42668. {
  42669. attrs: {
  42670. id: "asseteditModal",
  42671. tabindex: "-1",
  42672. role: "dialog",
  42673. "aria-labelledby": "asseteditModalLabel"
  42674. }
  42675. },
  42676. [
  42677. _c(
  42678. "h5",
  42679. {
  42680. staticClass: "modal-title",
  42681. attrs: { slot: "header", id: "asseteditModalLabel" },
  42682. slot: "header"
  42683. },
  42684. [_vm._v("\n Edit Work Order Information\n ")]
  42685. ),
  42686. _vm._v(" "),
  42687. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42688. _c("div", { staticClass: "form-group" }, [
  42689. _c("label", { attrs: { for: "manufacturer" } }, [
  42690. _vm._v("Manufacturer")
  42691. ]),
  42692. _vm._v(" "),
  42693. _c("input", {
  42694. directives: [
  42695. {
  42696. name: "model",
  42697. rawName: "v-model",
  42698. value: _vm.data.pcmanu,
  42699. expression: "data.pcmanu"
  42700. }
  42701. ],
  42702. staticClass: "form-control",
  42703. attrs: {
  42704. type: "text",
  42705. name: "manufacturer",
  42706. id: "manufacturer"
  42707. },
  42708. domProps: { value: _vm.data.pcmanu },
  42709. on: {
  42710. input: function($event) {
  42711. if ($event.target.composing) {
  42712. return
  42713. }
  42714. _vm.$set(_vm.data, "pcmanu", $event.target.value)
  42715. }
  42716. }
  42717. })
  42718. ]),
  42719. _vm._v(" "),
  42720. _c("div", { staticClass: "form-group" }, [
  42721. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  42722. _vm._v(" "),
  42723. _c("input", {
  42724. directives: [
  42725. {
  42726. name: "model",
  42727. rawName: "v-model",
  42728. value: _vm.data.pcmake,
  42729. expression: "data.pcmake"
  42730. }
  42731. ],
  42732. staticClass: "form-control",
  42733. attrs: { type: "text", name: "make", id: "make" },
  42734. domProps: { value: _vm.data.pcmake },
  42735. on: {
  42736. input: function($event) {
  42737. if ($event.target.composing) {
  42738. return
  42739. }
  42740. _vm.$set(_vm.data, "pcmake", $event.target.value)
  42741. }
  42742. }
  42743. })
  42744. ]),
  42745. _vm._v(" "),
  42746. _c("div", { staticClass: "form-group" }, [
  42747. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  42748. _vm._v(" "),
  42749. _c("input", {
  42750. directives: [
  42751. {
  42752. name: "model",
  42753. rawName: "v-model",
  42754. value: _vm.data.pcnickname,
  42755. expression: "data.pcnickname"
  42756. }
  42757. ],
  42758. staticClass: "form-control",
  42759. attrs: { type: "text", name: "nickname", id: "nickname" },
  42760. domProps: { value: _vm.data.pcnickname },
  42761. on: {
  42762. input: function($event) {
  42763. if ($event.target.composing) {
  42764. return
  42765. }
  42766. _vm.$set(_vm.data, "pcnickname", $event.target.value)
  42767. }
  42768. }
  42769. })
  42770. ]),
  42771. _vm._v(" "),
  42772. _c("div", { staticClass: "form-group" }, [
  42773. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  42774. _vm._v(" "),
  42775. _c("input", {
  42776. directives: [
  42777. {
  42778. name: "model",
  42779. rawName: "v-model",
  42780. value: _vm.pcextra[2],
  42781. expression: "pcextra[2]"
  42782. }
  42783. ],
  42784. staticClass: "form-control",
  42785. attrs: { type: "text", name: "os", id: "os" },
  42786. domProps: { value: _vm.pcextra[2] },
  42787. on: {
  42788. input: function($event) {
  42789. if ($event.target.composing) {
  42790. return
  42791. }
  42792. _vm.$set(_vm.pcextra, 2, $event.target.value)
  42793. }
  42794. }
  42795. })
  42796. ]),
  42797. _vm._v(" "),
  42798. _c("div", { staticClass: "form-group" }, [
  42799. _c("label", { attrs: { for: "serial" } }, [
  42800. _vm._v("Serial Number")
  42801. ]),
  42802. _vm._v(" "),
  42803. _c("input", {
  42804. directives: [
  42805. {
  42806. name: "model",
  42807. rawName: "v-model",
  42808. value: _vm.pcextra[104],
  42809. expression: "pcextra[104]"
  42810. }
  42811. ],
  42812. staticClass: "form-control",
  42813. attrs: { type: "text", id: "serial", name: "serial" },
  42814. domProps: { value: _vm.pcextra[104] },
  42815. on: {
  42816. input: function($event) {
  42817. if ($event.target.composing) {
  42818. return
  42819. }
  42820. _vm.$set(_vm.pcextra, 104, $event.target.value)
  42821. }
  42822. }
  42823. })
  42824. ]),
  42825. _vm._v(" "),
  42826. _c("div", { staticClass: "form-group" }, [
  42827. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  42828. _vm._v(" "),
  42829. _c("input", {
  42830. directives: [
  42831. {
  42832. name: "model",
  42833. rawName: "v-model",
  42834. value: _vm.pcextra[101],
  42835. expression: "pcextra[101]"
  42836. }
  42837. ],
  42838. staticClass: "form-control",
  42839. attrs: { type: "text", id: "cpu", name: "cpu" },
  42840. domProps: { value: _vm.pcextra[101] },
  42841. on: {
  42842. input: function($event) {
  42843. if ($event.target.composing) {
  42844. return
  42845. }
  42846. _vm.$set(_vm.pcextra, 101, $event.target.value)
  42847. }
  42848. }
  42849. })
  42850. ]),
  42851. _vm._v(" "),
  42852. _c("div", { staticClass: "form-group" }, [
  42853. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  42854. _vm._v(" "),
  42855. _c("input", {
  42856. directives: [
  42857. {
  42858. name: "model",
  42859. rawName: "v-model",
  42860. value: _vm.pcextra[100],
  42861. expression: "pcextra[100]"
  42862. }
  42863. ],
  42864. staticClass: "form-control",
  42865. attrs: { type: "text", name: "ram", id: "ram" },
  42866. domProps: { value: _vm.pcextra[100] },
  42867. on: {
  42868. input: function($event) {
  42869. if ($event.target.composing) {
  42870. return
  42871. }
  42872. _vm.$set(_vm.pcextra, 100, $event.target.value)
  42873. }
  42874. }
  42875. })
  42876. ]),
  42877. _vm._v(" "),
  42878. _c("div", { staticClass: "form-group" }, [
  42879. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  42880. _vm._v(" "),
  42881. _c("input", {
  42882. directives: [
  42883. {
  42884. name: "model",
  42885. rawName: "v-model",
  42886. value: _vm.pcextra[4],
  42887. expression: "pcextra[4]"
  42888. }
  42889. ],
  42890. staticClass: "form-control",
  42891. attrs: { type: "text", name: "graphics", id: "grapics" },
  42892. domProps: { value: _vm.pcextra[4] },
  42893. on: {
  42894. input: function($event) {
  42895. if ($event.target.composing) {
  42896. return
  42897. }
  42898. _vm.$set(_vm.pcextra, 4, $event.target.value)
  42899. }
  42900. }
  42901. })
  42902. ])
  42903. ]),
  42904. _vm._v(" "),
  42905. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  42906. _c(
  42907. "button",
  42908. {
  42909. staticClass: "btn btn-secondary",
  42910. attrs: { type: "button", "data-dismiss": "modal" }
  42911. },
  42912. [_vm._v("Close")]
  42913. ),
  42914. _vm._v(" "),
  42915. _c(
  42916. "button",
  42917. {
  42918. staticClass: "btn btn-primary",
  42919. attrs: { type: "button" },
  42920. on: {
  42921. click: function($event) {
  42922. return _vm.updateAsset()
  42923. }
  42924. }
  42925. },
  42926. [_vm._v("Save")]
  42927. )
  42928. ])
  42929. ]
  42930. ),
  42931. _vm._v(" "),
  42932. _c("h4", { staticClass: "text-center" }, [
  42933. _vm._v(
  42934. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  42935. ),
  42936. _c("small", { staticClass: "text-muted" }, [
  42937. _vm._v(_vm._s(this.data.pcnickname))
  42938. ])
  42939. ]),
  42940. _vm._v(" "),
  42941. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  42942. _vm._v(" "),
  42943. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  42944. _vm._v(" "),
  42945. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  42946. _vm._v(" "),
  42947. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  42948. _vm._v(" "),
  42949. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  42950. _vm._v(" "),
  42951. _c(
  42952. "button",
  42953. {
  42954. staticClass: "btn btn-primary",
  42955. attrs: {
  42956. type: "button",
  42957. "data-toggle": "modal",
  42958. "data-target": "#asseteditModal"
  42959. }
  42960. },
  42961. [_vm._v("Edit")]
  42962. )
  42963. ],
  42964. 1
  42965. )
  42966. }
  42967. var staticRenderFns = []
  42968. render._withStripped = true
  42969. /***/ }),
  42970. /***/ "./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&":
  42971. /*!*************************************************************************************************************************************************************************************************************!*\
  42972. !*** ./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& ***!
  42973. \*************************************************************************************************************************************************************************************************************/
  42974. /*! exports provided: render, staticRenderFns */
  42975. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42976. "use strict";
  42977. __webpack_require__.r(__webpack_exports__);
  42978. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42979. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42980. var render = function() {
  42981. var _vm = this
  42982. var _h = _vm.$createElement
  42983. var _c = _vm._self._c || _h
  42984. return _c(
  42985. "div",
  42986. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  42987. [
  42988. _c(
  42989. "modal",
  42990. {
  42991. attrs: {
  42992. id: "credential" + this.data.credid + "editModal",
  42993. tabindex: "-1",
  42994. role: "dialog",
  42995. "aria-labelledby":
  42996. "credential" + this.data.credid + "editModalLabel"
  42997. }
  42998. },
  42999. [
  43000. _c(
  43001. "h5",
  43002. {
  43003. staticClass: "modal-title",
  43004. attrs: { slot: "header", id: "credentialeditModalLabel" },
  43005. slot: "header"
  43006. },
  43007. [_vm._v("\r\n Edit Credential\r\n ")]
  43008. ),
  43009. _vm._v(" "),
  43010. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43011. _c("div", { staticClass: "form-group" }, [
  43012. _c("label", { attrs: { for: "username" } }, [_vm._v("Username")]),
  43013. _vm._v(" "),
  43014. _c("input", {
  43015. directives: [
  43016. {
  43017. name: "model",
  43018. rawName: "v-model",
  43019. value: this.data.creduser,
  43020. expression: "this.data.creduser"
  43021. }
  43022. ],
  43023. staticClass: "form-control credential",
  43024. attrs: {
  43025. type: "text",
  43026. name: "username" + this.data.credid,
  43027. id: "username" + this.data.credid
  43028. },
  43029. domProps: { value: this.data.creduser },
  43030. on: {
  43031. input: function($event) {
  43032. if ($event.target.composing) {
  43033. return
  43034. }
  43035. _vm.$set(this.data, "creduser", $event.target.value)
  43036. }
  43037. }
  43038. })
  43039. ]),
  43040. _vm._v(" "),
  43041. _c("div", { staticClass: "form-group" }, [
  43042. _c("label", { attrs: { for: "password" } }, [_vm._v("Password")]),
  43043. _vm._v(" "),
  43044. _c("input", {
  43045. directives: [
  43046. {
  43047. name: "model",
  43048. rawName: "v-model",
  43049. value: this.data.credpass,
  43050. expression: "this.data.credpass"
  43051. }
  43052. ],
  43053. staticClass: "form-control credential",
  43054. attrs: {
  43055. type: "text",
  43056. name: "password" + this.data.credid,
  43057. id: "password" + this.data.credid
  43058. },
  43059. domProps: { value: this.data.credpass },
  43060. on: {
  43061. input: function($event) {
  43062. if ($event.target.composing) {
  43063. return
  43064. }
  43065. _vm.$set(this.data, "credpass", $event.target.value)
  43066. }
  43067. }
  43068. }),
  43069. _vm._v(" "),
  43070. _c(
  43071. "button",
  43072. {
  43073. staticClass: "btn btn-secondary",
  43074. attrs: { type: "button" },
  43075. on: {
  43076. click: function($event) {
  43077. return _vm.getRandomPassword()
  43078. }
  43079. }
  43080. },
  43081. [_vm._v("Generate Random")]
  43082. )
  43083. ]),
  43084. _vm._v(" "),
  43085. _c("div", { staticClass: "form-group" })
  43086. ]),
  43087. _vm._v(" "),
  43088. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43089. _c(
  43090. "button",
  43091. {
  43092. staticClass: "btn btn-secondary",
  43093. attrs: { type: "button", "data-dismiss": "modal" }
  43094. },
  43095. [_vm._v("Close")]
  43096. ),
  43097. _vm._v(" "),
  43098. _c(
  43099. "button",
  43100. {
  43101. staticClass: "btn btn-primary",
  43102. attrs: { type: "button" },
  43103. on: {
  43104. click: function($event) {
  43105. return _vm.updateCredential()
  43106. }
  43107. }
  43108. },
  43109. [_vm._v("Save")]
  43110. )
  43111. ])
  43112. ]
  43113. ),
  43114. _vm._v(" "),
  43115. _c("div", { staticClass: "row no-gutters" }, [
  43116. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43117. _vm._v(_vm._s(this.data.creddesc))
  43118. ]),
  43119. _vm._v(" "),
  43120. _c("div", { staticClass: "col-9 text-right" }, [
  43121. _vm._v(_vm._s(this.data.creddate))
  43122. ])
  43123. ]),
  43124. _vm._v(" "),
  43125. _c("div", { staticClass: "row" }, [
  43126. _c("div", { staticClass: "col-lg-9" }, [
  43127. _c("div", [
  43128. _vm._m(0),
  43129. _vm._v(" "),
  43130. _c("input", {
  43131. staticClass: "border-0 credential",
  43132. attrs: {
  43133. type: "text",
  43134. id: "username" + this.data.credid,
  43135. readonly: ""
  43136. },
  43137. domProps: { value: this.data.creduser }
  43138. }),
  43139. _vm._v(" "),
  43140. _c(
  43141. "button",
  43142. {
  43143. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43144. attrs: {
  43145. id: "btn-username" + this.data.credid,
  43146. "data-clipboard-target": "#username" + this.data.credid
  43147. }
  43148. },
  43149. [_c("i", { staticClass: "far fa-clone" })]
  43150. )
  43151. ]),
  43152. _vm._v(" "),
  43153. _c("div", [
  43154. _vm._m(1),
  43155. _vm._v(" "),
  43156. _c("input", {
  43157. staticClass: "border-0 credential",
  43158. attrs: {
  43159. type: "text",
  43160. id: "password" + this.data.credid,
  43161. readonly: ""
  43162. },
  43163. domProps: { value: this.data.credpass }
  43164. }),
  43165. _vm._v(" "),
  43166. _c(
  43167. "button",
  43168. {
  43169. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43170. attrs: {
  43171. id: "btn-password" + this.data.credid,
  43172. "data-clipboard-target": "#password" + this.data.credid
  43173. }
  43174. },
  43175. [_c("i", { staticClass: "far fa-clone" })]
  43176. )
  43177. ])
  43178. ]),
  43179. _vm._v(" "),
  43180. _c(
  43181. "div",
  43182. {
  43183. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43184. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43185. },
  43186. [
  43187. _c(
  43188. "button",
  43189. {
  43190. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43191. attrs: {
  43192. type: "button",
  43193. "data-toggle": "modal",
  43194. "data-target": "#credential" + this.data.credid + "editModal"
  43195. }
  43196. },
  43197. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43198. ),
  43199. _vm._v(" "),
  43200. _vm._m(2)
  43201. ]
  43202. )
  43203. ])
  43204. ],
  43205. 1
  43206. )
  43207. }
  43208. var staticRenderFns = [
  43209. function() {
  43210. var _vm = this
  43211. var _h = _vm.$createElement
  43212. var _c = _vm._self._c || _h
  43213. return _c("label", { attrs: { for: "username" } }, [
  43214. _c("i", { staticClass: "fas fa-fw fa-user" })
  43215. ])
  43216. },
  43217. function() {
  43218. var _vm = this
  43219. var _h = _vm.$createElement
  43220. var _c = _vm._self._c || _h
  43221. return _c("label", { attrs: { for: "password" } }, [
  43222. _c("i", { staticClass: "fas fa-fw fa-key" })
  43223. ])
  43224. },
  43225. function() {
  43226. var _vm = this
  43227. var _h = _vm.$createElement
  43228. var _c = _vm._self._c || _h
  43229. return _c(
  43230. "button",
  43231. {
  43232. staticClass: "btn btn-sm btn-danger p-lg-1",
  43233. attrs: { type: "button" }
  43234. },
  43235. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43236. )
  43237. }
  43238. ]
  43239. render._withStripped = true
  43240. /***/ }),
  43241. /***/ "./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&":
  43242. /*!********************************************************************************************************************************************************************************************************!*\
  43243. !*** ./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& ***!
  43244. \********************************************************************************************************************************************************************************************************/
  43245. /*! exports provided: render, staticRenderFns */
  43246. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43247. "use strict";
  43248. __webpack_require__.r(__webpack_exports__);
  43249. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43250. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43251. var render = function() {
  43252. var _vm = this
  43253. var _h = _vm.$createElement
  43254. var _c = _vm._self._c || _h
  43255. return _c("div", { staticClass: "modal fade" }, [
  43256. _c(
  43257. "div",
  43258. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43259. [
  43260. _c("div", { staticClass: "modal-content" }, [
  43261. _c(
  43262. "div",
  43263. { staticClass: "modal-header" },
  43264. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43265. 2
  43266. ),
  43267. _vm._v(" "),
  43268. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43269. _vm._v(" "),
  43270. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43271. ])
  43272. ]
  43273. )
  43274. ])
  43275. }
  43276. var staticRenderFns = [
  43277. function() {
  43278. var _vm = this
  43279. var _h = _vm.$createElement
  43280. var _c = _vm._self._c || _h
  43281. return _c(
  43282. "button",
  43283. {
  43284. staticClass: "close",
  43285. attrs: {
  43286. type: "button",
  43287. "data-dismiss": "modal",
  43288. "aria-label": "Close"
  43289. }
  43290. },
  43291. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43292. )
  43293. }
  43294. ]
  43295. render._withStripped = true
  43296. /***/ }),
  43297. /***/ "./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&":
  43298. /*!********************************************************************************************************************************************************************************************************!*\
  43299. !*** ./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& ***!
  43300. \********************************************************************************************************************************************************************************************************/
  43301. /*! exports provided: render, staticRenderFns */
  43302. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43303. "use strict";
  43304. __webpack_require__.r(__webpack_exports__);
  43305. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43306. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43307. var render = function() {
  43308. var _vm = this
  43309. var _h = _vm.$createElement
  43310. var _c = _vm._self._c || _h
  43311. return _c(
  43312. "ul",
  43313. { staticClass: "list-unstyled" },
  43314. _vm._l(this.notes, function(note) {
  43315. return _c(
  43316. "li",
  43317. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43318. [
  43319. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  43320. _c("div", { staticClass: "text-center p-0 m-0" }, [
  43321. _vm._v(_vm._s(note.noteuser))
  43322. ]),
  43323. _vm._v(" "),
  43324. _c(
  43325. "div",
  43326. { staticClass: "text-muted text-small text-center p-0 m-0" },
  43327. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  43328. ),
  43329. _vm._v(" "),
  43330. _c(
  43331. "div",
  43332. { staticClass: "btn-group justify-content-center p-0 m-0" },
  43333. [
  43334. _vm.authusername === note.noteuser ||
  43335. _vm.authusername === "admin"
  43336. ? [
  43337. _vm._m(0, true),
  43338. _vm._v(" "),
  43339. _vm._m(1, true),
  43340. _vm._v(" "),
  43341. _vm._m(2, true)
  43342. ]
  43343. : _vm._e()
  43344. ],
  43345. 2
  43346. )
  43347. ]),
  43348. _vm._v(" "),
  43349. _c("div", { staticClass: "col-md-10" }, [
  43350. _c("div", { staticClass: "card m-2" }, [
  43351. _c("div", { staticClass: "card-body p-2" }, [
  43352. _vm._v(
  43353. "\n " +
  43354. _vm._s(note.thenote) +
  43355. "\n "
  43356. )
  43357. ])
  43358. ])
  43359. ])
  43360. ]
  43361. )
  43362. }),
  43363. 0
  43364. )
  43365. }
  43366. var staticRenderFns = [
  43367. function() {
  43368. var _vm = this
  43369. var _h = _vm.$createElement
  43370. var _c = _vm._self._c || _h
  43371. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43372. _c("i", { staticClass: "fas fa-fw fa-edit" })
  43373. ])
  43374. },
  43375. function() {
  43376. var _vm = this
  43377. var _h = _vm.$createElement
  43378. var _c = _vm._self._c || _h
  43379. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  43380. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  43381. ])
  43382. },
  43383. function() {
  43384. var _vm = this
  43385. var _h = _vm.$createElement
  43386. var _c = _vm._self._c || _h
  43387. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43388. _c("i", { staticClass: "fa fa-fw fa-random" })
  43389. ])
  43390. }
  43391. ]
  43392. render._withStripped = true
  43393. /***/ }),
  43394. /***/ "./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&":
  43395. /*!*********************************************************************************************************************************************************************************************************!*\
  43396. !*** ./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& ***!
  43397. \*********************************************************************************************************************************************************************************************************/
  43398. /*! exports provided: render, staticRenderFns */
  43399. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43400. "use strict";
  43401. __webpack_require__.r(__webpack_exports__);
  43402. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43403. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43404. var render = function() {
  43405. var _vm = this
  43406. var _h = _vm.$createElement
  43407. var _c = _vm._self._c || _h
  43408. return _c(
  43409. "div",
  43410. [
  43411. _c(
  43412. "modal",
  43413. {
  43414. attrs: {
  43415. id: "workordereditModal",
  43416. tabindex: "-1",
  43417. role: "dialog",
  43418. "aria-labelledby": "workordereditModalLabel"
  43419. }
  43420. },
  43421. [
  43422. _c(
  43423. "h5",
  43424. {
  43425. staticClass: "modal-title",
  43426. attrs: { slot: "header", id: "workordereditModalLabel" },
  43427. slot: "header"
  43428. },
  43429. [_vm._v("\n Edit Work Order Information\n ")]
  43430. ),
  43431. _vm._v(" "),
  43432. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43433. _c("div", { staticClass: "form-group" }, [
  43434. _c("label", { attrs: { for: "probdesc" } }, [
  43435. _vm._v("Problem Description")
  43436. ]),
  43437. _vm._v(" "),
  43438. _c("textarea", {
  43439. directives: [
  43440. {
  43441. name: "model",
  43442. rawName: "v-model",
  43443. value: _vm.data.probdesc,
  43444. expression: "data.probdesc"
  43445. }
  43446. ],
  43447. staticClass: "form-control",
  43448. attrs: { id: "probdesc", name: "probdesc" },
  43449. domProps: { value: _vm.data.probdesc },
  43450. on: {
  43451. input: function($event) {
  43452. if ($event.target.composing) {
  43453. return
  43454. }
  43455. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43456. }
  43457. }
  43458. })
  43459. ]),
  43460. _vm._v(" "),
  43461. _c("div", { staticClass: "form-group" }, [
  43462. _c("label", { attrs: { for: "suggested" } }, [
  43463. _vm._v("Suggested Solution")
  43464. ]),
  43465. _vm._v(" "),
  43466. _c("textarea", {
  43467. directives: [
  43468. {
  43469. name: "model",
  43470. rawName: "v-model",
  43471. value: _vm.data.suggested,
  43472. expression: "data.suggested"
  43473. }
  43474. ],
  43475. staticClass: "form-control",
  43476. attrs: { id: "suggested", name: "suggested" },
  43477. domProps: { value: _vm.data.suggested },
  43478. on: {
  43479. input: function($event) {
  43480. if ($event.target.composing) {
  43481. return
  43482. }
  43483. _vm.$set(_vm.data, "suggested", $event.target.value)
  43484. }
  43485. }
  43486. })
  43487. ]),
  43488. _vm._v(" "),
  43489. _c("div", { staticClass: "form-group" }, [
  43490. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  43491. _vm._v(" "),
  43492. _vm.storeList
  43493. ? _c(
  43494. "select",
  43495. {
  43496. directives: [
  43497. {
  43498. name: "model",
  43499. rawName: "v-model",
  43500. value: _vm.data.storeid,
  43501. expression: "data.storeid"
  43502. }
  43503. ],
  43504. staticClass: "form-control",
  43505. attrs: { name: "storelist", id: "storelist" },
  43506. on: {
  43507. change: function($event) {
  43508. var $$selectedVal = Array.prototype.filter
  43509. .call($event.target.options, function(o) {
  43510. return o.selected
  43511. })
  43512. .map(function(o) {
  43513. var val = "_value" in o ? o._value : o.value
  43514. return val
  43515. })
  43516. _vm.$set(
  43517. _vm.data,
  43518. "storeid",
  43519. $event.target.multiple
  43520. ? $$selectedVal
  43521. : $$selectedVal[0]
  43522. )
  43523. }
  43524. }
  43525. },
  43526. _vm._l(_vm.storeList.values(), function(store) {
  43527. return _c(
  43528. "option",
  43529. {
  43530. key: store.storeid,
  43531. domProps: { value: store.storeid }
  43532. },
  43533. [
  43534. _vm._v(
  43535. "\n " +
  43536. _vm._s(store.storesname) +
  43537. "\n "
  43538. )
  43539. ]
  43540. )
  43541. }),
  43542. 0
  43543. )
  43544. : _vm._e()
  43545. ])
  43546. ]),
  43547. _vm._v(" "),
  43548. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43549. _c(
  43550. "button",
  43551. {
  43552. staticClass: "btn btn-secondary",
  43553. attrs: { type: "button", "data-dismiss": "modal" }
  43554. },
  43555. [_vm._v("Close")]
  43556. ),
  43557. _vm._v(" "),
  43558. _c(
  43559. "button",
  43560. {
  43561. staticClass: "btn btn-primary",
  43562. attrs: { type: "button" },
  43563. on: {
  43564. click: function($event) {
  43565. return _vm.updateWorkOrder()
  43566. }
  43567. }
  43568. },
  43569. [_vm._v("Save")]
  43570. )
  43571. ])
  43572. ]
  43573. ),
  43574. _vm._v(" "),
  43575. _c("p", [
  43576. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  43577. _vm._v(" "),
  43578. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  43579. ]),
  43580. _vm._v(" "),
  43581. _c("p", [
  43582. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  43583. _vm._v(" "),
  43584. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  43585. ]),
  43586. _vm._v(" "),
  43587. _c("p", [
  43588. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43589. _vm._v(" "),
  43590. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  43591. ]),
  43592. _vm._v(" "),
  43593. _c("p", [
  43594. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43595. _vm._v(" "),
  43596. this.storeList
  43597. ? _c("span", [
  43598. _vm._v(_vm._s(this.storeList.get(this.data.storeid).storesname))
  43599. ])
  43600. : _vm._e()
  43601. ]),
  43602. _vm._v(" "),
  43603. _c("p", [
  43604. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43605. _vm._v(" "),
  43606. _c(
  43607. "span",
  43608. {
  43609. staticClass: "dashed-underline",
  43610. attrs: {
  43611. "data-toggle": "tooltip",
  43612. "data-placement": "bottom",
  43613. title: this.getHRDate(this.data.dropdate)
  43614. }
  43615. },
  43616. [
  43617. _vm._v(
  43618. "\n " +
  43619. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  43620. " days ago\n "
  43621. )
  43622. ]
  43623. )
  43624. ]),
  43625. _vm._v(" "),
  43626. _c("p", [
  43627. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43628. _vm._v(" "),
  43629. !this.isZero(this.data.pickupdate)
  43630. ? _c(
  43631. "span",
  43632. {
  43633. staticClass: "dashed-underline",
  43634. attrs: {
  43635. "data-toggle": "tooltip",
  43636. "data-placement": "bottom",
  43637. title: this.getHRDate(this.data.pickupdate)
  43638. }
  43639. },
  43640. [
  43641. _vm._v(
  43642. "\n " +
  43643. _vm._s(
  43644. Math.floor(this.daysSinceToday(this.data.pickupdate))
  43645. ) +
  43646. " days ago\n "
  43647. )
  43648. ]
  43649. )
  43650. : _vm._e()
  43651. ]),
  43652. _vm._v(" "),
  43653. _c(
  43654. "button",
  43655. {
  43656. staticClass: "btn btn-primary",
  43657. attrs: {
  43658. type: "button",
  43659. "data-toggle": "modal",
  43660. "data-target": "#workordereditModal"
  43661. }
  43662. },
  43663. [_vm._v("Edit")]
  43664. )
  43665. ],
  43666. 1
  43667. )
  43668. }
  43669. var staticRenderFns = []
  43670. render._withStripped = true
  43671. /***/ }),
  43672. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43673. /*!********************************************************************!*\
  43674. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43675. \********************************************************************/
  43676. /*! exports provided: default */
  43677. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43678. "use strict";
  43679. __webpack_require__.r(__webpack_exports__);
  43680. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43681. /* globals __VUE_SSR_CONTEXT__ */
  43682. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43683. // This module is a runtime utility for cleaner component module output and will
  43684. // be included in the final webpack user bundle.
  43685. function normalizeComponent (
  43686. scriptExports,
  43687. render,
  43688. staticRenderFns,
  43689. functionalTemplate,
  43690. injectStyles,
  43691. scopeId,
  43692. moduleIdentifier, /* server only */
  43693. shadowMode /* vue-cli only */
  43694. ) {
  43695. // Vue.extend constructor export interop
  43696. var options = typeof scriptExports === 'function'
  43697. ? scriptExports.options
  43698. : scriptExports
  43699. // render functions
  43700. if (render) {
  43701. options.render = render
  43702. options.staticRenderFns = staticRenderFns
  43703. options._compiled = true
  43704. }
  43705. // functional template
  43706. if (functionalTemplate) {
  43707. options.functional = true
  43708. }
  43709. // scopedId
  43710. if (scopeId) {
  43711. options._scopeId = 'data-v-' + scopeId
  43712. }
  43713. var hook
  43714. if (moduleIdentifier) { // server build
  43715. hook = function (context) {
  43716. // 2.3 injection
  43717. context =
  43718. context || // cached call
  43719. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43720. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43721. // 2.2 with runInNewContext: true
  43722. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43723. context = __VUE_SSR_CONTEXT__
  43724. }
  43725. // inject component styles
  43726. if (injectStyles) {
  43727. injectStyles.call(this, context)
  43728. }
  43729. // register component module identifier for async chunk inferrence
  43730. if (context && context._registeredComponents) {
  43731. context._registeredComponents.add(moduleIdentifier)
  43732. }
  43733. }
  43734. // used by ssr in case component is cached and beforeCreate
  43735. // never gets called
  43736. options._ssrRegister = hook
  43737. } else if (injectStyles) {
  43738. hook = shadowMode
  43739. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  43740. : injectStyles
  43741. }
  43742. if (hook) {
  43743. if (options.functional) {
  43744. // for template-only hot-reload because in that case the render fn doesn't
  43745. // go through the normalizer
  43746. options._injectStyles = hook
  43747. // register for functioal component in vue file
  43748. var originalRender = options.render
  43749. options.render = function renderWithStyleInjection (h, context) {
  43750. hook.call(context)
  43751. return originalRender(h, context)
  43752. }
  43753. } else {
  43754. // inject component registration as beforeCreate hook
  43755. var existing = options.beforeCreate
  43756. options.beforeCreate = existing
  43757. ? [].concat(existing, hook)
  43758. : [hook]
  43759. }
  43760. }
  43761. return {
  43762. exports: scriptExports,
  43763. options: options
  43764. }
  43765. }
  43766. /***/ }),
  43767. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  43768. /*!*************************************************!*\
  43769. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  43770. \*************************************************/
  43771. /*! no static exports found */
  43772. /***/ (function(module, exports, __webpack_require__) {
  43773. "use strict";
  43774. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  43775. * Vue.js v2.6.11
  43776. * (c) 2014-2019 Evan You
  43777. * Released under the MIT License.
  43778. */
  43779. /* */
  43780. var emptyObject = Object.freeze({});
  43781. // These helpers produce better VM code in JS engines due to their
  43782. // explicitness and function inlining.
  43783. function isUndef (v) {
  43784. return v === undefined || v === null
  43785. }
  43786. function isDef (v) {
  43787. return v !== undefined && v !== null
  43788. }
  43789. function isTrue (v) {
  43790. return v === true
  43791. }
  43792. function isFalse (v) {
  43793. return v === false
  43794. }
  43795. /**
  43796. * Check if value is primitive.
  43797. */
  43798. function isPrimitive (value) {
  43799. return (
  43800. typeof value === 'string' ||
  43801. typeof value === 'number' ||
  43802. // $flow-disable-line
  43803. typeof value === 'symbol' ||
  43804. typeof value === 'boolean'
  43805. )
  43806. }
  43807. /**
  43808. * Quick object check - this is primarily used to tell
  43809. * Objects from primitive values when we know the value
  43810. * is a JSON-compliant type.
  43811. */
  43812. function isObject (obj) {
  43813. return obj !== null && typeof obj === 'object'
  43814. }
  43815. /**
  43816. * Get the raw type string of a value, e.g., [object Object].
  43817. */
  43818. var _toString = Object.prototype.toString;
  43819. function toRawType (value) {
  43820. return _toString.call(value).slice(8, -1)
  43821. }
  43822. /**
  43823. * Strict object type check. Only returns true
  43824. * for plain JavaScript objects.
  43825. */
  43826. function isPlainObject (obj) {
  43827. return _toString.call(obj) === '[object Object]'
  43828. }
  43829. function isRegExp (v) {
  43830. return _toString.call(v) === '[object RegExp]'
  43831. }
  43832. /**
  43833. * Check if val is a valid array index.
  43834. */
  43835. function isValidArrayIndex (val) {
  43836. var n = parseFloat(String(val));
  43837. return n >= 0 && Math.floor(n) === n && isFinite(val)
  43838. }
  43839. function isPromise (val) {
  43840. return (
  43841. isDef(val) &&
  43842. typeof val.then === 'function' &&
  43843. typeof val.catch === 'function'
  43844. )
  43845. }
  43846. /**
  43847. * Convert a value to a string that is actually rendered.
  43848. */
  43849. function toString (val) {
  43850. return val == null
  43851. ? ''
  43852. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  43853. ? JSON.stringify(val, null, 2)
  43854. : String(val)
  43855. }
  43856. /**
  43857. * Convert an input value to a number for persistence.
  43858. * If the conversion fails, return original string.
  43859. */
  43860. function toNumber (val) {
  43861. var n = parseFloat(val);
  43862. return isNaN(n) ? val : n
  43863. }
  43864. /**
  43865. * Make a map and return a function for checking if a key
  43866. * is in that map.
  43867. */
  43868. function makeMap (
  43869. str,
  43870. expectsLowerCase
  43871. ) {
  43872. var map = Object.create(null);
  43873. var list = str.split(',');
  43874. for (var i = 0; i < list.length; i++) {
  43875. map[list[i]] = true;
  43876. }
  43877. return expectsLowerCase
  43878. ? function (val) { return map[val.toLowerCase()]; }
  43879. : function (val) { return map[val]; }
  43880. }
  43881. /**
  43882. * Check if a tag is a built-in tag.
  43883. */
  43884. var isBuiltInTag = makeMap('slot,component', true);
  43885. /**
  43886. * Check if an attribute is a reserved attribute.
  43887. */
  43888. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  43889. /**
  43890. * Remove an item from an array.
  43891. */
  43892. function remove (arr, item) {
  43893. if (arr.length) {
  43894. var index = arr.indexOf(item);
  43895. if (index > -1) {
  43896. return arr.splice(index, 1)
  43897. }
  43898. }
  43899. }
  43900. /**
  43901. * Check whether an object has the property.
  43902. */
  43903. var hasOwnProperty = Object.prototype.hasOwnProperty;
  43904. function hasOwn (obj, key) {
  43905. return hasOwnProperty.call(obj, key)
  43906. }
  43907. /**
  43908. * Create a cached version of a pure function.
  43909. */
  43910. function cached (fn) {
  43911. var cache = Object.create(null);
  43912. return (function cachedFn (str) {
  43913. var hit = cache[str];
  43914. return hit || (cache[str] = fn(str))
  43915. })
  43916. }
  43917. /**
  43918. * Camelize a hyphen-delimited string.
  43919. */
  43920. var camelizeRE = /-(\w)/g;
  43921. var camelize = cached(function (str) {
  43922. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  43923. });
  43924. /**
  43925. * Capitalize a string.
  43926. */
  43927. var capitalize = cached(function (str) {
  43928. return str.charAt(0).toUpperCase() + str.slice(1)
  43929. });
  43930. /**
  43931. * Hyphenate a camelCase string.
  43932. */
  43933. var hyphenateRE = /\B([A-Z])/g;
  43934. var hyphenate = cached(function (str) {
  43935. return str.replace(hyphenateRE, '-$1').toLowerCase()
  43936. });
  43937. /**
  43938. * Simple bind polyfill for environments that do not support it,
  43939. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  43940. * since native bind is now performant enough in most browsers.
  43941. * But removing it would mean breaking code that was able to run in
  43942. * PhantomJS 1.x, so this must be kept for backward compatibility.
  43943. */
  43944. /* istanbul ignore next */
  43945. function polyfillBind (fn, ctx) {
  43946. function boundFn (a) {
  43947. var l = arguments.length;
  43948. return l
  43949. ? l > 1
  43950. ? fn.apply(ctx, arguments)
  43951. : fn.call(ctx, a)
  43952. : fn.call(ctx)
  43953. }
  43954. boundFn._length = fn.length;
  43955. return boundFn
  43956. }
  43957. function nativeBind (fn, ctx) {
  43958. return fn.bind(ctx)
  43959. }
  43960. var bind = Function.prototype.bind
  43961. ? nativeBind
  43962. : polyfillBind;
  43963. /**
  43964. * Convert an Array-like object to a real Array.
  43965. */
  43966. function toArray (list, start) {
  43967. start = start || 0;
  43968. var i = list.length - start;
  43969. var ret = new Array(i);
  43970. while (i--) {
  43971. ret[i] = list[i + start];
  43972. }
  43973. return ret
  43974. }
  43975. /**
  43976. * Mix properties into target object.
  43977. */
  43978. function extend (to, _from) {
  43979. for (var key in _from) {
  43980. to[key] = _from[key];
  43981. }
  43982. return to
  43983. }
  43984. /**
  43985. * Merge an Array of Objects into a single Object.
  43986. */
  43987. function toObject (arr) {
  43988. var res = {};
  43989. for (var i = 0; i < arr.length; i++) {
  43990. if (arr[i]) {
  43991. extend(res, arr[i]);
  43992. }
  43993. }
  43994. return res
  43995. }
  43996. /* eslint-disable no-unused-vars */
  43997. /**
  43998. * Perform no operation.
  43999. * Stubbing args to make Flow happy without leaving useless transpiled code
  44000. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44001. */
  44002. function noop (a, b, c) {}
  44003. /**
  44004. * Always return false.
  44005. */
  44006. var no = function (a, b, c) { return false; };
  44007. /* eslint-enable no-unused-vars */
  44008. /**
  44009. * Return the same value.
  44010. */
  44011. var identity = function (_) { return _; };
  44012. /**
  44013. * Generate a string containing static keys from compiler modules.
  44014. */
  44015. function genStaticKeys (modules) {
  44016. return modules.reduce(function (keys, m) {
  44017. return keys.concat(m.staticKeys || [])
  44018. }, []).join(',')
  44019. }
  44020. /**
  44021. * Check if two values are loosely equal - that is,
  44022. * if they are plain objects, do they have the same shape?
  44023. */
  44024. function looseEqual (a, b) {
  44025. if (a === b) { return true }
  44026. var isObjectA = isObject(a);
  44027. var isObjectB = isObject(b);
  44028. if (isObjectA && isObjectB) {
  44029. try {
  44030. var isArrayA = Array.isArray(a);
  44031. var isArrayB = Array.isArray(b);
  44032. if (isArrayA && isArrayB) {
  44033. return a.length === b.length && a.every(function (e, i) {
  44034. return looseEqual(e, b[i])
  44035. })
  44036. } else if (a instanceof Date && b instanceof Date) {
  44037. return a.getTime() === b.getTime()
  44038. } else if (!isArrayA && !isArrayB) {
  44039. var keysA = Object.keys(a);
  44040. var keysB = Object.keys(b);
  44041. return keysA.length === keysB.length && keysA.every(function (key) {
  44042. return looseEqual(a[key], b[key])
  44043. })
  44044. } else {
  44045. /* istanbul ignore next */
  44046. return false
  44047. }
  44048. } catch (e) {
  44049. /* istanbul ignore next */
  44050. return false
  44051. }
  44052. } else if (!isObjectA && !isObjectB) {
  44053. return String(a) === String(b)
  44054. } else {
  44055. return false
  44056. }
  44057. }
  44058. /**
  44059. * Return the first index at which a loosely equal value can be
  44060. * found in the array (if value is a plain object, the array must
  44061. * contain an object of the same shape), or -1 if it is not present.
  44062. */
  44063. function looseIndexOf (arr, val) {
  44064. for (var i = 0; i < arr.length; i++) {
  44065. if (looseEqual(arr[i], val)) { return i }
  44066. }
  44067. return -1
  44068. }
  44069. /**
  44070. * Ensure a function is called only once.
  44071. */
  44072. function once (fn) {
  44073. var called = false;
  44074. return function () {
  44075. if (!called) {
  44076. called = true;
  44077. fn.apply(this, arguments);
  44078. }
  44079. }
  44080. }
  44081. var SSR_ATTR = 'data-server-rendered';
  44082. var ASSET_TYPES = [
  44083. 'component',
  44084. 'directive',
  44085. 'filter'
  44086. ];
  44087. var LIFECYCLE_HOOKS = [
  44088. 'beforeCreate',
  44089. 'created',
  44090. 'beforeMount',
  44091. 'mounted',
  44092. 'beforeUpdate',
  44093. 'updated',
  44094. 'beforeDestroy',
  44095. 'destroyed',
  44096. 'activated',
  44097. 'deactivated',
  44098. 'errorCaptured',
  44099. 'serverPrefetch'
  44100. ];
  44101. /* */
  44102. var config = ({
  44103. /**
  44104. * Option merge strategies (used in core/util/options)
  44105. */
  44106. // $flow-disable-line
  44107. optionMergeStrategies: Object.create(null),
  44108. /**
  44109. * Whether to suppress warnings.
  44110. */
  44111. silent: false,
  44112. /**
  44113. * Show production mode tip message on boot?
  44114. */
  44115. productionTip: "development" !== 'production',
  44116. /**
  44117. * Whether to enable devtools
  44118. */
  44119. devtools: "development" !== 'production',
  44120. /**
  44121. * Whether to record perf
  44122. */
  44123. performance: false,
  44124. /**
  44125. * Error handler for watcher errors
  44126. */
  44127. errorHandler: null,
  44128. /**
  44129. * Warn handler for watcher warns
  44130. */
  44131. warnHandler: null,
  44132. /**
  44133. * Ignore certain custom elements
  44134. */
  44135. ignoredElements: [],
  44136. /**
  44137. * Custom user key aliases for v-on
  44138. */
  44139. // $flow-disable-line
  44140. keyCodes: Object.create(null),
  44141. /**
  44142. * Check if a tag is reserved so that it cannot be registered as a
  44143. * component. This is platform-dependent and may be overwritten.
  44144. */
  44145. isReservedTag: no,
  44146. /**
  44147. * Check if an attribute is reserved so that it cannot be used as a component
  44148. * prop. This is platform-dependent and may be overwritten.
  44149. */
  44150. isReservedAttr: no,
  44151. /**
  44152. * Check if a tag is an unknown element.
  44153. * Platform-dependent.
  44154. */
  44155. isUnknownElement: no,
  44156. /**
  44157. * Get the namespace of an element
  44158. */
  44159. getTagNamespace: noop,
  44160. /**
  44161. * Parse the real tag name for the specific platform.
  44162. */
  44163. parsePlatformTagName: identity,
  44164. /**
  44165. * Check if an attribute must be bound using property, e.g. value
  44166. * Platform-dependent.
  44167. */
  44168. mustUseProp: no,
  44169. /**
  44170. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44171. * This will significantly reduce performance if set to false.
  44172. */
  44173. async: true,
  44174. /**
  44175. * Exposed for legacy reasons
  44176. */
  44177. _lifecycleHooks: LIFECYCLE_HOOKS
  44178. });
  44179. /* */
  44180. /**
  44181. * unicode letters used for parsing html tags, component names and property paths.
  44182. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44183. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44184. */
  44185. 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/;
  44186. /**
  44187. * Check if a string starts with $ or _
  44188. */
  44189. function isReserved (str) {
  44190. var c = (str + '').charCodeAt(0);
  44191. return c === 0x24 || c === 0x5F
  44192. }
  44193. /**
  44194. * Define a property.
  44195. */
  44196. function def (obj, key, val, enumerable) {
  44197. Object.defineProperty(obj, key, {
  44198. value: val,
  44199. enumerable: !!enumerable,
  44200. writable: true,
  44201. configurable: true
  44202. });
  44203. }
  44204. /**
  44205. * Parse simple path.
  44206. */
  44207. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44208. function parsePath (path) {
  44209. if (bailRE.test(path)) {
  44210. return
  44211. }
  44212. var segments = path.split('.');
  44213. return function (obj) {
  44214. for (var i = 0; i < segments.length; i++) {
  44215. if (!obj) { return }
  44216. obj = obj[segments[i]];
  44217. }
  44218. return obj
  44219. }
  44220. }
  44221. /* */
  44222. // can we use __proto__?
  44223. var hasProto = '__proto__' in {};
  44224. // Browser environment sniffing
  44225. var inBrowser = typeof window !== 'undefined';
  44226. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44227. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44228. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44229. var isIE = UA && /msie|trident/.test(UA);
  44230. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44231. var isEdge = UA && UA.indexOf('edge/') > 0;
  44232. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44233. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44234. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44235. var isPhantomJS = UA && /phantomjs/.test(UA);
  44236. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44237. // Firefox has a "watch" function on Object.prototype...
  44238. var nativeWatch = ({}).watch;
  44239. var supportsPassive = false;
  44240. if (inBrowser) {
  44241. try {
  44242. var opts = {};
  44243. Object.defineProperty(opts, 'passive', ({
  44244. get: function get () {
  44245. /* istanbul ignore next */
  44246. supportsPassive = true;
  44247. }
  44248. })); // https://github.com/facebook/flow/issues/285
  44249. window.addEventListener('test-passive', null, opts);
  44250. } catch (e) {}
  44251. }
  44252. // this needs to be lazy-evaled because vue may be required before
  44253. // vue-server-renderer can set VUE_ENV
  44254. var _isServer;
  44255. var isServerRendering = function () {
  44256. if (_isServer === undefined) {
  44257. /* istanbul ignore if */
  44258. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44259. // detect presence of vue-server-renderer and avoid
  44260. // Webpack shimming the process
  44261. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44262. } else {
  44263. _isServer = false;
  44264. }
  44265. }
  44266. return _isServer
  44267. };
  44268. // detect devtools
  44269. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44270. /* istanbul ignore next */
  44271. function isNative (Ctor) {
  44272. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44273. }
  44274. var hasSymbol =
  44275. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44276. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44277. var _Set;
  44278. /* istanbul ignore if */ // $flow-disable-line
  44279. if (typeof Set !== 'undefined' && isNative(Set)) {
  44280. // use native Set when available.
  44281. _Set = Set;
  44282. } else {
  44283. // a non-standard Set polyfill that only works with primitive keys.
  44284. _Set = /*@__PURE__*/(function () {
  44285. function Set () {
  44286. this.set = Object.create(null);
  44287. }
  44288. Set.prototype.has = function has (key) {
  44289. return this.set[key] === true
  44290. };
  44291. Set.prototype.add = function add (key) {
  44292. this.set[key] = true;
  44293. };
  44294. Set.prototype.clear = function clear () {
  44295. this.set = Object.create(null);
  44296. };
  44297. return Set;
  44298. }());
  44299. }
  44300. /* */
  44301. var warn = noop;
  44302. var tip = noop;
  44303. var generateComponentTrace = (noop); // work around flow check
  44304. var formatComponentName = (noop);
  44305. {
  44306. var hasConsole = typeof console !== 'undefined';
  44307. var classifyRE = /(?:^|[-_])(\w)/g;
  44308. var classify = function (str) { return str
  44309. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  44310. .replace(/[-_]/g, ''); };
  44311. warn = function (msg, vm) {
  44312. var trace = vm ? generateComponentTrace(vm) : '';
  44313. if (config.warnHandler) {
  44314. config.warnHandler.call(null, msg, vm, trace);
  44315. } else if (hasConsole && (!config.silent)) {
  44316. console.error(("[Vue warn]: " + msg + trace));
  44317. }
  44318. };
  44319. tip = function (msg, vm) {
  44320. if (hasConsole && (!config.silent)) {
  44321. console.warn("[Vue tip]: " + msg + (
  44322. vm ? generateComponentTrace(vm) : ''
  44323. ));
  44324. }
  44325. };
  44326. formatComponentName = function (vm, includeFile) {
  44327. if (vm.$root === vm) {
  44328. return '<Root>'
  44329. }
  44330. var options = typeof vm === 'function' && vm.cid != null
  44331. ? vm.options
  44332. : vm._isVue
  44333. ? vm.$options || vm.constructor.options
  44334. : vm;
  44335. var name = options.name || options._componentTag;
  44336. var file = options.__file;
  44337. if (!name && file) {
  44338. var match = file.match(/([^/\\]+)\.vue$/);
  44339. name = match && match[1];
  44340. }
  44341. return (
  44342. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  44343. (file && includeFile !== false ? (" at " + file) : '')
  44344. )
  44345. };
  44346. var repeat = function (str, n) {
  44347. var res = '';
  44348. while (n) {
  44349. if (n % 2 === 1) { res += str; }
  44350. if (n > 1) { str += str; }
  44351. n >>= 1;
  44352. }
  44353. return res
  44354. };
  44355. generateComponentTrace = function (vm) {
  44356. if (vm._isVue && vm.$parent) {
  44357. var tree = [];
  44358. var currentRecursiveSequence = 0;
  44359. while (vm) {
  44360. if (tree.length > 0) {
  44361. var last = tree[tree.length - 1];
  44362. if (last.constructor === vm.constructor) {
  44363. currentRecursiveSequence++;
  44364. vm = vm.$parent;
  44365. continue
  44366. } else if (currentRecursiveSequence > 0) {
  44367. tree[tree.length - 1] = [last, currentRecursiveSequence];
  44368. currentRecursiveSequence = 0;
  44369. }
  44370. }
  44371. tree.push(vm);
  44372. vm = vm.$parent;
  44373. }
  44374. return '\n\nfound in\n\n' + tree
  44375. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  44376. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  44377. : formatComponentName(vm))); })
  44378. .join('\n')
  44379. } else {
  44380. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  44381. }
  44382. };
  44383. }
  44384. /* */
  44385. var uid = 0;
  44386. /**
  44387. * A dep is an observable that can have multiple
  44388. * directives subscribing to it.
  44389. */
  44390. var Dep = function Dep () {
  44391. this.id = uid++;
  44392. this.subs = [];
  44393. };
  44394. Dep.prototype.addSub = function addSub (sub) {
  44395. this.subs.push(sub);
  44396. };
  44397. Dep.prototype.removeSub = function removeSub (sub) {
  44398. remove(this.subs, sub);
  44399. };
  44400. Dep.prototype.depend = function depend () {
  44401. if (Dep.target) {
  44402. Dep.target.addDep(this);
  44403. }
  44404. };
  44405. Dep.prototype.notify = function notify () {
  44406. // stabilize the subscriber list first
  44407. var subs = this.subs.slice();
  44408. if (!config.async) {
  44409. // subs aren't sorted in scheduler if not running async
  44410. // we need to sort them now to make sure they fire in correct
  44411. // order
  44412. subs.sort(function (a, b) { return a.id - b.id; });
  44413. }
  44414. for (var i = 0, l = subs.length; i < l; i++) {
  44415. subs[i].update();
  44416. }
  44417. };
  44418. // The current target watcher being evaluated.
  44419. // This is globally unique because only one watcher
  44420. // can be evaluated at a time.
  44421. Dep.target = null;
  44422. var targetStack = [];
  44423. function pushTarget (target) {
  44424. targetStack.push(target);
  44425. Dep.target = target;
  44426. }
  44427. function popTarget () {
  44428. targetStack.pop();
  44429. Dep.target = targetStack[targetStack.length - 1];
  44430. }
  44431. /* */
  44432. var VNode = function VNode (
  44433. tag,
  44434. data,
  44435. children,
  44436. text,
  44437. elm,
  44438. context,
  44439. componentOptions,
  44440. asyncFactory
  44441. ) {
  44442. this.tag = tag;
  44443. this.data = data;
  44444. this.children = children;
  44445. this.text = text;
  44446. this.elm = elm;
  44447. this.ns = undefined;
  44448. this.context = context;
  44449. this.fnContext = undefined;
  44450. this.fnOptions = undefined;
  44451. this.fnScopeId = undefined;
  44452. this.key = data && data.key;
  44453. this.componentOptions = componentOptions;
  44454. this.componentInstance = undefined;
  44455. this.parent = undefined;
  44456. this.raw = false;
  44457. this.isStatic = false;
  44458. this.isRootInsert = true;
  44459. this.isComment = false;
  44460. this.isCloned = false;
  44461. this.isOnce = false;
  44462. this.asyncFactory = asyncFactory;
  44463. this.asyncMeta = undefined;
  44464. this.isAsyncPlaceholder = false;
  44465. };
  44466. var prototypeAccessors = { child: { configurable: true } };
  44467. // DEPRECATED: alias for componentInstance for backwards compat.
  44468. /* istanbul ignore next */
  44469. prototypeAccessors.child.get = function () {
  44470. return this.componentInstance
  44471. };
  44472. Object.defineProperties( VNode.prototype, prototypeAccessors );
  44473. var createEmptyVNode = function (text) {
  44474. if ( text === void 0 ) text = '';
  44475. var node = new VNode();
  44476. node.text = text;
  44477. node.isComment = true;
  44478. return node
  44479. };
  44480. function createTextVNode (val) {
  44481. return new VNode(undefined, undefined, undefined, String(val))
  44482. }
  44483. // optimized shallow clone
  44484. // used for static nodes and slot nodes because they may be reused across
  44485. // multiple renders, cloning them avoids errors when DOM manipulations rely
  44486. // on their elm reference.
  44487. function cloneVNode (vnode) {
  44488. var cloned = new VNode(
  44489. vnode.tag,
  44490. vnode.data,
  44491. // #7975
  44492. // clone children array to avoid mutating original in case of cloning
  44493. // a child.
  44494. vnode.children && vnode.children.slice(),
  44495. vnode.text,
  44496. vnode.elm,
  44497. vnode.context,
  44498. vnode.componentOptions,
  44499. vnode.asyncFactory
  44500. );
  44501. cloned.ns = vnode.ns;
  44502. cloned.isStatic = vnode.isStatic;
  44503. cloned.key = vnode.key;
  44504. cloned.isComment = vnode.isComment;
  44505. cloned.fnContext = vnode.fnContext;
  44506. cloned.fnOptions = vnode.fnOptions;
  44507. cloned.fnScopeId = vnode.fnScopeId;
  44508. cloned.asyncMeta = vnode.asyncMeta;
  44509. cloned.isCloned = true;
  44510. return cloned
  44511. }
  44512. /*
  44513. * not type checking this file because flow doesn't play well with
  44514. * dynamically accessing methods on Array prototype
  44515. */
  44516. var arrayProto = Array.prototype;
  44517. var arrayMethods = Object.create(arrayProto);
  44518. var methodsToPatch = [
  44519. 'push',
  44520. 'pop',
  44521. 'shift',
  44522. 'unshift',
  44523. 'splice',
  44524. 'sort',
  44525. 'reverse'
  44526. ];
  44527. /**
  44528. * Intercept mutating methods and emit events
  44529. */
  44530. methodsToPatch.forEach(function (method) {
  44531. // cache original method
  44532. var original = arrayProto[method];
  44533. def(arrayMethods, method, function mutator () {
  44534. var args = [], len = arguments.length;
  44535. while ( len-- ) args[ len ] = arguments[ len ];
  44536. var result = original.apply(this, args);
  44537. var ob = this.__ob__;
  44538. var inserted;
  44539. switch (method) {
  44540. case 'push':
  44541. case 'unshift':
  44542. inserted = args;
  44543. break
  44544. case 'splice':
  44545. inserted = args.slice(2);
  44546. break
  44547. }
  44548. if (inserted) { ob.observeArray(inserted); }
  44549. // notify change
  44550. ob.dep.notify();
  44551. return result
  44552. });
  44553. });
  44554. /* */
  44555. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  44556. /**
  44557. * In some cases we may want to disable observation inside a component's
  44558. * update computation.
  44559. */
  44560. var shouldObserve = true;
  44561. function toggleObserving (value) {
  44562. shouldObserve = value;
  44563. }
  44564. /**
  44565. * Observer class that is attached to each observed
  44566. * object. Once attached, the observer converts the target
  44567. * object's property keys into getter/setters that
  44568. * collect dependencies and dispatch updates.
  44569. */
  44570. var Observer = function Observer (value) {
  44571. this.value = value;
  44572. this.dep = new Dep();
  44573. this.vmCount = 0;
  44574. def(value, '__ob__', this);
  44575. if (Array.isArray(value)) {
  44576. if (hasProto) {
  44577. protoAugment(value, arrayMethods);
  44578. } else {
  44579. copyAugment(value, arrayMethods, arrayKeys);
  44580. }
  44581. this.observeArray(value);
  44582. } else {
  44583. this.walk(value);
  44584. }
  44585. };
  44586. /**
  44587. * Walk through all properties and convert them into
  44588. * getter/setters. This method should only be called when
  44589. * value type is Object.
  44590. */
  44591. Observer.prototype.walk = function walk (obj) {
  44592. var keys = Object.keys(obj);
  44593. for (var i = 0; i < keys.length; i++) {
  44594. defineReactive$$1(obj, keys[i]);
  44595. }
  44596. };
  44597. /**
  44598. * Observe a list of Array items.
  44599. */
  44600. Observer.prototype.observeArray = function observeArray (items) {
  44601. for (var i = 0, l = items.length; i < l; i++) {
  44602. observe(items[i]);
  44603. }
  44604. };
  44605. // helpers
  44606. /**
  44607. * Augment a target Object or Array by intercepting
  44608. * the prototype chain using __proto__
  44609. */
  44610. function protoAugment (target, src) {
  44611. /* eslint-disable no-proto */
  44612. target.__proto__ = src;
  44613. /* eslint-enable no-proto */
  44614. }
  44615. /**
  44616. * Augment a target Object or Array by defining
  44617. * hidden properties.
  44618. */
  44619. /* istanbul ignore next */
  44620. function copyAugment (target, src, keys) {
  44621. for (var i = 0, l = keys.length; i < l; i++) {
  44622. var key = keys[i];
  44623. def(target, key, src[key]);
  44624. }
  44625. }
  44626. /**
  44627. * Attempt to create an observer instance for a value,
  44628. * returns the new observer if successfully observed,
  44629. * or the existing observer if the value already has one.
  44630. */
  44631. function observe (value, asRootData) {
  44632. if (!isObject(value) || value instanceof VNode) {
  44633. return
  44634. }
  44635. var ob;
  44636. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  44637. ob = value.__ob__;
  44638. } else if (
  44639. shouldObserve &&
  44640. !isServerRendering() &&
  44641. (Array.isArray(value) || isPlainObject(value)) &&
  44642. Object.isExtensible(value) &&
  44643. !value._isVue
  44644. ) {
  44645. ob = new Observer(value);
  44646. }
  44647. if (asRootData && ob) {
  44648. ob.vmCount++;
  44649. }
  44650. return ob
  44651. }
  44652. /**
  44653. * Define a reactive property on an Object.
  44654. */
  44655. function defineReactive$$1 (
  44656. obj,
  44657. key,
  44658. val,
  44659. customSetter,
  44660. shallow
  44661. ) {
  44662. var dep = new Dep();
  44663. var property = Object.getOwnPropertyDescriptor(obj, key);
  44664. if (property && property.configurable === false) {
  44665. return
  44666. }
  44667. // cater for pre-defined getter/setters
  44668. var getter = property && property.get;
  44669. var setter = property && property.set;
  44670. if ((!getter || setter) && arguments.length === 2) {
  44671. val = obj[key];
  44672. }
  44673. var childOb = !shallow && observe(val);
  44674. Object.defineProperty(obj, key, {
  44675. enumerable: true,
  44676. configurable: true,
  44677. get: function reactiveGetter () {
  44678. var value = getter ? getter.call(obj) : val;
  44679. if (Dep.target) {
  44680. dep.depend();
  44681. if (childOb) {
  44682. childOb.dep.depend();
  44683. if (Array.isArray(value)) {
  44684. dependArray(value);
  44685. }
  44686. }
  44687. }
  44688. return value
  44689. },
  44690. set: function reactiveSetter (newVal) {
  44691. var value = getter ? getter.call(obj) : val;
  44692. /* eslint-disable no-self-compare */
  44693. if (newVal === value || (newVal !== newVal && value !== value)) {
  44694. return
  44695. }
  44696. /* eslint-enable no-self-compare */
  44697. if (customSetter) {
  44698. customSetter();
  44699. }
  44700. // #7981: for accessor properties without setter
  44701. if (getter && !setter) { return }
  44702. if (setter) {
  44703. setter.call(obj, newVal);
  44704. } else {
  44705. val = newVal;
  44706. }
  44707. childOb = !shallow && observe(newVal);
  44708. dep.notify();
  44709. }
  44710. });
  44711. }
  44712. /**
  44713. * Set a property on an object. Adds the new property and
  44714. * triggers change notification if the property doesn't
  44715. * already exist.
  44716. */
  44717. function set (target, key, val) {
  44718. if (isUndef(target) || isPrimitive(target)
  44719. ) {
  44720. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  44721. }
  44722. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44723. target.length = Math.max(target.length, key);
  44724. target.splice(key, 1, val);
  44725. return val
  44726. }
  44727. if (key in target && !(key in Object.prototype)) {
  44728. target[key] = val;
  44729. return val
  44730. }
  44731. var ob = (target).__ob__;
  44732. if (target._isVue || (ob && ob.vmCount)) {
  44733. warn(
  44734. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  44735. 'at runtime - declare it upfront in the data option.'
  44736. );
  44737. return val
  44738. }
  44739. if (!ob) {
  44740. target[key] = val;
  44741. return val
  44742. }
  44743. defineReactive$$1(ob.value, key, val);
  44744. ob.dep.notify();
  44745. return val
  44746. }
  44747. /**
  44748. * Delete a property and trigger change if necessary.
  44749. */
  44750. function del (target, key) {
  44751. if (isUndef(target) || isPrimitive(target)
  44752. ) {
  44753. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  44754. }
  44755. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44756. target.splice(key, 1);
  44757. return
  44758. }
  44759. var ob = (target).__ob__;
  44760. if (target._isVue || (ob && ob.vmCount)) {
  44761. warn(
  44762. 'Avoid deleting properties on a Vue instance or its root $data ' +
  44763. '- just set it to null.'
  44764. );
  44765. return
  44766. }
  44767. if (!hasOwn(target, key)) {
  44768. return
  44769. }
  44770. delete target[key];
  44771. if (!ob) {
  44772. return
  44773. }
  44774. ob.dep.notify();
  44775. }
  44776. /**
  44777. * Collect dependencies on array elements when the array is touched, since
  44778. * we cannot intercept array element access like property getters.
  44779. */
  44780. function dependArray (value) {
  44781. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  44782. e = value[i];
  44783. e && e.__ob__ && e.__ob__.dep.depend();
  44784. if (Array.isArray(e)) {
  44785. dependArray(e);
  44786. }
  44787. }
  44788. }
  44789. /* */
  44790. /**
  44791. * Option overwriting strategies are functions that handle
  44792. * how to merge a parent option value and a child option
  44793. * value into the final value.
  44794. */
  44795. var strats = config.optionMergeStrategies;
  44796. /**
  44797. * Options with restrictions
  44798. */
  44799. {
  44800. strats.el = strats.propsData = function (parent, child, vm, key) {
  44801. if (!vm) {
  44802. warn(
  44803. "option \"" + key + "\" can only be used during instance " +
  44804. 'creation with the `new` keyword.'
  44805. );
  44806. }
  44807. return defaultStrat(parent, child)
  44808. };
  44809. }
  44810. /**
  44811. * Helper that recursively merges two data objects together.
  44812. */
  44813. function mergeData (to, from) {
  44814. if (!from) { return to }
  44815. var key, toVal, fromVal;
  44816. var keys = hasSymbol
  44817. ? Reflect.ownKeys(from)
  44818. : Object.keys(from);
  44819. for (var i = 0; i < keys.length; i++) {
  44820. key = keys[i];
  44821. // in case the object is already observed...
  44822. if (key === '__ob__') { continue }
  44823. toVal = to[key];
  44824. fromVal = from[key];
  44825. if (!hasOwn(to, key)) {
  44826. set(to, key, fromVal);
  44827. } else if (
  44828. toVal !== fromVal &&
  44829. isPlainObject(toVal) &&
  44830. isPlainObject(fromVal)
  44831. ) {
  44832. mergeData(toVal, fromVal);
  44833. }
  44834. }
  44835. return to
  44836. }
  44837. /**
  44838. * Data
  44839. */
  44840. function mergeDataOrFn (
  44841. parentVal,
  44842. childVal,
  44843. vm
  44844. ) {
  44845. if (!vm) {
  44846. // in a Vue.extend merge, both should be functions
  44847. if (!childVal) {
  44848. return parentVal
  44849. }
  44850. if (!parentVal) {
  44851. return childVal
  44852. }
  44853. // when parentVal & childVal are both present,
  44854. // we need to return a function that returns the
  44855. // merged result of both functions... no need to
  44856. // check if parentVal is a function here because
  44857. // it has to be a function to pass previous merges.
  44858. return function mergedDataFn () {
  44859. return mergeData(
  44860. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  44861. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  44862. )
  44863. }
  44864. } else {
  44865. return function mergedInstanceDataFn () {
  44866. // instance merge
  44867. var instanceData = typeof childVal === 'function'
  44868. ? childVal.call(vm, vm)
  44869. : childVal;
  44870. var defaultData = typeof parentVal === 'function'
  44871. ? parentVal.call(vm, vm)
  44872. : parentVal;
  44873. if (instanceData) {
  44874. return mergeData(instanceData, defaultData)
  44875. } else {
  44876. return defaultData
  44877. }
  44878. }
  44879. }
  44880. }
  44881. strats.data = function (
  44882. parentVal,
  44883. childVal,
  44884. vm
  44885. ) {
  44886. if (!vm) {
  44887. if (childVal && typeof childVal !== 'function') {
  44888. warn(
  44889. 'The "data" option should be a function ' +
  44890. 'that returns a per-instance value in component ' +
  44891. 'definitions.',
  44892. vm
  44893. );
  44894. return parentVal
  44895. }
  44896. return mergeDataOrFn(parentVal, childVal)
  44897. }
  44898. return mergeDataOrFn(parentVal, childVal, vm)
  44899. };
  44900. /**
  44901. * Hooks and props are merged as arrays.
  44902. */
  44903. function mergeHook (
  44904. parentVal,
  44905. childVal
  44906. ) {
  44907. var res = childVal
  44908. ? parentVal
  44909. ? parentVal.concat(childVal)
  44910. : Array.isArray(childVal)
  44911. ? childVal
  44912. : [childVal]
  44913. : parentVal;
  44914. return res
  44915. ? dedupeHooks(res)
  44916. : res
  44917. }
  44918. function dedupeHooks (hooks) {
  44919. var res = [];
  44920. for (var i = 0; i < hooks.length; i++) {
  44921. if (res.indexOf(hooks[i]) === -1) {
  44922. res.push(hooks[i]);
  44923. }
  44924. }
  44925. return res
  44926. }
  44927. LIFECYCLE_HOOKS.forEach(function (hook) {
  44928. strats[hook] = mergeHook;
  44929. });
  44930. /**
  44931. * Assets
  44932. *
  44933. * When a vm is present (instance creation), we need to do
  44934. * a three-way merge between constructor options, instance
  44935. * options and parent options.
  44936. */
  44937. function mergeAssets (
  44938. parentVal,
  44939. childVal,
  44940. vm,
  44941. key
  44942. ) {
  44943. var res = Object.create(parentVal || null);
  44944. if (childVal) {
  44945. assertObjectType(key, childVal, vm);
  44946. return extend(res, childVal)
  44947. } else {
  44948. return res
  44949. }
  44950. }
  44951. ASSET_TYPES.forEach(function (type) {
  44952. strats[type + 's'] = mergeAssets;
  44953. });
  44954. /**
  44955. * Watchers.
  44956. *
  44957. * Watchers hashes should not overwrite one
  44958. * another, so we merge them as arrays.
  44959. */
  44960. strats.watch = function (
  44961. parentVal,
  44962. childVal,
  44963. vm,
  44964. key
  44965. ) {
  44966. // work around Firefox's Object.prototype.watch...
  44967. if (parentVal === nativeWatch) { parentVal = undefined; }
  44968. if (childVal === nativeWatch) { childVal = undefined; }
  44969. /* istanbul ignore if */
  44970. if (!childVal) { return Object.create(parentVal || null) }
  44971. {
  44972. assertObjectType(key, childVal, vm);
  44973. }
  44974. if (!parentVal) { return childVal }
  44975. var ret = {};
  44976. extend(ret, parentVal);
  44977. for (var key$1 in childVal) {
  44978. var parent = ret[key$1];
  44979. var child = childVal[key$1];
  44980. if (parent && !Array.isArray(parent)) {
  44981. parent = [parent];
  44982. }
  44983. ret[key$1] = parent
  44984. ? parent.concat(child)
  44985. : Array.isArray(child) ? child : [child];
  44986. }
  44987. return ret
  44988. };
  44989. /**
  44990. * Other object hashes.
  44991. */
  44992. strats.props =
  44993. strats.methods =
  44994. strats.inject =
  44995. strats.computed = function (
  44996. parentVal,
  44997. childVal,
  44998. vm,
  44999. key
  45000. ) {
  45001. if (childVal && "development" !== 'production') {
  45002. assertObjectType(key, childVal, vm);
  45003. }
  45004. if (!parentVal) { return childVal }
  45005. var ret = Object.create(null);
  45006. extend(ret, parentVal);
  45007. if (childVal) { extend(ret, childVal); }
  45008. return ret
  45009. };
  45010. strats.provide = mergeDataOrFn;
  45011. /**
  45012. * Default strategy.
  45013. */
  45014. var defaultStrat = function (parentVal, childVal) {
  45015. return childVal === undefined
  45016. ? parentVal
  45017. : childVal
  45018. };
  45019. /**
  45020. * Validate component names
  45021. */
  45022. function checkComponents (options) {
  45023. for (var key in options.components) {
  45024. validateComponentName(key);
  45025. }
  45026. }
  45027. function validateComponentName (name) {
  45028. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45029. warn(
  45030. 'Invalid component name: "' + name + '". Component names ' +
  45031. 'should conform to valid custom element name in html5 specification.'
  45032. );
  45033. }
  45034. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45035. warn(
  45036. 'Do not use built-in or reserved HTML elements as component ' +
  45037. 'id: ' + name
  45038. );
  45039. }
  45040. }
  45041. /**
  45042. * Ensure all props option syntax are normalized into the
  45043. * Object-based format.
  45044. */
  45045. function normalizeProps (options, vm) {
  45046. var props = options.props;
  45047. if (!props) { return }
  45048. var res = {};
  45049. var i, val, name;
  45050. if (Array.isArray(props)) {
  45051. i = props.length;
  45052. while (i--) {
  45053. val = props[i];
  45054. if (typeof val === 'string') {
  45055. name = camelize(val);
  45056. res[name] = { type: null };
  45057. } else {
  45058. warn('props must be strings when using array syntax.');
  45059. }
  45060. }
  45061. } else if (isPlainObject(props)) {
  45062. for (var key in props) {
  45063. val = props[key];
  45064. name = camelize(key);
  45065. res[name] = isPlainObject(val)
  45066. ? val
  45067. : { type: val };
  45068. }
  45069. } else {
  45070. warn(
  45071. "Invalid value for option \"props\": expected an Array or an Object, " +
  45072. "but got " + (toRawType(props)) + ".",
  45073. vm
  45074. );
  45075. }
  45076. options.props = res;
  45077. }
  45078. /**
  45079. * Normalize all injections into Object-based format
  45080. */
  45081. function normalizeInject (options, vm) {
  45082. var inject = options.inject;
  45083. if (!inject) { return }
  45084. var normalized = options.inject = {};
  45085. if (Array.isArray(inject)) {
  45086. for (var i = 0; i < inject.length; i++) {
  45087. normalized[inject[i]] = { from: inject[i] };
  45088. }
  45089. } else if (isPlainObject(inject)) {
  45090. for (var key in inject) {
  45091. var val = inject[key];
  45092. normalized[key] = isPlainObject(val)
  45093. ? extend({ from: key }, val)
  45094. : { from: val };
  45095. }
  45096. } else {
  45097. warn(
  45098. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45099. "but got " + (toRawType(inject)) + ".",
  45100. vm
  45101. );
  45102. }
  45103. }
  45104. /**
  45105. * Normalize raw function directives into object format.
  45106. */
  45107. function normalizeDirectives (options) {
  45108. var dirs = options.directives;
  45109. if (dirs) {
  45110. for (var key in dirs) {
  45111. var def$$1 = dirs[key];
  45112. if (typeof def$$1 === 'function') {
  45113. dirs[key] = { bind: def$$1, update: def$$1 };
  45114. }
  45115. }
  45116. }
  45117. }
  45118. function assertObjectType (name, value, vm) {
  45119. if (!isPlainObject(value)) {
  45120. warn(
  45121. "Invalid value for option \"" + name + "\": expected an Object, " +
  45122. "but got " + (toRawType(value)) + ".",
  45123. vm
  45124. );
  45125. }
  45126. }
  45127. /**
  45128. * Merge two option objects into a new one.
  45129. * Core utility used in both instantiation and inheritance.
  45130. */
  45131. function mergeOptions (
  45132. parent,
  45133. child,
  45134. vm
  45135. ) {
  45136. {
  45137. checkComponents(child);
  45138. }
  45139. if (typeof child === 'function') {
  45140. child = child.options;
  45141. }
  45142. normalizeProps(child, vm);
  45143. normalizeInject(child, vm);
  45144. normalizeDirectives(child);
  45145. // Apply extends and mixins on the child options,
  45146. // but only if it is a raw options object that isn't
  45147. // the result of another mergeOptions call.
  45148. // Only merged options has the _base property.
  45149. if (!child._base) {
  45150. if (child.extends) {
  45151. parent = mergeOptions(parent, child.extends, vm);
  45152. }
  45153. if (child.mixins) {
  45154. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45155. parent = mergeOptions(parent, child.mixins[i], vm);
  45156. }
  45157. }
  45158. }
  45159. var options = {};
  45160. var key;
  45161. for (key in parent) {
  45162. mergeField(key);
  45163. }
  45164. for (key in child) {
  45165. if (!hasOwn(parent, key)) {
  45166. mergeField(key);
  45167. }
  45168. }
  45169. function mergeField (key) {
  45170. var strat = strats[key] || defaultStrat;
  45171. options[key] = strat(parent[key], child[key], vm, key);
  45172. }
  45173. return options
  45174. }
  45175. /**
  45176. * Resolve an asset.
  45177. * This function is used because child instances need access
  45178. * to assets defined in its ancestor chain.
  45179. */
  45180. function resolveAsset (
  45181. options,
  45182. type,
  45183. id,
  45184. warnMissing
  45185. ) {
  45186. /* istanbul ignore if */
  45187. if (typeof id !== 'string') {
  45188. return
  45189. }
  45190. var assets = options[type];
  45191. // check local registration variations first
  45192. if (hasOwn(assets, id)) { return assets[id] }
  45193. var camelizedId = camelize(id);
  45194. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45195. var PascalCaseId = capitalize(camelizedId);
  45196. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45197. // fallback to prototype chain
  45198. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45199. if (warnMissing && !res) {
  45200. warn(
  45201. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45202. options
  45203. );
  45204. }
  45205. return res
  45206. }
  45207. /* */
  45208. function validateProp (
  45209. key,
  45210. propOptions,
  45211. propsData,
  45212. vm
  45213. ) {
  45214. var prop = propOptions[key];
  45215. var absent = !hasOwn(propsData, key);
  45216. var value = propsData[key];
  45217. // boolean casting
  45218. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45219. if (booleanIndex > -1) {
  45220. if (absent && !hasOwn(prop, 'default')) {
  45221. value = false;
  45222. } else if (value === '' || value === hyphenate(key)) {
  45223. // only cast empty string / same name to boolean if
  45224. // boolean has higher priority
  45225. var stringIndex = getTypeIndex(String, prop.type);
  45226. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45227. value = true;
  45228. }
  45229. }
  45230. }
  45231. // check default value
  45232. if (value === undefined) {
  45233. value = getPropDefaultValue(vm, prop, key);
  45234. // since the default value is a fresh copy,
  45235. // make sure to observe it.
  45236. var prevShouldObserve = shouldObserve;
  45237. toggleObserving(true);
  45238. observe(value);
  45239. toggleObserving(prevShouldObserve);
  45240. }
  45241. {
  45242. assertProp(prop, key, value, vm, absent);
  45243. }
  45244. return value
  45245. }
  45246. /**
  45247. * Get the default value of a prop.
  45248. */
  45249. function getPropDefaultValue (vm, prop, key) {
  45250. // no default, return undefined
  45251. if (!hasOwn(prop, 'default')) {
  45252. return undefined
  45253. }
  45254. var def = prop.default;
  45255. // warn against non-factory defaults for Object & Array
  45256. if (isObject(def)) {
  45257. warn(
  45258. 'Invalid default value for prop "' + key + '": ' +
  45259. 'Props with type Object/Array must use a factory function ' +
  45260. 'to return the default value.',
  45261. vm
  45262. );
  45263. }
  45264. // the raw prop value was also undefined from previous render,
  45265. // return previous default value to avoid unnecessary watcher trigger
  45266. if (vm && vm.$options.propsData &&
  45267. vm.$options.propsData[key] === undefined &&
  45268. vm._props[key] !== undefined
  45269. ) {
  45270. return vm._props[key]
  45271. }
  45272. // call factory function for non-Function types
  45273. // a value is Function if its prototype is function even across different execution context
  45274. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45275. ? def.call(vm)
  45276. : def
  45277. }
  45278. /**
  45279. * Assert whether a prop is valid.
  45280. */
  45281. function assertProp (
  45282. prop,
  45283. name,
  45284. value,
  45285. vm,
  45286. absent
  45287. ) {
  45288. if (prop.required && absent) {
  45289. warn(
  45290. 'Missing required prop: "' + name + '"',
  45291. vm
  45292. );
  45293. return
  45294. }
  45295. if (value == null && !prop.required) {
  45296. return
  45297. }
  45298. var type = prop.type;
  45299. var valid = !type || type === true;
  45300. var expectedTypes = [];
  45301. if (type) {
  45302. if (!Array.isArray(type)) {
  45303. type = [type];
  45304. }
  45305. for (var i = 0; i < type.length && !valid; i++) {
  45306. var assertedType = assertType(value, type[i]);
  45307. expectedTypes.push(assertedType.expectedType || '');
  45308. valid = assertedType.valid;
  45309. }
  45310. }
  45311. if (!valid) {
  45312. warn(
  45313. getInvalidTypeMessage(name, value, expectedTypes),
  45314. vm
  45315. );
  45316. return
  45317. }
  45318. var validator = prop.validator;
  45319. if (validator) {
  45320. if (!validator(value)) {
  45321. warn(
  45322. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  45323. vm
  45324. );
  45325. }
  45326. }
  45327. }
  45328. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  45329. function assertType (value, type) {
  45330. var valid;
  45331. var expectedType = getType(type);
  45332. if (simpleCheckRE.test(expectedType)) {
  45333. var t = typeof value;
  45334. valid = t === expectedType.toLowerCase();
  45335. // for primitive wrapper objects
  45336. if (!valid && t === 'object') {
  45337. valid = value instanceof type;
  45338. }
  45339. } else if (expectedType === 'Object') {
  45340. valid = isPlainObject(value);
  45341. } else if (expectedType === 'Array') {
  45342. valid = Array.isArray(value);
  45343. } else {
  45344. valid = value instanceof type;
  45345. }
  45346. return {
  45347. valid: valid,
  45348. expectedType: expectedType
  45349. }
  45350. }
  45351. /**
  45352. * Use function string name to check built-in types,
  45353. * because a simple equality check will fail when running
  45354. * across different vms / iframes.
  45355. */
  45356. function getType (fn) {
  45357. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  45358. return match ? match[1] : ''
  45359. }
  45360. function isSameType (a, b) {
  45361. return getType(a) === getType(b)
  45362. }
  45363. function getTypeIndex (type, expectedTypes) {
  45364. if (!Array.isArray(expectedTypes)) {
  45365. return isSameType(expectedTypes, type) ? 0 : -1
  45366. }
  45367. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  45368. if (isSameType(expectedTypes[i], type)) {
  45369. return i
  45370. }
  45371. }
  45372. return -1
  45373. }
  45374. function getInvalidTypeMessage (name, value, expectedTypes) {
  45375. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  45376. " Expected " + (expectedTypes.map(capitalize).join(', '));
  45377. var expectedType = expectedTypes[0];
  45378. var receivedType = toRawType(value);
  45379. var expectedValue = styleValue(value, expectedType);
  45380. var receivedValue = styleValue(value, receivedType);
  45381. // check if we need to specify expected value
  45382. if (expectedTypes.length === 1 &&
  45383. isExplicable(expectedType) &&
  45384. !isBoolean(expectedType, receivedType)) {
  45385. message += " with value " + expectedValue;
  45386. }
  45387. message += ", got " + receivedType + " ";
  45388. // check if we need to specify received value
  45389. if (isExplicable(receivedType)) {
  45390. message += "with value " + receivedValue + ".";
  45391. }
  45392. return message
  45393. }
  45394. function styleValue (value, type) {
  45395. if (type === 'String') {
  45396. return ("\"" + value + "\"")
  45397. } else if (type === 'Number') {
  45398. return ("" + (Number(value)))
  45399. } else {
  45400. return ("" + value)
  45401. }
  45402. }
  45403. function isExplicable (value) {
  45404. var explicitTypes = ['string', 'number', 'boolean'];
  45405. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  45406. }
  45407. function isBoolean () {
  45408. var args = [], len = arguments.length;
  45409. while ( len-- ) args[ len ] = arguments[ len ];
  45410. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  45411. }
  45412. /* */
  45413. function handleError (err, vm, info) {
  45414. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  45415. // See: https://github.com/vuejs/vuex/issues/1505
  45416. pushTarget();
  45417. try {
  45418. if (vm) {
  45419. var cur = vm;
  45420. while ((cur = cur.$parent)) {
  45421. var hooks = cur.$options.errorCaptured;
  45422. if (hooks) {
  45423. for (var i = 0; i < hooks.length; i++) {
  45424. try {
  45425. var capture = hooks[i].call(cur, err, vm, info) === false;
  45426. if (capture) { return }
  45427. } catch (e) {
  45428. globalHandleError(e, cur, 'errorCaptured hook');
  45429. }
  45430. }
  45431. }
  45432. }
  45433. }
  45434. globalHandleError(err, vm, info);
  45435. } finally {
  45436. popTarget();
  45437. }
  45438. }
  45439. function invokeWithErrorHandling (
  45440. handler,
  45441. context,
  45442. args,
  45443. vm,
  45444. info
  45445. ) {
  45446. var res;
  45447. try {
  45448. res = args ? handler.apply(context, args) : handler.call(context);
  45449. if (res && !res._isVue && isPromise(res) && !res._handled) {
  45450. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  45451. // issue #9511
  45452. // avoid catch triggering multiple times when nested calls
  45453. res._handled = true;
  45454. }
  45455. } catch (e) {
  45456. handleError(e, vm, info);
  45457. }
  45458. return res
  45459. }
  45460. function globalHandleError (err, vm, info) {
  45461. if (config.errorHandler) {
  45462. try {
  45463. return config.errorHandler.call(null, err, vm, info)
  45464. } catch (e) {
  45465. // if the user intentionally throws the original error in the handler,
  45466. // do not log it twice
  45467. if (e !== err) {
  45468. logError(e, null, 'config.errorHandler');
  45469. }
  45470. }
  45471. }
  45472. logError(err, vm, info);
  45473. }
  45474. function logError (err, vm, info) {
  45475. {
  45476. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  45477. }
  45478. /* istanbul ignore else */
  45479. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  45480. console.error(err);
  45481. } else {
  45482. throw err
  45483. }
  45484. }
  45485. /* */
  45486. var isUsingMicroTask = false;
  45487. var callbacks = [];
  45488. var pending = false;
  45489. function flushCallbacks () {
  45490. pending = false;
  45491. var copies = callbacks.slice(0);
  45492. callbacks.length = 0;
  45493. for (var i = 0; i < copies.length; i++) {
  45494. copies[i]();
  45495. }
  45496. }
  45497. // Here we have async deferring wrappers using microtasks.
  45498. // In 2.5 we used (macro) tasks (in combination with microtasks).
  45499. // However, it has subtle problems when state is changed right before repaint
  45500. // (e.g. #6813, out-in transitions).
  45501. // Also, using (macro) tasks in event handler would cause some weird behaviors
  45502. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  45503. // So we now use microtasks everywhere, again.
  45504. // A major drawback of this tradeoff is that there are some scenarios
  45505. // where microtasks have too high a priority and fire in between supposedly
  45506. // sequential events (e.g. #4521, #6690, which have workarounds)
  45507. // or even between bubbling of the same event (#6566).
  45508. var timerFunc;
  45509. // The nextTick behavior leverages the microtask queue, which can be accessed
  45510. // via either native Promise.then or MutationObserver.
  45511. // MutationObserver has wider support, however it is seriously bugged in
  45512. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  45513. // completely stops working after triggering a few times... so, if native
  45514. // Promise is available, we will use it:
  45515. /* istanbul ignore next, $flow-disable-line */
  45516. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  45517. var p = Promise.resolve();
  45518. timerFunc = function () {
  45519. p.then(flushCallbacks);
  45520. // In problematic UIWebViews, Promise.then doesn't completely break, but
  45521. // it can get stuck in a weird state where callbacks are pushed into the
  45522. // microtask queue but the queue isn't being flushed, until the browser
  45523. // needs to do some other work, e.g. handle a timer. Therefore we can
  45524. // "force" the microtask queue to be flushed by adding an empty timer.
  45525. if (isIOS) { setTimeout(noop); }
  45526. };
  45527. isUsingMicroTask = true;
  45528. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  45529. isNative(MutationObserver) ||
  45530. // PhantomJS and iOS 7.x
  45531. MutationObserver.toString() === '[object MutationObserverConstructor]'
  45532. )) {
  45533. // Use MutationObserver where native Promise is not available,
  45534. // e.g. PhantomJS, iOS7, Android 4.4
  45535. // (#6466 MutationObserver is unreliable in IE11)
  45536. var counter = 1;
  45537. var observer = new MutationObserver(flushCallbacks);
  45538. var textNode = document.createTextNode(String(counter));
  45539. observer.observe(textNode, {
  45540. characterData: true
  45541. });
  45542. timerFunc = function () {
  45543. counter = (counter + 1) % 2;
  45544. textNode.data = String(counter);
  45545. };
  45546. isUsingMicroTask = true;
  45547. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  45548. // Fallback to setImmediate.
  45549. // Technically it leverages the (macro) task queue,
  45550. // but it is still a better choice than setTimeout.
  45551. timerFunc = function () {
  45552. setImmediate(flushCallbacks);
  45553. };
  45554. } else {
  45555. // Fallback to setTimeout.
  45556. timerFunc = function () {
  45557. setTimeout(flushCallbacks, 0);
  45558. };
  45559. }
  45560. function nextTick (cb, ctx) {
  45561. var _resolve;
  45562. callbacks.push(function () {
  45563. if (cb) {
  45564. try {
  45565. cb.call(ctx);
  45566. } catch (e) {
  45567. handleError(e, ctx, 'nextTick');
  45568. }
  45569. } else if (_resolve) {
  45570. _resolve(ctx);
  45571. }
  45572. });
  45573. if (!pending) {
  45574. pending = true;
  45575. timerFunc();
  45576. }
  45577. // $flow-disable-line
  45578. if (!cb && typeof Promise !== 'undefined') {
  45579. return new Promise(function (resolve) {
  45580. _resolve = resolve;
  45581. })
  45582. }
  45583. }
  45584. /* */
  45585. var mark;
  45586. var measure;
  45587. {
  45588. var perf = inBrowser && window.performance;
  45589. /* istanbul ignore if */
  45590. if (
  45591. perf &&
  45592. perf.mark &&
  45593. perf.measure &&
  45594. perf.clearMarks &&
  45595. perf.clearMeasures
  45596. ) {
  45597. mark = function (tag) { return perf.mark(tag); };
  45598. measure = function (name, startTag, endTag) {
  45599. perf.measure(name, startTag, endTag);
  45600. perf.clearMarks(startTag);
  45601. perf.clearMarks(endTag);
  45602. // perf.clearMeasures(name)
  45603. };
  45604. }
  45605. }
  45606. /* not type checking this file because flow doesn't play well with Proxy */
  45607. var initProxy;
  45608. {
  45609. var allowedGlobals = makeMap(
  45610. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  45611. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  45612. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  45613. 'require' // for Webpack/Browserify
  45614. );
  45615. var warnNonPresent = function (target, key) {
  45616. warn(
  45617. "Property or method \"" + key + "\" is not defined on the instance but " +
  45618. 'referenced during render. Make sure that this property is reactive, ' +
  45619. 'either in the data option, or for class-based components, by ' +
  45620. 'initializing the property. ' +
  45621. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  45622. target
  45623. );
  45624. };
  45625. var warnReservedPrefix = function (target, key) {
  45626. warn(
  45627. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  45628. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  45629. 'prevent conflicts with Vue internals. ' +
  45630. 'See: https://vuejs.org/v2/api/#data',
  45631. target
  45632. );
  45633. };
  45634. var hasProxy =
  45635. typeof Proxy !== 'undefined' && isNative(Proxy);
  45636. if (hasProxy) {
  45637. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  45638. config.keyCodes = new Proxy(config.keyCodes, {
  45639. set: function set (target, key, value) {
  45640. if (isBuiltInModifier(key)) {
  45641. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  45642. return false
  45643. } else {
  45644. target[key] = value;
  45645. return true
  45646. }
  45647. }
  45648. });
  45649. }
  45650. var hasHandler = {
  45651. has: function has (target, key) {
  45652. var has = key in target;
  45653. var isAllowed = allowedGlobals(key) ||
  45654. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  45655. if (!has && !isAllowed) {
  45656. if (key in target.$data) { warnReservedPrefix(target, key); }
  45657. else { warnNonPresent(target, key); }
  45658. }
  45659. return has || !isAllowed
  45660. }
  45661. };
  45662. var getHandler = {
  45663. get: function get (target, key) {
  45664. if (typeof key === 'string' && !(key in target)) {
  45665. if (key in target.$data) { warnReservedPrefix(target, key); }
  45666. else { warnNonPresent(target, key); }
  45667. }
  45668. return target[key]
  45669. }
  45670. };
  45671. initProxy = function initProxy (vm) {
  45672. if (hasProxy) {
  45673. // determine which proxy handler to use
  45674. var options = vm.$options;
  45675. var handlers = options.render && options.render._withStripped
  45676. ? getHandler
  45677. : hasHandler;
  45678. vm._renderProxy = new Proxy(vm, handlers);
  45679. } else {
  45680. vm._renderProxy = vm;
  45681. }
  45682. };
  45683. }
  45684. /* */
  45685. var seenObjects = new _Set();
  45686. /**
  45687. * Recursively traverse an object to evoke all converted
  45688. * getters, so that every nested property inside the object
  45689. * is collected as a "deep" dependency.
  45690. */
  45691. function traverse (val) {
  45692. _traverse(val, seenObjects);
  45693. seenObjects.clear();
  45694. }
  45695. function _traverse (val, seen) {
  45696. var i, keys;
  45697. var isA = Array.isArray(val);
  45698. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  45699. return
  45700. }
  45701. if (val.__ob__) {
  45702. var depId = val.__ob__.dep.id;
  45703. if (seen.has(depId)) {
  45704. return
  45705. }
  45706. seen.add(depId);
  45707. }
  45708. if (isA) {
  45709. i = val.length;
  45710. while (i--) { _traverse(val[i], seen); }
  45711. } else {
  45712. keys = Object.keys(val);
  45713. i = keys.length;
  45714. while (i--) { _traverse(val[keys[i]], seen); }
  45715. }
  45716. }
  45717. /* */
  45718. var normalizeEvent = cached(function (name) {
  45719. var passive = name.charAt(0) === '&';
  45720. name = passive ? name.slice(1) : name;
  45721. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  45722. name = once$$1 ? name.slice(1) : name;
  45723. var capture = name.charAt(0) === '!';
  45724. name = capture ? name.slice(1) : name;
  45725. return {
  45726. name: name,
  45727. once: once$$1,
  45728. capture: capture,
  45729. passive: passive
  45730. }
  45731. });
  45732. function createFnInvoker (fns, vm) {
  45733. function invoker () {
  45734. var arguments$1 = arguments;
  45735. var fns = invoker.fns;
  45736. if (Array.isArray(fns)) {
  45737. var cloned = fns.slice();
  45738. for (var i = 0; i < cloned.length; i++) {
  45739. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  45740. }
  45741. } else {
  45742. // return handler return value for single handlers
  45743. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  45744. }
  45745. }
  45746. invoker.fns = fns;
  45747. return invoker
  45748. }
  45749. function updateListeners (
  45750. on,
  45751. oldOn,
  45752. add,
  45753. remove$$1,
  45754. createOnceHandler,
  45755. vm
  45756. ) {
  45757. var name, def$$1, cur, old, event;
  45758. for (name in on) {
  45759. def$$1 = cur = on[name];
  45760. old = oldOn[name];
  45761. event = normalizeEvent(name);
  45762. if (isUndef(cur)) {
  45763. warn(
  45764. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  45765. vm
  45766. );
  45767. } else if (isUndef(old)) {
  45768. if (isUndef(cur.fns)) {
  45769. cur = on[name] = createFnInvoker(cur, vm);
  45770. }
  45771. if (isTrue(event.once)) {
  45772. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  45773. }
  45774. add(event.name, cur, event.capture, event.passive, event.params);
  45775. } else if (cur !== old) {
  45776. old.fns = cur;
  45777. on[name] = old;
  45778. }
  45779. }
  45780. for (name in oldOn) {
  45781. if (isUndef(on[name])) {
  45782. event = normalizeEvent(name);
  45783. remove$$1(event.name, oldOn[name], event.capture);
  45784. }
  45785. }
  45786. }
  45787. /* */
  45788. function mergeVNodeHook (def, hookKey, hook) {
  45789. if (def instanceof VNode) {
  45790. def = def.data.hook || (def.data.hook = {});
  45791. }
  45792. var invoker;
  45793. var oldHook = def[hookKey];
  45794. function wrappedHook () {
  45795. hook.apply(this, arguments);
  45796. // important: remove merged hook to ensure it's called only once
  45797. // and prevent memory leak
  45798. remove(invoker.fns, wrappedHook);
  45799. }
  45800. if (isUndef(oldHook)) {
  45801. // no existing hook
  45802. invoker = createFnInvoker([wrappedHook]);
  45803. } else {
  45804. /* istanbul ignore if */
  45805. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  45806. // already a merged invoker
  45807. invoker = oldHook;
  45808. invoker.fns.push(wrappedHook);
  45809. } else {
  45810. // existing plain hook
  45811. invoker = createFnInvoker([oldHook, wrappedHook]);
  45812. }
  45813. }
  45814. invoker.merged = true;
  45815. def[hookKey] = invoker;
  45816. }
  45817. /* */
  45818. function extractPropsFromVNodeData (
  45819. data,
  45820. Ctor,
  45821. tag
  45822. ) {
  45823. // we are only extracting raw values here.
  45824. // validation and default values are handled in the child
  45825. // component itself.
  45826. var propOptions = Ctor.options.props;
  45827. if (isUndef(propOptions)) {
  45828. return
  45829. }
  45830. var res = {};
  45831. var attrs = data.attrs;
  45832. var props = data.props;
  45833. if (isDef(attrs) || isDef(props)) {
  45834. for (var key in propOptions) {
  45835. var altKey = hyphenate(key);
  45836. {
  45837. var keyInLowerCase = key.toLowerCase();
  45838. if (
  45839. key !== keyInLowerCase &&
  45840. attrs && hasOwn(attrs, keyInLowerCase)
  45841. ) {
  45842. tip(
  45843. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  45844. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  45845. " \"" + key + "\". " +
  45846. "Note that HTML attributes are case-insensitive and camelCased " +
  45847. "props need to use their kebab-case equivalents when using in-DOM " +
  45848. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  45849. );
  45850. }
  45851. }
  45852. checkProp(res, props, key, altKey, true) ||
  45853. checkProp(res, attrs, key, altKey, false);
  45854. }
  45855. }
  45856. return res
  45857. }
  45858. function checkProp (
  45859. res,
  45860. hash,
  45861. key,
  45862. altKey,
  45863. preserve
  45864. ) {
  45865. if (isDef(hash)) {
  45866. if (hasOwn(hash, key)) {
  45867. res[key] = hash[key];
  45868. if (!preserve) {
  45869. delete hash[key];
  45870. }
  45871. return true
  45872. } else if (hasOwn(hash, altKey)) {
  45873. res[key] = hash[altKey];
  45874. if (!preserve) {
  45875. delete hash[altKey];
  45876. }
  45877. return true
  45878. }
  45879. }
  45880. return false
  45881. }
  45882. /* */
  45883. // The template compiler attempts to minimize the need for normalization by
  45884. // statically analyzing the template at compile time.
  45885. //
  45886. // For plain HTML markup, normalization can be completely skipped because the
  45887. // generated render function is guaranteed to return Array<VNode>. There are
  45888. // two cases where extra normalization is needed:
  45889. // 1. When the children contains components - because a functional component
  45890. // may return an Array instead of a single root. In this case, just a simple
  45891. // normalization is needed - if any child is an Array, we flatten the whole
  45892. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  45893. // because functional components already normalize their own children.
  45894. function simpleNormalizeChildren (children) {
  45895. for (var i = 0; i < children.length; i++) {
  45896. if (Array.isArray(children[i])) {
  45897. return Array.prototype.concat.apply([], children)
  45898. }
  45899. }
  45900. return children
  45901. }
  45902. // 2. When the children contains constructs that always generated nested Arrays,
  45903. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  45904. // with hand-written render functions / JSX. In such cases a full normalization
  45905. // is needed to cater to all possible types of children values.
  45906. function normalizeChildren (children) {
  45907. return isPrimitive(children)
  45908. ? [createTextVNode(children)]
  45909. : Array.isArray(children)
  45910. ? normalizeArrayChildren(children)
  45911. : undefined
  45912. }
  45913. function isTextNode (node) {
  45914. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  45915. }
  45916. function normalizeArrayChildren (children, nestedIndex) {
  45917. var res = [];
  45918. var i, c, lastIndex, last;
  45919. for (i = 0; i < children.length; i++) {
  45920. c = children[i];
  45921. if (isUndef(c) || typeof c === 'boolean') { continue }
  45922. lastIndex = res.length - 1;
  45923. last = res[lastIndex];
  45924. // nested
  45925. if (Array.isArray(c)) {
  45926. if (c.length > 0) {
  45927. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  45928. // merge adjacent text nodes
  45929. if (isTextNode(c[0]) && isTextNode(last)) {
  45930. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  45931. c.shift();
  45932. }
  45933. res.push.apply(res, c);
  45934. }
  45935. } else if (isPrimitive(c)) {
  45936. if (isTextNode(last)) {
  45937. // merge adjacent text nodes
  45938. // this is necessary for SSR hydration because text nodes are
  45939. // essentially merged when rendered to HTML strings
  45940. res[lastIndex] = createTextVNode(last.text + c);
  45941. } else if (c !== '') {
  45942. // convert primitive to vnode
  45943. res.push(createTextVNode(c));
  45944. }
  45945. } else {
  45946. if (isTextNode(c) && isTextNode(last)) {
  45947. // merge adjacent text nodes
  45948. res[lastIndex] = createTextVNode(last.text + c.text);
  45949. } else {
  45950. // default key for nested array children (likely generated by v-for)
  45951. if (isTrue(children._isVList) &&
  45952. isDef(c.tag) &&
  45953. isUndef(c.key) &&
  45954. isDef(nestedIndex)) {
  45955. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  45956. }
  45957. res.push(c);
  45958. }
  45959. }
  45960. }
  45961. return res
  45962. }
  45963. /* */
  45964. function initProvide (vm) {
  45965. var provide = vm.$options.provide;
  45966. if (provide) {
  45967. vm._provided = typeof provide === 'function'
  45968. ? provide.call(vm)
  45969. : provide;
  45970. }
  45971. }
  45972. function initInjections (vm) {
  45973. var result = resolveInject(vm.$options.inject, vm);
  45974. if (result) {
  45975. toggleObserving(false);
  45976. Object.keys(result).forEach(function (key) {
  45977. /* istanbul ignore else */
  45978. {
  45979. defineReactive$$1(vm, key, result[key], function () {
  45980. warn(
  45981. "Avoid mutating an injected value directly since the changes will be " +
  45982. "overwritten whenever the provided component re-renders. " +
  45983. "injection being mutated: \"" + key + "\"",
  45984. vm
  45985. );
  45986. });
  45987. }
  45988. });
  45989. toggleObserving(true);
  45990. }
  45991. }
  45992. function resolveInject (inject, vm) {
  45993. if (inject) {
  45994. // inject is :any because flow is not smart enough to figure out cached
  45995. var result = Object.create(null);
  45996. var keys = hasSymbol
  45997. ? Reflect.ownKeys(inject)
  45998. : Object.keys(inject);
  45999. for (var i = 0; i < keys.length; i++) {
  46000. var key = keys[i];
  46001. // #6574 in case the inject object is observed...
  46002. if (key === '__ob__') { continue }
  46003. var provideKey = inject[key].from;
  46004. var source = vm;
  46005. while (source) {
  46006. if (source._provided && hasOwn(source._provided, provideKey)) {
  46007. result[key] = source._provided[provideKey];
  46008. break
  46009. }
  46010. source = source.$parent;
  46011. }
  46012. if (!source) {
  46013. if ('default' in inject[key]) {
  46014. var provideDefault = inject[key].default;
  46015. result[key] = typeof provideDefault === 'function'
  46016. ? provideDefault.call(vm)
  46017. : provideDefault;
  46018. } else {
  46019. warn(("Injection \"" + key + "\" not found"), vm);
  46020. }
  46021. }
  46022. }
  46023. return result
  46024. }
  46025. }
  46026. /* */
  46027. /**
  46028. * Runtime helper for resolving raw children VNodes into a slot object.
  46029. */
  46030. function resolveSlots (
  46031. children,
  46032. context
  46033. ) {
  46034. if (!children || !children.length) {
  46035. return {}
  46036. }
  46037. var slots = {};
  46038. for (var i = 0, l = children.length; i < l; i++) {
  46039. var child = children[i];
  46040. var data = child.data;
  46041. // remove slot attribute if the node is resolved as a Vue slot node
  46042. if (data && data.attrs && data.attrs.slot) {
  46043. delete data.attrs.slot;
  46044. }
  46045. // named slots should only be respected if the vnode was rendered in the
  46046. // same context.
  46047. if ((child.context === context || child.fnContext === context) &&
  46048. data && data.slot != null
  46049. ) {
  46050. var name = data.slot;
  46051. var slot = (slots[name] || (slots[name] = []));
  46052. if (child.tag === 'template') {
  46053. slot.push.apply(slot, child.children || []);
  46054. } else {
  46055. slot.push(child);
  46056. }
  46057. } else {
  46058. (slots.default || (slots.default = [])).push(child);
  46059. }
  46060. }
  46061. // ignore slots that contains only whitespace
  46062. for (var name$1 in slots) {
  46063. if (slots[name$1].every(isWhitespace)) {
  46064. delete slots[name$1];
  46065. }
  46066. }
  46067. return slots
  46068. }
  46069. function isWhitespace (node) {
  46070. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46071. }
  46072. /* */
  46073. function normalizeScopedSlots (
  46074. slots,
  46075. normalSlots,
  46076. prevSlots
  46077. ) {
  46078. var res;
  46079. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46080. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46081. var key = slots && slots.$key;
  46082. if (!slots) {
  46083. res = {};
  46084. } else if (slots._normalized) {
  46085. // fast path 1: child component re-render only, parent did not change
  46086. return slots._normalized
  46087. } else if (
  46088. isStable &&
  46089. prevSlots &&
  46090. prevSlots !== emptyObject &&
  46091. key === prevSlots.$key &&
  46092. !hasNormalSlots &&
  46093. !prevSlots.$hasNormal
  46094. ) {
  46095. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46096. // only need to normalize once
  46097. return prevSlots
  46098. } else {
  46099. res = {};
  46100. for (var key$1 in slots) {
  46101. if (slots[key$1] && key$1[0] !== '$') {
  46102. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46103. }
  46104. }
  46105. }
  46106. // expose normal slots on scopedSlots
  46107. for (var key$2 in normalSlots) {
  46108. if (!(key$2 in res)) {
  46109. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46110. }
  46111. }
  46112. // avoriaz seems to mock a non-extensible $scopedSlots object
  46113. // and when that is passed down this would cause an error
  46114. if (slots && Object.isExtensible(slots)) {
  46115. (slots)._normalized = res;
  46116. }
  46117. def(res, '$stable', isStable);
  46118. def(res, '$key', key);
  46119. def(res, '$hasNormal', hasNormalSlots);
  46120. return res
  46121. }
  46122. function normalizeScopedSlot(normalSlots, key, fn) {
  46123. var normalized = function () {
  46124. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46125. res = res && typeof res === 'object' && !Array.isArray(res)
  46126. ? [res] // single vnode
  46127. : normalizeChildren(res);
  46128. return res && (
  46129. res.length === 0 ||
  46130. (res.length === 1 && res[0].isComment) // #9658
  46131. ) ? undefined
  46132. : res
  46133. };
  46134. // this is a slot using the new v-slot syntax without scope. although it is
  46135. // compiled as a scoped slot, render fn users would expect it to be present
  46136. // on this.$slots because the usage is semantically a normal slot.
  46137. if (fn.proxy) {
  46138. Object.defineProperty(normalSlots, key, {
  46139. get: normalized,
  46140. enumerable: true,
  46141. configurable: true
  46142. });
  46143. }
  46144. return normalized
  46145. }
  46146. function proxyNormalSlot(slots, key) {
  46147. return function () { return slots[key]; }
  46148. }
  46149. /* */
  46150. /**
  46151. * Runtime helper for rendering v-for lists.
  46152. */
  46153. function renderList (
  46154. val,
  46155. render
  46156. ) {
  46157. var ret, i, l, keys, key;
  46158. if (Array.isArray(val) || typeof val === 'string') {
  46159. ret = new Array(val.length);
  46160. for (i = 0, l = val.length; i < l; i++) {
  46161. ret[i] = render(val[i], i);
  46162. }
  46163. } else if (typeof val === 'number') {
  46164. ret = new Array(val);
  46165. for (i = 0; i < val; i++) {
  46166. ret[i] = render(i + 1, i);
  46167. }
  46168. } else if (isObject(val)) {
  46169. if (hasSymbol && val[Symbol.iterator]) {
  46170. ret = [];
  46171. var iterator = val[Symbol.iterator]();
  46172. var result = iterator.next();
  46173. while (!result.done) {
  46174. ret.push(render(result.value, ret.length));
  46175. result = iterator.next();
  46176. }
  46177. } else {
  46178. keys = Object.keys(val);
  46179. ret = new Array(keys.length);
  46180. for (i = 0, l = keys.length; i < l; i++) {
  46181. key = keys[i];
  46182. ret[i] = render(val[key], key, i);
  46183. }
  46184. }
  46185. }
  46186. if (!isDef(ret)) {
  46187. ret = [];
  46188. }
  46189. (ret)._isVList = true;
  46190. return ret
  46191. }
  46192. /* */
  46193. /**
  46194. * Runtime helper for rendering <slot>
  46195. */
  46196. function renderSlot (
  46197. name,
  46198. fallback,
  46199. props,
  46200. bindObject
  46201. ) {
  46202. var scopedSlotFn = this.$scopedSlots[name];
  46203. var nodes;
  46204. if (scopedSlotFn) { // scoped slot
  46205. props = props || {};
  46206. if (bindObject) {
  46207. if (!isObject(bindObject)) {
  46208. warn(
  46209. 'slot v-bind without argument expects an Object',
  46210. this
  46211. );
  46212. }
  46213. props = extend(extend({}, bindObject), props);
  46214. }
  46215. nodes = scopedSlotFn(props) || fallback;
  46216. } else {
  46217. nodes = this.$slots[name] || fallback;
  46218. }
  46219. var target = props && props.slot;
  46220. if (target) {
  46221. return this.$createElement('template', { slot: target }, nodes)
  46222. } else {
  46223. return nodes
  46224. }
  46225. }
  46226. /* */
  46227. /**
  46228. * Runtime helper for resolving filters
  46229. */
  46230. function resolveFilter (id) {
  46231. return resolveAsset(this.$options, 'filters', id, true) || identity
  46232. }
  46233. /* */
  46234. function isKeyNotMatch (expect, actual) {
  46235. if (Array.isArray(expect)) {
  46236. return expect.indexOf(actual) === -1
  46237. } else {
  46238. return expect !== actual
  46239. }
  46240. }
  46241. /**
  46242. * Runtime helper for checking keyCodes from config.
  46243. * exposed as Vue.prototype._k
  46244. * passing in eventKeyName as last argument separately for backwards compat
  46245. */
  46246. function checkKeyCodes (
  46247. eventKeyCode,
  46248. key,
  46249. builtInKeyCode,
  46250. eventKeyName,
  46251. builtInKeyName
  46252. ) {
  46253. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46254. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46255. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46256. } else if (mappedKeyCode) {
  46257. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46258. } else if (eventKeyName) {
  46259. return hyphenate(eventKeyName) !== key
  46260. }
  46261. }
  46262. /* */
  46263. /**
  46264. * Runtime helper for merging v-bind="object" into a VNode's data.
  46265. */
  46266. function bindObjectProps (
  46267. data,
  46268. tag,
  46269. value,
  46270. asProp,
  46271. isSync
  46272. ) {
  46273. if (value) {
  46274. if (!isObject(value)) {
  46275. warn(
  46276. 'v-bind without argument expects an Object or Array value',
  46277. this
  46278. );
  46279. } else {
  46280. if (Array.isArray(value)) {
  46281. value = toObject(value);
  46282. }
  46283. var hash;
  46284. var loop = function ( key ) {
  46285. if (
  46286. key === 'class' ||
  46287. key === 'style' ||
  46288. isReservedAttribute(key)
  46289. ) {
  46290. hash = data;
  46291. } else {
  46292. var type = data.attrs && data.attrs.type;
  46293. hash = asProp || config.mustUseProp(tag, type, key)
  46294. ? data.domProps || (data.domProps = {})
  46295. : data.attrs || (data.attrs = {});
  46296. }
  46297. var camelizedKey = camelize(key);
  46298. var hyphenatedKey = hyphenate(key);
  46299. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  46300. hash[key] = value[key];
  46301. if (isSync) {
  46302. var on = data.on || (data.on = {});
  46303. on[("update:" + key)] = function ($event) {
  46304. value[key] = $event;
  46305. };
  46306. }
  46307. }
  46308. };
  46309. for (var key in value) loop( key );
  46310. }
  46311. }
  46312. return data
  46313. }
  46314. /* */
  46315. /**
  46316. * Runtime helper for rendering static trees.
  46317. */
  46318. function renderStatic (
  46319. index,
  46320. isInFor
  46321. ) {
  46322. var cached = this._staticTrees || (this._staticTrees = []);
  46323. var tree = cached[index];
  46324. // if has already-rendered static tree and not inside v-for,
  46325. // we can reuse the same tree.
  46326. if (tree && !isInFor) {
  46327. return tree
  46328. }
  46329. // otherwise, render a fresh tree.
  46330. tree = cached[index] = this.$options.staticRenderFns[index].call(
  46331. this._renderProxy,
  46332. null,
  46333. this // for render fns generated for functional component templates
  46334. );
  46335. markStatic(tree, ("__static__" + index), false);
  46336. return tree
  46337. }
  46338. /**
  46339. * Runtime helper for v-once.
  46340. * Effectively it means marking the node as static with a unique key.
  46341. */
  46342. function markOnce (
  46343. tree,
  46344. index,
  46345. key
  46346. ) {
  46347. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  46348. return tree
  46349. }
  46350. function markStatic (
  46351. tree,
  46352. key,
  46353. isOnce
  46354. ) {
  46355. if (Array.isArray(tree)) {
  46356. for (var i = 0; i < tree.length; i++) {
  46357. if (tree[i] && typeof tree[i] !== 'string') {
  46358. markStaticNode(tree[i], (key + "_" + i), isOnce);
  46359. }
  46360. }
  46361. } else {
  46362. markStaticNode(tree, key, isOnce);
  46363. }
  46364. }
  46365. function markStaticNode (node, key, isOnce) {
  46366. node.isStatic = true;
  46367. node.key = key;
  46368. node.isOnce = isOnce;
  46369. }
  46370. /* */
  46371. function bindObjectListeners (data, value) {
  46372. if (value) {
  46373. if (!isPlainObject(value)) {
  46374. warn(
  46375. 'v-on without argument expects an Object value',
  46376. this
  46377. );
  46378. } else {
  46379. var on = data.on = data.on ? extend({}, data.on) : {};
  46380. for (var key in value) {
  46381. var existing = on[key];
  46382. var ours = value[key];
  46383. on[key] = existing ? [].concat(existing, ours) : ours;
  46384. }
  46385. }
  46386. }
  46387. return data
  46388. }
  46389. /* */
  46390. function resolveScopedSlots (
  46391. fns, // see flow/vnode
  46392. res,
  46393. // the following are added in 2.6
  46394. hasDynamicKeys,
  46395. contentHashKey
  46396. ) {
  46397. res = res || { $stable: !hasDynamicKeys };
  46398. for (var i = 0; i < fns.length; i++) {
  46399. var slot = fns[i];
  46400. if (Array.isArray(slot)) {
  46401. resolveScopedSlots(slot, res, hasDynamicKeys);
  46402. } else if (slot) {
  46403. // marker for reverse proxying v-slot without scope on this.$slots
  46404. if (slot.proxy) {
  46405. slot.fn.proxy = true;
  46406. }
  46407. res[slot.key] = slot.fn;
  46408. }
  46409. }
  46410. if (contentHashKey) {
  46411. (res).$key = contentHashKey;
  46412. }
  46413. return res
  46414. }
  46415. /* */
  46416. function bindDynamicKeys (baseObj, values) {
  46417. for (var i = 0; i < values.length; i += 2) {
  46418. var key = values[i];
  46419. if (typeof key === 'string' && key) {
  46420. baseObj[values[i]] = values[i + 1];
  46421. } else if (key !== '' && key !== null) {
  46422. // null is a special value for explicitly removing a binding
  46423. warn(
  46424. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  46425. this
  46426. );
  46427. }
  46428. }
  46429. return baseObj
  46430. }
  46431. // helper to dynamically append modifier runtime markers to event names.
  46432. // ensure only append when value is already string, otherwise it will be cast
  46433. // to string and cause the type check to miss.
  46434. function prependModifier (value, symbol) {
  46435. return typeof value === 'string' ? symbol + value : value
  46436. }
  46437. /* */
  46438. function installRenderHelpers (target) {
  46439. target._o = markOnce;
  46440. target._n = toNumber;
  46441. target._s = toString;
  46442. target._l = renderList;
  46443. target._t = renderSlot;
  46444. target._q = looseEqual;
  46445. target._i = looseIndexOf;
  46446. target._m = renderStatic;
  46447. target._f = resolveFilter;
  46448. target._k = checkKeyCodes;
  46449. target._b = bindObjectProps;
  46450. target._v = createTextVNode;
  46451. target._e = createEmptyVNode;
  46452. target._u = resolveScopedSlots;
  46453. target._g = bindObjectListeners;
  46454. target._d = bindDynamicKeys;
  46455. target._p = prependModifier;
  46456. }
  46457. /* */
  46458. function FunctionalRenderContext (
  46459. data,
  46460. props,
  46461. children,
  46462. parent,
  46463. Ctor
  46464. ) {
  46465. var this$1 = this;
  46466. var options = Ctor.options;
  46467. // ensure the createElement function in functional components
  46468. // gets a unique context - this is necessary for correct named slot check
  46469. var contextVm;
  46470. if (hasOwn(parent, '_uid')) {
  46471. contextVm = Object.create(parent);
  46472. // $flow-disable-line
  46473. contextVm._original = parent;
  46474. } else {
  46475. // the context vm passed in is a functional context as well.
  46476. // in this case we want to make sure we are able to get a hold to the
  46477. // real context instance.
  46478. contextVm = parent;
  46479. // $flow-disable-line
  46480. parent = parent._original;
  46481. }
  46482. var isCompiled = isTrue(options._compiled);
  46483. var needNormalization = !isCompiled;
  46484. this.data = data;
  46485. this.props = props;
  46486. this.children = children;
  46487. this.parent = parent;
  46488. this.listeners = data.on || emptyObject;
  46489. this.injections = resolveInject(options.inject, parent);
  46490. this.slots = function () {
  46491. if (!this$1.$slots) {
  46492. normalizeScopedSlots(
  46493. data.scopedSlots,
  46494. this$1.$slots = resolveSlots(children, parent)
  46495. );
  46496. }
  46497. return this$1.$slots
  46498. };
  46499. Object.defineProperty(this, 'scopedSlots', ({
  46500. enumerable: true,
  46501. get: function get () {
  46502. return normalizeScopedSlots(data.scopedSlots, this.slots())
  46503. }
  46504. }));
  46505. // support for compiled functional template
  46506. if (isCompiled) {
  46507. // exposing $options for renderStatic()
  46508. this.$options = options;
  46509. // pre-resolve slots for renderSlot()
  46510. this.$slots = this.slots();
  46511. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  46512. }
  46513. if (options._scopeId) {
  46514. this._c = function (a, b, c, d) {
  46515. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  46516. if (vnode && !Array.isArray(vnode)) {
  46517. vnode.fnScopeId = options._scopeId;
  46518. vnode.fnContext = parent;
  46519. }
  46520. return vnode
  46521. };
  46522. } else {
  46523. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  46524. }
  46525. }
  46526. installRenderHelpers(FunctionalRenderContext.prototype);
  46527. function createFunctionalComponent (
  46528. Ctor,
  46529. propsData,
  46530. data,
  46531. contextVm,
  46532. children
  46533. ) {
  46534. var options = Ctor.options;
  46535. var props = {};
  46536. var propOptions = options.props;
  46537. if (isDef(propOptions)) {
  46538. for (var key in propOptions) {
  46539. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  46540. }
  46541. } else {
  46542. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  46543. if (isDef(data.props)) { mergeProps(props, data.props); }
  46544. }
  46545. var renderContext = new FunctionalRenderContext(
  46546. data,
  46547. props,
  46548. children,
  46549. contextVm,
  46550. Ctor
  46551. );
  46552. var vnode = options.render.call(null, renderContext._c, renderContext);
  46553. if (vnode instanceof VNode) {
  46554. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  46555. } else if (Array.isArray(vnode)) {
  46556. var vnodes = normalizeChildren(vnode) || [];
  46557. var res = new Array(vnodes.length);
  46558. for (var i = 0; i < vnodes.length; i++) {
  46559. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  46560. }
  46561. return res
  46562. }
  46563. }
  46564. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  46565. // #7817 clone node before setting fnContext, otherwise if the node is reused
  46566. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  46567. // that should not be matched to match.
  46568. var clone = cloneVNode(vnode);
  46569. clone.fnContext = contextVm;
  46570. clone.fnOptions = options;
  46571. {
  46572. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  46573. }
  46574. if (data.slot) {
  46575. (clone.data || (clone.data = {})).slot = data.slot;
  46576. }
  46577. return clone
  46578. }
  46579. function mergeProps (to, from) {
  46580. for (var key in from) {
  46581. to[camelize(key)] = from[key];
  46582. }
  46583. }
  46584. /* */
  46585. /* */
  46586. /* */
  46587. /* */
  46588. // inline hooks to be invoked on component VNodes during patch
  46589. var componentVNodeHooks = {
  46590. init: function init (vnode, hydrating) {
  46591. if (
  46592. vnode.componentInstance &&
  46593. !vnode.componentInstance._isDestroyed &&
  46594. vnode.data.keepAlive
  46595. ) {
  46596. // kept-alive components, treat as a patch
  46597. var mountedNode = vnode; // work around flow
  46598. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  46599. } else {
  46600. var child = vnode.componentInstance = createComponentInstanceForVnode(
  46601. vnode,
  46602. activeInstance
  46603. );
  46604. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  46605. }
  46606. },
  46607. prepatch: function prepatch (oldVnode, vnode) {
  46608. var options = vnode.componentOptions;
  46609. var child = vnode.componentInstance = oldVnode.componentInstance;
  46610. updateChildComponent(
  46611. child,
  46612. options.propsData, // updated props
  46613. options.listeners, // updated listeners
  46614. vnode, // new parent vnode
  46615. options.children // new children
  46616. );
  46617. },
  46618. insert: function insert (vnode) {
  46619. var context = vnode.context;
  46620. var componentInstance = vnode.componentInstance;
  46621. if (!componentInstance._isMounted) {
  46622. componentInstance._isMounted = true;
  46623. callHook(componentInstance, 'mounted');
  46624. }
  46625. if (vnode.data.keepAlive) {
  46626. if (context._isMounted) {
  46627. // vue-router#1212
  46628. // During updates, a kept-alive component's child components may
  46629. // change, so directly walking the tree here may call activated hooks
  46630. // on incorrect children. Instead we push them into a queue which will
  46631. // be processed after the whole patch process ended.
  46632. queueActivatedComponent(componentInstance);
  46633. } else {
  46634. activateChildComponent(componentInstance, true /* direct */);
  46635. }
  46636. }
  46637. },
  46638. destroy: function destroy (vnode) {
  46639. var componentInstance = vnode.componentInstance;
  46640. if (!componentInstance._isDestroyed) {
  46641. if (!vnode.data.keepAlive) {
  46642. componentInstance.$destroy();
  46643. } else {
  46644. deactivateChildComponent(componentInstance, true /* direct */);
  46645. }
  46646. }
  46647. }
  46648. };
  46649. var hooksToMerge = Object.keys(componentVNodeHooks);
  46650. function createComponent (
  46651. Ctor,
  46652. data,
  46653. context,
  46654. children,
  46655. tag
  46656. ) {
  46657. if (isUndef(Ctor)) {
  46658. return
  46659. }
  46660. var baseCtor = context.$options._base;
  46661. // plain options object: turn it into a constructor
  46662. if (isObject(Ctor)) {
  46663. Ctor = baseCtor.extend(Ctor);
  46664. }
  46665. // if at this stage it's not a constructor or an async component factory,
  46666. // reject.
  46667. if (typeof Ctor !== 'function') {
  46668. {
  46669. warn(("Invalid Component definition: " + (String(Ctor))), context);
  46670. }
  46671. return
  46672. }
  46673. // async component
  46674. var asyncFactory;
  46675. if (isUndef(Ctor.cid)) {
  46676. asyncFactory = Ctor;
  46677. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  46678. if (Ctor === undefined) {
  46679. // return a placeholder node for async component, which is rendered
  46680. // as a comment node but preserves all the raw information for the node.
  46681. // the information will be used for async server-rendering and hydration.
  46682. return createAsyncPlaceholder(
  46683. asyncFactory,
  46684. data,
  46685. context,
  46686. children,
  46687. tag
  46688. )
  46689. }
  46690. }
  46691. data = data || {};
  46692. // resolve constructor options in case global mixins are applied after
  46693. // component constructor creation
  46694. resolveConstructorOptions(Ctor);
  46695. // transform component v-model data into props & events
  46696. if (isDef(data.model)) {
  46697. transformModel(Ctor.options, data);
  46698. }
  46699. // extract props
  46700. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  46701. // functional component
  46702. if (isTrue(Ctor.options.functional)) {
  46703. return createFunctionalComponent(Ctor, propsData, data, context, children)
  46704. }
  46705. // extract listeners, since these needs to be treated as
  46706. // child component listeners instead of DOM listeners
  46707. var listeners = data.on;
  46708. // replace with listeners with .native modifier
  46709. // so it gets processed during parent component patch.
  46710. data.on = data.nativeOn;
  46711. if (isTrue(Ctor.options.abstract)) {
  46712. // abstract components do not keep anything
  46713. // other than props & listeners & slot
  46714. // work around flow
  46715. var slot = data.slot;
  46716. data = {};
  46717. if (slot) {
  46718. data.slot = slot;
  46719. }
  46720. }
  46721. // install component management hooks onto the placeholder node
  46722. installComponentHooks(data);
  46723. // return a placeholder vnode
  46724. var name = Ctor.options.name || tag;
  46725. var vnode = new VNode(
  46726. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  46727. data, undefined, undefined, undefined, context,
  46728. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  46729. asyncFactory
  46730. );
  46731. return vnode
  46732. }
  46733. function createComponentInstanceForVnode (
  46734. vnode, // we know it's MountedComponentVNode but flow doesn't
  46735. parent // activeInstance in lifecycle state
  46736. ) {
  46737. var options = {
  46738. _isComponent: true,
  46739. _parentVnode: vnode,
  46740. parent: parent
  46741. };
  46742. // check inline-template render functions
  46743. var inlineTemplate = vnode.data.inlineTemplate;
  46744. if (isDef(inlineTemplate)) {
  46745. options.render = inlineTemplate.render;
  46746. options.staticRenderFns = inlineTemplate.staticRenderFns;
  46747. }
  46748. return new vnode.componentOptions.Ctor(options)
  46749. }
  46750. function installComponentHooks (data) {
  46751. var hooks = data.hook || (data.hook = {});
  46752. for (var i = 0; i < hooksToMerge.length; i++) {
  46753. var key = hooksToMerge[i];
  46754. var existing = hooks[key];
  46755. var toMerge = componentVNodeHooks[key];
  46756. if (existing !== toMerge && !(existing && existing._merged)) {
  46757. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  46758. }
  46759. }
  46760. }
  46761. function mergeHook$1 (f1, f2) {
  46762. var merged = function (a, b) {
  46763. // flow complains about extra args which is why we use any
  46764. f1(a, b);
  46765. f2(a, b);
  46766. };
  46767. merged._merged = true;
  46768. return merged
  46769. }
  46770. // transform component v-model info (value and callback) into
  46771. // prop and event handler respectively.
  46772. function transformModel (options, data) {
  46773. var prop = (options.model && options.model.prop) || 'value';
  46774. var event = (options.model && options.model.event) || 'input'
  46775. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  46776. var on = data.on || (data.on = {});
  46777. var existing = on[event];
  46778. var callback = data.model.callback;
  46779. if (isDef(existing)) {
  46780. if (
  46781. Array.isArray(existing)
  46782. ? existing.indexOf(callback) === -1
  46783. : existing !== callback
  46784. ) {
  46785. on[event] = [callback].concat(existing);
  46786. }
  46787. } else {
  46788. on[event] = callback;
  46789. }
  46790. }
  46791. /* */
  46792. var SIMPLE_NORMALIZE = 1;
  46793. var ALWAYS_NORMALIZE = 2;
  46794. // wrapper function for providing a more flexible interface
  46795. // without getting yelled at by flow
  46796. function createElement (
  46797. context,
  46798. tag,
  46799. data,
  46800. children,
  46801. normalizationType,
  46802. alwaysNormalize
  46803. ) {
  46804. if (Array.isArray(data) || isPrimitive(data)) {
  46805. normalizationType = children;
  46806. children = data;
  46807. data = undefined;
  46808. }
  46809. if (isTrue(alwaysNormalize)) {
  46810. normalizationType = ALWAYS_NORMALIZE;
  46811. }
  46812. return _createElement(context, tag, data, children, normalizationType)
  46813. }
  46814. function _createElement (
  46815. context,
  46816. tag,
  46817. data,
  46818. children,
  46819. normalizationType
  46820. ) {
  46821. if (isDef(data) && isDef((data).__ob__)) {
  46822. warn(
  46823. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  46824. 'Always create fresh vnode data objects in each render!',
  46825. context
  46826. );
  46827. return createEmptyVNode()
  46828. }
  46829. // object syntax in v-bind
  46830. if (isDef(data) && isDef(data.is)) {
  46831. tag = data.is;
  46832. }
  46833. if (!tag) {
  46834. // in case of component :is set to falsy value
  46835. return createEmptyVNode()
  46836. }
  46837. // warn against non-primitive key
  46838. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  46839. ) {
  46840. {
  46841. warn(
  46842. 'Avoid using non-primitive value as key, ' +
  46843. 'use string/number value instead.',
  46844. context
  46845. );
  46846. }
  46847. }
  46848. // support single function children as default scoped slot
  46849. if (Array.isArray(children) &&
  46850. typeof children[0] === 'function'
  46851. ) {
  46852. data = data || {};
  46853. data.scopedSlots = { default: children[0] };
  46854. children.length = 0;
  46855. }
  46856. if (normalizationType === ALWAYS_NORMALIZE) {
  46857. children = normalizeChildren(children);
  46858. } else if (normalizationType === SIMPLE_NORMALIZE) {
  46859. children = simpleNormalizeChildren(children);
  46860. }
  46861. var vnode, ns;
  46862. if (typeof tag === 'string') {
  46863. var Ctor;
  46864. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  46865. if (config.isReservedTag(tag)) {
  46866. // platform built-in elements
  46867. if (isDef(data) && isDef(data.nativeOn)) {
  46868. warn(
  46869. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  46870. context
  46871. );
  46872. }
  46873. vnode = new VNode(
  46874. config.parsePlatformTagName(tag), data, children,
  46875. undefined, undefined, context
  46876. );
  46877. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  46878. // component
  46879. vnode = createComponent(Ctor, data, context, children, tag);
  46880. } else {
  46881. // unknown or unlisted namespaced elements
  46882. // check at runtime because it may get assigned a namespace when its
  46883. // parent normalizes children
  46884. vnode = new VNode(
  46885. tag, data, children,
  46886. undefined, undefined, context
  46887. );
  46888. }
  46889. } else {
  46890. // direct component options / constructor
  46891. vnode = createComponent(tag, data, context, children);
  46892. }
  46893. if (Array.isArray(vnode)) {
  46894. return vnode
  46895. } else if (isDef(vnode)) {
  46896. if (isDef(ns)) { applyNS(vnode, ns); }
  46897. if (isDef(data)) { registerDeepBindings(data); }
  46898. return vnode
  46899. } else {
  46900. return createEmptyVNode()
  46901. }
  46902. }
  46903. function applyNS (vnode, ns, force) {
  46904. vnode.ns = ns;
  46905. if (vnode.tag === 'foreignObject') {
  46906. // use default namespace inside foreignObject
  46907. ns = undefined;
  46908. force = true;
  46909. }
  46910. if (isDef(vnode.children)) {
  46911. for (var i = 0, l = vnode.children.length; i < l; i++) {
  46912. var child = vnode.children[i];
  46913. if (isDef(child.tag) && (
  46914. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  46915. applyNS(child, ns, force);
  46916. }
  46917. }
  46918. }
  46919. }
  46920. // ref #5318
  46921. // necessary to ensure parent re-render when deep bindings like :style and
  46922. // :class are used on slot nodes
  46923. function registerDeepBindings (data) {
  46924. if (isObject(data.style)) {
  46925. traverse(data.style);
  46926. }
  46927. if (isObject(data.class)) {
  46928. traverse(data.class);
  46929. }
  46930. }
  46931. /* */
  46932. function initRender (vm) {
  46933. vm._vnode = null; // the root of the child tree
  46934. vm._staticTrees = null; // v-once cached trees
  46935. var options = vm.$options;
  46936. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  46937. var renderContext = parentVnode && parentVnode.context;
  46938. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  46939. vm.$scopedSlots = emptyObject;
  46940. // bind the createElement fn to this instance
  46941. // so that we get proper render context inside it.
  46942. // args order: tag, data, children, normalizationType, alwaysNormalize
  46943. // internal version is used by render functions compiled from templates
  46944. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  46945. // normalization is always applied for the public version, used in
  46946. // user-written render functions.
  46947. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  46948. // $attrs & $listeners are exposed for easier HOC creation.
  46949. // they need to be reactive so that HOCs using them are always updated
  46950. var parentData = parentVnode && parentVnode.data;
  46951. /* istanbul ignore else */
  46952. {
  46953. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  46954. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  46955. }, true);
  46956. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  46957. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  46958. }, true);
  46959. }
  46960. }
  46961. var currentRenderingInstance = null;
  46962. function renderMixin (Vue) {
  46963. // install runtime convenience helpers
  46964. installRenderHelpers(Vue.prototype);
  46965. Vue.prototype.$nextTick = function (fn) {
  46966. return nextTick(fn, this)
  46967. };
  46968. Vue.prototype._render = function () {
  46969. var vm = this;
  46970. var ref = vm.$options;
  46971. var render = ref.render;
  46972. var _parentVnode = ref._parentVnode;
  46973. if (_parentVnode) {
  46974. vm.$scopedSlots = normalizeScopedSlots(
  46975. _parentVnode.data.scopedSlots,
  46976. vm.$slots,
  46977. vm.$scopedSlots
  46978. );
  46979. }
  46980. // set parent vnode. this allows render functions to have access
  46981. // to the data on the placeholder node.
  46982. vm.$vnode = _parentVnode;
  46983. // render self
  46984. var vnode;
  46985. try {
  46986. // There's no need to maintain a stack because all render fns are called
  46987. // separately from one another. Nested component's render fns are called
  46988. // when parent component is patched.
  46989. currentRenderingInstance = vm;
  46990. vnode = render.call(vm._renderProxy, vm.$createElement);
  46991. } catch (e) {
  46992. handleError(e, vm, "render");
  46993. // return error render result,
  46994. // or previous vnode to prevent render error causing blank component
  46995. /* istanbul ignore else */
  46996. if (vm.$options.renderError) {
  46997. try {
  46998. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  46999. } catch (e) {
  47000. handleError(e, vm, "renderError");
  47001. vnode = vm._vnode;
  47002. }
  47003. } else {
  47004. vnode = vm._vnode;
  47005. }
  47006. } finally {
  47007. currentRenderingInstance = null;
  47008. }
  47009. // if the returned array contains only a single node, allow it
  47010. if (Array.isArray(vnode) && vnode.length === 1) {
  47011. vnode = vnode[0];
  47012. }
  47013. // return empty vnode in case the render function errored out
  47014. if (!(vnode instanceof VNode)) {
  47015. if (Array.isArray(vnode)) {
  47016. warn(
  47017. 'Multiple root nodes returned from render function. Render function ' +
  47018. 'should return a single root node.',
  47019. vm
  47020. );
  47021. }
  47022. vnode = createEmptyVNode();
  47023. }
  47024. // set parent
  47025. vnode.parent = _parentVnode;
  47026. return vnode
  47027. };
  47028. }
  47029. /* */
  47030. function ensureCtor (comp, base) {
  47031. if (
  47032. comp.__esModule ||
  47033. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47034. ) {
  47035. comp = comp.default;
  47036. }
  47037. return isObject(comp)
  47038. ? base.extend(comp)
  47039. : comp
  47040. }
  47041. function createAsyncPlaceholder (
  47042. factory,
  47043. data,
  47044. context,
  47045. children,
  47046. tag
  47047. ) {
  47048. var node = createEmptyVNode();
  47049. node.asyncFactory = factory;
  47050. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47051. return node
  47052. }
  47053. function resolveAsyncComponent (
  47054. factory,
  47055. baseCtor
  47056. ) {
  47057. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47058. return factory.errorComp
  47059. }
  47060. if (isDef(factory.resolved)) {
  47061. return factory.resolved
  47062. }
  47063. var owner = currentRenderingInstance;
  47064. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47065. // already pending
  47066. factory.owners.push(owner);
  47067. }
  47068. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47069. return factory.loadingComp
  47070. }
  47071. if (owner && !isDef(factory.owners)) {
  47072. var owners = factory.owners = [owner];
  47073. var sync = true;
  47074. var timerLoading = null;
  47075. var timerTimeout = null
  47076. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47077. var forceRender = function (renderCompleted) {
  47078. for (var i = 0, l = owners.length; i < l; i++) {
  47079. (owners[i]).$forceUpdate();
  47080. }
  47081. if (renderCompleted) {
  47082. owners.length = 0;
  47083. if (timerLoading !== null) {
  47084. clearTimeout(timerLoading);
  47085. timerLoading = null;
  47086. }
  47087. if (timerTimeout !== null) {
  47088. clearTimeout(timerTimeout);
  47089. timerTimeout = null;
  47090. }
  47091. }
  47092. };
  47093. var resolve = once(function (res) {
  47094. // cache resolved
  47095. factory.resolved = ensureCtor(res, baseCtor);
  47096. // invoke callbacks only if this is not a synchronous resolve
  47097. // (async resolves are shimmed as synchronous during SSR)
  47098. if (!sync) {
  47099. forceRender(true);
  47100. } else {
  47101. owners.length = 0;
  47102. }
  47103. });
  47104. var reject = once(function (reason) {
  47105. warn(
  47106. "Failed to resolve async component: " + (String(factory)) +
  47107. (reason ? ("\nReason: " + reason) : '')
  47108. );
  47109. if (isDef(factory.errorComp)) {
  47110. factory.error = true;
  47111. forceRender(true);
  47112. }
  47113. });
  47114. var res = factory(resolve, reject);
  47115. if (isObject(res)) {
  47116. if (isPromise(res)) {
  47117. // () => Promise
  47118. if (isUndef(factory.resolved)) {
  47119. res.then(resolve, reject);
  47120. }
  47121. } else if (isPromise(res.component)) {
  47122. res.component.then(resolve, reject);
  47123. if (isDef(res.error)) {
  47124. factory.errorComp = ensureCtor(res.error, baseCtor);
  47125. }
  47126. if (isDef(res.loading)) {
  47127. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47128. if (res.delay === 0) {
  47129. factory.loading = true;
  47130. } else {
  47131. timerLoading = setTimeout(function () {
  47132. timerLoading = null;
  47133. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47134. factory.loading = true;
  47135. forceRender(false);
  47136. }
  47137. }, res.delay || 200);
  47138. }
  47139. }
  47140. if (isDef(res.timeout)) {
  47141. timerTimeout = setTimeout(function () {
  47142. timerTimeout = null;
  47143. if (isUndef(factory.resolved)) {
  47144. reject(
  47145. "timeout (" + (res.timeout) + "ms)"
  47146. );
  47147. }
  47148. }, res.timeout);
  47149. }
  47150. }
  47151. }
  47152. sync = false;
  47153. // return in case resolved synchronously
  47154. return factory.loading
  47155. ? factory.loadingComp
  47156. : factory.resolved
  47157. }
  47158. }
  47159. /* */
  47160. function isAsyncPlaceholder (node) {
  47161. return node.isComment && node.asyncFactory
  47162. }
  47163. /* */
  47164. function getFirstComponentChild (children) {
  47165. if (Array.isArray(children)) {
  47166. for (var i = 0; i < children.length; i++) {
  47167. var c = children[i];
  47168. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47169. return c
  47170. }
  47171. }
  47172. }
  47173. }
  47174. /* */
  47175. /* */
  47176. function initEvents (vm) {
  47177. vm._events = Object.create(null);
  47178. vm._hasHookEvent = false;
  47179. // init parent attached events
  47180. var listeners = vm.$options._parentListeners;
  47181. if (listeners) {
  47182. updateComponentListeners(vm, listeners);
  47183. }
  47184. }
  47185. var target;
  47186. function add (event, fn) {
  47187. target.$on(event, fn);
  47188. }
  47189. function remove$1 (event, fn) {
  47190. target.$off(event, fn);
  47191. }
  47192. function createOnceHandler (event, fn) {
  47193. var _target = target;
  47194. return function onceHandler () {
  47195. var res = fn.apply(null, arguments);
  47196. if (res !== null) {
  47197. _target.$off(event, onceHandler);
  47198. }
  47199. }
  47200. }
  47201. function updateComponentListeners (
  47202. vm,
  47203. listeners,
  47204. oldListeners
  47205. ) {
  47206. target = vm;
  47207. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47208. target = undefined;
  47209. }
  47210. function eventsMixin (Vue) {
  47211. var hookRE = /^hook:/;
  47212. Vue.prototype.$on = function (event, fn) {
  47213. var vm = this;
  47214. if (Array.isArray(event)) {
  47215. for (var i = 0, l = event.length; i < l; i++) {
  47216. vm.$on(event[i], fn);
  47217. }
  47218. } else {
  47219. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47220. // optimize hook:event cost by using a boolean flag marked at registration
  47221. // instead of a hash lookup
  47222. if (hookRE.test(event)) {
  47223. vm._hasHookEvent = true;
  47224. }
  47225. }
  47226. return vm
  47227. };
  47228. Vue.prototype.$once = function (event, fn) {
  47229. var vm = this;
  47230. function on () {
  47231. vm.$off(event, on);
  47232. fn.apply(vm, arguments);
  47233. }
  47234. on.fn = fn;
  47235. vm.$on(event, on);
  47236. return vm
  47237. };
  47238. Vue.prototype.$off = function (event, fn) {
  47239. var vm = this;
  47240. // all
  47241. if (!arguments.length) {
  47242. vm._events = Object.create(null);
  47243. return vm
  47244. }
  47245. // array of events
  47246. if (Array.isArray(event)) {
  47247. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47248. vm.$off(event[i$1], fn);
  47249. }
  47250. return vm
  47251. }
  47252. // specific event
  47253. var cbs = vm._events[event];
  47254. if (!cbs) {
  47255. return vm
  47256. }
  47257. if (!fn) {
  47258. vm._events[event] = null;
  47259. return vm
  47260. }
  47261. // specific handler
  47262. var cb;
  47263. var i = cbs.length;
  47264. while (i--) {
  47265. cb = cbs[i];
  47266. if (cb === fn || cb.fn === fn) {
  47267. cbs.splice(i, 1);
  47268. break
  47269. }
  47270. }
  47271. return vm
  47272. };
  47273. Vue.prototype.$emit = function (event) {
  47274. var vm = this;
  47275. {
  47276. var lowerCaseEvent = event.toLowerCase();
  47277. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47278. tip(
  47279. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47280. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  47281. "Note that HTML attributes are case-insensitive and you cannot use " +
  47282. "v-on to listen to camelCase events when using in-DOM templates. " +
  47283. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  47284. );
  47285. }
  47286. }
  47287. var cbs = vm._events[event];
  47288. if (cbs) {
  47289. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  47290. var args = toArray(arguments, 1);
  47291. var info = "event handler for \"" + event + "\"";
  47292. for (var i = 0, l = cbs.length; i < l; i++) {
  47293. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  47294. }
  47295. }
  47296. return vm
  47297. };
  47298. }
  47299. /* */
  47300. var activeInstance = null;
  47301. var isUpdatingChildComponent = false;
  47302. function setActiveInstance(vm) {
  47303. var prevActiveInstance = activeInstance;
  47304. activeInstance = vm;
  47305. return function () {
  47306. activeInstance = prevActiveInstance;
  47307. }
  47308. }
  47309. function initLifecycle (vm) {
  47310. var options = vm.$options;
  47311. // locate first non-abstract parent
  47312. var parent = options.parent;
  47313. if (parent && !options.abstract) {
  47314. while (parent.$options.abstract && parent.$parent) {
  47315. parent = parent.$parent;
  47316. }
  47317. parent.$children.push(vm);
  47318. }
  47319. vm.$parent = parent;
  47320. vm.$root = parent ? parent.$root : vm;
  47321. vm.$children = [];
  47322. vm.$refs = {};
  47323. vm._watcher = null;
  47324. vm._inactive = null;
  47325. vm._directInactive = false;
  47326. vm._isMounted = false;
  47327. vm._isDestroyed = false;
  47328. vm._isBeingDestroyed = false;
  47329. }
  47330. function lifecycleMixin (Vue) {
  47331. Vue.prototype._update = function (vnode, hydrating) {
  47332. var vm = this;
  47333. var prevEl = vm.$el;
  47334. var prevVnode = vm._vnode;
  47335. var restoreActiveInstance = setActiveInstance(vm);
  47336. vm._vnode = vnode;
  47337. // Vue.prototype.__patch__ is injected in entry points
  47338. // based on the rendering backend used.
  47339. if (!prevVnode) {
  47340. // initial render
  47341. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  47342. } else {
  47343. // updates
  47344. vm.$el = vm.__patch__(prevVnode, vnode);
  47345. }
  47346. restoreActiveInstance();
  47347. // update __vue__ reference
  47348. if (prevEl) {
  47349. prevEl.__vue__ = null;
  47350. }
  47351. if (vm.$el) {
  47352. vm.$el.__vue__ = vm;
  47353. }
  47354. // if parent is an HOC, update its $el as well
  47355. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  47356. vm.$parent.$el = vm.$el;
  47357. }
  47358. // updated hook is called by the scheduler to ensure that children are
  47359. // updated in a parent's updated hook.
  47360. };
  47361. Vue.prototype.$forceUpdate = function () {
  47362. var vm = this;
  47363. if (vm._watcher) {
  47364. vm._watcher.update();
  47365. }
  47366. };
  47367. Vue.prototype.$destroy = function () {
  47368. var vm = this;
  47369. if (vm._isBeingDestroyed) {
  47370. return
  47371. }
  47372. callHook(vm, 'beforeDestroy');
  47373. vm._isBeingDestroyed = true;
  47374. // remove self from parent
  47375. var parent = vm.$parent;
  47376. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  47377. remove(parent.$children, vm);
  47378. }
  47379. // teardown watchers
  47380. if (vm._watcher) {
  47381. vm._watcher.teardown();
  47382. }
  47383. var i = vm._watchers.length;
  47384. while (i--) {
  47385. vm._watchers[i].teardown();
  47386. }
  47387. // remove reference from data ob
  47388. // frozen object may not have observer.
  47389. if (vm._data.__ob__) {
  47390. vm._data.__ob__.vmCount--;
  47391. }
  47392. // call the last hook...
  47393. vm._isDestroyed = true;
  47394. // invoke destroy hooks on current rendered tree
  47395. vm.__patch__(vm._vnode, null);
  47396. // fire destroyed hook
  47397. callHook(vm, 'destroyed');
  47398. // turn off all instance listeners.
  47399. vm.$off();
  47400. // remove __vue__ reference
  47401. if (vm.$el) {
  47402. vm.$el.__vue__ = null;
  47403. }
  47404. // release circular reference (#6759)
  47405. if (vm.$vnode) {
  47406. vm.$vnode.parent = null;
  47407. }
  47408. };
  47409. }
  47410. function mountComponent (
  47411. vm,
  47412. el,
  47413. hydrating
  47414. ) {
  47415. vm.$el = el;
  47416. if (!vm.$options.render) {
  47417. vm.$options.render = createEmptyVNode;
  47418. {
  47419. /* istanbul ignore if */
  47420. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  47421. vm.$options.el || el) {
  47422. warn(
  47423. 'You are using the runtime-only build of Vue where the template ' +
  47424. 'compiler is not available. Either pre-compile the templates into ' +
  47425. 'render functions, or use the compiler-included build.',
  47426. vm
  47427. );
  47428. } else {
  47429. warn(
  47430. 'Failed to mount component: template or render function not defined.',
  47431. vm
  47432. );
  47433. }
  47434. }
  47435. }
  47436. callHook(vm, 'beforeMount');
  47437. var updateComponent;
  47438. /* istanbul ignore if */
  47439. if (config.performance && mark) {
  47440. updateComponent = function () {
  47441. var name = vm._name;
  47442. var id = vm._uid;
  47443. var startTag = "vue-perf-start:" + id;
  47444. var endTag = "vue-perf-end:" + id;
  47445. mark(startTag);
  47446. var vnode = vm._render();
  47447. mark(endTag);
  47448. measure(("vue " + name + " render"), startTag, endTag);
  47449. mark(startTag);
  47450. vm._update(vnode, hydrating);
  47451. mark(endTag);
  47452. measure(("vue " + name + " patch"), startTag, endTag);
  47453. };
  47454. } else {
  47455. updateComponent = function () {
  47456. vm._update(vm._render(), hydrating);
  47457. };
  47458. }
  47459. // we set this to vm._watcher inside the watcher's constructor
  47460. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  47461. // component's mounted hook), which relies on vm._watcher being already defined
  47462. new Watcher(vm, updateComponent, noop, {
  47463. before: function before () {
  47464. if (vm._isMounted && !vm._isDestroyed) {
  47465. callHook(vm, 'beforeUpdate');
  47466. }
  47467. }
  47468. }, true /* isRenderWatcher */);
  47469. hydrating = false;
  47470. // manually mounted instance, call mounted on self
  47471. // mounted is called for render-created child components in its inserted hook
  47472. if (vm.$vnode == null) {
  47473. vm._isMounted = true;
  47474. callHook(vm, 'mounted');
  47475. }
  47476. return vm
  47477. }
  47478. function updateChildComponent (
  47479. vm,
  47480. propsData,
  47481. listeners,
  47482. parentVnode,
  47483. renderChildren
  47484. ) {
  47485. {
  47486. isUpdatingChildComponent = true;
  47487. }
  47488. // determine whether component has slot children
  47489. // we need to do this before overwriting $options._renderChildren.
  47490. // check if there are dynamic scopedSlots (hand-written or compiled but with
  47491. // dynamic slot names). Static scoped slots compiled from template has the
  47492. // "$stable" marker.
  47493. var newScopedSlots = parentVnode.data.scopedSlots;
  47494. var oldScopedSlots = vm.$scopedSlots;
  47495. var hasDynamicScopedSlot = !!(
  47496. (newScopedSlots && !newScopedSlots.$stable) ||
  47497. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  47498. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  47499. );
  47500. // Any static slot children from the parent may have changed during parent's
  47501. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  47502. // update is necessary to ensure correctness.
  47503. var needsForceUpdate = !!(
  47504. renderChildren || // has new static slots
  47505. vm.$options._renderChildren || // has old static slots
  47506. hasDynamicScopedSlot
  47507. );
  47508. vm.$options._parentVnode = parentVnode;
  47509. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  47510. if (vm._vnode) { // update child tree's parent
  47511. vm._vnode.parent = parentVnode;
  47512. }
  47513. vm.$options._renderChildren = renderChildren;
  47514. // update $attrs and $listeners hash
  47515. // these are also reactive so they may trigger child update if the child
  47516. // used them during render
  47517. vm.$attrs = parentVnode.data.attrs || emptyObject;
  47518. vm.$listeners = listeners || emptyObject;
  47519. // update props
  47520. if (propsData && vm.$options.props) {
  47521. toggleObserving(false);
  47522. var props = vm._props;
  47523. var propKeys = vm.$options._propKeys || [];
  47524. for (var i = 0; i < propKeys.length; i++) {
  47525. var key = propKeys[i];
  47526. var propOptions = vm.$options.props; // wtf flow?
  47527. props[key] = validateProp(key, propOptions, propsData, vm);
  47528. }
  47529. toggleObserving(true);
  47530. // keep a copy of raw propsData
  47531. vm.$options.propsData = propsData;
  47532. }
  47533. // update listeners
  47534. listeners = listeners || emptyObject;
  47535. var oldListeners = vm.$options._parentListeners;
  47536. vm.$options._parentListeners = listeners;
  47537. updateComponentListeners(vm, listeners, oldListeners);
  47538. // resolve slots + force update if has children
  47539. if (needsForceUpdate) {
  47540. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  47541. vm.$forceUpdate();
  47542. }
  47543. {
  47544. isUpdatingChildComponent = false;
  47545. }
  47546. }
  47547. function isInInactiveTree (vm) {
  47548. while (vm && (vm = vm.$parent)) {
  47549. if (vm._inactive) { return true }
  47550. }
  47551. return false
  47552. }
  47553. function activateChildComponent (vm, direct) {
  47554. if (direct) {
  47555. vm._directInactive = false;
  47556. if (isInInactiveTree(vm)) {
  47557. return
  47558. }
  47559. } else if (vm._directInactive) {
  47560. return
  47561. }
  47562. if (vm._inactive || vm._inactive === null) {
  47563. vm._inactive = false;
  47564. for (var i = 0; i < vm.$children.length; i++) {
  47565. activateChildComponent(vm.$children[i]);
  47566. }
  47567. callHook(vm, 'activated');
  47568. }
  47569. }
  47570. function deactivateChildComponent (vm, direct) {
  47571. if (direct) {
  47572. vm._directInactive = true;
  47573. if (isInInactiveTree(vm)) {
  47574. return
  47575. }
  47576. }
  47577. if (!vm._inactive) {
  47578. vm._inactive = true;
  47579. for (var i = 0; i < vm.$children.length; i++) {
  47580. deactivateChildComponent(vm.$children[i]);
  47581. }
  47582. callHook(vm, 'deactivated');
  47583. }
  47584. }
  47585. function callHook (vm, hook) {
  47586. // #7573 disable dep collection when invoking lifecycle hooks
  47587. pushTarget();
  47588. var handlers = vm.$options[hook];
  47589. var info = hook + " hook";
  47590. if (handlers) {
  47591. for (var i = 0, j = handlers.length; i < j; i++) {
  47592. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  47593. }
  47594. }
  47595. if (vm._hasHookEvent) {
  47596. vm.$emit('hook:' + hook);
  47597. }
  47598. popTarget();
  47599. }
  47600. /* */
  47601. var MAX_UPDATE_COUNT = 100;
  47602. var queue = [];
  47603. var activatedChildren = [];
  47604. var has = {};
  47605. var circular = {};
  47606. var waiting = false;
  47607. var flushing = false;
  47608. var index = 0;
  47609. /**
  47610. * Reset the scheduler's state.
  47611. */
  47612. function resetSchedulerState () {
  47613. index = queue.length = activatedChildren.length = 0;
  47614. has = {};
  47615. {
  47616. circular = {};
  47617. }
  47618. waiting = flushing = false;
  47619. }
  47620. // Async edge case #6566 requires saving the timestamp when event listeners are
  47621. // attached. However, calling performance.now() has a perf overhead especially
  47622. // if the page has thousands of event listeners. Instead, we take a timestamp
  47623. // every time the scheduler flushes and use that for all event listeners
  47624. // attached during that flush.
  47625. var currentFlushTimestamp = 0;
  47626. // Async edge case fix requires storing an event listener's attach timestamp.
  47627. var getNow = Date.now;
  47628. // Determine what event timestamp the browser is using. Annoyingly, the
  47629. // timestamp can either be hi-res (relative to page load) or low-res
  47630. // (relative to UNIX epoch), so in order to compare time we have to use the
  47631. // same timestamp type when saving the flush timestamp.
  47632. // All IE versions use low-res event timestamps, and have problematic clock
  47633. // implementations (#9632)
  47634. if (inBrowser && !isIE) {
  47635. var performance = window.performance;
  47636. if (
  47637. performance &&
  47638. typeof performance.now === 'function' &&
  47639. getNow() > document.createEvent('Event').timeStamp
  47640. ) {
  47641. // if the event timestamp, although evaluated AFTER the Date.now(), is
  47642. // smaller than it, it means the event is using a hi-res timestamp,
  47643. // and we need to use the hi-res version for event listener timestamps as
  47644. // well.
  47645. getNow = function () { return performance.now(); };
  47646. }
  47647. }
  47648. /**
  47649. * Flush both queues and run the watchers.
  47650. */
  47651. function flushSchedulerQueue () {
  47652. currentFlushTimestamp = getNow();
  47653. flushing = true;
  47654. var watcher, id;
  47655. // Sort queue before flush.
  47656. // This ensures that:
  47657. // 1. Components are updated from parent to child. (because parent is always
  47658. // created before the child)
  47659. // 2. A component's user watchers are run before its render watcher (because
  47660. // user watchers are created before the render watcher)
  47661. // 3. If a component is destroyed during a parent component's watcher run,
  47662. // its watchers can be skipped.
  47663. queue.sort(function (a, b) { return a.id - b.id; });
  47664. // do not cache length because more watchers might be pushed
  47665. // as we run existing watchers
  47666. for (index = 0; index < queue.length; index++) {
  47667. watcher = queue[index];
  47668. if (watcher.before) {
  47669. watcher.before();
  47670. }
  47671. id = watcher.id;
  47672. has[id] = null;
  47673. watcher.run();
  47674. // in dev build, check and stop circular updates.
  47675. if (has[id] != null) {
  47676. circular[id] = (circular[id] || 0) + 1;
  47677. if (circular[id] > MAX_UPDATE_COUNT) {
  47678. warn(
  47679. 'You may have an infinite update loop ' + (
  47680. watcher.user
  47681. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  47682. : "in a component render function."
  47683. ),
  47684. watcher.vm
  47685. );
  47686. break
  47687. }
  47688. }
  47689. }
  47690. // keep copies of post queues before resetting state
  47691. var activatedQueue = activatedChildren.slice();
  47692. var updatedQueue = queue.slice();
  47693. resetSchedulerState();
  47694. // call component updated and activated hooks
  47695. callActivatedHooks(activatedQueue);
  47696. callUpdatedHooks(updatedQueue);
  47697. // devtool hook
  47698. /* istanbul ignore if */
  47699. if (devtools && config.devtools) {
  47700. devtools.emit('flush');
  47701. }
  47702. }
  47703. function callUpdatedHooks (queue) {
  47704. var i = queue.length;
  47705. while (i--) {
  47706. var watcher = queue[i];
  47707. var vm = watcher.vm;
  47708. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  47709. callHook(vm, 'updated');
  47710. }
  47711. }
  47712. }
  47713. /**
  47714. * Queue a kept-alive component that was activated during patch.
  47715. * The queue will be processed after the entire tree has been patched.
  47716. */
  47717. function queueActivatedComponent (vm) {
  47718. // setting _inactive to false here so that a render function can
  47719. // rely on checking whether it's in an inactive tree (e.g. router-view)
  47720. vm._inactive = false;
  47721. activatedChildren.push(vm);
  47722. }
  47723. function callActivatedHooks (queue) {
  47724. for (var i = 0; i < queue.length; i++) {
  47725. queue[i]._inactive = true;
  47726. activateChildComponent(queue[i], true /* true */);
  47727. }
  47728. }
  47729. /**
  47730. * Push a watcher into the watcher queue.
  47731. * Jobs with duplicate IDs will be skipped unless it's
  47732. * pushed when the queue is being flushed.
  47733. */
  47734. function queueWatcher (watcher) {
  47735. var id = watcher.id;
  47736. if (has[id] == null) {
  47737. has[id] = true;
  47738. if (!flushing) {
  47739. queue.push(watcher);
  47740. } else {
  47741. // if already flushing, splice the watcher based on its id
  47742. // if already past its id, it will be run next immediately.
  47743. var i = queue.length - 1;
  47744. while (i > index && queue[i].id > watcher.id) {
  47745. i--;
  47746. }
  47747. queue.splice(i + 1, 0, watcher);
  47748. }
  47749. // queue the flush
  47750. if (!waiting) {
  47751. waiting = true;
  47752. if (!config.async) {
  47753. flushSchedulerQueue();
  47754. return
  47755. }
  47756. nextTick(flushSchedulerQueue);
  47757. }
  47758. }
  47759. }
  47760. /* */
  47761. var uid$2 = 0;
  47762. /**
  47763. * A watcher parses an expression, collects dependencies,
  47764. * and fires callback when the expression value changes.
  47765. * This is used for both the $watch() api and directives.
  47766. */
  47767. var Watcher = function Watcher (
  47768. vm,
  47769. expOrFn,
  47770. cb,
  47771. options,
  47772. isRenderWatcher
  47773. ) {
  47774. this.vm = vm;
  47775. if (isRenderWatcher) {
  47776. vm._watcher = this;
  47777. }
  47778. vm._watchers.push(this);
  47779. // options
  47780. if (options) {
  47781. this.deep = !!options.deep;
  47782. this.user = !!options.user;
  47783. this.lazy = !!options.lazy;
  47784. this.sync = !!options.sync;
  47785. this.before = options.before;
  47786. } else {
  47787. this.deep = this.user = this.lazy = this.sync = false;
  47788. }
  47789. this.cb = cb;
  47790. this.id = ++uid$2; // uid for batching
  47791. this.active = true;
  47792. this.dirty = this.lazy; // for lazy watchers
  47793. this.deps = [];
  47794. this.newDeps = [];
  47795. this.depIds = new _Set();
  47796. this.newDepIds = new _Set();
  47797. this.expression = expOrFn.toString();
  47798. // parse expression for getter
  47799. if (typeof expOrFn === 'function') {
  47800. this.getter = expOrFn;
  47801. } else {
  47802. this.getter = parsePath(expOrFn);
  47803. if (!this.getter) {
  47804. this.getter = noop;
  47805. warn(
  47806. "Failed watching path: \"" + expOrFn + "\" " +
  47807. 'Watcher only accepts simple dot-delimited paths. ' +
  47808. 'For full control, use a function instead.',
  47809. vm
  47810. );
  47811. }
  47812. }
  47813. this.value = this.lazy
  47814. ? undefined
  47815. : this.get();
  47816. };
  47817. /**
  47818. * Evaluate the getter, and re-collect dependencies.
  47819. */
  47820. Watcher.prototype.get = function get () {
  47821. pushTarget(this);
  47822. var value;
  47823. var vm = this.vm;
  47824. try {
  47825. value = this.getter.call(vm, vm);
  47826. } catch (e) {
  47827. if (this.user) {
  47828. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  47829. } else {
  47830. throw e
  47831. }
  47832. } finally {
  47833. // "touch" every property so they are all tracked as
  47834. // dependencies for deep watching
  47835. if (this.deep) {
  47836. traverse(value);
  47837. }
  47838. popTarget();
  47839. this.cleanupDeps();
  47840. }
  47841. return value
  47842. };
  47843. /**
  47844. * Add a dependency to this directive.
  47845. */
  47846. Watcher.prototype.addDep = function addDep (dep) {
  47847. var id = dep.id;
  47848. if (!this.newDepIds.has(id)) {
  47849. this.newDepIds.add(id);
  47850. this.newDeps.push(dep);
  47851. if (!this.depIds.has(id)) {
  47852. dep.addSub(this);
  47853. }
  47854. }
  47855. };
  47856. /**
  47857. * Clean up for dependency collection.
  47858. */
  47859. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  47860. var i = this.deps.length;
  47861. while (i--) {
  47862. var dep = this.deps[i];
  47863. if (!this.newDepIds.has(dep.id)) {
  47864. dep.removeSub(this);
  47865. }
  47866. }
  47867. var tmp = this.depIds;
  47868. this.depIds = this.newDepIds;
  47869. this.newDepIds = tmp;
  47870. this.newDepIds.clear();
  47871. tmp = this.deps;
  47872. this.deps = this.newDeps;
  47873. this.newDeps = tmp;
  47874. this.newDeps.length = 0;
  47875. };
  47876. /**
  47877. * Subscriber interface.
  47878. * Will be called when a dependency changes.
  47879. */
  47880. Watcher.prototype.update = function update () {
  47881. /* istanbul ignore else */
  47882. if (this.lazy) {
  47883. this.dirty = true;
  47884. } else if (this.sync) {
  47885. this.run();
  47886. } else {
  47887. queueWatcher(this);
  47888. }
  47889. };
  47890. /**
  47891. * Scheduler job interface.
  47892. * Will be called by the scheduler.
  47893. */
  47894. Watcher.prototype.run = function run () {
  47895. if (this.active) {
  47896. var value = this.get();
  47897. if (
  47898. value !== this.value ||
  47899. // Deep watchers and watchers on Object/Arrays should fire even
  47900. // when the value is the same, because the value may
  47901. // have mutated.
  47902. isObject(value) ||
  47903. this.deep
  47904. ) {
  47905. // set new value
  47906. var oldValue = this.value;
  47907. this.value = value;
  47908. if (this.user) {
  47909. try {
  47910. this.cb.call(this.vm, value, oldValue);
  47911. } catch (e) {
  47912. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  47913. }
  47914. } else {
  47915. this.cb.call(this.vm, value, oldValue);
  47916. }
  47917. }
  47918. }
  47919. };
  47920. /**
  47921. * Evaluate the value of the watcher.
  47922. * This only gets called for lazy watchers.
  47923. */
  47924. Watcher.prototype.evaluate = function evaluate () {
  47925. this.value = this.get();
  47926. this.dirty = false;
  47927. };
  47928. /**
  47929. * Depend on all deps collected by this watcher.
  47930. */
  47931. Watcher.prototype.depend = function depend () {
  47932. var i = this.deps.length;
  47933. while (i--) {
  47934. this.deps[i].depend();
  47935. }
  47936. };
  47937. /**
  47938. * Remove self from all dependencies' subscriber list.
  47939. */
  47940. Watcher.prototype.teardown = function teardown () {
  47941. if (this.active) {
  47942. // remove self from vm's watcher list
  47943. // this is a somewhat expensive operation so we skip it
  47944. // if the vm is being destroyed.
  47945. if (!this.vm._isBeingDestroyed) {
  47946. remove(this.vm._watchers, this);
  47947. }
  47948. var i = this.deps.length;
  47949. while (i--) {
  47950. this.deps[i].removeSub(this);
  47951. }
  47952. this.active = false;
  47953. }
  47954. };
  47955. /* */
  47956. var sharedPropertyDefinition = {
  47957. enumerable: true,
  47958. configurable: true,
  47959. get: noop,
  47960. set: noop
  47961. };
  47962. function proxy (target, sourceKey, key) {
  47963. sharedPropertyDefinition.get = function proxyGetter () {
  47964. return this[sourceKey][key]
  47965. };
  47966. sharedPropertyDefinition.set = function proxySetter (val) {
  47967. this[sourceKey][key] = val;
  47968. };
  47969. Object.defineProperty(target, key, sharedPropertyDefinition);
  47970. }
  47971. function initState (vm) {
  47972. vm._watchers = [];
  47973. var opts = vm.$options;
  47974. if (opts.props) { initProps(vm, opts.props); }
  47975. if (opts.methods) { initMethods(vm, opts.methods); }
  47976. if (opts.data) {
  47977. initData(vm);
  47978. } else {
  47979. observe(vm._data = {}, true /* asRootData */);
  47980. }
  47981. if (opts.computed) { initComputed(vm, opts.computed); }
  47982. if (opts.watch && opts.watch !== nativeWatch) {
  47983. initWatch(vm, opts.watch);
  47984. }
  47985. }
  47986. function initProps (vm, propsOptions) {
  47987. var propsData = vm.$options.propsData || {};
  47988. var props = vm._props = {};
  47989. // cache prop keys so that future props updates can iterate using Array
  47990. // instead of dynamic object key enumeration.
  47991. var keys = vm.$options._propKeys = [];
  47992. var isRoot = !vm.$parent;
  47993. // root instance props should be converted
  47994. if (!isRoot) {
  47995. toggleObserving(false);
  47996. }
  47997. var loop = function ( key ) {
  47998. keys.push(key);
  47999. var value = validateProp(key, propsOptions, propsData, vm);
  48000. /* istanbul ignore else */
  48001. {
  48002. var hyphenatedKey = hyphenate(key);
  48003. if (isReservedAttribute(hyphenatedKey) ||
  48004. config.isReservedAttr(hyphenatedKey)) {
  48005. warn(
  48006. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48007. vm
  48008. );
  48009. }
  48010. defineReactive$$1(props, key, value, function () {
  48011. if (!isRoot && !isUpdatingChildComponent) {
  48012. warn(
  48013. "Avoid mutating a prop directly since the value will be " +
  48014. "overwritten whenever the parent component re-renders. " +
  48015. "Instead, use a data or computed property based on the prop's " +
  48016. "value. Prop being mutated: \"" + key + "\"",
  48017. vm
  48018. );
  48019. }
  48020. });
  48021. }
  48022. // static props are already proxied on the component's prototype
  48023. // during Vue.extend(). We only need to proxy props defined at
  48024. // instantiation here.
  48025. if (!(key in vm)) {
  48026. proxy(vm, "_props", key);
  48027. }
  48028. };
  48029. for (var key in propsOptions) loop( key );
  48030. toggleObserving(true);
  48031. }
  48032. function initData (vm) {
  48033. var data = vm.$options.data;
  48034. data = vm._data = typeof data === 'function'
  48035. ? getData(data, vm)
  48036. : data || {};
  48037. if (!isPlainObject(data)) {
  48038. data = {};
  48039. warn(
  48040. 'data functions should return an object:\n' +
  48041. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48042. vm
  48043. );
  48044. }
  48045. // proxy data on instance
  48046. var keys = Object.keys(data);
  48047. var props = vm.$options.props;
  48048. var methods = vm.$options.methods;
  48049. var i = keys.length;
  48050. while (i--) {
  48051. var key = keys[i];
  48052. {
  48053. if (methods && hasOwn(methods, key)) {
  48054. warn(
  48055. ("Method \"" + key + "\" has already been defined as a data property."),
  48056. vm
  48057. );
  48058. }
  48059. }
  48060. if (props && hasOwn(props, key)) {
  48061. warn(
  48062. "The data property \"" + key + "\" is already declared as a prop. " +
  48063. "Use prop default value instead.",
  48064. vm
  48065. );
  48066. } else if (!isReserved(key)) {
  48067. proxy(vm, "_data", key);
  48068. }
  48069. }
  48070. // observe data
  48071. observe(data, true /* asRootData */);
  48072. }
  48073. function getData (data, vm) {
  48074. // #7573 disable dep collection when invoking data getters
  48075. pushTarget();
  48076. try {
  48077. return data.call(vm, vm)
  48078. } catch (e) {
  48079. handleError(e, vm, "data()");
  48080. return {}
  48081. } finally {
  48082. popTarget();
  48083. }
  48084. }
  48085. var computedWatcherOptions = { lazy: true };
  48086. function initComputed (vm, computed) {
  48087. // $flow-disable-line
  48088. var watchers = vm._computedWatchers = Object.create(null);
  48089. // computed properties are just getters during SSR
  48090. var isSSR = isServerRendering();
  48091. for (var key in computed) {
  48092. var userDef = computed[key];
  48093. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48094. if (getter == null) {
  48095. warn(
  48096. ("Getter is missing for computed property \"" + key + "\"."),
  48097. vm
  48098. );
  48099. }
  48100. if (!isSSR) {
  48101. // create internal watcher for the computed property.
  48102. watchers[key] = new Watcher(
  48103. vm,
  48104. getter || noop,
  48105. noop,
  48106. computedWatcherOptions
  48107. );
  48108. }
  48109. // component-defined computed properties are already defined on the
  48110. // component prototype. We only need to define computed properties defined
  48111. // at instantiation here.
  48112. if (!(key in vm)) {
  48113. defineComputed(vm, key, userDef);
  48114. } else {
  48115. if (key in vm.$data) {
  48116. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48117. } else if (vm.$options.props && key in vm.$options.props) {
  48118. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48119. }
  48120. }
  48121. }
  48122. }
  48123. function defineComputed (
  48124. target,
  48125. key,
  48126. userDef
  48127. ) {
  48128. var shouldCache = !isServerRendering();
  48129. if (typeof userDef === 'function') {
  48130. sharedPropertyDefinition.get = shouldCache
  48131. ? createComputedGetter(key)
  48132. : createGetterInvoker(userDef);
  48133. sharedPropertyDefinition.set = noop;
  48134. } else {
  48135. sharedPropertyDefinition.get = userDef.get
  48136. ? shouldCache && userDef.cache !== false
  48137. ? createComputedGetter(key)
  48138. : createGetterInvoker(userDef.get)
  48139. : noop;
  48140. sharedPropertyDefinition.set = userDef.set || noop;
  48141. }
  48142. if (sharedPropertyDefinition.set === noop) {
  48143. sharedPropertyDefinition.set = function () {
  48144. warn(
  48145. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48146. this
  48147. );
  48148. };
  48149. }
  48150. Object.defineProperty(target, key, sharedPropertyDefinition);
  48151. }
  48152. function createComputedGetter (key) {
  48153. return function computedGetter () {
  48154. var watcher = this._computedWatchers && this._computedWatchers[key];
  48155. if (watcher) {
  48156. if (watcher.dirty) {
  48157. watcher.evaluate();
  48158. }
  48159. if (Dep.target) {
  48160. watcher.depend();
  48161. }
  48162. return watcher.value
  48163. }
  48164. }
  48165. }
  48166. function createGetterInvoker(fn) {
  48167. return function computedGetter () {
  48168. return fn.call(this, this)
  48169. }
  48170. }
  48171. function initMethods (vm, methods) {
  48172. var props = vm.$options.props;
  48173. for (var key in methods) {
  48174. {
  48175. if (typeof methods[key] !== 'function') {
  48176. warn(
  48177. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48178. "Did you reference the function correctly?",
  48179. vm
  48180. );
  48181. }
  48182. if (props && hasOwn(props, key)) {
  48183. warn(
  48184. ("Method \"" + key + "\" has already been defined as a prop."),
  48185. vm
  48186. );
  48187. }
  48188. if ((key in vm) && isReserved(key)) {
  48189. warn(
  48190. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48191. "Avoid defining component methods that start with _ or $."
  48192. );
  48193. }
  48194. }
  48195. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48196. }
  48197. }
  48198. function initWatch (vm, watch) {
  48199. for (var key in watch) {
  48200. var handler = watch[key];
  48201. if (Array.isArray(handler)) {
  48202. for (var i = 0; i < handler.length; i++) {
  48203. createWatcher(vm, key, handler[i]);
  48204. }
  48205. } else {
  48206. createWatcher(vm, key, handler);
  48207. }
  48208. }
  48209. }
  48210. function createWatcher (
  48211. vm,
  48212. expOrFn,
  48213. handler,
  48214. options
  48215. ) {
  48216. if (isPlainObject(handler)) {
  48217. options = handler;
  48218. handler = handler.handler;
  48219. }
  48220. if (typeof handler === 'string') {
  48221. handler = vm[handler];
  48222. }
  48223. return vm.$watch(expOrFn, handler, options)
  48224. }
  48225. function stateMixin (Vue) {
  48226. // flow somehow has problems with directly declared definition object
  48227. // when using Object.defineProperty, so we have to procedurally build up
  48228. // the object here.
  48229. var dataDef = {};
  48230. dataDef.get = function () { return this._data };
  48231. var propsDef = {};
  48232. propsDef.get = function () { return this._props };
  48233. {
  48234. dataDef.set = function () {
  48235. warn(
  48236. 'Avoid replacing instance root $data. ' +
  48237. 'Use nested data properties instead.',
  48238. this
  48239. );
  48240. };
  48241. propsDef.set = function () {
  48242. warn("$props is readonly.", this);
  48243. };
  48244. }
  48245. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48246. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48247. Vue.prototype.$set = set;
  48248. Vue.prototype.$delete = del;
  48249. Vue.prototype.$watch = function (
  48250. expOrFn,
  48251. cb,
  48252. options
  48253. ) {
  48254. var vm = this;
  48255. if (isPlainObject(cb)) {
  48256. return createWatcher(vm, expOrFn, cb, options)
  48257. }
  48258. options = options || {};
  48259. options.user = true;
  48260. var watcher = new Watcher(vm, expOrFn, cb, options);
  48261. if (options.immediate) {
  48262. try {
  48263. cb.call(vm, watcher.value);
  48264. } catch (error) {
  48265. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48266. }
  48267. }
  48268. return function unwatchFn () {
  48269. watcher.teardown();
  48270. }
  48271. };
  48272. }
  48273. /* */
  48274. var uid$3 = 0;
  48275. function initMixin (Vue) {
  48276. Vue.prototype._init = function (options) {
  48277. var vm = this;
  48278. // a uid
  48279. vm._uid = uid$3++;
  48280. var startTag, endTag;
  48281. /* istanbul ignore if */
  48282. if (config.performance && mark) {
  48283. startTag = "vue-perf-start:" + (vm._uid);
  48284. endTag = "vue-perf-end:" + (vm._uid);
  48285. mark(startTag);
  48286. }
  48287. // a flag to avoid this being observed
  48288. vm._isVue = true;
  48289. // merge options
  48290. if (options && options._isComponent) {
  48291. // optimize internal component instantiation
  48292. // since dynamic options merging is pretty slow, and none of the
  48293. // internal component options needs special treatment.
  48294. initInternalComponent(vm, options);
  48295. } else {
  48296. vm.$options = mergeOptions(
  48297. resolveConstructorOptions(vm.constructor),
  48298. options || {},
  48299. vm
  48300. );
  48301. }
  48302. /* istanbul ignore else */
  48303. {
  48304. initProxy(vm);
  48305. }
  48306. // expose real self
  48307. vm._self = vm;
  48308. initLifecycle(vm);
  48309. initEvents(vm);
  48310. initRender(vm);
  48311. callHook(vm, 'beforeCreate');
  48312. initInjections(vm); // resolve injections before data/props
  48313. initState(vm);
  48314. initProvide(vm); // resolve provide after data/props
  48315. callHook(vm, 'created');
  48316. /* istanbul ignore if */
  48317. if (config.performance && mark) {
  48318. vm._name = formatComponentName(vm, false);
  48319. mark(endTag);
  48320. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  48321. }
  48322. if (vm.$options.el) {
  48323. vm.$mount(vm.$options.el);
  48324. }
  48325. };
  48326. }
  48327. function initInternalComponent (vm, options) {
  48328. var opts = vm.$options = Object.create(vm.constructor.options);
  48329. // doing this because it's faster than dynamic enumeration.
  48330. var parentVnode = options._parentVnode;
  48331. opts.parent = options.parent;
  48332. opts._parentVnode = parentVnode;
  48333. var vnodeComponentOptions = parentVnode.componentOptions;
  48334. opts.propsData = vnodeComponentOptions.propsData;
  48335. opts._parentListeners = vnodeComponentOptions.listeners;
  48336. opts._renderChildren = vnodeComponentOptions.children;
  48337. opts._componentTag = vnodeComponentOptions.tag;
  48338. if (options.render) {
  48339. opts.render = options.render;
  48340. opts.staticRenderFns = options.staticRenderFns;
  48341. }
  48342. }
  48343. function resolveConstructorOptions (Ctor) {
  48344. var options = Ctor.options;
  48345. if (Ctor.super) {
  48346. var superOptions = resolveConstructorOptions(Ctor.super);
  48347. var cachedSuperOptions = Ctor.superOptions;
  48348. if (superOptions !== cachedSuperOptions) {
  48349. // super option changed,
  48350. // need to resolve new options.
  48351. Ctor.superOptions = superOptions;
  48352. // check if there are any late-modified/attached options (#4976)
  48353. var modifiedOptions = resolveModifiedOptions(Ctor);
  48354. // update base extend options
  48355. if (modifiedOptions) {
  48356. extend(Ctor.extendOptions, modifiedOptions);
  48357. }
  48358. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  48359. if (options.name) {
  48360. options.components[options.name] = Ctor;
  48361. }
  48362. }
  48363. }
  48364. return options
  48365. }
  48366. function resolveModifiedOptions (Ctor) {
  48367. var modified;
  48368. var latest = Ctor.options;
  48369. var sealed = Ctor.sealedOptions;
  48370. for (var key in latest) {
  48371. if (latest[key] !== sealed[key]) {
  48372. if (!modified) { modified = {}; }
  48373. modified[key] = latest[key];
  48374. }
  48375. }
  48376. return modified
  48377. }
  48378. function Vue (options) {
  48379. if (!(this instanceof Vue)
  48380. ) {
  48381. warn('Vue is a constructor and should be called with the `new` keyword');
  48382. }
  48383. this._init(options);
  48384. }
  48385. initMixin(Vue);
  48386. stateMixin(Vue);
  48387. eventsMixin(Vue);
  48388. lifecycleMixin(Vue);
  48389. renderMixin(Vue);
  48390. /* */
  48391. function initUse (Vue) {
  48392. Vue.use = function (plugin) {
  48393. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  48394. if (installedPlugins.indexOf(plugin) > -1) {
  48395. return this
  48396. }
  48397. // additional parameters
  48398. var args = toArray(arguments, 1);
  48399. args.unshift(this);
  48400. if (typeof plugin.install === 'function') {
  48401. plugin.install.apply(plugin, args);
  48402. } else if (typeof plugin === 'function') {
  48403. plugin.apply(null, args);
  48404. }
  48405. installedPlugins.push(plugin);
  48406. return this
  48407. };
  48408. }
  48409. /* */
  48410. function initMixin$1 (Vue) {
  48411. Vue.mixin = function (mixin) {
  48412. this.options = mergeOptions(this.options, mixin);
  48413. return this
  48414. };
  48415. }
  48416. /* */
  48417. function initExtend (Vue) {
  48418. /**
  48419. * Each instance constructor, including Vue, has a unique
  48420. * cid. This enables us to create wrapped "child
  48421. * constructors" for prototypal inheritance and cache them.
  48422. */
  48423. Vue.cid = 0;
  48424. var cid = 1;
  48425. /**
  48426. * Class inheritance
  48427. */
  48428. Vue.extend = function (extendOptions) {
  48429. extendOptions = extendOptions || {};
  48430. var Super = this;
  48431. var SuperId = Super.cid;
  48432. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  48433. if (cachedCtors[SuperId]) {
  48434. return cachedCtors[SuperId]
  48435. }
  48436. var name = extendOptions.name || Super.options.name;
  48437. if (name) {
  48438. validateComponentName(name);
  48439. }
  48440. var Sub = function VueComponent (options) {
  48441. this._init(options);
  48442. };
  48443. Sub.prototype = Object.create(Super.prototype);
  48444. Sub.prototype.constructor = Sub;
  48445. Sub.cid = cid++;
  48446. Sub.options = mergeOptions(
  48447. Super.options,
  48448. extendOptions
  48449. );
  48450. Sub['super'] = Super;
  48451. // For props and computed properties, we define the proxy getters on
  48452. // the Vue instances at extension time, on the extended prototype. This
  48453. // avoids Object.defineProperty calls for each instance created.
  48454. if (Sub.options.props) {
  48455. initProps$1(Sub);
  48456. }
  48457. if (Sub.options.computed) {
  48458. initComputed$1(Sub);
  48459. }
  48460. // allow further extension/mixin/plugin usage
  48461. Sub.extend = Super.extend;
  48462. Sub.mixin = Super.mixin;
  48463. Sub.use = Super.use;
  48464. // create asset registers, so extended classes
  48465. // can have their private assets too.
  48466. ASSET_TYPES.forEach(function (type) {
  48467. Sub[type] = Super[type];
  48468. });
  48469. // enable recursive self-lookup
  48470. if (name) {
  48471. Sub.options.components[name] = Sub;
  48472. }
  48473. // keep a reference to the super options at extension time.
  48474. // later at instantiation we can check if Super's options have
  48475. // been updated.
  48476. Sub.superOptions = Super.options;
  48477. Sub.extendOptions = extendOptions;
  48478. Sub.sealedOptions = extend({}, Sub.options);
  48479. // cache constructor
  48480. cachedCtors[SuperId] = Sub;
  48481. return Sub
  48482. };
  48483. }
  48484. function initProps$1 (Comp) {
  48485. var props = Comp.options.props;
  48486. for (var key in props) {
  48487. proxy(Comp.prototype, "_props", key);
  48488. }
  48489. }
  48490. function initComputed$1 (Comp) {
  48491. var computed = Comp.options.computed;
  48492. for (var key in computed) {
  48493. defineComputed(Comp.prototype, key, computed[key]);
  48494. }
  48495. }
  48496. /* */
  48497. function initAssetRegisters (Vue) {
  48498. /**
  48499. * Create asset registration methods.
  48500. */
  48501. ASSET_TYPES.forEach(function (type) {
  48502. Vue[type] = function (
  48503. id,
  48504. definition
  48505. ) {
  48506. if (!definition) {
  48507. return this.options[type + 's'][id]
  48508. } else {
  48509. /* istanbul ignore if */
  48510. if (type === 'component') {
  48511. validateComponentName(id);
  48512. }
  48513. if (type === 'component' && isPlainObject(definition)) {
  48514. definition.name = definition.name || id;
  48515. definition = this.options._base.extend(definition);
  48516. }
  48517. if (type === 'directive' && typeof definition === 'function') {
  48518. definition = { bind: definition, update: definition };
  48519. }
  48520. this.options[type + 's'][id] = definition;
  48521. return definition
  48522. }
  48523. };
  48524. });
  48525. }
  48526. /* */
  48527. function getComponentName (opts) {
  48528. return opts && (opts.Ctor.options.name || opts.tag)
  48529. }
  48530. function matches (pattern, name) {
  48531. if (Array.isArray(pattern)) {
  48532. return pattern.indexOf(name) > -1
  48533. } else if (typeof pattern === 'string') {
  48534. return pattern.split(',').indexOf(name) > -1
  48535. } else if (isRegExp(pattern)) {
  48536. return pattern.test(name)
  48537. }
  48538. /* istanbul ignore next */
  48539. return false
  48540. }
  48541. function pruneCache (keepAliveInstance, filter) {
  48542. var cache = keepAliveInstance.cache;
  48543. var keys = keepAliveInstance.keys;
  48544. var _vnode = keepAliveInstance._vnode;
  48545. for (var key in cache) {
  48546. var cachedNode = cache[key];
  48547. if (cachedNode) {
  48548. var name = getComponentName(cachedNode.componentOptions);
  48549. if (name && !filter(name)) {
  48550. pruneCacheEntry(cache, key, keys, _vnode);
  48551. }
  48552. }
  48553. }
  48554. }
  48555. function pruneCacheEntry (
  48556. cache,
  48557. key,
  48558. keys,
  48559. current
  48560. ) {
  48561. var cached$$1 = cache[key];
  48562. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  48563. cached$$1.componentInstance.$destroy();
  48564. }
  48565. cache[key] = null;
  48566. remove(keys, key);
  48567. }
  48568. var patternTypes = [String, RegExp, Array];
  48569. var KeepAlive = {
  48570. name: 'keep-alive',
  48571. abstract: true,
  48572. props: {
  48573. include: patternTypes,
  48574. exclude: patternTypes,
  48575. max: [String, Number]
  48576. },
  48577. created: function created () {
  48578. this.cache = Object.create(null);
  48579. this.keys = [];
  48580. },
  48581. destroyed: function destroyed () {
  48582. for (var key in this.cache) {
  48583. pruneCacheEntry(this.cache, key, this.keys);
  48584. }
  48585. },
  48586. mounted: function mounted () {
  48587. var this$1 = this;
  48588. this.$watch('include', function (val) {
  48589. pruneCache(this$1, function (name) { return matches(val, name); });
  48590. });
  48591. this.$watch('exclude', function (val) {
  48592. pruneCache(this$1, function (name) { return !matches(val, name); });
  48593. });
  48594. },
  48595. render: function render () {
  48596. var slot = this.$slots.default;
  48597. var vnode = getFirstComponentChild(slot);
  48598. var componentOptions = vnode && vnode.componentOptions;
  48599. if (componentOptions) {
  48600. // check pattern
  48601. var name = getComponentName(componentOptions);
  48602. var ref = this;
  48603. var include = ref.include;
  48604. var exclude = ref.exclude;
  48605. if (
  48606. // not included
  48607. (include && (!name || !matches(include, name))) ||
  48608. // excluded
  48609. (exclude && name && matches(exclude, name))
  48610. ) {
  48611. return vnode
  48612. }
  48613. var ref$1 = this;
  48614. var cache = ref$1.cache;
  48615. var keys = ref$1.keys;
  48616. var key = vnode.key == null
  48617. // same constructor may get registered as different local components
  48618. // so cid alone is not enough (#3269)
  48619. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  48620. : vnode.key;
  48621. if (cache[key]) {
  48622. vnode.componentInstance = cache[key].componentInstance;
  48623. // make current key freshest
  48624. remove(keys, key);
  48625. keys.push(key);
  48626. } else {
  48627. cache[key] = vnode;
  48628. keys.push(key);
  48629. // prune oldest entry
  48630. if (this.max && keys.length > parseInt(this.max)) {
  48631. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  48632. }
  48633. }
  48634. vnode.data.keepAlive = true;
  48635. }
  48636. return vnode || (slot && slot[0])
  48637. }
  48638. };
  48639. var builtInComponents = {
  48640. KeepAlive: KeepAlive
  48641. };
  48642. /* */
  48643. function initGlobalAPI (Vue) {
  48644. // config
  48645. var configDef = {};
  48646. configDef.get = function () { return config; };
  48647. {
  48648. configDef.set = function () {
  48649. warn(
  48650. 'Do not replace the Vue.config object, set individual fields instead.'
  48651. );
  48652. };
  48653. }
  48654. Object.defineProperty(Vue, 'config', configDef);
  48655. // exposed util methods.
  48656. // NOTE: these are not considered part of the public API - avoid relying on
  48657. // them unless you are aware of the risk.
  48658. Vue.util = {
  48659. warn: warn,
  48660. extend: extend,
  48661. mergeOptions: mergeOptions,
  48662. defineReactive: defineReactive$$1
  48663. };
  48664. Vue.set = set;
  48665. Vue.delete = del;
  48666. Vue.nextTick = nextTick;
  48667. // 2.6 explicit observable API
  48668. Vue.observable = function (obj) {
  48669. observe(obj);
  48670. return obj
  48671. };
  48672. Vue.options = Object.create(null);
  48673. ASSET_TYPES.forEach(function (type) {
  48674. Vue.options[type + 's'] = Object.create(null);
  48675. });
  48676. // this is used to identify the "base" constructor to extend all plain-object
  48677. // components with in Weex's multi-instance scenarios.
  48678. Vue.options._base = Vue;
  48679. extend(Vue.options.components, builtInComponents);
  48680. initUse(Vue);
  48681. initMixin$1(Vue);
  48682. initExtend(Vue);
  48683. initAssetRegisters(Vue);
  48684. }
  48685. initGlobalAPI(Vue);
  48686. Object.defineProperty(Vue.prototype, '$isServer', {
  48687. get: isServerRendering
  48688. });
  48689. Object.defineProperty(Vue.prototype, '$ssrContext', {
  48690. get: function get () {
  48691. /* istanbul ignore next */
  48692. return this.$vnode && this.$vnode.ssrContext
  48693. }
  48694. });
  48695. // expose FunctionalRenderContext for ssr runtime helper installation
  48696. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  48697. value: FunctionalRenderContext
  48698. });
  48699. Vue.version = '2.6.11';
  48700. /* */
  48701. // these are reserved for web because they are directly compiled away
  48702. // during template compilation
  48703. var isReservedAttr = makeMap('style,class');
  48704. // attributes that should be using props for binding
  48705. var acceptValue = makeMap('input,textarea,option,select,progress');
  48706. var mustUseProp = function (tag, type, attr) {
  48707. return (
  48708. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  48709. (attr === 'selected' && tag === 'option') ||
  48710. (attr === 'checked' && tag === 'input') ||
  48711. (attr === 'muted' && tag === 'video')
  48712. )
  48713. };
  48714. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  48715. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  48716. var convertEnumeratedValue = function (key, value) {
  48717. return isFalsyAttrValue(value) || value === 'false'
  48718. ? 'false'
  48719. // allow arbitrary string value for contenteditable
  48720. : key === 'contenteditable' && isValidContentEditableValue(value)
  48721. ? value
  48722. : 'true'
  48723. };
  48724. var isBooleanAttr = makeMap(
  48725. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  48726. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  48727. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  48728. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  48729. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  48730. 'truespeed,typemustmatch,visible'
  48731. );
  48732. var xlinkNS = 'http://www.w3.org/1999/xlink';
  48733. var isXlink = function (name) {
  48734. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  48735. };
  48736. var getXlinkProp = function (name) {
  48737. return isXlink(name) ? name.slice(6, name.length) : ''
  48738. };
  48739. var isFalsyAttrValue = function (val) {
  48740. return val == null || val === false
  48741. };
  48742. /* */
  48743. function genClassForVnode (vnode) {
  48744. var data = vnode.data;
  48745. var parentNode = vnode;
  48746. var childNode = vnode;
  48747. while (isDef(childNode.componentInstance)) {
  48748. childNode = childNode.componentInstance._vnode;
  48749. if (childNode && childNode.data) {
  48750. data = mergeClassData(childNode.data, data);
  48751. }
  48752. }
  48753. while (isDef(parentNode = parentNode.parent)) {
  48754. if (parentNode && parentNode.data) {
  48755. data = mergeClassData(data, parentNode.data);
  48756. }
  48757. }
  48758. return renderClass(data.staticClass, data.class)
  48759. }
  48760. function mergeClassData (child, parent) {
  48761. return {
  48762. staticClass: concat(child.staticClass, parent.staticClass),
  48763. class: isDef(child.class)
  48764. ? [child.class, parent.class]
  48765. : parent.class
  48766. }
  48767. }
  48768. function renderClass (
  48769. staticClass,
  48770. dynamicClass
  48771. ) {
  48772. if (isDef(staticClass) || isDef(dynamicClass)) {
  48773. return concat(staticClass, stringifyClass(dynamicClass))
  48774. }
  48775. /* istanbul ignore next */
  48776. return ''
  48777. }
  48778. function concat (a, b) {
  48779. return a ? b ? (a + ' ' + b) : a : (b || '')
  48780. }
  48781. function stringifyClass (value) {
  48782. if (Array.isArray(value)) {
  48783. return stringifyArray(value)
  48784. }
  48785. if (isObject(value)) {
  48786. return stringifyObject(value)
  48787. }
  48788. if (typeof value === 'string') {
  48789. return value
  48790. }
  48791. /* istanbul ignore next */
  48792. return ''
  48793. }
  48794. function stringifyArray (value) {
  48795. var res = '';
  48796. var stringified;
  48797. for (var i = 0, l = value.length; i < l; i++) {
  48798. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  48799. if (res) { res += ' '; }
  48800. res += stringified;
  48801. }
  48802. }
  48803. return res
  48804. }
  48805. function stringifyObject (value) {
  48806. var res = '';
  48807. for (var key in value) {
  48808. if (value[key]) {
  48809. if (res) { res += ' '; }
  48810. res += key;
  48811. }
  48812. }
  48813. return res
  48814. }
  48815. /* */
  48816. var namespaceMap = {
  48817. svg: 'http://www.w3.org/2000/svg',
  48818. math: 'http://www.w3.org/1998/Math/MathML'
  48819. };
  48820. var isHTMLTag = makeMap(
  48821. 'html,body,base,head,link,meta,style,title,' +
  48822. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  48823. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  48824. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  48825. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  48826. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  48827. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  48828. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  48829. 'output,progress,select,textarea,' +
  48830. 'details,dialog,menu,menuitem,summary,' +
  48831. 'content,element,shadow,template,blockquote,iframe,tfoot'
  48832. );
  48833. // this map is intentionally selective, only covering SVG elements that may
  48834. // contain child elements.
  48835. var isSVG = makeMap(
  48836. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  48837. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  48838. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  48839. true
  48840. );
  48841. var isPreTag = function (tag) { return tag === 'pre'; };
  48842. var isReservedTag = function (tag) {
  48843. return isHTMLTag(tag) || isSVG(tag)
  48844. };
  48845. function getTagNamespace (tag) {
  48846. if (isSVG(tag)) {
  48847. return 'svg'
  48848. }
  48849. // basic support for MathML
  48850. // note it doesn't support other MathML elements being component roots
  48851. if (tag === 'math') {
  48852. return 'math'
  48853. }
  48854. }
  48855. var unknownElementCache = Object.create(null);
  48856. function isUnknownElement (tag) {
  48857. /* istanbul ignore if */
  48858. if (!inBrowser) {
  48859. return true
  48860. }
  48861. if (isReservedTag(tag)) {
  48862. return false
  48863. }
  48864. tag = tag.toLowerCase();
  48865. /* istanbul ignore if */
  48866. if (unknownElementCache[tag] != null) {
  48867. return unknownElementCache[tag]
  48868. }
  48869. var el = document.createElement(tag);
  48870. if (tag.indexOf('-') > -1) {
  48871. // http://stackoverflow.com/a/28210364/1070244
  48872. return (unknownElementCache[tag] = (
  48873. el.constructor === window.HTMLUnknownElement ||
  48874. el.constructor === window.HTMLElement
  48875. ))
  48876. } else {
  48877. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  48878. }
  48879. }
  48880. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  48881. /* */
  48882. /**
  48883. * Query an element selector if it's not an element already.
  48884. */
  48885. function query (el) {
  48886. if (typeof el === 'string') {
  48887. var selected = document.querySelector(el);
  48888. if (!selected) {
  48889. warn(
  48890. 'Cannot find element: ' + el
  48891. );
  48892. return document.createElement('div')
  48893. }
  48894. return selected
  48895. } else {
  48896. return el
  48897. }
  48898. }
  48899. /* */
  48900. function createElement$1 (tagName, vnode) {
  48901. var elm = document.createElement(tagName);
  48902. if (tagName !== 'select') {
  48903. return elm
  48904. }
  48905. // false or null will remove the attribute but undefined will not
  48906. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  48907. elm.setAttribute('multiple', 'multiple');
  48908. }
  48909. return elm
  48910. }
  48911. function createElementNS (namespace, tagName) {
  48912. return document.createElementNS(namespaceMap[namespace], tagName)
  48913. }
  48914. function createTextNode (text) {
  48915. return document.createTextNode(text)
  48916. }
  48917. function createComment (text) {
  48918. return document.createComment(text)
  48919. }
  48920. function insertBefore (parentNode, newNode, referenceNode) {
  48921. parentNode.insertBefore(newNode, referenceNode);
  48922. }
  48923. function removeChild (node, child) {
  48924. node.removeChild(child);
  48925. }
  48926. function appendChild (node, child) {
  48927. node.appendChild(child);
  48928. }
  48929. function parentNode (node) {
  48930. return node.parentNode
  48931. }
  48932. function nextSibling (node) {
  48933. return node.nextSibling
  48934. }
  48935. function tagName (node) {
  48936. return node.tagName
  48937. }
  48938. function setTextContent (node, text) {
  48939. node.textContent = text;
  48940. }
  48941. function setStyleScope (node, scopeId) {
  48942. node.setAttribute(scopeId, '');
  48943. }
  48944. var nodeOps = /*#__PURE__*/Object.freeze({
  48945. createElement: createElement$1,
  48946. createElementNS: createElementNS,
  48947. createTextNode: createTextNode,
  48948. createComment: createComment,
  48949. insertBefore: insertBefore,
  48950. removeChild: removeChild,
  48951. appendChild: appendChild,
  48952. parentNode: parentNode,
  48953. nextSibling: nextSibling,
  48954. tagName: tagName,
  48955. setTextContent: setTextContent,
  48956. setStyleScope: setStyleScope
  48957. });
  48958. /* */
  48959. var ref = {
  48960. create: function create (_, vnode) {
  48961. registerRef(vnode);
  48962. },
  48963. update: function update (oldVnode, vnode) {
  48964. if (oldVnode.data.ref !== vnode.data.ref) {
  48965. registerRef(oldVnode, true);
  48966. registerRef(vnode);
  48967. }
  48968. },
  48969. destroy: function destroy (vnode) {
  48970. registerRef(vnode, true);
  48971. }
  48972. };
  48973. function registerRef (vnode, isRemoval) {
  48974. var key = vnode.data.ref;
  48975. if (!isDef(key)) { return }
  48976. var vm = vnode.context;
  48977. var ref = vnode.componentInstance || vnode.elm;
  48978. var refs = vm.$refs;
  48979. if (isRemoval) {
  48980. if (Array.isArray(refs[key])) {
  48981. remove(refs[key], ref);
  48982. } else if (refs[key] === ref) {
  48983. refs[key] = undefined;
  48984. }
  48985. } else {
  48986. if (vnode.data.refInFor) {
  48987. if (!Array.isArray(refs[key])) {
  48988. refs[key] = [ref];
  48989. } else if (refs[key].indexOf(ref) < 0) {
  48990. // $flow-disable-line
  48991. refs[key].push(ref);
  48992. }
  48993. } else {
  48994. refs[key] = ref;
  48995. }
  48996. }
  48997. }
  48998. /**
  48999. * Virtual DOM patching algorithm based on Snabbdom by
  49000. * Simon Friis Vindum (@paldepind)
  49001. * Licensed under the MIT License
  49002. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49003. *
  49004. * modified by Evan You (@yyx990803)
  49005. *
  49006. * Not type-checking this because this file is perf-critical and the cost
  49007. * of making flow understand it is not worth it.
  49008. */
  49009. var emptyNode = new VNode('', {}, []);
  49010. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49011. function sameVnode (a, b) {
  49012. return (
  49013. a.key === b.key && (
  49014. (
  49015. a.tag === b.tag &&
  49016. a.isComment === b.isComment &&
  49017. isDef(a.data) === isDef(b.data) &&
  49018. sameInputType(a, b)
  49019. ) || (
  49020. isTrue(a.isAsyncPlaceholder) &&
  49021. a.asyncFactory === b.asyncFactory &&
  49022. isUndef(b.asyncFactory.error)
  49023. )
  49024. )
  49025. )
  49026. }
  49027. function sameInputType (a, b) {
  49028. if (a.tag !== 'input') { return true }
  49029. var i;
  49030. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49031. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49032. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49033. }
  49034. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49035. var i, key;
  49036. var map = {};
  49037. for (i = beginIdx; i <= endIdx; ++i) {
  49038. key = children[i].key;
  49039. if (isDef(key)) { map[key] = i; }
  49040. }
  49041. return map
  49042. }
  49043. function createPatchFunction (backend) {
  49044. var i, j;
  49045. var cbs = {};
  49046. var modules = backend.modules;
  49047. var nodeOps = backend.nodeOps;
  49048. for (i = 0; i < hooks.length; ++i) {
  49049. cbs[hooks[i]] = [];
  49050. for (j = 0; j < modules.length; ++j) {
  49051. if (isDef(modules[j][hooks[i]])) {
  49052. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49053. }
  49054. }
  49055. }
  49056. function emptyNodeAt (elm) {
  49057. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49058. }
  49059. function createRmCb (childElm, listeners) {
  49060. function remove$$1 () {
  49061. if (--remove$$1.listeners === 0) {
  49062. removeNode(childElm);
  49063. }
  49064. }
  49065. remove$$1.listeners = listeners;
  49066. return remove$$1
  49067. }
  49068. function removeNode (el) {
  49069. var parent = nodeOps.parentNode(el);
  49070. // element may have already been removed due to v-html / v-text
  49071. if (isDef(parent)) {
  49072. nodeOps.removeChild(parent, el);
  49073. }
  49074. }
  49075. function isUnknownElement$$1 (vnode, inVPre) {
  49076. return (
  49077. !inVPre &&
  49078. !vnode.ns &&
  49079. !(
  49080. config.ignoredElements.length &&
  49081. config.ignoredElements.some(function (ignore) {
  49082. return isRegExp(ignore)
  49083. ? ignore.test(vnode.tag)
  49084. : ignore === vnode.tag
  49085. })
  49086. ) &&
  49087. config.isUnknownElement(vnode.tag)
  49088. )
  49089. }
  49090. var creatingElmInVPre = 0;
  49091. function createElm (
  49092. vnode,
  49093. insertedVnodeQueue,
  49094. parentElm,
  49095. refElm,
  49096. nested,
  49097. ownerArray,
  49098. index
  49099. ) {
  49100. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49101. // This vnode was used in a previous render!
  49102. // now it's used as a new node, overwriting its elm would cause
  49103. // potential patch errors down the road when it's used as an insertion
  49104. // reference node. Instead, we clone the node on-demand before creating
  49105. // associated DOM element for it.
  49106. vnode = ownerArray[index] = cloneVNode(vnode);
  49107. }
  49108. vnode.isRootInsert = !nested; // for transition enter check
  49109. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49110. return
  49111. }
  49112. var data = vnode.data;
  49113. var children = vnode.children;
  49114. var tag = vnode.tag;
  49115. if (isDef(tag)) {
  49116. {
  49117. if (data && data.pre) {
  49118. creatingElmInVPre++;
  49119. }
  49120. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49121. warn(
  49122. 'Unknown custom element: <' + tag + '> - did you ' +
  49123. 'register the component correctly? For recursive components, ' +
  49124. 'make sure to provide the "name" option.',
  49125. vnode.context
  49126. );
  49127. }
  49128. }
  49129. vnode.elm = vnode.ns
  49130. ? nodeOps.createElementNS(vnode.ns, tag)
  49131. : nodeOps.createElement(tag, vnode);
  49132. setScope(vnode);
  49133. /* istanbul ignore if */
  49134. {
  49135. createChildren(vnode, children, insertedVnodeQueue);
  49136. if (isDef(data)) {
  49137. invokeCreateHooks(vnode, insertedVnodeQueue);
  49138. }
  49139. insert(parentElm, vnode.elm, refElm);
  49140. }
  49141. if (data && data.pre) {
  49142. creatingElmInVPre--;
  49143. }
  49144. } else if (isTrue(vnode.isComment)) {
  49145. vnode.elm = nodeOps.createComment(vnode.text);
  49146. insert(parentElm, vnode.elm, refElm);
  49147. } else {
  49148. vnode.elm = nodeOps.createTextNode(vnode.text);
  49149. insert(parentElm, vnode.elm, refElm);
  49150. }
  49151. }
  49152. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49153. var i = vnode.data;
  49154. if (isDef(i)) {
  49155. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49156. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49157. i(vnode, false /* hydrating */);
  49158. }
  49159. // after calling the init hook, if the vnode is a child component
  49160. // it should've created a child instance and mounted it. the child
  49161. // component also has set the placeholder vnode's elm.
  49162. // in that case we can just return the element and be done.
  49163. if (isDef(vnode.componentInstance)) {
  49164. initComponent(vnode, insertedVnodeQueue);
  49165. insert(parentElm, vnode.elm, refElm);
  49166. if (isTrue(isReactivated)) {
  49167. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49168. }
  49169. return true
  49170. }
  49171. }
  49172. }
  49173. function initComponent (vnode, insertedVnodeQueue) {
  49174. if (isDef(vnode.data.pendingInsert)) {
  49175. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49176. vnode.data.pendingInsert = null;
  49177. }
  49178. vnode.elm = vnode.componentInstance.$el;
  49179. if (isPatchable(vnode)) {
  49180. invokeCreateHooks(vnode, insertedVnodeQueue);
  49181. setScope(vnode);
  49182. } else {
  49183. // empty component root.
  49184. // skip all element-related modules except for ref (#3455)
  49185. registerRef(vnode);
  49186. // make sure to invoke the insert hook
  49187. insertedVnodeQueue.push(vnode);
  49188. }
  49189. }
  49190. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49191. var i;
  49192. // hack for #4339: a reactivated component with inner transition
  49193. // does not trigger because the inner node's created hooks are not called
  49194. // again. It's not ideal to involve module-specific logic in here but
  49195. // there doesn't seem to be a better way to do it.
  49196. var innerNode = vnode;
  49197. while (innerNode.componentInstance) {
  49198. innerNode = innerNode.componentInstance._vnode;
  49199. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49200. for (i = 0; i < cbs.activate.length; ++i) {
  49201. cbs.activate[i](emptyNode, innerNode);
  49202. }
  49203. insertedVnodeQueue.push(innerNode);
  49204. break
  49205. }
  49206. }
  49207. // unlike a newly created component,
  49208. // a reactivated keep-alive component doesn't insert itself
  49209. insert(parentElm, vnode.elm, refElm);
  49210. }
  49211. function insert (parent, elm, ref$$1) {
  49212. if (isDef(parent)) {
  49213. if (isDef(ref$$1)) {
  49214. if (nodeOps.parentNode(ref$$1) === parent) {
  49215. nodeOps.insertBefore(parent, elm, ref$$1);
  49216. }
  49217. } else {
  49218. nodeOps.appendChild(parent, elm);
  49219. }
  49220. }
  49221. }
  49222. function createChildren (vnode, children, insertedVnodeQueue) {
  49223. if (Array.isArray(children)) {
  49224. {
  49225. checkDuplicateKeys(children);
  49226. }
  49227. for (var i = 0; i < children.length; ++i) {
  49228. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49229. }
  49230. } else if (isPrimitive(vnode.text)) {
  49231. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49232. }
  49233. }
  49234. function isPatchable (vnode) {
  49235. while (vnode.componentInstance) {
  49236. vnode = vnode.componentInstance._vnode;
  49237. }
  49238. return isDef(vnode.tag)
  49239. }
  49240. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49241. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49242. cbs.create[i$1](emptyNode, vnode);
  49243. }
  49244. i = vnode.data.hook; // Reuse variable
  49245. if (isDef(i)) {
  49246. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49247. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49248. }
  49249. }
  49250. // set scope id attribute for scoped CSS.
  49251. // this is implemented as a special case to avoid the overhead
  49252. // of going through the normal attribute patching process.
  49253. function setScope (vnode) {
  49254. var i;
  49255. if (isDef(i = vnode.fnScopeId)) {
  49256. nodeOps.setStyleScope(vnode.elm, i);
  49257. } else {
  49258. var ancestor = vnode;
  49259. while (ancestor) {
  49260. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49261. nodeOps.setStyleScope(vnode.elm, i);
  49262. }
  49263. ancestor = ancestor.parent;
  49264. }
  49265. }
  49266. // for slot content they should also get the scopeId from the host instance.
  49267. if (isDef(i = activeInstance) &&
  49268. i !== vnode.context &&
  49269. i !== vnode.fnContext &&
  49270. isDef(i = i.$options._scopeId)
  49271. ) {
  49272. nodeOps.setStyleScope(vnode.elm, i);
  49273. }
  49274. }
  49275. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49276. for (; startIdx <= endIdx; ++startIdx) {
  49277. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49278. }
  49279. }
  49280. function invokeDestroyHook (vnode) {
  49281. var i, j;
  49282. var data = vnode.data;
  49283. if (isDef(data)) {
  49284. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  49285. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  49286. }
  49287. if (isDef(i = vnode.children)) {
  49288. for (j = 0; j < vnode.children.length; ++j) {
  49289. invokeDestroyHook(vnode.children[j]);
  49290. }
  49291. }
  49292. }
  49293. function removeVnodes (vnodes, startIdx, endIdx) {
  49294. for (; startIdx <= endIdx; ++startIdx) {
  49295. var ch = vnodes[startIdx];
  49296. if (isDef(ch)) {
  49297. if (isDef(ch.tag)) {
  49298. removeAndInvokeRemoveHook(ch);
  49299. invokeDestroyHook(ch);
  49300. } else { // Text node
  49301. removeNode(ch.elm);
  49302. }
  49303. }
  49304. }
  49305. }
  49306. function removeAndInvokeRemoveHook (vnode, rm) {
  49307. if (isDef(rm) || isDef(vnode.data)) {
  49308. var i;
  49309. var listeners = cbs.remove.length + 1;
  49310. if (isDef(rm)) {
  49311. // we have a recursively passed down rm callback
  49312. // increase the listeners count
  49313. rm.listeners += listeners;
  49314. } else {
  49315. // directly removing
  49316. rm = createRmCb(vnode.elm, listeners);
  49317. }
  49318. // recursively invoke hooks on child component root node
  49319. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  49320. removeAndInvokeRemoveHook(i, rm);
  49321. }
  49322. for (i = 0; i < cbs.remove.length; ++i) {
  49323. cbs.remove[i](vnode, rm);
  49324. }
  49325. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  49326. i(vnode, rm);
  49327. } else {
  49328. rm();
  49329. }
  49330. } else {
  49331. removeNode(vnode.elm);
  49332. }
  49333. }
  49334. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  49335. var oldStartIdx = 0;
  49336. var newStartIdx = 0;
  49337. var oldEndIdx = oldCh.length - 1;
  49338. var oldStartVnode = oldCh[0];
  49339. var oldEndVnode = oldCh[oldEndIdx];
  49340. var newEndIdx = newCh.length - 1;
  49341. var newStartVnode = newCh[0];
  49342. var newEndVnode = newCh[newEndIdx];
  49343. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  49344. // removeOnly is a special flag used only by <transition-group>
  49345. // to ensure removed elements stay in correct relative positions
  49346. // during leaving transitions
  49347. var canMove = !removeOnly;
  49348. {
  49349. checkDuplicateKeys(newCh);
  49350. }
  49351. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  49352. if (isUndef(oldStartVnode)) {
  49353. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  49354. } else if (isUndef(oldEndVnode)) {
  49355. oldEndVnode = oldCh[--oldEndIdx];
  49356. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  49357. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49358. oldStartVnode = oldCh[++oldStartIdx];
  49359. newStartVnode = newCh[++newStartIdx];
  49360. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  49361. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49362. oldEndVnode = oldCh[--oldEndIdx];
  49363. newEndVnode = newCh[--newEndIdx];
  49364. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  49365. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49366. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  49367. oldStartVnode = oldCh[++oldStartIdx];
  49368. newEndVnode = newCh[--newEndIdx];
  49369. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  49370. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49371. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  49372. oldEndVnode = oldCh[--oldEndIdx];
  49373. newStartVnode = newCh[++newStartIdx];
  49374. } else {
  49375. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  49376. idxInOld = isDef(newStartVnode.key)
  49377. ? oldKeyToIdx[newStartVnode.key]
  49378. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  49379. if (isUndef(idxInOld)) { // New element
  49380. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49381. } else {
  49382. vnodeToMove = oldCh[idxInOld];
  49383. if (sameVnode(vnodeToMove, newStartVnode)) {
  49384. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49385. oldCh[idxInOld] = undefined;
  49386. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  49387. } else {
  49388. // same key but different element. treat as new element
  49389. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49390. }
  49391. }
  49392. newStartVnode = newCh[++newStartIdx];
  49393. }
  49394. }
  49395. if (oldStartIdx > oldEndIdx) {
  49396. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  49397. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  49398. } else if (newStartIdx > newEndIdx) {
  49399. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  49400. }
  49401. }
  49402. function checkDuplicateKeys (children) {
  49403. var seenKeys = {};
  49404. for (var i = 0; i < children.length; i++) {
  49405. var vnode = children[i];
  49406. var key = vnode.key;
  49407. if (isDef(key)) {
  49408. if (seenKeys[key]) {
  49409. warn(
  49410. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  49411. vnode.context
  49412. );
  49413. } else {
  49414. seenKeys[key] = true;
  49415. }
  49416. }
  49417. }
  49418. }
  49419. function findIdxInOld (node, oldCh, start, end) {
  49420. for (var i = start; i < end; i++) {
  49421. var c = oldCh[i];
  49422. if (isDef(c) && sameVnode(node, c)) { return i }
  49423. }
  49424. }
  49425. function patchVnode (
  49426. oldVnode,
  49427. vnode,
  49428. insertedVnodeQueue,
  49429. ownerArray,
  49430. index,
  49431. removeOnly
  49432. ) {
  49433. if (oldVnode === vnode) {
  49434. return
  49435. }
  49436. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49437. // clone reused vnode
  49438. vnode = ownerArray[index] = cloneVNode(vnode);
  49439. }
  49440. var elm = vnode.elm = oldVnode.elm;
  49441. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  49442. if (isDef(vnode.asyncFactory.resolved)) {
  49443. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  49444. } else {
  49445. vnode.isAsyncPlaceholder = true;
  49446. }
  49447. return
  49448. }
  49449. // reuse element for static trees.
  49450. // note we only do this if the vnode is cloned -
  49451. // if the new node is not cloned it means the render functions have been
  49452. // reset by the hot-reload-api and we need to do a proper re-render.
  49453. if (isTrue(vnode.isStatic) &&
  49454. isTrue(oldVnode.isStatic) &&
  49455. vnode.key === oldVnode.key &&
  49456. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  49457. ) {
  49458. vnode.componentInstance = oldVnode.componentInstance;
  49459. return
  49460. }
  49461. var i;
  49462. var data = vnode.data;
  49463. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  49464. i(oldVnode, vnode);
  49465. }
  49466. var oldCh = oldVnode.children;
  49467. var ch = vnode.children;
  49468. if (isDef(data) && isPatchable(vnode)) {
  49469. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  49470. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  49471. }
  49472. if (isUndef(vnode.text)) {
  49473. if (isDef(oldCh) && isDef(ch)) {
  49474. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  49475. } else if (isDef(ch)) {
  49476. {
  49477. checkDuplicateKeys(ch);
  49478. }
  49479. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  49480. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  49481. } else if (isDef(oldCh)) {
  49482. removeVnodes(oldCh, 0, oldCh.length - 1);
  49483. } else if (isDef(oldVnode.text)) {
  49484. nodeOps.setTextContent(elm, '');
  49485. }
  49486. } else if (oldVnode.text !== vnode.text) {
  49487. nodeOps.setTextContent(elm, vnode.text);
  49488. }
  49489. if (isDef(data)) {
  49490. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  49491. }
  49492. }
  49493. function invokeInsertHook (vnode, queue, initial) {
  49494. // delay insert hooks for component root nodes, invoke them after the
  49495. // element is really inserted
  49496. if (isTrue(initial) && isDef(vnode.parent)) {
  49497. vnode.parent.data.pendingInsert = queue;
  49498. } else {
  49499. for (var i = 0; i < queue.length; ++i) {
  49500. queue[i].data.hook.insert(queue[i]);
  49501. }
  49502. }
  49503. }
  49504. var hydrationBailed = false;
  49505. // list of modules that can skip create hook during hydration because they
  49506. // are already rendered on the client or has no need for initialization
  49507. // Note: style is excluded because it relies on initial clone for future
  49508. // deep updates (#7063).
  49509. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  49510. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  49511. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  49512. var i;
  49513. var tag = vnode.tag;
  49514. var data = vnode.data;
  49515. var children = vnode.children;
  49516. inVPre = inVPre || (data && data.pre);
  49517. vnode.elm = elm;
  49518. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  49519. vnode.isAsyncPlaceholder = true;
  49520. return true
  49521. }
  49522. // assert node match
  49523. {
  49524. if (!assertNodeMatch(elm, vnode, inVPre)) {
  49525. return false
  49526. }
  49527. }
  49528. if (isDef(data)) {
  49529. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  49530. if (isDef(i = vnode.componentInstance)) {
  49531. // child component. it should have hydrated its own tree.
  49532. initComponent(vnode, insertedVnodeQueue);
  49533. return true
  49534. }
  49535. }
  49536. if (isDef(tag)) {
  49537. if (isDef(children)) {
  49538. // empty element, allow client to pick up and populate children
  49539. if (!elm.hasChildNodes()) {
  49540. createChildren(vnode, children, insertedVnodeQueue);
  49541. } else {
  49542. // v-html and domProps: innerHTML
  49543. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  49544. if (i !== elm.innerHTML) {
  49545. /* istanbul ignore if */
  49546. if (typeof console !== 'undefined' &&
  49547. !hydrationBailed
  49548. ) {
  49549. hydrationBailed = true;
  49550. console.warn('Parent: ', elm);
  49551. console.warn('server innerHTML: ', i);
  49552. console.warn('client innerHTML: ', elm.innerHTML);
  49553. }
  49554. return false
  49555. }
  49556. } else {
  49557. // iterate and compare children lists
  49558. var childrenMatch = true;
  49559. var childNode = elm.firstChild;
  49560. for (var i$1 = 0; i$1 < children.length; i$1++) {
  49561. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  49562. childrenMatch = false;
  49563. break
  49564. }
  49565. childNode = childNode.nextSibling;
  49566. }
  49567. // if childNode is not null, it means the actual childNodes list is
  49568. // longer than the virtual children list.
  49569. if (!childrenMatch || childNode) {
  49570. /* istanbul ignore if */
  49571. if (typeof console !== 'undefined' &&
  49572. !hydrationBailed
  49573. ) {
  49574. hydrationBailed = true;
  49575. console.warn('Parent: ', elm);
  49576. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  49577. }
  49578. return false
  49579. }
  49580. }
  49581. }
  49582. }
  49583. if (isDef(data)) {
  49584. var fullInvoke = false;
  49585. for (var key in data) {
  49586. if (!isRenderedModule(key)) {
  49587. fullInvoke = true;
  49588. invokeCreateHooks(vnode, insertedVnodeQueue);
  49589. break
  49590. }
  49591. }
  49592. if (!fullInvoke && data['class']) {
  49593. // ensure collecting deps for deep class bindings for future updates
  49594. traverse(data['class']);
  49595. }
  49596. }
  49597. } else if (elm.data !== vnode.text) {
  49598. elm.data = vnode.text;
  49599. }
  49600. return true
  49601. }
  49602. function assertNodeMatch (node, vnode, inVPre) {
  49603. if (isDef(vnode.tag)) {
  49604. return vnode.tag.indexOf('vue-component') === 0 || (
  49605. !isUnknownElement$$1(vnode, inVPre) &&
  49606. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  49607. )
  49608. } else {
  49609. return node.nodeType === (vnode.isComment ? 8 : 3)
  49610. }
  49611. }
  49612. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  49613. if (isUndef(vnode)) {
  49614. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  49615. return
  49616. }
  49617. var isInitialPatch = false;
  49618. var insertedVnodeQueue = [];
  49619. if (isUndef(oldVnode)) {
  49620. // empty mount (likely as component), create new root element
  49621. isInitialPatch = true;
  49622. createElm(vnode, insertedVnodeQueue);
  49623. } else {
  49624. var isRealElement = isDef(oldVnode.nodeType);
  49625. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  49626. // patch existing root node
  49627. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  49628. } else {
  49629. if (isRealElement) {
  49630. // mounting to a real element
  49631. // check if this is server-rendered content and if we can perform
  49632. // a successful hydration.
  49633. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  49634. oldVnode.removeAttribute(SSR_ATTR);
  49635. hydrating = true;
  49636. }
  49637. if (isTrue(hydrating)) {
  49638. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  49639. invokeInsertHook(vnode, insertedVnodeQueue, true);
  49640. return oldVnode
  49641. } else {
  49642. warn(
  49643. 'The client-side rendered virtual DOM tree is not matching ' +
  49644. 'server-rendered content. This is likely caused by incorrect ' +
  49645. 'HTML markup, for example nesting block-level elements inside ' +
  49646. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  49647. 'full client-side render.'
  49648. );
  49649. }
  49650. }
  49651. // either not server-rendered, or hydration failed.
  49652. // create an empty node and replace it
  49653. oldVnode = emptyNodeAt(oldVnode);
  49654. }
  49655. // replacing existing element
  49656. var oldElm = oldVnode.elm;
  49657. var parentElm = nodeOps.parentNode(oldElm);
  49658. // create new node
  49659. createElm(
  49660. vnode,
  49661. insertedVnodeQueue,
  49662. // extremely rare edge case: do not insert if old element is in a
  49663. // leaving transition. Only happens when combining transition +
  49664. // keep-alive + HOCs. (#4590)
  49665. oldElm._leaveCb ? null : parentElm,
  49666. nodeOps.nextSibling(oldElm)
  49667. );
  49668. // update parent placeholder node element, recursively
  49669. if (isDef(vnode.parent)) {
  49670. var ancestor = vnode.parent;
  49671. var patchable = isPatchable(vnode);
  49672. while (ancestor) {
  49673. for (var i = 0; i < cbs.destroy.length; ++i) {
  49674. cbs.destroy[i](ancestor);
  49675. }
  49676. ancestor.elm = vnode.elm;
  49677. if (patchable) {
  49678. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49679. cbs.create[i$1](emptyNode, ancestor);
  49680. }
  49681. // #6513
  49682. // invoke insert hooks that may have been merged by create hooks.
  49683. // e.g. for directives that uses the "inserted" hook.
  49684. var insert = ancestor.data.hook.insert;
  49685. if (insert.merged) {
  49686. // start at index 1 to avoid re-invoking component mounted hook
  49687. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  49688. insert.fns[i$2]();
  49689. }
  49690. }
  49691. } else {
  49692. registerRef(ancestor);
  49693. }
  49694. ancestor = ancestor.parent;
  49695. }
  49696. }
  49697. // destroy old node
  49698. if (isDef(parentElm)) {
  49699. removeVnodes([oldVnode], 0, 0);
  49700. } else if (isDef(oldVnode.tag)) {
  49701. invokeDestroyHook(oldVnode);
  49702. }
  49703. }
  49704. }
  49705. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  49706. return vnode.elm
  49707. }
  49708. }
  49709. /* */
  49710. var directives = {
  49711. create: updateDirectives,
  49712. update: updateDirectives,
  49713. destroy: function unbindDirectives (vnode) {
  49714. updateDirectives(vnode, emptyNode);
  49715. }
  49716. };
  49717. function updateDirectives (oldVnode, vnode) {
  49718. if (oldVnode.data.directives || vnode.data.directives) {
  49719. _update(oldVnode, vnode);
  49720. }
  49721. }
  49722. function _update (oldVnode, vnode) {
  49723. var isCreate = oldVnode === emptyNode;
  49724. var isDestroy = vnode === emptyNode;
  49725. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  49726. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  49727. var dirsWithInsert = [];
  49728. var dirsWithPostpatch = [];
  49729. var key, oldDir, dir;
  49730. for (key in newDirs) {
  49731. oldDir = oldDirs[key];
  49732. dir = newDirs[key];
  49733. if (!oldDir) {
  49734. // new directive, bind
  49735. callHook$1(dir, 'bind', vnode, oldVnode);
  49736. if (dir.def && dir.def.inserted) {
  49737. dirsWithInsert.push(dir);
  49738. }
  49739. } else {
  49740. // existing directive, update
  49741. dir.oldValue = oldDir.value;
  49742. dir.oldArg = oldDir.arg;
  49743. callHook$1(dir, 'update', vnode, oldVnode);
  49744. if (dir.def && dir.def.componentUpdated) {
  49745. dirsWithPostpatch.push(dir);
  49746. }
  49747. }
  49748. }
  49749. if (dirsWithInsert.length) {
  49750. var callInsert = function () {
  49751. for (var i = 0; i < dirsWithInsert.length; i++) {
  49752. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  49753. }
  49754. };
  49755. if (isCreate) {
  49756. mergeVNodeHook(vnode, 'insert', callInsert);
  49757. } else {
  49758. callInsert();
  49759. }
  49760. }
  49761. if (dirsWithPostpatch.length) {
  49762. mergeVNodeHook(vnode, 'postpatch', function () {
  49763. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  49764. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  49765. }
  49766. });
  49767. }
  49768. if (!isCreate) {
  49769. for (key in oldDirs) {
  49770. if (!newDirs[key]) {
  49771. // no longer present, unbind
  49772. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  49773. }
  49774. }
  49775. }
  49776. }
  49777. var emptyModifiers = Object.create(null);
  49778. function normalizeDirectives$1 (
  49779. dirs,
  49780. vm
  49781. ) {
  49782. var res = Object.create(null);
  49783. if (!dirs) {
  49784. // $flow-disable-line
  49785. return res
  49786. }
  49787. var i, dir;
  49788. for (i = 0; i < dirs.length; i++) {
  49789. dir = dirs[i];
  49790. if (!dir.modifiers) {
  49791. // $flow-disable-line
  49792. dir.modifiers = emptyModifiers;
  49793. }
  49794. res[getRawDirName(dir)] = dir;
  49795. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  49796. }
  49797. // $flow-disable-line
  49798. return res
  49799. }
  49800. function getRawDirName (dir) {
  49801. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  49802. }
  49803. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  49804. var fn = dir.def && dir.def[hook];
  49805. if (fn) {
  49806. try {
  49807. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  49808. } catch (e) {
  49809. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  49810. }
  49811. }
  49812. }
  49813. var baseModules = [
  49814. ref,
  49815. directives
  49816. ];
  49817. /* */
  49818. function updateAttrs (oldVnode, vnode) {
  49819. var opts = vnode.componentOptions;
  49820. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  49821. return
  49822. }
  49823. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  49824. return
  49825. }
  49826. var key, cur, old;
  49827. var elm = vnode.elm;
  49828. var oldAttrs = oldVnode.data.attrs || {};
  49829. var attrs = vnode.data.attrs || {};
  49830. // clone observed objects, as the user probably wants to mutate it
  49831. if (isDef(attrs.__ob__)) {
  49832. attrs = vnode.data.attrs = extend({}, attrs);
  49833. }
  49834. for (key in attrs) {
  49835. cur = attrs[key];
  49836. old = oldAttrs[key];
  49837. if (old !== cur) {
  49838. setAttr(elm, key, cur);
  49839. }
  49840. }
  49841. // #4391: in IE9, setting type can reset value for input[type=radio]
  49842. // #6666: IE/Edge forces progress value down to 1 before setting a max
  49843. /* istanbul ignore if */
  49844. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  49845. setAttr(elm, 'value', attrs.value);
  49846. }
  49847. for (key in oldAttrs) {
  49848. if (isUndef(attrs[key])) {
  49849. if (isXlink(key)) {
  49850. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49851. } else if (!isEnumeratedAttr(key)) {
  49852. elm.removeAttribute(key);
  49853. }
  49854. }
  49855. }
  49856. }
  49857. function setAttr (el, key, value) {
  49858. if (el.tagName.indexOf('-') > -1) {
  49859. baseSetAttr(el, key, value);
  49860. } else if (isBooleanAttr(key)) {
  49861. // set attribute for blank value
  49862. // e.g. <option disabled>Select one</option>
  49863. if (isFalsyAttrValue(value)) {
  49864. el.removeAttribute(key);
  49865. } else {
  49866. // technically allowfullscreen is a boolean attribute for <iframe>,
  49867. // but Flash expects a value of "true" when used on <embed> tag
  49868. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  49869. ? 'true'
  49870. : key;
  49871. el.setAttribute(key, value);
  49872. }
  49873. } else if (isEnumeratedAttr(key)) {
  49874. el.setAttribute(key, convertEnumeratedValue(key, value));
  49875. } else if (isXlink(key)) {
  49876. if (isFalsyAttrValue(value)) {
  49877. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  49878. } else {
  49879. el.setAttributeNS(xlinkNS, key, value);
  49880. }
  49881. } else {
  49882. baseSetAttr(el, key, value);
  49883. }
  49884. }
  49885. function baseSetAttr (el, key, value) {
  49886. if (isFalsyAttrValue(value)) {
  49887. el.removeAttribute(key);
  49888. } else {
  49889. // #7138: IE10 & 11 fires input event when setting placeholder on
  49890. // <textarea>... block the first input event and remove the blocker
  49891. // immediately.
  49892. /* istanbul ignore if */
  49893. if (
  49894. isIE && !isIE9 &&
  49895. el.tagName === 'TEXTAREA' &&
  49896. key === 'placeholder' && value !== '' && !el.__ieph
  49897. ) {
  49898. var blocker = function (e) {
  49899. e.stopImmediatePropagation();
  49900. el.removeEventListener('input', blocker);
  49901. };
  49902. el.addEventListener('input', blocker);
  49903. // $flow-disable-line
  49904. el.__ieph = true; /* IE placeholder patched */
  49905. }
  49906. el.setAttribute(key, value);
  49907. }
  49908. }
  49909. var attrs = {
  49910. create: updateAttrs,
  49911. update: updateAttrs
  49912. };
  49913. /* */
  49914. function updateClass (oldVnode, vnode) {
  49915. var el = vnode.elm;
  49916. var data = vnode.data;
  49917. var oldData = oldVnode.data;
  49918. if (
  49919. isUndef(data.staticClass) &&
  49920. isUndef(data.class) && (
  49921. isUndef(oldData) || (
  49922. isUndef(oldData.staticClass) &&
  49923. isUndef(oldData.class)
  49924. )
  49925. )
  49926. ) {
  49927. return
  49928. }
  49929. var cls = genClassForVnode(vnode);
  49930. // handle transition classes
  49931. var transitionClass = el._transitionClasses;
  49932. if (isDef(transitionClass)) {
  49933. cls = concat(cls, stringifyClass(transitionClass));
  49934. }
  49935. // set the class
  49936. if (cls !== el._prevClass) {
  49937. el.setAttribute('class', cls);
  49938. el._prevClass = cls;
  49939. }
  49940. }
  49941. var klass = {
  49942. create: updateClass,
  49943. update: updateClass
  49944. };
  49945. /* */
  49946. var validDivisionCharRE = /[\w).+\-_$\]]/;
  49947. function parseFilters (exp) {
  49948. var inSingle = false;
  49949. var inDouble = false;
  49950. var inTemplateString = false;
  49951. var inRegex = false;
  49952. var curly = 0;
  49953. var square = 0;
  49954. var paren = 0;
  49955. var lastFilterIndex = 0;
  49956. var c, prev, i, expression, filters;
  49957. for (i = 0; i < exp.length; i++) {
  49958. prev = c;
  49959. c = exp.charCodeAt(i);
  49960. if (inSingle) {
  49961. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  49962. } else if (inDouble) {
  49963. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  49964. } else if (inTemplateString) {
  49965. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  49966. } else if (inRegex) {
  49967. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  49968. } else if (
  49969. c === 0x7C && // pipe
  49970. exp.charCodeAt(i + 1) !== 0x7C &&
  49971. exp.charCodeAt(i - 1) !== 0x7C &&
  49972. !curly && !square && !paren
  49973. ) {
  49974. if (expression === undefined) {
  49975. // first filter, end of expression
  49976. lastFilterIndex = i + 1;
  49977. expression = exp.slice(0, i).trim();
  49978. } else {
  49979. pushFilter();
  49980. }
  49981. } else {
  49982. switch (c) {
  49983. case 0x22: inDouble = true; break // "
  49984. case 0x27: inSingle = true; break // '
  49985. case 0x60: inTemplateString = true; break // `
  49986. case 0x28: paren++; break // (
  49987. case 0x29: paren--; break // )
  49988. case 0x5B: square++; break // [
  49989. case 0x5D: square--; break // ]
  49990. case 0x7B: curly++; break // {
  49991. case 0x7D: curly--; break // }
  49992. }
  49993. if (c === 0x2f) { // /
  49994. var j = i - 1;
  49995. var p = (void 0);
  49996. // find first non-whitespace prev char
  49997. for (; j >= 0; j--) {
  49998. p = exp.charAt(j);
  49999. if (p !== ' ') { break }
  50000. }
  50001. if (!p || !validDivisionCharRE.test(p)) {
  50002. inRegex = true;
  50003. }
  50004. }
  50005. }
  50006. }
  50007. if (expression === undefined) {
  50008. expression = exp.slice(0, i).trim();
  50009. } else if (lastFilterIndex !== 0) {
  50010. pushFilter();
  50011. }
  50012. function pushFilter () {
  50013. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50014. lastFilterIndex = i + 1;
  50015. }
  50016. if (filters) {
  50017. for (i = 0; i < filters.length; i++) {
  50018. expression = wrapFilter(expression, filters[i]);
  50019. }
  50020. }
  50021. return expression
  50022. }
  50023. function wrapFilter (exp, filter) {
  50024. var i = filter.indexOf('(');
  50025. if (i < 0) {
  50026. // _f: resolveFilter
  50027. return ("_f(\"" + filter + "\")(" + exp + ")")
  50028. } else {
  50029. var name = filter.slice(0, i);
  50030. var args = filter.slice(i + 1);
  50031. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50032. }
  50033. }
  50034. /* */
  50035. /* eslint-disable no-unused-vars */
  50036. function baseWarn (msg, range) {
  50037. console.error(("[Vue compiler]: " + msg));
  50038. }
  50039. /* eslint-enable no-unused-vars */
  50040. function pluckModuleFunction (
  50041. modules,
  50042. key
  50043. ) {
  50044. return modules
  50045. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50046. : []
  50047. }
  50048. function addProp (el, name, value, range, dynamic) {
  50049. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50050. el.plain = false;
  50051. }
  50052. function addAttr (el, name, value, range, dynamic) {
  50053. var attrs = dynamic
  50054. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50055. : (el.attrs || (el.attrs = []));
  50056. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50057. el.plain = false;
  50058. }
  50059. // add a raw attr (use this in preTransforms)
  50060. function addRawAttr (el, name, value, range) {
  50061. el.attrsMap[name] = value;
  50062. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50063. }
  50064. function addDirective (
  50065. el,
  50066. name,
  50067. rawName,
  50068. value,
  50069. arg,
  50070. isDynamicArg,
  50071. modifiers,
  50072. range
  50073. ) {
  50074. (el.directives || (el.directives = [])).push(rangeSetItem({
  50075. name: name,
  50076. rawName: rawName,
  50077. value: value,
  50078. arg: arg,
  50079. isDynamicArg: isDynamicArg,
  50080. modifiers: modifiers
  50081. }, range));
  50082. el.plain = false;
  50083. }
  50084. function prependModifierMarker (symbol, name, dynamic) {
  50085. return dynamic
  50086. ? ("_p(" + name + ",\"" + symbol + "\")")
  50087. : symbol + name // mark the event as captured
  50088. }
  50089. function addHandler (
  50090. el,
  50091. name,
  50092. value,
  50093. modifiers,
  50094. important,
  50095. warn,
  50096. range,
  50097. dynamic
  50098. ) {
  50099. modifiers = modifiers || emptyObject;
  50100. // warn prevent and passive modifier
  50101. /* istanbul ignore if */
  50102. if (
  50103. warn &&
  50104. modifiers.prevent && modifiers.passive
  50105. ) {
  50106. warn(
  50107. 'passive and prevent can\'t be used together. ' +
  50108. 'Passive handler can\'t prevent default event.',
  50109. range
  50110. );
  50111. }
  50112. // normalize click.right and click.middle since they don't actually fire
  50113. // this is technically browser-specific, but at least for now browsers are
  50114. // the only target envs that have right/middle clicks.
  50115. if (modifiers.right) {
  50116. if (dynamic) {
  50117. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50118. } else if (name === 'click') {
  50119. name = 'contextmenu';
  50120. delete modifiers.right;
  50121. }
  50122. } else if (modifiers.middle) {
  50123. if (dynamic) {
  50124. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50125. } else if (name === 'click') {
  50126. name = 'mouseup';
  50127. }
  50128. }
  50129. // check capture modifier
  50130. if (modifiers.capture) {
  50131. delete modifiers.capture;
  50132. name = prependModifierMarker('!', name, dynamic);
  50133. }
  50134. if (modifiers.once) {
  50135. delete modifiers.once;
  50136. name = prependModifierMarker('~', name, dynamic);
  50137. }
  50138. /* istanbul ignore if */
  50139. if (modifiers.passive) {
  50140. delete modifiers.passive;
  50141. name = prependModifierMarker('&', name, dynamic);
  50142. }
  50143. var events;
  50144. if (modifiers.native) {
  50145. delete modifiers.native;
  50146. events = el.nativeEvents || (el.nativeEvents = {});
  50147. } else {
  50148. events = el.events || (el.events = {});
  50149. }
  50150. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50151. if (modifiers !== emptyObject) {
  50152. newHandler.modifiers = modifiers;
  50153. }
  50154. var handlers = events[name];
  50155. /* istanbul ignore if */
  50156. if (Array.isArray(handlers)) {
  50157. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50158. } else if (handlers) {
  50159. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50160. } else {
  50161. events[name] = newHandler;
  50162. }
  50163. el.plain = false;
  50164. }
  50165. function getRawBindingAttr (
  50166. el,
  50167. name
  50168. ) {
  50169. return el.rawAttrsMap[':' + name] ||
  50170. el.rawAttrsMap['v-bind:' + name] ||
  50171. el.rawAttrsMap[name]
  50172. }
  50173. function getBindingAttr (
  50174. el,
  50175. name,
  50176. getStatic
  50177. ) {
  50178. var dynamicValue =
  50179. getAndRemoveAttr(el, ':' + name) ||
  50180. getAndRemoveAttr(el, 'v-bind:' + name);
  50181. if (dynamicValue != null) {
  50182. return parseFilters(dynamicValue)
  50183. } else if (getStatic !== false) {
  50184. var staticValue = getAndRemoveAttr(el, name);
  50185. if (staticValue != null) {
  50186. return JSON.stringify(staticValue)
  50187. }
  50188. }
  50189. }
  50190. // note: this only removes the attr from the Array (attrsList) so that it
  50191. // doesn't get processed by processAttrs.
  50192. // By default it does NOT remove it from the map (attrsMap) because the map is
  50193. // needed during codegen.
  50194. function getAndRemoveAttr (
  50195. el,
  50196. name,
  50197. removeFromMap
  50198. ) {
  50199. var val;
  50200. if ((val = el.attrsMap[name]) != null) {
  50201. var list = el.attrsList;
  50202. for (var i = 0, l = list.length; i < l; i++) {
  50203. if (list[i].name === name) {
  50204. list.splice(i, 1);
  50205. break
  50206. }
  50207. }
  50208. }
  50209. if (removeFromMap) {
  50210. delete el.attrsMap[name];
  50211. }
  50212. return val
  50213. }
  50214. function getAndRemoveAttrByRegex (
  50215. el,
  50216. name
  50217. ) {
  50218. var list = el.attrsList;
  50219. for (var i = 0, l = list.length; i < l; i++) {
  50220. var attr = list[i];
  50221. if (name.test(attr.name)) {
  50222. list.splice(i, 1);
  50223. return attr
  50224. }
  50225. }
  50226. }
  50227. function rangeSetItem (
  50228. item,
  50229. range
  50230. ) {
  50231. if (range) {
  50232. if (range.start != null) {
  50233. item.start = range.start;
  50234. }
  50235. if (range.end != null) {
  50236. item.end = range.end;
  50237. }
  50238. }
  50239. return item
  50240. }
  50241. /* */
  50242. /**
  50243. * Cross-platform code generation for component v-model
  50244. */
  50245. function genComponentModel (
  50246. el,
  50247. value,
  50248. modifiers
  50249. ) {
  50250. var ref = modifiers || {};
  50251. var number = ref.number;
  50252. var trim = ref.trim;
  50253. var baseValueExpression = '$$v';
  50254. var valueExpression = baseValueExpression;
  50255. if (trim) {
  50256. valueExpression =
  50257. "(typeof " + baseValueExpression + " === 'string'" +
  50258. "? " + baseValueExpression + ".trim()" +
  50259. ": " + baseValueExpression + ")";
  50260. }
  50261. if (number) {
  50262. valueExpression = "_n(" + valueExpression + ")";
  50263. }
  50264. var assignment = genAssignmentCode(value, valueExpression);
  50265. el.model = {
  50266. value: ("(" + value + ")"),
  50267. expression: JSON.stringify(value),
  50268. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50269. };
  50270. }
  50271. /**
  50272. * Cross-platform codegen helper for generating v-model value assignment code.
  50273. */
  50274. function genAssignmentCode (
  50275. value,
  50276. assignment
  50277. ) {
  50278. var res = parseModel(value);
  50279. if (res.key === null) {
  50280. return (value + "=" + assignment)
  50281. } else {
  50282. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  50283. }
  50284. }
  50285. /**
  50286. * Parse a v-model expression into a base path and a final key segment.
  50287. * Handles both dot-path and possible square brackets.
  50288. *
  50289. * Possible cases:
  50290. *
  50291. * - test
  50292. * - test[key]
  50293. * - test[test1[key]]
  50294. * - test["a"][key]
  50295. * - xxx.test[a[a].test1[key]]
  50296. * - test.xxx.a["asa"][test1[key]]
  50297. *
  50298. */
  50299. var len, str, chr, index$1, expressionPos, expressionEndPos;
  50300. function parseModel (val) {
  50301. // Fix https://github.com/vuejs/vue/pull/7730
  50302. // allow v-model="obj.val " (trailing whitespace)
  50303. val = val.trim();
  50304. len = val.length;
  50305. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  50306. index$1 = val.lastIndexOf('.');
  50307. if (index$1 > -1) {
  50308. return {
  50309. exp: val.slice(0, index$1),
  50310. key: '"' + val.slice(index$1 + 1) + '"'
  50311. }
  50312. } else {
  50313. return {
  50314. exp: val,
  50315. key: null
  50316. }
  50317. }
  50318. }
  50319. str = val;
  50320. index$1 = expressionPos = expressionEndPos = 0;
  50321. while (!eof()) {
  50322. chr = next();
  50323. /* istanbul ignore if */
  50324. if (isStringStart(chr)) {
  50325. parseString(chr);
  50326. } else if (chr === 0x5B) {
  50327. parseBracket(chr);
  50328. }
  50329. }
  50330. return {
  50331. exp: val.slice(0, expressionPos),
  50332. key: val.slice(expressionPos + 1, expressionEndPos)
  50333. }
  50334. }
  50335. function next () {
  50336. return str.charCodeAt(++index$1)
  50337. }
  50338. function eof () {
  50339. return index$1 >= len
  50340. }
  50341. function isStringStart (chr) {
  50342. return chr === 0x22 || chr === 0x27
  50343. }
  50344. function parseBracket (chr) {
  50345. var inBracket = 1;
  50346. expressionPos = index$1;
  50347. while (!eof()) {
  50348. chr = next();
  50349. if (isStringStart(chr)) {
  50350. parseString(chr);
  50351. continue
  50352. }
  50353. if (chr === 0x5B) { inBracket++; }
  50354. if (chr === 0x5D) { inBracket--; }
  50355. if (inBracket === 0) {
  50356. expressionEndPos = index$1;
  50357. break
  50358. }
  50359. }
  50360. }
  50361. function parseString (chr) {
  50362. var stringQuote = chr;
  50363. while (!eof()) {
  50364. chr = next();
  50365. if (chr === stringQuote) {
  50366. break
  50367. }
  50368. }
  50369. }
  50370. /* */
  50371. var warn$1;
  50372. // in some cases, the event used has to be determined at runtime
  50373. // so we used some reserved tokens during compile.
  50374. var RANGE_TOKEN = '__r';
  50375. var CHECKBOX_RADIO_TOKEN = '__c';
  50376. function model (
  50377. el,
  50378. dir,
  50379. _warn
  50380. ) {
  50381. warn$1 = _warn;
  50382. var value = dir.value;
  50383. var modifiers = dir.modifiers;
  50384. var tag = el.tag;
  50385. var type = el.attrsMap.type;
  50386. {
  50387. // inputs with type="file" are read only and setting the input's
  50388. // value will throw an error.
  50389. if (tag === 'input' && type === 'file') {
  50390. warn$1(
  50391. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  50392. "File inputs are read only. Use a v-on:change listener instead.",
  50393. el.rawAttrsMap['v-model']
  50394. );
  50395. }
  50396. }
  50397. if (el.component) {
  50398. genComponentModel(el, value, modifiers);
  50399. // component v-model doesn't need extra runtime
  50400. return false
  50401. } else if (tag === 'select') {
  50402. genSelect(el, value, modifiers);
  50403. } else if (tag === 'input' && type === 'checkbox') {
  50404. genCheckboxModel(el, value, modifiers);
  50405. } else if (tag === 'input' && type === 'radio') {
  50406. genRadioModel(el, value, modifiers);
  50407. } else if (tag === 'input' || tag === 'textarea') {
  50408. genDefaultModel(el, value, modifiers);
  50409. } else if (!config.isReservedTag(tag)) {
  50410. genComponentModel(el, value, modifiers);
  50411. // component v-model doesn't need extra runtime
  50412. return false
  50413. } else {
  50414. warn$1(
  50415. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  50416. "v-model is not supported on this element type. " +
  50417. 'If you are working with contenteditable, it\'s recommended to ' +
  50418. 'wrap a library dedicated for that purpose inside a custom component.',
  50419. el.rawAttrsMap['v-model']
  50420. );
  50421. }
  50422. // ensure runtime directive metadata
  50423. return true
  50424. }
  50425. function genCheckboxModel (
  50426. el,
  50427. value,
  50428. modifiers
  50429. ) {
  50430. var number = modifiers && modifiers.number;
  50431. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50432. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  50433. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  50434. addProp(el, 'checked',
  50435. "Array.isArray(" + value + ")" +
  50436. "?_i(" + value + "," + valueBinding + ")>-1" + (
  50437. trueValueBinding === 'true'
  50438. ? (":(" + value + ")")
  50439. : (":_q(" + value + "," + trueValueBinding + ")")
  50440. )
  50441. );
  50442. addHandler(el, 'change',
  50443. "var $$a=" + value + "," +
  50444. '$$el=$event.target,' +
  50445. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  50446. 'if(Array.isArray($$a)){' +
  50447. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  50448. '$$i=_i($$a,$$v);' +
  50449. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  50450. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  50451. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  50452. null, true
  50453. );
  50454. }
  50455. function genRadioModel (
  50456. el,
  50457. value,
  50458. modifiers
  50459. ) {
  50460. var number = modifiers && modifiers.number;
  50461. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50462. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  50463. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  50464. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  50465. }
  50466. function genSelect (
  50467. el,
  50468. value,
  50469. modifiers
  50470. ) {
  50471. var number = modifiers && modifiers.number;
  50472. var selectedVal = "Array.prototype.filter" +
  50473. ".call($event.target.options,function(o){return o.selected})" +
  50474. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  50475. "return " + (number ? '_n(val)' : 'val') + "})";
  50476. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  50477. var code = "var $$selectedVal = " + selectedVal + ";";
  50478. code = code + " " + (genAssignmentCode(value, assignment));
  50479. addHandler(el, 'change', code, null, true);
  50480. }
  50481. function genDefaultModel (
  50482. el,
  50483. value,
  50484. modifiers
  50485. ) {
  50486. var type = el.attrsMap.type;
  50487. // warn if v-bind:value conflicts with v-model
  50488. // except for inputs with v-bind:type
  50489. {
  50490. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  50491. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  50492. if (value$1 && !typeBinding) {
  50493. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  50494. warn$1(
  50495. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  50496. 'because the latter already expands to a value binding internally',
  50497. el.rawAttrsMap[binding]
  50498. );
  50499. }
  50500. }
  50501. var ref = modifiers || {};
  50502. var lazy = ref.lazy;
  50503. var number = ref.number;
  50504. var trim = ref.trim;
  50505. var needCompositionGuard = !lazy && type !== 'range';
  50506. var event = lazy
  50507. ? 'change'
  50508. : type === 'range'
  50509. ? RANGE_TOKEN
  50510. : 'input';
  50511. var valueExpression = '$event.target.value';
  50512. if (trim) {
  50513. valueExpression = "$event.target.value.trim()";
  50514. }
  50515. if (number) {
  50516. valueExpression = "_n(" + valueExpression + ")";
  50517. }
  50518. var code = genAssignmentCode(value, valueExpression);
  50519. if (needCompositionGuard) {
  50520. code = "if($event.target.composing)return;" + code;
  50521. }
  50522. addProp(el, 'value', ("(" + value + ")"));
  50523. addHandler(el, event, code, null, true);
  50524. if (trim || number) {
  50525. addHandler(el, 'blur', '$forceUpdate()');
  50526. }
  50527. }
  50528. /* */
  50529. // normalize v-model event tokens that can only be determined at runtime.
  50530. // it's important to place the event as the first in the array because
  50531. // the whole point is ensuring the v-model callback gets called before
  50532. // user-attached handlers.
  50533. function normalizeEvents (on) {
  50534. /* istanbul ignore if */
  50535. if (isDef(on[RANGE_TOKEN])) {
  50536. // IE input[type=range] only supports `change` event
  50537. var event = isIE ? 'change' : 'input';
  50538. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  50539. delete on[RANGE_TOKEN];
  50540. }
  50541. // This was originally intended to fix #4521 but no longer necessary
  50542. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  50543. /* istanbul ignore if */
  50544. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  50545. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  50546. delete on[CHECKBOX_RADIO_TOKEN];
  50547. }
  50548. }
  50549. var target$1;
  50550. function createOnceHandler$1 (event, handler, capture) {
  50551. var _target = target$1; // save current target element in closure
  50552. return function onceHandler () {
  50553. var res = handler.apply(null, arguments);
  50554. if (res !== null) {
  50555. remove$2(event, onceHandler, capture, _target);
  50556. }
  50557. }
  50558. }
  50559. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  50560. // implementation and does not fire microtasks in between event propagation, so
  50561. // safe to exclude.
  50562. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  50563. function add$1 (
  50564. name,
  50565. handler,
  50566. capture,
  50567. passive
  50568. ) {
  50569. // async edge case #6566: inner click event triggers patch, event handler
  50570. // attached to outer element during patch, and triggered again. This
  50571. // happens because browsers fire microtask ticks between event propagation.
  50572. // the solution is simple: we save the timestamp when a handler is attached,
  50573. // and the handler would only fire if the event passed to it was fired
  50574. // AFTER it was attached.
  50575. if (useMicrotaskFix) {
  50576. var attachedTimestamp = currentFlushTimestamp;
  50577. var original = handler;
  50578. handler = original._wrapper = function (e) {
  50579. if (
  50580. // no bubbling, should always fire.
  50581. // this is just a safety net in case event.timeStamp is unreliable in
  50582. // certain weird environments...
  50583. e.target === e.currentTarget ||
  50584. // event is fired after handler attachment
  50585. e.timeStamp >= attachedTimestamp ||
  50586. // bail for environments that have buggy event.timeStamp implementations
  50587. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  50588. // #9681 QtWebEngine event.timeStamp is negative value
  50589. e.timeStamp <= 0 ||
  50590. // #9448 bail if event is fired in another document in a multi-page
  50591. // electron/nw.js app, since event.timeStamp will be using a different
  50592. // starting reference
  50593. e.target.ownerDocument !== document
  50594. ) {
  50595. return original.apply(this, arguments)
  50596. }
  50597. };
  50598. }
  50599. target$1.addEventListener(
  50600. name,
  50601. handler,
  50602. supportsPassive
  50603. ? { capture: capture, passive: passive }
  50604. : capture
  50605. );
  50606. }
  50607. function remove$2 (
  50608. name,
  50609. handler,
  50610. capture,
  50611. _target
  50612. ) {
  50613. (_target || target$1).removeEventListener(
  50614. name,
  50615. handler._wrapper || handler,
  50616. capture
  50617. );
  50618. }
  50619. function updateDOMListeners (oldVnode, vnode) {
  50620. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  50621. return
  50622. }
  50623. var on = vnode.data.on || {};
  50624. var oldOn = oldVnode.data.on || {};
  50625. target$1 = vnode.elm;
  50626. normalizeEvents(on);
  50627. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  50628. target$1 = undefined;
  50629. }
  50630. var events = {
  50631. create: updateDOMListeners,
  50632. update: updateDOMListeners
  50633. };
  50634. /* */
  50635. var svgContainer;
  50636. function updateDOMProps (oldVnode, vnode) {
  50637. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  50638. return
  50639. }
  50640. var key, cur;
  50641. var elm = vnode.elm;
  50642. var oldProps = oldVnode.data.domProps || {};
  50643. var props = vnode.data.domProps || {};
  50644. // clone observed objects, as the user probably wants to mutate it
  50645. if (isDef(props.__ob__)) {
  50646. props = vnode.data.domProps = extend({}, props);
  50647. }
  50648. for (key in oldProps) {
  50649. if (!(key in props)) {
  50650. elm[key] = '';
  50651. }
  50652. }
  50653. for (key in props) {
  50654. cur = props[key];
  50655. // ignore children if the node has textContent or innerHTML,
  50656. // as these will throw away existing DOM nodes and cause removal errors
  50657. // on subsequent patches (#3360)
  50658. if (key === 'textContent' || key === 'innerHTML') {
  50659. if (vnode.children) { vnode.children.length = 0; }
  50660. if (cur === oldProps[key]) { continue }
  50661. // #6601 work around Chrome version <= 55 bug where single textNode
  50662. // replaced by innerHTML/textContent retains its parentNode property
  50663. if (elm.childNodes.length === 1) {
  50664. elm.removeChild(elm.childNodes[0]);
  50665. }
  50666. }
  50667. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  50668. // store value as _value as well since
  50669. // non-string values will be stringified
  50670. elm._value = cur;
  50671. // avoid resetting cursor position when value is the same
  50672. var strCur = isUndef(cur) ? '' : String(cur);
  50673. if (shouldUpdateValue(elm, strCur)) {
  50674. elm.value = strCur;
  50675. }
  50676. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  50677. // IE doesn't support innerHTML for SVG elements
  50678. svgContainer = svgContainer || document.createElement('div');
  50679. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  50680. var svg = svgContainer.firstChild;
  50681. while (elm.firstChild) {
  50682. elm.removeChild(elm.firstChild);
  50683. }
  50684. while (svg.firstChild) {
  50685. elm.appendChild(svg.firstChild);
  50686. }
  50687. } else if (
  50688. // skip the update if old and new VDOM state is the same.
  50689. // `value` is handled separately because the DOM value may be temporarily
  50690. // out of sync with VDOM state due to focus, composition and modifiers.
  50691. // This #4521 by skipping the unnecesarry `checked` update.
  50692. cur !== oldProps[key]
  50693. ) {
  50694. // some property updates can throw
  50695. // e.g. `value` on <progress> w/ non-finite value
  50696. try {
  50697. elm[key] = cur;
  50698. } catch (e) {}
  50699. }
  50700. }
  50701. }
  50702. // check platforms/web/util/attrs.js acceptValue
  50703. function shouldUpdateValue (elm, checkVal) {
  50704. return (!elm.composing && (
  50705. elm.tagName === 'OPTION' ||
  50706. isNotInFocusAndDirty(elm, checkVal) ||
  50707. isDirtyWithModifiers(elm, checkVal)
  50708. ))
  50709. }
  50710. function isNotInFocusAndDirty (elm, checkVal) {
  50711. // return true when textbox (.number and .trim) loses focus and its value is
  50712. // not equal to the updated value
  50713. var notInFocus = true;
  50714. // #6157
  50715. // work around IE bug when accessing document.activeElement in an iframe
  50716. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  50717. return notInFocus && elm.value !== checkVal
  50718. }
  50719. function isDirtyWithModifiers (elm, newVal) {
  50720. var value = elm.value;
  50721. var modifiers = elm._vModifiers; // injected by v-model runtime
  50722. if (isDef(modifiers)) {
  50723. if (modifiers.number) {
  50724. return toNumber(value) !== toNumber(newVal)
  50725. }
  50726. if (modifiers.trim) {
  50727. return value.trim() !== newVal.trim()
  50728. }
  50729. }
  50730. return value !== newVal
  50731. }
  50732. var domProps = {
  50733. create: updateDOMProps,
  50734. update: updateDOMProps
  50735. };
  50736. /* */
  50737. var parseStyleText = cached(function (cssText) {
  50738. var res = {};
  50739. var listDelimiter = /;(?![^(]*\))/g;
  50740. var propertyDelimiter = /:(.+)/;
  50741. cssText.split(listDelimiter).forEach(function (item) {
  50742. if (item) {
  50743. var tmp = item.split(propertyDelimiter);
  50744. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  50745. }
  50746. });
  50747. return res
  50748. });
  50749. // merge static and dynamic style data on the same vnode
  50750. function normalizeStyleData (data) {
  50751. var style = normalizeStyleBinding(data.style);
  50752. // static style is pre-processed into an object during compilation
  50753. // and is always a fresh object, so it's safe to merge into it
  50754. return data.staticStyle
  50755. ? extend(data.staticStyle, style)
  50756. : style
  50757. }
  50758. // normalize possible array / string values into Object
  50759. function normalizeStyleBinding (bindingStyle) {
  50760. if (Array.isArray(bindingStyle)) {
  50761. return toObject(bindingStyle)
  50762. }
  50763. if (typeof bindingStyle === 'string') {
  50764. return parseStyleText(bindingStyle)
  50765. }
  50766. return bindingStyle
  50767. }
  50768. /**
  50769. * parent component style should be after child's
  50770. * so that parent component's style could override it
  50771. */
  50772. function getStyle (vnode, checkChild) {
  50773. var res = {};
  50774. var styleData;
  50775. if (checkChild) {
  50776. var childNode = vnode;
  50777. while (childNode.componentInstance) {
  50778. childNode = childNode.componentInstance._vnode;
  50779. if (
  50780. childNode && childNode.data &&
  50781. (styleData = normalizeStyleData(childNode.data))
  50782. ) {
  50783. extend(res, styleData);
  50784. }
  50785. }
  50786. }
  50787. if ((styleData = normalizeStyleData(vnode.data))) {
  50788. extend(res, styleData);
  50789. }
  50790. var parentNode = vnode;
  50791. while ((parentNode = parentNode.parent)) {
  50792. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  50793. extend(res, styleData);
  50794. }
  50795. }
  50796. return res
  50797. }
  50798. /* */
  50799. var cssVarRE = /^--/;
  50800. var importantRE = /\s*!important$/;
  50801. var setProp = function (el, name, val) {
  50802. /* istanbul ignore if */
  50803. if (cssVarRE.test(name)) {
  50804. el.style.setProperty(name, val);
  50805. } else if (importantRE.test(val)) {
  50806. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  50807. } else {
  50808. var normalizedName = normalize(name);
  50809. if (Array.isArray(val)) {
  50810. // Support values array created by autoprefixer, e.g.
  50811. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  50812. // Set them one by one, and the browser will only set those it can recognize
  50813. for (var i = 0, len = val.length; i < len; i++) {
  50814. el.style[normalizedName] = val[i];
  50815. }
  50816. } else {
  50817. el.style[normalizedName] = val;
  50818. }
  50819. }
  50820. };
  50821. var vendorNames = ['Webkit', 'Moz', 'ms'];
  50822. var emptyStyle;
  50823. var normalize = cached(function (prop) {
  50824. emptyStyle = emptyStyle || document.createElement('div').style;
  50825. prop = camelize(prop);
  50826. if (prop !== 'filter' && (prop in emptyStyle)) {
  50827. return prop
  50828. }
  50829. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  50830. for (var i = 0; i < vendorNames.length; i++) {
  50831. var name = vendorNames[i] + capName;
  50832. if (name in emptyStyle) {
  50833. return name
  50834. }
  50835. }
  50836. });
  50837. function updateStyle (oldVnode, vnode) {
  50838. var data = vnode.data;
  50839. var oldData = oldVnode.data;
  50840. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  50841. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  50842. ) {
  50843. return
  50844. }
  50845. var cur, name;
  50846. var el = vnode.elm;
  50847. var oldStaticStyle = oldData.staticStyle;
  50848. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  50849. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  50850. var oldStyle = oldStaticStyle || oldStyleBinding;
  50851. var style = normalizeStyleBinding(vnode.data.style) || {};
  50852. // store normalized style under a different key for next diff
  50853. // make sure to clone it if it's reactive, since the user likely wants
  50854. // to mutate it.
  50855. vnode.data.normalizedStyle = isDef(style.__ob__)
  50856. ? extend({}, style)
  50857. : style;
  50858. var newStyle = getStyle(vnode, true);
  50859. for (name in oldStyle) {
  50860. if (isUndef(newStyle[name])) {
  50861. setProp(el, name, '');
  50862. }
  50863. }
  50864. for (name in newStyle) {
  50865. cur = newStyle[name];
  50866. if (cur !== oldStyle[name]) {
  50867. // ie9 setting to null has no effect, must use empty string
  50868. setProp(el, name, cur == null ? '' : cur);
  50869. }
  50870. }
  50871. }
  50872. var style = {
  50873. create: updateStyle,
  50874. update: updateStyle
  50875. };
  50876. /* */
  50877. var whitespaceRE = /\s+/;
  50878. /**
  50879. * Add class with compatibility for SVG since classList is not supported on
  50880. * SVG elements in IE
  50881. */
  50882. function addClass (el, cls) {
  50883. /* istanbul ignore if */
  50884. if (!cls || !(cls = cls.trim())) {
  50885. return
  50886. }
  50887. /* istanbul ignore else */
  50888. if (el.classList) {
  50889. if (cls.indexOf(' ') > -1) {
  50890. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  50891. } else {
  50892. el.classList.add(cls);
  50893. }
  50894. } else {
  50895. var cur = " " + (el.getAttribute('class') || '') + " ";
  50896. if (cur.indexOf(' ' + cls + ' ') < 0) {
  50897. el.setAttribute('class', (cur + cls).trim());
  50898. }
  50899. }
  50900. }
  50901. /**
  50902. * Remove class with compatibility for SVG since classList is not supported on
  50903. * SVG elements in IE
  50904. */
  50905. function removeClass (el, cls) {
  50906. /* istanbul ignore if */
  50907. if (!cls || !(cls = cls.trim())) {
  50908. return
  50909. }
  50910. /* istanbul ignore else */
  50911. if (el.classList) {
  50912. if (cls.indexOf(' ') > -1) {
  50913. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  50914. } else {
  50915. el.classList.remove(cls);
  50916. }
  50917. if (!el.classList.length) {
  50918. el.removeAttribute('class');
  50919. }
  50920. } else {
  50921. var cur = " " + (el.getAttribute('class') || '') + " ";
  50922. var tar = ' ' + cls + ' ';
  50923. while (cur.indexOf(tar) >= 0) {
  50924. cur = cur.replace(tar, ' ');
  50925. }
  50926. cur = cur.trim();
  50927. if (cur) {
  50928. el.setAttribute('class', cur);
  50929. } else {
  50930. el.removeAttribute('class');
  50931. }
  50932. }
  50933. }
  50934. /* */
  50935. function resolveTransition (def$$1) {
  50936. if (!def$$1) {
  50937. return
  50938. }
  50939. /* istanbul ignore else */
  50940. if (typeof def$$1 === 'object') {
  50941. var res = {};
  50942. if (def$$1.css !== false) {
  50943. extend(res, autoCssTransition(def$$1.name || 'v'));
  50944. }
  50945. extend(res, def$$1);
  50946. return res
  50947. } else if (typeof def$$1 === 'string') {
  50948. return autoCssTransition(def$$1)
  50949. }
  50950. }
  50951. var autoCssTransition = cached(function (name) {
  50952. return {
  50953. enterClass: (name + "-enter"),
  50954. enterToClass: (name + "-enter-to"),
  50955. enterActiveClass: (name + "-enter-active"),
  50956. leaveClass: (name + "-leave"),
  50957. leaveToClass: (name + "-leave-to"),
  50958. leaveActiveClass: (name + "-leave-active")
  50959. }
  50960. });
  50961. var hasTransition = inBrowser && !isIE9;
  50962. var TRANSITION = 'transition';
  50963. var ANIMATION = 'animation';
  50964. // Transition property/event sniffing
  50965. var transitionProp = 'transition';
  50966. var transitionEndEvent = 'transitionend';
  50967. var animationProp = 'animation';
  50968. var animationEndEvent = 'animationend';
  50969. if (hasTransition) {
  50970. /* istanbul ignore if */
  50971. if (window.ontransitionend === undefined &&
  50972. window.onwebkittransitionend !== undefined
  50973. ) {
  50974. transitionProp = 'WebkitTransition';
  50975. transitionEndEvent = 'webkitTransitionEnd';
  50976. }
  50977. if (window.onanimationend === undefined &&
  50978. window.onwebkitanimationend !== undefined
  50979. ) {
  50980. animationProp = 'WebkitAnimation';
  50981. animationEndEvent = 'webkitAnimationEnd';
  50982. }
  50983. }
  50984. // binding to window is necessary to make hot reload work in IE in strict mode
  50985. var raf = inBrowser
  50986. ? window.requestAnimationFrame
  50987. ? window.requestAnimationFrame.bind(window)
  50988. : setTimeout
  50989. : /* istanbul ignore next */ function (fn) { return fn(); };
  50990. function nextFrame (fn) {
  50991. raf(function () {
  50992. raf(fn);
  50993. });
  50994. }
  50995. function addTransitionClass (el, cls) {
  50996. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  50997. if (transitionClasses.indexOf(cls) < 0) {
  50998. transitionClasses.push(cls);
  50999. addClass(el, cls);
  51000. }
  51001. }
  51002. function removeTransitionClass (el, cls) {
  51003. if (el._transitionClasses) {
  51004. remove(el._transitionClasses, cls);
  51005. }
  51006. removeClass(el, cls);
  51007. }
  51008. function whenTransitionEnds (
  51009. el,
  51010. expectedType,
  51011. cb
  51012. ) {
  51013. var ref = getTransitionInfo(el, expectedType);
  51014. var type = ref.type;
  51015. var timeout = ref.timeout;
  51016. var propCount = ref.propCount;
  51017. if (!type) { return cb() }
  51018. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51019. var ended = 0;
  51020. var end = function () {
  51021. el.removeEventListener(event, onEnd);
  51022. cb();
  51023. };
  51024. var onEnd = function (e) {
  51025. if (e.target === el) {
  51026. if (++ended >= propCount) {
  51027. end();
  51028. }
  51029. }
  51030. };
  51031. setTimeout(function () {
  51032. if (ended < propCount) {
  51033. end();
  51034. }
  51035. }, timeout + 1);
  51036. el.addEventListener(event, onEnd);
  51037. }
  51038. var transformRE = /\b(transform|all)(,|$)/;
  51039. function getTransitionInfo (el, expectedType) {
  51040. var styles = window.getComputedStyle(el);
  51041. // JSDOM may return undefined for transition properties
  51042. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51043. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51044. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51045. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51046. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51047. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51048. var type;
  51049. var timeout = 0;
  51050. var propCount = 0;
  51051. /* istanbul ignore if */
  51052. if (expectedType === TRANSITION) {
  51053. if (transitionTimeout > 0) {
  51054. type = TRANSITION;
  51055. timeout = transitionTimeout;
  51056. propCount = transitionDurations.length;
  51057. }
  51058. } else if (expectedType === ANIMATION) {
  51059. if (animationTimeout > 0) {
  51060. type = ANIMATION;
  51061. timeout = animationTimeout;
  51062. propCount = animationDurations.length;
  51063. }
  51064. } else {
  51065. timeout = Math.max(transitionTimeout, animationTimeout);
  51066. type = timeout > 0
  51067. ? transitionTimeout > animationTimeout
  51068. ? TRANSITION
  51069. : ANIMATION
  51070. : null;
  51071. propCount = type
  51072. ? type === TRANSITION
  51073. ? transitionDurations.length
  51074. : animationDurations.length
  51075. : 0;
  51076. }
  51077. var hasTransform =
  51078. type === TRANSITION &&
  51079. transformRE.test(styles[transitionProp + 'Property']);
  51080. return {
  51081. type: type,
  51082. timeout: timeout,
  51083. propCount: propCount,
  51084. hasTransform: hasTransform
  51085. }
  51086. }
  51087. function getTimeout (delays, durations) {
  51088. /* istanbul ignore next */
  51089. while (delays.length < durations.length) {
  51090. delays = delays.concat(delays);
  51091. }
  51092. return Math.max.apply(null, durations.map(function (d, i) {
  51093. return toMs(d) + toMs(delays[i])
  51094. }))
  51095. }
  51096. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51097. // in a locale-dependent way, using a comma instead of a dot.
  51098. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51099. // as a floor function) causing unexpected behaviors
  51100. function toMs (s) {
  51101. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51102. }
  51103. /* */
  51104. function enter (vnode, toggleDisplay) {
  51105. var el = vnode.elm;
  51106. // call leave callback now
  51107. if (isDef(el._leaveCb)) {
  51108. el._leaveCb.cancelled = true;
  51109. el._leaveCb();
  51110. }
  51111. var data = resolveTransition(vnode.data.transition);
  51112. if (isUndef(data)) {
  51113. return
  51114. }
  51115. /* istanbul ignore if */
  51116. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51117. return
  51118. }
  51119. var css = data.css;
  51120. var type = data.type;
  51121. var enterClass = data.enterClass;
  51122. var enterToClass = data.enterToClass;
  51123. var enterActiveClass = data.enterActiveClass;
  51124. var appearClass = data.appearClass;
  51125. var appearToClass = data.appearToClass;
  51126. var appearActiveClass = data.appearActiveClass;
  51127. var beforeEnter = data.beforeEnter;
  51128. var enter = data.enter;
  51129. var afterEnter = data.afterEnter;
  51130. var enterCancelled = data.enterCancelled;
  51131. var beforeAppear = data.beforeAppear;
  51132. var appear = data.appear;
  51133. var afterAppear = data.afterAppear;
  51134. var appearCancelled = data.appearCancelled;
  51135. var duration = data.duration;
  51136. // activeInstance will always be the <transition> component managing this
  51137. // transition. One edge case to check is when the <transition> is placed
  51138. // as the root node of a child component. In that case we need to check
  51139. // <transition>'s parent for appear check.
  51140. var context = activeInstance;
  51141. var transitionNode = activeInstance.$vnode;
  51142. while (transitionNode && transitionNode.parent) {
  51143. context = transitionNode.context;
  51144. transitionNode = transitionNode.parent;
  51145. }
  51146. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51147. if (isAppear && !appear && appear !== '') {
  51148. return
  51149. }
  51150. var startClass = isAppear && appearClass
  51151. ? appearClass
  51152. : enterClass;
  51153. var activeClass = isAppear && appearActiveClass
  51154. ? appearActiveClass
  51155. : enterActiveClass;
  51156. var toClass = isAppear && appearToClass
  51157. ? appearToClass
  51158. : enterToClass;
  51159. var beforeEnterHook = isAppear
  51160. ? (beforeAppear || beforeEnter)
  51161. : beforeEnter;
  51162. var enterHook = isAppear
  51163. ? (typeof appear === 'function' ? appear : enter)
  51164. : enter;
  51165. var afterEnterHook = isAppear
  51166. ? (afterAppear || afterEnter)
  51167. : afterEnter;
  51168. var enterCancelledHook = isAppear
  51169. ? (appearCancelled || enterCancelled)
  51170. : enterCancelled;
  51171. var explicitEnterDuration = toNumber(
  51172. isObject(duration)
  51173. ? duration.enter
  51174. : duration
  51175. );
  51176. if (explicitEnterDuration != null) {
  51177. checkDuration(explicitEnterDuration, 'enter', vnode);
  51178. }
  51179. var expectsCSS = css !== false && !isIE9;
  51180. var userWantsControl = getHookArgumentsLength(enterHook);
  51181. var cb = el._enterCb = once(function () {
  51182. if (expectsCSS) {
  51183. removeTransitionClass(el, toClass);
  51184. removeTransitionClass(el, activeClass);
  51185. }
  51186. if (cb.cancelled) {
  51187. if (expectsCSS) {
  51188. removeTransitionClass(el, startClass);
  51189. }
  51190. enterCancelledHook && enterCancelledHook(el);
  51191. } else {
  51192. afterEnterHook && afterEnterHook(el);
  51193. }
  51194. el._enterCb = null;
  51195. });
  51196. if (!vnode.data.show) {
  51197. // remove pending leave element on enter by injecting an insert hook
  51198. mergeVNodeHook(vnode, 'insert', function () {
  51199. var parent = el.parentNode;
  51200. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51201. if (pendingNode &&
  51202. pendingNode.tag === vnode.tag &&
  51203. pendingNode.elm._leaveCb
  51204. ) {
  51205. pendingNode.elm._leaveCb();
  51206. }
  51207. enterHook && enterHook(el, cb);
  51208. });
  51209. }
  51210. // start enter transition
  51211. beforeEnterHook && beforeEnterHook(el);
  51212. if (expectsCSS) {
  51213. addTransitionClass(el, startClass);
  51214. addTransitionClass(el, activeClass);
  51215. nextFrame(function () {
  51216. removeTransitionClass(el, startClass);
  51217. if (!cb.cancelled) {
  51218. addTransitionClass(el, toClass);
  51219. if (!userWantsControl) {
  51220. if (isValidDuration(explicitEnterDuration)) {
  51221. setTimeout(cb, explicitEnterDuration);
  51222. } else {
  51223. whenTransitionEnds(el, type, cb);
  51224. }
  51225. }
  51226. }
  51227. });
  51228. }
  51229. if (vnode.data.show) {
  51230. toggleDisplay && toggleDisplay();
  51231. enterHook && enterHook(el, cb);
  51232. }
  51233. if (!expectsCSS && !userWantsControl) {
  51234. cb();
  51235. }
  51236. }
  51237. function leave (vnode, rm) {
  51238. var el = vnode.elm;
  51239. // call enter callback now
  51240. if (isDef(el._enterCb)) {
  51241. el._enterCb.cancelled = true;
  51242. el._enterCb();
  51243. }
  51244. var data = resolveTransition(vnode.data.transition);
  51245. if (isUndef(data) || el.nodeType !== 1) {
  51246. return rm()
  51247. }
  51248. /* istanbul ignore if */
  51249. if (isDef(el._leaveCb)) {
  51250. return
  51251. }
  51252. var css = data.css;
  51253. var type = data.type;
  51254. var leaveClass = data.leaveClass;
  51255. var leaveToClass = data.leaveToClass;
  51256. var leaveActiveClass = data.leaveActiveClass;
  51257. var beforeLeave = data.beforeLeave;
  51258. var leave = data.leave;
  51259. var afterLeave = data.afterLeave;
  51260. var leaveCancelled = data.leaveCancelled;
  51261. var delayLeave = data.delayLeave;
  51262. var duration = data.duration;
  51263. var expectsCSS = css !== false && !isIE9;
  51264. var userWantsControl = getHookArgumentsLength(leave);
  51265. var explicitLeaveDuration = toNumber(
  51266. isObject(duration)
  51267. ? duration.leave
  51268. : duration
  51269. );
  51270. if (isDef(explicitLeaveDuration)) {
  51271. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51272. }
  51273. var cb = el._leaveCb = once(function () {
  51274. if (el.parentNode && el.parentNode._pending) {
  51275. el.parentNode._pending[vnode.key] = null;
  51276. }
  51277. if (expectsCSS) {
  51278. removeTransitionClass(el, leaveToClass);
  51279. removeTransitionClass(el, leaveActiveClass);
  51280. }
  51281. if (cb.cancelled) {
  51282. if (expectsCSS) {
  51283. removeTransitionClass(el, leaveClass);
  51284. }
  51285. leaveCancelled && leaveCancelled(el);
  51286. } else {
  51287. rm();
  51288. afterLeave && afterLeave(el);
  51289. }
  51290. el._leaveCb = null;
  51291. });
  51292. if (delayLeave) {
  51293. delayLeave(performLeave);
  51294. } else {
  51295. performLeave();
  51296. }
  51297. function performLeave () {
  51298. // the delayed leave may have already been cancelled
  51299. if (cb.cancelled) {
  51300. return
  51301. }
  51302. // record leaving element
  51303. if (!vnode.data.show && el.parentNode) {
  51304. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  51305. }
  51306. beforeLeave && beforeLeave(el);
  51307. if (expectsCSS) {
  51308. addTransitionClass(el, leaveClass);
  51309. addTransitionClass(el, leaveActiveClass);
  51310. nextFrame(function () {
  51311. removeTransitionClass(el, leaveClass);
  51312. if (!cb.cancelled) {
  51313. addTransitionClass(el, leaveToClass);
  51314. if (!userWantsControl) {
  51315. if (isValidDuration(explicitLeaveDuration)) {
  51316. setTimeout(cb, explicitLeaveDuration);
  51317. } else {
  51318. whenTransitionEnds(el, type, cb);
  51319. }
  51320. }
  51321. }
  51322. });
  51323. }
  51324. leave && leave(el, cb);
  51325. if (!expectsCSS && !userWantsControl) {
  51326. cb();
  51327. }
  51328. }
  51329. }
  51330. // only used in dev mode
  51331. function checkDuration (val, name, vnode) {
  51332. if (typeof val !== 'number') {
  51333. warn(
  51334. "<transition> explicit " + name + " duration is not a valid number - " +
  51335. "got " + (JSON.stringify(val)) + ".",
  51336. vnode.context
  51337. );
  51338. } else if (isNaN(val)) {
  51339. warn(
  51340. "<transition> explicit " + name + " duration is NaN - " +
  51341. 'the duration expression might be incorrect.',
  51342. vnode.context
  51343. );
  51344. }
  51345. }
  51346. function isValidDuration (val) {
  51347. return typeof val === 'number' && !isNaN(val)
  51348. }
  51349. /**
  51350. * Normalize a transition hook's argument length. The hook may be:
  51351. * - a merged hook (invoker) with the original in .fns
  51352. * - a wrapped component method (check ._length)
  51353. * - a plain function (.length)
  51354. */
  51355. function getHookArgumentsLength (fn) {
  51356. if (isUndef(fn)) {
  51357. return false
  51358. }
  51359. var invokerFns = fn.fns;
  51360. if (isDef(invokerFns)) {
  51361. // invoker
  51362. return getHookArgumentsLength(
  51363. Array.isArray(invokerFns)
  51364. ? invokerFns[0]
  51365. : invokerFns
  51366. )
  51367. } else {
  51368. return (fn._length || fn.length) > 1
  51369. }
  51370. }
  51371. function _enter (_, vnode) {
  51372. if (vnode.data.show !== true) {
  51373. enter(vnode);
  51374. }
  51375. }
  51376. var transition = inBrowser ? {
  51377. create: _enter,
  51378. activate: _enter,
  51379. remove: function remove$$1 (vnode, rm) {
  51380. /* istanbul ignore else */
  51381. if (vnode.data.show !== true) {
  51382. leave(vnode, rm);
  51383. } else {
  51384. rm();
  51385. }
  51386. }
  51387. } : {};
  51388. var platformModules = [
  51389. attrs,
  51390. klass,
  51391. events,
  51392. domProps,
  51393. style,
  51394. transition
  51395. ];
  51396. /* */
  51397. // the directive module should be applied last, after all
  51398. // built-in modules have been applied.
  51399. var modules = platformModules.concat(baseModules);
  51400. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  51401. /**
  51402. * Not type checking this file because flow doesn't like attaching
  51403. * properties to Elements.
  51404. */
  51405. /* istanbul ignore if */
  51406. if (isIE9) {
  51407. // http://www.matts411.com/post/internet-explorer-9-oninput/
  51408. document.addEventListener('selectionchange', function () {
  51409. var el = document.activeElement;
  51410. if (el && el.vmodel) {
  51411. trigger(el, 'input');
  51412. }
  51413. });
  51414. }
  51415. var directive = {
  51416. inserted: function inserted (el, binding, vnode, oldVnode) {
  51417. if (vnode.tag === 'select') {
  51418. // #6903
  51419. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  51420. mergeVNodeHook(vnode, 'postpatch', function () {
  51421. directive.componentUpdated(el, binding, vnode);
  51422. });
  51423. } else {
  51424. setSelected(el, binding, vnode.context);
  51425. }
  51426. el._vOptions = [].map.call(el.options, getValue);
  51427. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  51428. el._vModifiers = binding.modifiers;
  51429. if (!binding.modifiers.lazy) {
  51430. el.addEventListener('compositionstart', onCompositionStart);
  51431. el.addEventListener('compositionend', onCompositionEnd);
  51432. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  51433. // switching focus before confirming composition choice
  51434. // this also fixes the issue where some browsers e.g. iOS Chrome
  51435. // fires "change" instead of "input" on autocomplete.
  51436. el.addEventListener('change', onCompositionEnd);
  51437. /* istanbul ignore if */
  51438. if (isIE9) {
  51439. el.vmodel = true;
  51440. }
  51441. }
  51442. }
  51443. },
  51444. componentUpdated: function componentUpdated (el, binding, vnode) {
  51445. if (vnode.tag === 'select') {
  51446. setSelected(el, binding, vnode.context);
  51447. // in case the options rendered by v-for have changed,
  51448. // it's possible that the value is out-of-sync with the rendered options.
  51449. // detect such cases and filter out values that no longer has a matching
  51450. // option in the DOM.
  51451. var prevOptions = el._vOptions;
  51452. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  51453. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  51454. // trigger change event if
  51455. // no matching option found for at least one value
  51456. var needReset = el.multiple
  51457. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  51458. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  51459. if (needReset) {
  51460. trigger(el, 'change');
  51461. }
  51462. }
  51463. }
  51464. }
  51465. };
  51466. function setSelected (el, binding, vm) {
  51467. actuallySetSelected(el, binding, vm);
  51468. /* istanbul ignore if */
  51469. if (isIE || isEdge) {
  51470. setTimeout(function () {
  51471. actuallySetSelected(el, binding, vm);
  51472. }, 0);
  51473. }
  51474. }
  51475. function actuallySetSelected (el, binding, vm) {
  51476. var value = binding.value;
  51477. var isMultiple = el.multiple;
  51478. if (isMultiple && !Array.isArray(value)) {
  51479. warn(
  51480. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  51481. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  51482. vm
  51483. );
  51484. return
  51485. }
  51486. var selected, option;
  51487. for (var i = 0, l = el.options.length; i < l; i++) {
  51488. option = el.options[i];
  51489. if (isMultiple) {
  51490. selected = looseIndexOf(value, getValue(option)) > -1;
  51491. if (option.selected !== selected) {
  51492. option.selected = selected;
  51493. }
  51494. } else {
  51495. if (looseEqual(getValue(option), value)) {
  51496. if (el.selectedIndex !== i) {
  51497. el.selectedIndex = i;
  51498. }
  51499. return
  51500. }
  51501. }
  51502. }
  51503. if (!isMultiple) {
  51504. el.selectedIndex = -1;
  51505. }
  51506. }
  51507. function hasNoMatchingOption (value, options) {
  51508. return options.every(function (o) { return !looseEqual(o, value); })
  51509. }
  51510. function getValue (option) {
  51511. return '_value' in option
  51512. ? option._value
  51513. : option.value
  51514. }
  51515. function onCompositionStart (e) {
  51516. e.target.composing = true;
  51517. }
  51518. function onCompositionEnd (e) {
  51519. // prevent triggering an input event for no reason
  51520. if (!e.target.composing) { return }
  51521. e.target.composing = false;
  51522. trigger(e.target, 'input');
  51523. }
  51524. function trigger (el, type) {
  51525. var e = document.createEvent('HTMLEvents');
  51526. e.initEvent(type, true, true);
  51527. el.dispatchEvent(e);
  51528. }
  51529. /* */
  51530. // recursively search for possible transition defined inside the component root
  51531. function locateNode (vnode) {
  51532. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  51533. ? locateNode(vnode.componentInstance._vnode)
  51534. : vnode
  51535. }
  51536. var show = {
  51537. bind: function bind (el, ref, vnode) {
  51538. var value = ref.value;
  51539. vnode = locateNode(vnode);
  51540. var transition$$1 = vnode.data && vnode.data.transition;
  51541. var originalDisplay = el.__vOriginalDisplay =
  51542. el.style.display === 'none' ? '' : el.style.display;
  51543. if (value && transition$$1) {
  51544. vnode.data.show = true;
  51545. enter(vnode, function () {
  51546. el.style.display = originalDisplay;
  51547. });
  51548. } else {
  51549. el.style.display = value ? originalDisplay : 'none';
  51550. }
  51551. },
  51552. update: function update (el, ref, vnode) {
  51553. var value = ref.value;
  51554. var oldValue = ref.oldValue;
  51555. /* istanbul ignore if */
  51556. if (!value === !oldValue) { return }
  51557. vnode = locateNode(vnode);
  51558. var transition$$1 = vnode.data && vnode.data.transition;
  51559. if (transition$$1) {
  51560. vnode.data.show = true;
  51561. if (value) {
  51562. enter(vnode, function () {
  51563. el.style.display = el.__vOriginalDisplay;
  51564. });
  51565. } else {
  51566. leave(vnode, function () {
  51567. el.style.display = 'none';
  51568. });
  51569. }
  51570. } else {
  51571. el.style.display = value ? el.__vOriginalDisplay : 'none';
  51572. }
  51573. },
  51574. unbind: function unbind (
  51575. el,
  51576. binding,
  51577. vnode,
  51578. oldVnode,
  51579. isDestroy
  51580. ) {
  51581. if (!isDestroy) {
  51582. el.style.display = el.__vOriginalDisplay;
  51583. }
  51584. }
  51585. };
  51586. var platformDirectives = {
  51587. model: directive,
  51588. show: show
  51589. };
  51590. /* */
  51591. var transitionProps = {
  51592. name: String,
  51593. appear: Boolean,
  51594. css: Boolean,
  51595. mode: String,
  51596. type: String,
  51597. enterClass: String,
  51598. leaveClass: String,
  51599. enterToClass: String,
  51600. leaveToClass: String,
  51601. enterActiveClass: String,
  51602. leaveActiveClass: String,
  51603. appearClass: String,
  51604. appearActiveClass: String,
  51605. appearToClass: String,
  51606. duration: [Number, String, Object]
  51607. };
  51608. // in case the child is also an abstract component, e.g. <keep-alive>
  51609. // we want to recursively retrieve the real component to be rendered
  51610. function getRealChild (vnode) {
  51611. var compOptions = vnode && vnode.componentOptions;
  51612. if (compOptions && compOptions.Ctor.options.abstract) {
  51613. return getRealChild(getFirstComponentChild(compOptions.children))
  51614. } else {
  51615. return vnode
  51616. }
  51617. }
  51618. function extractTransitionData (comp) {
  51619. var data = {};
  51620. var options = comp.$options;
  51621. // props
  51622. for (var key in options.propsData) {
  51623. data[key] = comp[key];
  51624. }
  51625. // events.
  51626. // extract listeners and pass them directly to the transition methods
  51627. var listeners = options._parentListeners;
  51628. for (var key$1 in listeners) {
  51629. data[camelize(key$1)] = listeners[key$1];
  51630. }
  51631. return data
  51632. }
  51633. function placeholder (h, rawChild) {
  51634. if (/\d-keep-alive$/.test(rawChild.tag)) {
  51635. return h('keep-alive', {
  51636. props: rawChild.componentOptions.propsData
  51637. })
  51638. }
  51639. }
  51640. function hasParentTransition (vnode) {
  51641. while ((vnode = vnode.parent)) {
  51642. if (vnode.data.transition) {
  51643. return true
  51644. }
  51645. }
  51646. }
  51647. function isSameChild (child, oldChild) {
  51648. return oldChild.key === child.key && oldChild.tag === child.tag
  51649. }
  51650. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  51651. var isVShowDirective = function (d) { return d.name === 'show'; };
  51652. var Transition = {
  51653. name: 'transition',
  51654. props: transitionProps,
  51655. abstract: true,
  51656. render: function render (h) {
  51657. var this$1 = this;
  51658. var children = this.$slots.default;
  51659. if (!children) {
  51660. return
  51661. }
  51662. // filter out text nodes (possible whitespaces)
  51663. children = children.filter(isNotTextNode);
  51664. /* istanbul ignore if */
  51665. if (!children.length) {
  51666. return
  51667. }
  51668. // warn multiple elements
  51669. if (children.length > 1) {
  51670. warn(
  51671. '<transition> can only be used on a single element. Use ' +
  51672. '<transition-group> for lists.',
  51673. this.$parent
  51674. );
  51675. }
  51676. var mode = this.mode;
  51677. // warn invalid mode
  51678. if (mode && mode !== 'in-out' && mode !== 'out-in'
  51679. ) {
  51680. warn(
  51681. 'invalid <transition> mode: ' + mode,
  51682. this.$parent
  51683. );
  51684. }
  51685. var rawChild = children[0];
  51686. // if this is a component root node and the component's
  51687. // parent container node also has transition, skip.
  51688. if (hasParentTransition(this.$vnode)) {
  51689. return rawChild
  51690. }
  51691. // apply transition data to child
  51692. // use getRealChild() to ignore abstract components e.g. keep-alive
  51693. var child = getRealChild(rawChild);
  51694. /* istanbul ignore if */
  51695. if (!child) {
  51696. return rawChild
  51697. }
  51698. if (this._leaving) {
  51699. return placeholder(h, rawChild)
  51700. }
  51701. // ensure a key that is unique to the vnode type and to this transition
  51702. // component instance. This key will be used to remove pending leaving nodes
  51703. // during entering.
  51704. var id = "__transition-" + (this._uid) + "-";
  51705. child.key = child.key == null
  51706. ? child.isComment
  51707. ? id + 'comment'
  51708. : id + child.tag
  51709. : isPrimitive(child.key)
  51710. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  51711. : child.key;
  51712. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  51713. var oldRawChild = this._vnode;
  51714. var oldChild = getRealChild(oldRawChild);
  51715. // mark v-show
  51716. // so that the transition module can hand over the control to the directive
  51717. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  51718. child.data.show = true;
  51719. }
  51720. if (
  51721. oldChild &&
  51722. oldChild.data &&
  51723. !isSameChild(child, oldChild) &&
  51724. !isAsyncPlaceholder(oldChild) &&
  51725. // #6687 component root is a comment node
  51726. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  51727. ) {
  51728. // replace old child transition data with fresh one
  51729. // important for dynamic transitions!
  51730. var oldData = oldChild.data.transition = extend({}, data);
  51731. // handle transition mode
  51732. if (mode === 'out-in') {
  51733. // return placeholder node and queue update when leave finishes
  51734. this._leaving = true;
  51735. mergeVNodeHook(oldData, 'afterLeave', function () {
  51736. this$1._leaving = false;
  51737. this$1.$forceUpdate();
  51738. });
  51739. return placeholder(h, rawChild)
  51740. } else if (mode === 'in-out') {
  51741. if (isAsyncPlaceholder(child)) {
  51742. return oldRawChild
  51743. }
  51744. var delayedLeave;
  51745. var performLeave = function () { delayedLeave(); };
  51746. mergeVNodeHook(data, 'afterEnter', performLeave);
  51747. mergeVNodeHook(data, 'enterCancelled', performLeave);
  51748. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  51749. }
  51750. }
  51751. return rawChild
  51752. }
  51753. };
  51754. /* */
  51755. var props = extend({
  51756. tag: String,
  51757. moveClass: String
  51758. }, transitionProps);
  51759. delete props.mode;
  51760. var TransitionGroup = {
  51761. props: props,
  51762. beforeMount: function beforeMount () {
  51763. var this$1 = this;
  51764. var update = this._update;
  51765. this._update = function (vnode, hydrating) {
  51766. var restoreActiveInstance = setActiveInstance(this$1);
  51767. // force removing pass
  51768. this$1.__patch__(
  51769. this$1._vnode,
  51770. this$1.kept,
  51771. false, // hydrating
  51772. true // removeOnly (!important, avoids unnecessary moves)
  51773. );
  51774. this$1._vnode = this$1.kept;
  51775. restoreActiveInstance();
  51776. update.call(this$1, vnode, hydrating);
  51777. };
  51778. },
  51779. render: function render (h) {
  51780. var tag = this.tag || this.$vnode.data.tag || 'span';
  51781. var map = Object.create(null);
  51782. var prevChildren = this.prevChildren = this.children;
  51783. var rawChildren = this.$slots.default || [];
  51784. var children = this.children = [];
  51785. var transitionData = extractTransitionData(this);
  51786. for (var i = 0; i < rawChildren.length; i++) {
  51787. var c = rawChildren[i];
  51788. if (c.tag) {
  51789. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  51790. children.push(c);
  51791. map[c.key] = c
  51792. ;(c.data || (c.data = {})).transition = transitionData;
  51793. } else {
  51794. var opts = c.componentOptions;
  51795. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  51796. warn(("<transition-group> children must be keyed: <" + name + ">"));
  51797. }
  51798. }
  51799. }
  51800. if (prevChildren) {
  51801. var kept = [];
  51802. var removed = [];
  51803. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  51804. var c$1 = prevChildren[i$1];
  51805. c$1.data.transition = transitionData;
  51806. c$1.data.pos = c$1.elm.getBoundingClientRect();
  51807. if (map[c$1.key]) {
  51808. kept.push(c$1);
  51809. } else {
  51810. removed.push(c$1);
  51811. }
  51812. }
  51813. this.kept = h(tag, null, kept);
  51814. this.removed = removed;
  51815. }
  51816. return h(tag, null, children)
  51817. },
  51818. updated: function updated () {
  51819. var children = this.prevChildren;
  51820. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  51821. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  51822. return
  51823. }
  51824. // we divide the work into three loops to avoid mixing DOM reads and writes
  51825. // in each iteration - which helps prevent layout thrashing.
  51826. children.forEach(callPendingCbs);
  51827. children.forEach(recordPosition);
  51828. children.forEach(applyTranslation);
  51829. // force reflow to put everything in position
  51830. // assign to this to avoid being removed in tree-shaking
  51831. // $flow-disable-line
  51832. this._reflow = document.body.offsetHeight;
  51833. children.forEach(function (c) {
  51834. if (c.data.moved) {
  51835. var el = c.elm;
  51836. var s = el.style;
  51837. addTransitionClass(el, moveClass);
  51838. s.transform = s.WebkitTransform = s.transitionDuration = '';
  51839. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  51840. if (e && e.target !== el) {
  51841. return
  51842. }
  51843. if (!e || /transform$/.test(e.propertyName)) {
  51844. el.removeEventListener(transitionEndEvent, cb);
  51845. el._moveCb = null;
  51846. removeTransitionClass(el, moveClass);
  51847. }
  51848. });
  51849. }
  51850. });
  51851. },
  51852. methods: {
  51853. hasMove: function hasMove (el, moveClass) {
  51854. /* istanbul ignore if */
  51855. if (!hasTransition) {
  51856. return false
  51857. }
  51858. /* istanbul ignore if */
  51859. if (this._hasMove) {
  51860. return this._hasMove
  51861. }
  51862. // Detect whether an element with the move class applied has
  51863. // CSS transitions. Since the element may be inside an entering
  51864. // transition at this very moment, we make a clone of it and remove
  51865. // all other transition classes applied to ensure only the move class
  51866. // is applied.
  51867. var clone = el.cloneNode();
  51868. if (el._transitionClasses) {
  51869. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  51870. }
  51871. addClass(clone, moveClass);
  51872. clone.style.display = 'none';
  51873. this.$el.appendChild(clone);
  51874. var info = getTransitionInfo(clone);
  51875. this.$el.removeChild(clone);
  51876. return (this._hasMove = info.hasTransform)
  51877. }
  51878. }
  51879. };
  51880. function callPendingCbs (c) {
  51881. /* istanbul ignore if */
  51882. if (c.elm._moveCb) {
  51883. c.elm._moveCb();
  51884. }
  51885. /* istanbul ignore if */
  51886. if (c.elm._enterCb) {
  51887. c.elm._enterCb();
  51888. }
  51889. }
  51890. function recordPosition (c) {
  51891. c.data.newPos = c.elm.getBoundingClientRect();
  51892. }
  51893. function applyTranslation (c) {
  51894. var oldPos = c.data.pos;
  51895. var newPos = c.data.newPos;
  51896. var dx = oldPos.left - newPos.left;
  51897. var dy = oldPos.top - newPos.top;
  51898. if (dx || dy) {
  51899. c.data.moved = true;
  51900. var s = c.elm.style;
  51901. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  51902. s.transitionDuration = '0s';
  51903. }
  51904. }
  51905. var platformComponents = {
  51906. Transition: Transition,
  51907. TransitionGroup: TransitionGroup
  51908. };
  51909. /* */
  51910. // install platform specific utils
  51911. Vue.config.mustUseProp = mustUseProp;
  51912. Vue.config.isReservedTag = isReservedTag;
  51913. Vue.config.isReservedAttr = isReservedAttr;
  51914. Vue.config.getTagNamespace = getTagNamespace;
  51915. Vue.config.isUnknownElement = isUnknownElement;
  51916. // install platform runtime directives & components
  51917. extend(Vue.options.directives, platformDirectives);
  51918. extend(Vue.options.components, platformComponents);
  51919. // install platform patch function
  51920. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  51921. // public mount method
  51922. Vue.prototype.$mount = function (
  51923. el,
  51924. hydrating
  51925. ) {
  51926. el = el && inBrowser ? query(el) : undefined;
  51927. return mountComponent(this, el, hydrating)
  51928. };
  51929. // devtools global hook
  51930. /* istanbul ignore next */
  51931. if (inBrowser) {
  51932. setTimeout(function () {
  51933. if (config.devtools) {
  51934. if (devtools) {
  51935. devtools.emit('init', Vue);
  51936. } else {
  51937. console[console.info ? 'info' : 'log'](
  51938. 'Download the Vue Devtools extension for a better development experience:\n' +
  51939. 'https://github.com/vuejs/vue-devtools'
  51940. );
  51941. }
  51942. }
  51943. if (config.productionTip !== false &&
  51944. typeof console !== 'undefined'
  51945. ) {
  51946. console[console.info ? 'info' : 'log'](
  51947. "You are running Vue in development mode.\n" +
  51948. "Make sure to turn on production mode when deploying for production.\n" +
  51949. "See more tips at https://vuejs.org/guide/deployment.html"
  51950. );
  51951. }
  51952. }, 0);
  51953. }
  51954. /* */
  51955. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  51956. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  51957. var buildRegex = cached(function (delimiters) {
  51958. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  51959. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  51960. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  51961. });
  51962. function parseText (
  51963. text,
  51964. delimiters
  51965. ) {
  51966. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  51967. if (!tagRE.test(text)) {
  51968. return
  51969. }
  51970. var tokens = [];
  51971. var rawTokens = [];
  51972. var lastIndex = tagRE.lastIndex = 0;
  51973. var match, index, tokenValue;
  51974. while ((match = tagRE.exec(text))) {
  51975. index = match.index;
  51976. // push text token
  51977. if (index > lastIndex) {
  51978. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  51979. tokens.push(JSON.stringify(tokenValue));
  51980. }
  51981. // tag token
  51982. var exp = parseFilters(match[1].trim());
  51983. tokens.push(("_s(" + exp + ")"));
  51984. rawTokens.push({ '@binding': exp });
  51985. lastIndex = index + match[0].length;
  51986. }
  51987. if (lastIndex < text.length) {
  51988. rawTokens.push(tokenValue = text.slice(lastIndex));
  51989. tokens.push(JSON.stringify(tokenValue));
  51990. }
  51991. return {
  51992. expression: tokens.join('+'),
  51993. tokens: rawTokens
  51994. }
  51995. }
  51996. /* */
  51997. function transformNode (el, options) {
  51998. var warn = options.warn || baseWarn;
  51999. var staticClass = getAndRemoveAttr(el, 'class');
  52000. if (staticClass) {
  52001. var res = parseText(staticClass, options.delimiters);
  52002. if (res) {
  52003. warn(
  52004. "class=\"" + staticClass + "\": " +
  52005. 'Interpolation inside attributes has been removed. ' +
  52006. 'Use v-bind or the colon shorthand instead. For example, ' +
  52007. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52008. el.rawAttrsMap['class']
  52009. );
  52010. }
  52011. }
  52012. if (staticClass) {
  52013. el.staticClass = JSON.stringify(staticClass);
  52014. }
  52015. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52016. if (classBinding) {
  52017. el.classBinding = classBinding;
  52018. }
  52019. }
  52020. function genData (el) {
  52021. var data = '';
  52022. if (el.staticClass) {
  52023. data += "staticClass:" + (el.staticClass) + ",";
  52024. }
  52025. if (el.classBinding) {
  52026. data += "class:" + (el.classBinding) + ",";
  52027. }
  52028. return data
  52029. }
  52030. var klass$1 = {
  52031. staticKeys: ['staticClass'],
  52032. transformNode: transformNode,
  52033. genData: genData
  52034. };
  52035. /* */
  52036. function transformNode$1 (el, options) {
  52037. var warn = options.warn || baseWarn;
  52038. var staticStyle = getAndRemoveAttr(el, 'style');
  52039. if (staticStyle) {
  52040. /* istanbul ignore if */
  52041. {
  52042. var res = parseText(staticStyle, options.delimiters);
  52043. if (res) {
  52044. warn(
  52045. "style=\"" + staticStyle + "\": " +
  52046. 'Interpolation inside attributes has been removed. ' +
  52047. 'Use v-bind or the colon shorthand instead. For example, ' +
  52048. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52049. el.rawAttrsMap['style']
  52050. );
  52051. }
  52052. }
  52053. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52054. }
  52055. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52056. if (styleBinding) {
  52057. el.styleBinding = styleBinding;
  52058. }
  52059. }
  52060. function genData$1 (el) {
  52061. var data = '';
  52062. if (el.staticStyle) {
  52063. data += "staticStyle:" + (el.staticStyle) + ",";
  52064. }
  52065. if (el.styleBinding) {
  52066. data += "style:(" + (el.styleBinding) + "),";
  52067. }
  52068. return data
  52069. }
  52070. var style$1 = {
  52071. staticKeys: ['staticStyle'],
  52072. transformNode: transformNode$1,
  52073. genData: genData$1
  52074. };
  52075. /* */
  52076. var decoder;
  52077. var he = {
  52078. decode: function decode (html) {
  52079. decoder = decoder || document.createElement('div');
  52080. decoder.innerHTML = html;
  52081. return decoder.textContent
  52082. }
  52083. };
  52084. /* */
  52085. var isUnaryTag = makeMap(
  52086. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52087. 'link,meta,param,source,track,wbr'
  52088. );
  52089. // Elements that you can, intentionally, leave open
  52090. // (and which close themselves)
  52091. var canBeLeftOpenTag = makeMap(
  52092. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52093. );
  52094. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52095. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52096. var isNonPhrasingTag = makeMap(
  52097. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52098. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52099. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52100. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52101. 'title,tr,track'
  52102. );
  52103. /**
  52104. * Not type-checking this file because it's mostly vendor code.
  52105. */
  52106. // Regular Expressions for parsing tags and attributes
  52107. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52108. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52109. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52110. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52111. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52112. var startTagClose = /^\s*(\/?)>/;
  52113. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52114. var doctype = /^<!DOCTYPE [^>]+>/i;
  52115. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52116. var comment = /^<!\--/;
  52117. var conditionalComment = /^<!\[/;
  52118. // Special Elements (can contain anything)
  52119. var isPlainTextElement = makeMap('script,style,textarea', true);
  52120. var reCache = {};
  52121. var decodingMap = {
  52122. '&lt;': '<',
  52123. '&gt;': '>',
  52124. '&quot;': '"',
  52125. '&amp;': '&',
  52126. '&#10;': '\n',
  52127. '&#9;': '\t',
  52128. '&#39;': "'"
  52129. };
  52130. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52131. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52132. // #5992
  52133. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52134. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52135. function decodeAttr (value, shouldDecodeNewlines) {
  52136. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52137. return value.replace(re, function (match) { return decodingMap[match]; })
  52138. }
  52139. function parseHTML (html, options) {
  52140. var stack = [];
  52141. var expectHTML = options.expectHTML;
  52142. var isUnaryTag$$1 = options.isUnaryTag || no;
  52143. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52144. var index = 0;
  52145. var last, lastTag;
  52146. while (html) {
  52147. last = html;
  52148. // Make sure we're not in a plaintext content element like script/style
  52149. if (!lastTag || !isPlainTextElement(lastTag)) {
  52150. var textEnd = html.indexOf('<');
  52151. if (textEnd === 0) {
  52152. // Comment:
  52153. if (comment.test(html)) {
  52154. var commentEnd = html.indexOf('-->');
  52155. if (commentEnd >= 0) {
  52156. if (options.shouldKeepComment) {
  52157. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52158. }
  52159. advance(commentEnd + 3);
  52160. continue
  52161. }
  52162. }
  52163. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52164. if (conditionalComment.test(html)) {
  52165. var conditionalEnd = html.indexOf(']>');
  52166. if (conditionalEnd >= 0) {
  52167. advance(conditionalEnd + 2);
  52168. continue
  52169. }
  52170. }
  52171. // Doctype:
  52172. var doctypeMatch = html.match(doctype);
  52173. if (doctypeMatch) {
  52174. advance(doctypeMatch[0].length);
  52175. continue
  52176. }
  52177. // End tag:
  52178. var endTagMatch = html.match(endTag);
  52179. if (endTagMatch) {
  52180. var curIndex = index;
  52181. advance(endTagMatch[0].length);
  52182. parseEndTag(endTagMatch[1], curIndex, index);
  52183. continue
  52184. }
  52185. // Start tag:
  52186. var startTagMatch = parseStartTag();
  52187. if (startTagMatch) {
  52188. handleStartTag(startTagMatch);
  52189. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52190. advance(1);
  52191. }
  52192. continue
  52193. }
  52194. }
  52195. var text = (void 0), rest = (void 0), next = (void 0);
  52196. if (textEnd >= 0) {
  52197. rest = html.slice(textEnd);
  52198. while (
  52199. !endTag.test(rest) &&
  52200. !startTagOpen.test(rest) &&
  52201. !comment.test(rest) &&
  52202. !conditionalComment.test(rest)
  52203. ) {
  52204. // < in plain text, be forgiving and treat it as text
  52205. next = rest.indexOf('<', 1);
  52206. if (next < 0) { break }
  52207. textEnd += next;
  52208. rest = html.slice(textEnd);
  52209. }
  52210. text = html.substring(0, textEnd);
  52211. }
  52212. if (textEnd < 0) {
  52213. text = html;
  52214. }
  52215. if (text) {
  52216. advance(text.length);
  52217. }
  52218. if (options.chars && text) {
  52219. options.chars(text, index - text.length, index);
  52220. }
  52221. } else {
  52222. var endTagLength = 0;
  52223. var stackedTag = lastTag.toLowerCase();
  52224. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52225. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52226. endTagLength = endTag.length;
  52227. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52228. text = text
  52229. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52230. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52231. }
  52232. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52233. text = text.slice(1);
  52234. }
  52235. if (options.chars) {
  52236. options.chars(text);
  52237. }
  52238. return ''
  52239. });
  52240. index += html.length - rest$1.length;
  52241. html = rest$1;
  52242. parseEndTag(stackedTag, index - endTagLength, index);
  52243. }
  52244. if (html === last) {
  52245. options.chars && options.chars(html);
  52246. if (!stack.length && options.warn) {
  52247. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52248. }
  52249. break
  52250. }
  52251. }
  52252. // Clean up any remaining tags
  52253. parseEndTag();
  52254. function advance (n) {
  52255. index += n;
  52256. html = html.substring(n);
  52257. }
  52258. function parseStartTag () {
  52259. var start = html.match(startTagOpen);
  52260. if (start) {
  52261. var match = {
  52262. tagName: start[1],
  52263. attrs: [],
  52264. start: index
  52265. };
  52266. advance(start[0].length);
  52267. var end, attr;
  52268. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52269. attr.start = index;
  52270. advance(attr[0].length);
  52271. attr.end = index;
  52272. match.attrs.push(attr);
  52273. }
  52274. if (end) {
  52275. match.unarySlash = end[1];
  52276. advance(end[0].length);
  52277. match.end = index;
  52278. return match
  52279. }
  52280. }
  52281. }
  52282. function handleStartTag (match) {
  52283. var tagName = match.tagName;
  52284. var unarySlash = match.unarySlash;
  52285. if (expectHTML) {
  52286. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  52287. parseEndTag(lastTag);
  52288. }
  52289. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  52290. parseEndTag(tagName);
  52291. }
  52292. }
  52293. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  52294. var l = match.attrs.length;
  52295. var attrs = new Array(l);
  52296. for (var i = 0; i < l; i++) {
  52297. var args = match.attrs[i];
  52298. var value = args[3] || args[4] || args[5] || '';
  52299. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  52300. ? options.shouldDecodeNewlinesForHref
  52301. : options.shouldDecodeNewlines;
  52302. attrs[i] = {
  52303. name: args[1],
  52304. value: decodeAttr(value, shouldDecodeNewlines)
  52305. };
  52306. if (options.outputSourceRange) {
  52307. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  52308. attrs[i].end = args.end;
  52309. }
  52310. }
  52311. if (!unary) {
  52312. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  52313. lastTag = tagName;
  52314. }
  52315. if (options.start) {
  52316. options.start(tagName, attrs, unary, match.start, match.end);
  52317. }
  52318. }
  52319. function parseEndTag (tagName, start, end) {
  52320. var pos, lowerCasedTagName;
  52321. if (start == null) { start = index; }
  52322. if (end == null) { end = index; }
  52323. // Find the closest opened tag of the same type
  52324. if (tagName) {
  52325. lowerCasedTagName = tagName.toLowerCase();
  52326. for (pos = stack.length - 1; pos >= 0; pos--) {
  52327. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  52328. break
  52329. }
  52330. }
  52331. } else {
  52332. // If no tag name is provided, clean shop
  52333. pos = 0;
  52334. }
  52335. if (pos >= 0) {
  52336. // Close all the open elements, up the stack
  52337. for (var i = stack.length - 1; i >= pos; i--) {
  52338. if (i > pos || !tagName &&
  52339. options.warn
  52340. ) {
  52341. options.warn(
  52342. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  52343. { start: stack[i].start, end: stack[i].end }
  52344. );
  52345. }
  52346. if (options.end) {
  52347. options.end(stack[i].tag, start, end);
  52348. }
  52349. }
  52350. // Remove the open elements from the stack
  52351. stack.length = pos;
  52352. lastTag = pos && stack[pos - 1].tag;
  52353. } else if (lowerCasedTagName === 'br') {
  52354. if (options.start) {
  52355. options.start(tagName, [], true, start, end);
  52356. }
  52357. } else if (lowerCasedTagName === 'p') {
  52358. if (options.start) {
  52359. options.start(tagName, [], false, start, end);
  52360. }
  52361. if (options.end) {
  52362. options.end(tagName, start, end);
  52363. }
  52364. }
  52365. }
  52366. }
  52367. /* */
  52368. var onRE = /^@|^v-on:/;
  52369. var dirRE = /^v-|^@|^:|^#/;
  52370. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  52371. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  52372. var stripParensRE = /^\(|\)$/g;
  52373. var dynamicArgRE = /^\[.*\]$/;
  52374. var argRE = /:(.*)$/;
  52375. var bindRE = /^:|^\.|^v-bind:/;
  52376. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  52377. var slotRE = /^v-slot(:|$)|^#/;
  52378. var lineBreakRE = /[\r\n]/;
  52379. var whitespaceRE$1 = /\s+/g;
  52380. var invalidAttributeRE = /[\s"'<>\/=]/;
  52381. var decodeHTMLCached = cached(he.decode);
  52382. var emptySlotScopeToken = "_empty_";
  52383. // configurable state
  52384. var warn$2;
  52385. var delimiters;
  52386. var transforms;
  52387. var preTransforms;
  52388. var postTransforms;
  52389. var platformIsPreTag;
  52390. var platformMustUseProp;
  52391. var platformGetTagNamespace;
  52392. var maybeComponent;
  52393. function createASTElement (
  52394. tag,
  52395. attrs,
  52396. parent
  52397. ) {
  52398. return {
  52399. type: 1,
  52400. tag: tag,
  52401. attrsList: attrs,
  52402. attrsMap: makeAttrsMap(attrs),
  52403. rawAttrsMap: {},
  52404. parent: parent,
  52405. children: []
  52406. }
  52407. }
  52408. /**
  52409. * Convert HTML string to AST.
  52410. */
  52411. function parse (
  52412. template,
  52413. options
  52414. ) {
  52415. warn$2 = options.warn || baseWarn;
  52416. platformIsPreTag = options.isPreTag || no;
  52417. platformMustUseProp = options.mustUseProp || no;
  52418. platformGetTagNamespace = options.getTagNamespace || no;
  52419. var isReservedTag = options.isReservedTag || no;
  52420. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  52421. transforms = pluckModuleFunction(options.modules, 'transformNode');
  52422. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  52423. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  52424. delimiters = options.delimiters;
  52425. var stack = [];
  52426. var preserveWhitespace = options.preserveWhitespace !== false;
  52427. var whitespaceOption = options.whitespace;
  52428. var root;
  52429. var currentParent;
  52430. var inVPre = false;
  52431. var inPre = false;
  52432. var warned = false;
  52433. function warnOnce (msg, range) {
  52434. if (!warned) {
  52435. warned = true;
  52436. warn$2(msg, range);
  52437. }
  52438. }
  52439. function closeElement (element) {
  52440. trimEndingWhitespace(element);
  52441. if (!inVPre && !element.processed) {
  52442. element = processElement(element, options);
  52443. }
  52444. // tree management
  52445. if (!stack.length && element !== root) {
  52446. // allow root elements with v-if, v-else-if and v-else
  52447. if (root.if && (element.elseif || element.else)) {
  52448. {
  52449. checkRootConstraints(element);
  52450. }
  52451. addIfCondition(root, {
  52452. exp: element.elseif,
  52453. block: element
  52454. });
  52455. } else {
  52456. warnOnce(
  52457. "Component template should contain exactly one root element. " +
  52458. "If you are using v-if on multiple elements, " +
  52459. "use v-else-if to chain them instead.",
  52460. { start: element.start }
  52461. );
  52462. }
  52463. }
  52464. if (currentParent && !element.forbidden) {
  52465. if (element.elseif || element.else) {
  52466. processIfConditions(element, currentParent);
  52467. } else {
  52468. if (element.slotScope) {
  52469. // scoped slot
  52470. // keep it in the children list so that v-else(-if) conditions can
  52471. // find it as the prev node.
  52472. var name = element.slotTarget || '"default"'
  52473. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  52474. }
  52475. currentParent.children.push(element);
  52476. element.parent = currentParent;
  52477. }
  52478. }
  52479. // final children cleanup
  52480. // filter out scoped slots
  52481. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  52482. // remove trailing whitespace node again
  52483. trimEndingWhitespace(element);
  52484. // check pre state
  52485. if (element.pre) {
  52486. inVPre = false;
  52487. }
  52488. if (platformIsPreTag(element.tag)) {
  52489. inPre = false;
  52490. }
  52491. // apply post-transforms
  52492. for (var i = 0; i < postTransforms.length; i++) {
  52493. postTransforms[i](element, options);
  52494. }
  52495. }
  52496. function trimEndingWhitespace (el) {
  52497. // remove trailing whitespace node
  52498. if (!inPre) {
  52499. var lastNode;
  52500. while (
  52501. (lastNode = el.children[el.children.length - 1]) &&
  52502. lastNode.type === 3 &&
  52503. lastNode.text === ' '
  52504. ) {
  52505. el.children.pop();
  52506. }
  52507. }
  52508. }
  52509. function checkRootConstraints (el) {
  52510. if (el.tag === 'slot' || el.tag === 'template') {
  52511. warnOnce(
  52512. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  52513. 'contain multiple nodes.',
  52514. { start: el.start }
  52515. );
  52516. }
  52517. if (el.attrsMap.hasOwnProperty('v-for')) {
  52518. warnOnce(
  52519. 'Cannot use v-for on stateful component root element because ' +
  52520. 'it renders multiple elements.',
  52521. el.rawAttrsMap['v-for']
  52522. );
  52523. }
  52524. }
  52525. parseHTML(template, {
  52526. warn: warn$2,
  52527. expectHTML: options.expectHTML,
  52528. isUnaryTag: options.isUnaryTag,
  52529. canBeLeftOpenTag: options.canBeLeftOpenTag,
  52530. shouldDecodeNewlines: options.shouldDecodeNewlines,
  52531. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  52532. shouldKeepComment: options.comments,
  52533. outputSourceRange: options.outputSourceRange,
  52534. start: function start (tag, attrs, unary, start$1, end) {
  52535. // check namespace.
  52536. // inherit parent ns if there is one
  52537. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  52538. // handle IE svg bug
  52539. /* istanbul ignore if */
  52540. if (isIE && ns === 'svg') {
  52541. attrs = guardIESVGBug(attrs);
  52542. }
  52543. var element = createASTElement(tag, attrs, currentParent);
  52544. if (ns) {
  52545. element.ns = ns;
  52546. }
  52547. {
  52548. if (options.outputSourceRange) {
  52549. element.start = start$1;
  52550. element.end = end;
  52551. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  52552. cumulated[attr.name] = attr;
  52553. return cumulated
  52554. }, {});
  52555. }
  52556. attrs.forEach(function (attr) {
  52557. if (invalidAttributeRE.test(attr.name)) {
  52558. warn$2(
  52559. "Invalid dynamic argument expression: attribute names cannot contain " +
  52560. "spaces, quotes, <, >, / or =.",
  52561. {
  52562. start: attr.start + attr.name.indexOf("["),
  52563. end: attr.start + attr.name.length
  52564. }
  52565. );
  52566. }
  52567. });
  52568. }
  52569. if (isForbiddenTag(element) && !isServerRendering()) {
  52570. element.forbidden = true;
  52571. warn$2(
  52572. 'Templates should only be responsible for mapping the state to the ' +
  52573. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  52574. "<" + tag + ">" + ', as they will not be parsed.',
  52575. { start: element.start }
  52576. );
  52577. }
  52578. // apply pre-transforms
  52579. for (var i = 0; i < preTransforms.length; i++) {
  52580. element = preTransforms[i](element, options) || element;
  52581. }
  52582. if (!inVPre) {
  52583. processPre(element);
  52584. if (element.pre) {
  52585. inVPre = true;
  52586. }
  52587. }
  52588. if (platformIsPreTag(element.tag)) {
  52589. inPre = true;
  52590. }
  52591. if (inVPre) {
  52592. processRawAttrs(element);
  52593. } else if (!element.processed) {
  52594. // structural directives
  52595. processFor(element);
  52596. processIf(element);
  52597. processOnce(element);
  52598. }
  52599. if (!root) {
  52600. root = element;
  52601. {
  52602. checkRootConstraints(root);
  52603. }
  52604. }
  52605. if (!unary) {
  52606. currentParent = element;
  52607. stack.push(element);
  52608. } else {
  52609. closeElement(element);
  52610. }
  52611. },
  52612. end: function end (tag, start, end$1) {
  52613. var element = stack[stack.length - 1];
  52614. // pop stack
  52615. stack.length -= 1;
  52616. currentParent = stack[stack.length - 1];
  52617. if (options.outputSourceRange) {
  52618. element.end = end$1;
  52619. }
  52620. closeElement(element);
  52621. },
  52622. chars: function chars (text, start, end) {
  52623. if (!currentParent) {
  52624. {
  52625. if (text === template) {
  52626. warnOnce(
  52627. 'Component template requires a root element, rather than just text.',
  52628. { start: start }
  52629. );
  52630. } else if ((text = text.trim())) {
  52631. warnOnce(
  52632. ("text \"" + text + "\" outside root element will be ignored."),
  52633. { start: start }
  52634. );
  52635. }
  52636. }
  52637. return
  52638. }
  52639. // IE textarea placeholder bug
  52640. /* istanbul ignore if */
  52641. if (isIE &&
  52642. currentParent.tag === 'textarea' &&
  52643. currentParent.attrsMap.placeholder === text
  52644. ) {
  52645. return
  52646. }
  52647. var children = currentParent.children;
  52648. if (inPre || text.trim()) {
  52649. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  52650. } else if (!children.length) {
  52651. // remove the whitespace-only node right after an opening tag
  52652. text = '';
  52653. } else if (whitespaceOption) {
  52654. if (whitespaceOption === 'condense') {
  52655. // in condense mode, remove the whitespace node if it contains
  52656. // line break, otherwise condense to a single space
  52657. text = lineBreakRE.test(text) ? '' : ' ';
  52658. } else {
  52659. text = ' ';
  52660. }
  52661. } else {
  52662. text = preserveWhitespace ? ' ' : '';
  52663. }
  52664. if (text) {
  52665. if (!inPre && whitespaceOption === 'condense') {
  52666. // condense consecutive whitespaces into single space
  52667. text = text.replace(whitespaceRE$1, ' ');
  52668. }
  52669. var res;
  52670. var child;
  52671. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  52672. child = {
  52673. type: 2,
  52674. expression: res.expression,
  52675. tokens: res.tokens,
  52676. text: text
  52677. };
  52678. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  52679. child = {
  52680. type: 3,
  52681. text: text
  52682. };
  52683. }
  52684. if (child) {
  52685. if (options.outputSourceRange) {
  52686. child.start = start;
  52687. child.end = end;
  52688. }
  52689. children.push(child);
  52690. }
  52691. }
  52692. },
  52693. comment: function comment (text, start, end) {
  52694. // adding anyting as a sibling to the root node is forbidden
  52695. // comments should still be allowed, but ignored
  52696. if (currentParent) {
  52697. var child = {
  52698. type: 3,
  52699. text: text,
  52700. isComment: true
  52701. };
  52702. if (options.outputSourceRange) {
  52703. child.start = start;
  52704. child.end = end;
  52705. }
  52706. currentParent.children.push(child);
  52707. }
  52708. }
  52709. });
  52710. return root
  52711. }
  52712. function processPre (el) {
  52713. if (getAndRemoveAttr(el, 'v-pre') != null) {
  52714. el.pre = true;
  52715. }
  52716. }
  52717. function processRawAttrs (el) {
  52718. var list = el.attrsList;
  52719. var len = list.length;
  52720. if (len) {
  52721. var attrs = el.attrs = new Array(len);
  52722. for (var i = 0; i < len; i++) {
  52723. attrs[i] = {
  52724. name: list[i].name,
  52725. value: JSON.stringify(list[i].value)
  52726. };
  52727. if (list[i].start != null) {
  52728. attrs[i].start = list[i].start;
  52729. attrs[i].end = list[i].end;
  52730. }
  52731. }
  52732. } else if (!el.pre) {
  52733. // non root node in pre blocks with no attributes
  52734. el.plain = true;
  52735. }
  52736. }
  52737. function processElement (
  52738. element,
  52739. options
  52740. ) {
  52741. processKey(element);
  52742. // determine whether this is a plain element after
  52743. // removing structural attributes
  52744. element.plain = (
  52745. !element.key &&
  52746. !element.scopedSlots &&
  52747. !element.attrsList.length
  52748. );
  52749. processRef(element);
  52750. processSlotContent(element);
  52751. processSlotOutlet(element);
  52752. processComponent(element);
  52753. for (var i = 0; i < transforms.length; i++) {
  52754. element = transforms[i](element, options) || element;
  52755. }
  52756. processAttrs(element);
  52757. return element
  52758. }
  52759. function processKey (el) {
  52760. var exp = getBindingAttr(el, 'key');
  52761. if (exp) {
  52762. {
  52763. if (el.tag === 'template') {
  52764. warn$2(
  52765. "<template> cannot be keyed. Place the key on real elements instead.",
  52766. getRawBindingAttr(el, 'key')
  52767. );
  52768. }
  52769. if (el.for) {
  52770. var iterator = el.iterator2 || el.iterator1;
  52771. var parent = el.parent;
  52772. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  52773. warn$2(
  52774. "Do not use v-for index as key on <transition-group> children, " +
  52775. "this is the same as not using keys.",
  52776. getRawBindingAttr(el, 'key'),
  52777. true /* tip */
  52778. );
  52779. }
  52780. }
  52781. }
  52782. el.key = exp;
  52783. }
  52784. }
  52785. function processRef (el) {
  52786. var ref = getBindingAttr(el, 'ref');
  52787. if (ref) {
  52788. el.ref = ref;
  52789. el.refInFor = checkInFor(el);
  52790. }
  52791. }
  52792. function processFor (el) {
  52793. var exp;
  52794. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  52795. var res = parseFor(exp);
  52796. if (res) {
  52797. extend(el, res);
  52798. } else {
  52799. warn$2(
  52800. ("Invalid v-for expression: " + exp),
  52801. el.rawAttrsMap['v-for']
  52802. );
  52803. }
  52804. }
  52805. }
  52806. function parseFor (exp) {
  52807. var inMatch = exp.match(forAliasRE);
  52808. if (!inMatch) { return }
  52809. var res = {};
  52810. res.for = inMatch[2].trim();
  52811. var alias = inMatch[1].trim().replace(stripParensRE, '');
  52812. var iteratorMatch = alias.match(forIteratorRE);
  52813. if (iteratorMatch) {
  52814. res.alias = alias.replace(forIteratorRE, '').trim();
  52815. res.iterator1 = iteratorMatch[1].trim();
  52816. if (iteratorMatch[2]) {
  52817. res.iterator2 = iteratorMatch[2].trim();
  52818. }
  52819. } else {
  52820. res.alias = alias;
  52821. }
  52822. return res
  52823. }
  52824. function processIf (el) {
  52825. var exp = getAndRemoveAttr(el, 'v-if');
  52826. if (exp) {
  52827. el.if = exp;
  52828. addIfCondition(el, {
  52829. exp: exp,
  52830. block: el
  52831. });
  52832. } else {
  52833. if (getAndRemoveAttr(el, 'v-else') != null) {
  52834. el.else = true;
  52835. }
  52836. var elseif = getAndRemoveAttr(el, 'v-else-if');
  52837. if (elseif) {
  52838. el.elseif = elseif;
  52839. }
  52840. }
  52841. }
  52842. function processIfConditions (el, parent) {
  52843. var prev = findPrevElement(parent.children);
  52844. if (prev && prev.if) {
  52845. addIfCondition(prev, {
  52846. exp: el.elseif,
  52847. block: el
  52848. });
  52849. } else {
  52850. warn$2(
  52851. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  52852. "used on element <" + (el.tag) + "> without corresponding v-if.",
  52853. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  52854. );
  52855. }
  52856. }
  52857. function findPrevElement (children) {
  52858. var i = children.length;
  52859. while (i--) {
  52860. if (children[i].type === 1) {
  52861. return children[i]
  52862. } else {
  52863. if (children[i].text !== ' ') {
  52864. warn$2(
  52865. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  52866. "will be ignored.",
  52867. children[i]
  52868. );
  52869. }
  52870. children.pop();
  52871. }
  52872. }
  52873. }
  52874. function addIfCondition (el, condition) {
  52875. if (!el.ifConditions) {
  52876. el.ifConditions = [];
  52877. }
  52878. el.ifConditions.push(condition);
  52879. }
  52880. function processOnce (el) {
  52881. var once$$1 = getAndRemoveAttr(el, 'v-once');
  52882. if (once$$1 != null) {
  52883. el.once = true;
  52884. }
  52885. }
  52886. // handle content being passed to a component as slot,
  52887. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  52888. function processSlotContent (el) {
  52889. var slotScope;
  52890. if (el.tag === 'template') {
  52891. slotScope = getAndRemoveAttr(el, 'scope');
  52892. /* istanbul ignore if */
  52893. if (slotScope) {
  52894. warn$2(
  52895. "the \"scope\" attribute for scoped slots have been deprecated and " +
  52896. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  52897. "can also be used on plain elements in addition to <template> to " +
  52898. "denote scoped slots.",
  52899. el.rawAttrsMap['scope'],
  52900. true
  52901. );
  52902. }
  52903. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  52904. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  52905. /* istanbul ignore if */
  52906. if (el.attrsMap['v-for']) {
  52907. warn$2(
  52908. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  52909. "(v-for takes higher priority). Use a wrapper <template> for the " +
  52910. "scoped slot to make it clearer.",
  52911. el.rawAttrsMap['slot-scope'],
  52912. true
  52913. );
  52914. }
  52915. el.slotScope = slotScope;
  52916. }
  52917. // slot="xxx"
  52918. var slotTarget = getBindingAttr(el, 'slot');
  52919. if (slotTarget) {
  52920. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  52921. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  52922. // preserve slot as an attribute for native shadow DOM compat
  52923. // only for non-scoped slots.
  52924. if (el.tag !== 'template' && !el.slotScope) {
  52925. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  52926. }
  52927. }
  52928. // 2.6 v-slot syntax
  52929. {
  52930. if (el.tag === 'template') {
  52931. // v-slot on <template>
  52932. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  52933. if (slotBinding) {
  52934. {
  52935. if (el.slotTarget || el.slotScope) {
  52936. warn$2(
  52937. "Unexpected mixed usage of different slot syntaxes.",
  52938. el
  52939. );
  52940. }
  52941. if (el.parent && !maybeComponent(el.parent)) {
  52942. warn$2(
  52943. "<template v-slot> can only appear at the root level inside " +
  52944. "the receiving component",
  52945. el
  52946. );
  52947. }
  52948. }
  52949. var ref = getSlotName(slotBinding);
  52950. var name = ref.name;
  52951. var dynamic = ref.dynamic;
  52952. el.slotTarget = name;
  52953. el.slotTargetDynamic = dynamic;
  52954. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  52955. }
  52956. } else {
  52957. // v-slot on component, denotes default slot
  52958. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  52959. if (slotBinding$1) {
  52960. {
  52961. if (!maybeComponent(el)) {
  52962. warn$2(
  52963. "v-slot can only be used on components or <template>.",
  52964. slotBinding$1
  52965. );
  52966. }
  52967. if (el.slotScope || el.slotTarget) {
  52968. warn$2(
  52969. "Unexpected mixed usage of different slot syntaxes.",
  52970. el
  52971. );
  52972. }
  52973. if (el.scopedSlots) {
  52974. warn$2(
  52975. "To avoid scope ambiguity, the default slot should also use " +
  52976. "<template> syntax when there are other named slots.",
  52977. slotBinding$1
  52978. );
  52979. }
  52980. }
  52981. // add the component's children to its default slot
  52982. var slots = el.scopedSlots || (el.scopedSlots = {});
  52983. var ref$1 = getSlotName(slotBinding$1);
  52984. var name$1 = ref$1.name;
  52985. var dynamic$1 = ref$1.dynamic;
  52986. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  52987. slotContainer.slotTarget = name$1;
  52988. slotContainer.slotTargetDynamic = dynamic$1;
  52989. slotContainer.children = el.children.filter(function (c) {
  52990. if (!c.slotScope) {
  52991. c.parent = slotContainer;
  52992. return true
  52993. }
  52994. });
  52995. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  52996. // remove children as they are returned from scopedSlots now
  52997. el.children = [];
  52998. // mark el non-plain so data gets generated
  52999. el.plain = false;
  53000. }
  53001. }
  53002. }
  53003. }
  53004. function getSlotName (binding) {
  53005. var name = binding.name.replace(slotRE, '');
  53006. if (!name) {
  53007. if (binding.name[0] !== '#') {
  53008. name = 'default';
  53009. } else {
  53010. warn$2(
  53011. "v-slot shorthand syntax requires a slot name.",
  53012. binding
  53013. );
  53014. }
  53015. }
  53016. return dynamicArgRE.test(name)
  53017. // dynamic [name]
  53018. ? { name: name.slice(1, -1), dynamic: true }
  53019. // static name
  53020. : { name: ("\"" + name + "\""), dynamic: false }
  53021. }
  53022. // handle <slot/> outlets
  53023. function processSlotOutlet (el) {
  53024. if (el.tag === 'slot') {
  53025. el.slotName = getBindingAttr(el, 'name');
  53026. if (el.key) {
  53027. warn$2(
  53028. "`key` does not work on <slot> because slots are abstract outlets " +
  53029. "and can possibly expand into multiple elements. " +
  53030. "Use the key on a wrapping element instead.",
  53031. getRawBindingAttr(el, 'key')
  53032. );
  53033. }
  53034. }
  53035. }
  53036. function processComponent (el) {
  53037. var binding;
  53038. if ((binding = getBindingAttr(el, 'is'))) {
  53039. el.component = binding;
  53040. }
  53041. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53042. el.inlineTemplate = true;
  53043. }
  53044. }
  53045. function processAttrs (el) {
  53046. var list = el.attrsList;
  53047. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53048. for (i = 0, l = list.length; i < l; i++) {
  53049. name = rawName = list[i].name;
  53050. value = list[i].value;
  53051. if (dirRE.test(name)) {
  53052. // mark element as dynamic
  53053. el.hasBindings = true;
  53054. // modifiers
  53055. modifiers = parseModifiers(name.replace(dirRE, ''));
  53056. // support .foo shorthand syntax for the .prop modifier
  53057. if (modifiers) {
  53058. name = name.replace(modifierRE, '');
  53059. }
  53060. if (bindRE.test(name)) { // v-bind
  53061. name = name.replace(bindRE, '');
  53062. value = parseFilters(value);
  53063. isDynamic = dynamicArgRE.test(name);
  53064. if (isDynamic) {
  53065. name = name.slice(1, -1);
  53066. }
  53067. if (
  53068. value.trim().length === 0
  53069. ) {
  53070. warn$2(
  53071. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53072. );
  53073. }
  53074. if (modifiers) {
  53075. if (modifiers.prop && !isDynamic) {
  53076. name = camelize(name);
  53077. if (name === 'innerHtml') { name = 'innerHTML'; }
  53078. }
  53079. if (modifiers.camel && !isDynamic) {
  53080. name = camelize(name);
  53081. }
  53082. if (modifiers.sync) {
  53083. syncGen = genAssignmentCode(value, "$event");
  53084. if (!isDynamic) {
  53085. addHandler(
  53086. el,
  53087. ("update:" + (camelize(name))),
  53088. syncGen,
  53089. null,
  53090. false,
  53091. warn$2,
  53092. list[i]
  53093. );
  53094. if (hyphenate(name) !== camelize(name)) {
  53095. addHandler(
  53096. el,
  53097. ("update:" + (hyphenate(name))),
  53098. syncGen,
  53099. null,
  53100. false,
  53101. warn$2,
  53102. list[i]
  53103. );
  53104. }
  53105. } else {
  53106. // handler w/ dynamic event name
  53107. addHandler(
  53108. el,
  53109. ("\"update:\"+(" + name + ")"),
  53110. syncGen,
  53111. null,
  53112. false,
  53113. warn$2,
  53114. list[i],
  53115. true // dynamic
  53116. );
  53117. }
  53118. }
  53119. }
  53120. if ((modifiers && modifiers.prop) || (
  53121. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53122. )) {
  53123. addProp(el, name, value, list[i], isDynamic);
  53124. } else {
  53125. addAttr(el, name, value, list[i], isDynamic);
  53126. }
  53127. } else if (onRE.test(name)) { // v-on
  53128. name = name.replace(onRE, '');
  53129. isDynamic = dynamicArgRE.test(name);
  53130. if (isDynamic) {
  53131. name = name.slice(1, -1);
  53132. }
  53133. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53134. } else { // normal directives
  53135. name = name.replace(dirRE, '');
  53136. // parse arg
  53137. var argMatch = name.match(argRE);
  53138. var arg = argMatch && argMatch[1];
  53139. isDynamic = false;
  53140. if (arg) {
  53141. name = name.slice(0, -(arg.length + 1));
  53142. if (dynamicArgRE.test(arg)) {
  53143. arg = arg.slice(1, -1);
  53144. isDynamic = true;
  53145. }
  53146. }
  53147. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53148. if (name === 'model') {
  53149. checkForAliasModel(el, value);
  53150. }
  53151. }
  53152. } else {
  53153. // literal attribute
  53154. {
  53155. var res = parseText(value, delimiters);
  53156. if (res) {
  53157. warn$2(
  53158. name + "=\"" + value + "\": " +
  53159. 'Interpolation inside attributes has been removed. ' +
  53160. 'Use v-bind or the colon shorthand instead. For example, ' +
  53161. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53162. list[i]
  53163. );
  53164. }
  53165. }
  53166. addAttr(el, name, JSON.stringify(value), list[i]);
  53167. // #6887 firefox doesn't update muted state if set via attribute
  53168. // even immediately after element creation
  53169. if (!el.component &&
  53170. name === 'muted' &&
  53171. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53172. addProp(el, name, 'true', list[i]);
  53173. }
  53174. }
  53175. }
  53176. }
  53177. function checkInFor (el) {
  53178. var parent = el;
  53179. while (parent) {
  53180. if (parent.for !== undefined) {
  53181. return true
  53182. }
  53183. parent = parent.parent;
  53184. }
  53185. return false
  53186. }
  53187. function parseModifiers (name) {
  53188. var match = name.match(modifierRE);
  53189. if (match) {
  53190. var ret = {};
  53191. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53192. return ret
  53193. }
  53194. }
  53195. function makeAttrsMap (attrs) {
  53196. var map = {};
  53197. for (var i = 0, l = attrs.length; i < l; i++) {
  53198. if (
  53199. map[attrs[i].name] && !isIE && !isEdge
  53200. ) {
  53201. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53202. }
  53203. map[attrs[i].name] = attrs[i].value;
  53204. }
  53205. return map
  53206. }
  53207. // for script (e.g. type="x/template") or style, do not decode content
  53208. function isTextTag (el) {
  53209. return el.tag === 'script' || el.tag === 'style'
  53210. }
  53211. function isForbiddenTag (el) {
  53212. return (
  53213. el.tag === 'style' ||
  53214. (el.tag === 'script' && (
  53215. !el.attrsMap.type ||
  53216. el.attrsMap.type === 'text/javascript'
  53217. ))
  53218. )
  53219. }
  53220. var ieNSBug = /^xmlns:NS\d+/;
  53221. var ieNSPrefix = /^NS\d+:/;
  53222. /* istanbul ignore next */
  53223. function guardIESVGBug (attrs) {
  53224. var res = [];
  53225. for (var i = 0; i < attrs.length; i++) {
  53226. var attr = attrs[i];
  53227. if (!ieNSBug.test(attr.name)) {
  53228. attr.name = attr.name.replace(ieNSPrefix, '');
  53229. res.push(attr);
  53230. }
  53231. }
  53232. return res
  53233. }
  53234. function checkForAliasModel (el, value) {
  53235. var _el = el;
  53236. while (_el) {
  53237. if (_el.for && _el.alias === value) {
  53238. warn$2(
  53239. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53240. "You are binding v-model directly to a v-for iteration alias. " +
  53241. "This will not be able to modify the v-for source array because " +
  53242. "writing to the alias is like modifying a function local variable. " +
  53243. "Consider using an array of objects and use v-model on an object property instead.",
  53244. el.rawAttrsMap['v-model']
  53245. );
  53246. }
  53247. _el = _el.parent;
  53248. }
  53249. }
  53250. /* */
  53251. function preTransformNode (el, options) {
  53252. if (el.tag === 'input') {
  53253. var map = el.attrsMap;
  53254. if (!map['v-model']) {
  53255. return
  53256. }
  53257. var typeBinding;
  53258. if (map[':type'] || map['v-bind:type']) {
  53259. typeBinding = getBindingAttr(el, 'type');
  53260. }
  53261. if (!map.type && !typeBinding && map['v-bind']) {
  53262. typeBinding = "(" + (map['v-bind']) + ").type";
  53263. }
  53264. if (typeBinding) {
  53265. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53266. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53267. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53268. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53269. // 1. checkbox
  53270. var branch0 = cloneASTElement(el);
  53271. // process for on the main node
  53272. processFor(branch0);
  53273. addRawAttr(branch0, 'type', 'checkbox');
  53274. processElement(branch0, options);
  53275. branch0.processed = true; // prevent it from double-processed
  53276. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53277. addIfCondition(branch0, {
  53278. exp: branch0.if,
  53279. block: branch0
  53280. });
  53281. // 2. add radio else-if condition
  53282. var branch1 = cloneASTElement(el);
  53283. getAndRemoveAttr(branch1, 'v-for', true);
  53284. addRawAttr(branch1, 'type', 'radio');
  53285. processElement(branch1, options);
  53286. addIfCondition(branch0, {
  53287. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  53288. block: branch1
  53289. });
  53290. // 3. other
  53291. var branch2 = cloneASTElement(el);
  53292. getAndRemoveAttr(branch2, 'v-for', true);
  53293. addRawAttr(branch2, ':type', typeBinding);
  53294. processElement(branch2, options);
  53295. addIfCondition(branch0, {
  53296. exp: ifCondition,
  53297. block: branch2
  53298. });
  53299. if (hasElse) {
  53300. branch0.else = true;
  53301. } else if (elseIfCondition) {
  53302. branch0.elseif = elseIfCondition;
  53303. }
  53304. return branch0
  53305. }
  53306. }
  53307. }
  53308. function cloneASTElement (el) {
  53309. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  53310. }
  53311. var model$1 = {
  53312. preTransformNode: preTransformNode
  53313. };
  53314. var modules$1 = [
  53315. klass$1,
  53316. style$1,
  53317. model$1
  53318. ];
  53319. /* */
  53320. function text (el, dir) {
  53321. if (dir.value) {
  53322. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  53323. }
  53324. }
  53325. /* */
  53326. function html (el, dir) {
  53327. if (dir.value) {
  53328. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  53329. }
  53330. }
  53331. var directives$1 = {
  53332. model: model,
  53333. text: text,
  53334. html: html
  53335. };
  53336. /* */
  53337. var baseOptions = {
  53338. expectHTML: true,
  53339. modules: modules$1,
  53340. directives: directives$1,
  53341. isPreTag: isPreTag,
  53342. isUnaryTag: isUnaryTag,
  53343. mustUseProp: mustUseProp,
  53344. canBeLeftOpenTag: canBeLeftOpenTag,
  53345. isReservedTag: isReservedTag,
  53346. getTagNamespace: getTagNamespace,
  53347. staticKeys: genStaticKeys(modules$1)
  53348. };
  53349. /* */
  53350. var isStaticKey;
  53351. var isPlatformReservedTag;
  53352. var genStaticKeysCached = cached(genStaticKeys$1);
  53353. /**
  53354. * Goal of the optimizer: walk the generated template AST tree
  53355. * and detect sub-trees that are purely static, i.e. parts of
  53356. * the DOM that never needs to change.
  53357. *
  53358. * Once we detect these sub-trees, we can:
  53359. *
  53360. * 1. Hoist them into constants, so that we no longer need to
  53361. * create fresh nodes for them on each re-render;
  53362. * 2. Completely skip them in the patching process.
  53363. */
  53364. function optimize (root, options) {
  53365. if (!root) { return }
  53366. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  53367. isPlatformReservedTag = options.isReservedTag || no;
  53368. // first pass: mark all non-static nodes.
  53369. markStatic$1(root);
  53370. // second pass: mark static roots.
  53371. markStaticRoots(root, false);
  53372. }
  53373. function genStaticKeys$1 (keys) {
  53374. return makeMap(
  53375. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  53376. (keys ? ',' + keys : '')
  53377. )
  53378. }
  53379. function markStatic$1 (node) {
  53380. node.static = isStatic(node);
  53381. if (node.type === 1) {
  53382. // do not make component slot content static. this avoids
  53383. // 1. components not able to mutate slot nodes
  53384. // 2. static slot content fails for hot-reloading
  53385. if (
  53386. !isPlatformReservedTag(node.tag) &&
  53387. node.tag !== 'slot' &&
  53388. node.attrsMap['inline-template'] == null
  53389. ) {
  53390. return
  53391. }
  53392. for (var i = 0, l = node.children.length; i < l; i++) {
  53393. var child = node.children[i];
  53394. markStatic$1(child);
  53395. if (!child.static) {
  53396. node.static = false;
  53397. }
  53398. }
  53399. if (node.ifConditions) {
  53400. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53401. var block = node.ifConditions[i$1].block;
  53402. markStatic$1(block);
  53403. if (!block.static) {
  53404. node.static = false;
  53405. }
  53406. }
  53407. }
  53408. }
  53409. }
  53410. function markStaticRoots (node, isInFor) {
  53411. if (node.type === 1) {
  53412. if (node.static || node.once) {
  53413. node.staticInFor = isInFor;
  53414. }
  53415. // For a node to qualify as a static root, it should have children that
  53416. // are not just static text. Otherwise the cost of hoisting out will
  53417. // outweigh the benefits and it's better off to just always render it fresh.
  53418. if (node.static && node.children.length && !(
  53419. node.children.length === 1 &&
  53420. node.children[0].type === 3
  53421. )) {
  53422. node.staticRoot = true;
  53423. return
  53424. } else {
  53425. node.staticRoot = false;
  53426. }
  53427. if (node.children) {
  53428. for (var i = 0, l = node.children.length; i < l; i++) {
  53429. markStaticRoots(node.children[i], isInFor || !!node.for);
  53430. }
  53431. }
  53432. if (node.ifConditions) {
  53433. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53434. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  53435. }
  53436. }
  53437. }
  53438. }
  53439. function isStatic (node) {
  53440. if (node.type === 2) { // expression
  53441. return false
  53442. }
  53443. if (node.type === 3) { // text
  53444. return true
  53445. }
  53446. return !!(node.pre || (
  53447. !node.hasBindings && // no dynamic bindings
  53448. !node.if && !node.for && // not v-if or v-for or v-else
  53449. !isBuiltInTag(node.tag) && // not a built-in
  53450. isPlatformReservedTag(node.tag) && // not a component
  53451. !isDirectChildOfTemplateFor(node) &&
  53452. Object.keys(node).every(isStaticKey)
  53453. ))
  53454. }
  53455. function isDirectChildOfTemplateFor (node) {
  53456. while (node.parent) {
  53457. node = node.parent;
  53458. if (node.tag !== 'template') {
  53459. return false
  53460. }
  53461. if (node.for) {
  53462. return true
  53463. }
  53464. }
  53465. return false
  53466. }
  53467. /* */
  53468. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  53469. var fnInvokeRE = /\([^)]*?\);*$/;
  53470. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  53471. // KeyboardEvent.keyCode aliases
  53472. var keyCodes = {
  53473. esc: 27,
  53474. tab: 9,
  53475. enter: 13,
  53476. space: 32,
  53477. up: 38,
  53478. left: 37,
  53479. right: 39,
  53480. down: 40,
  53481. 'delete': [8, 46]
  53482. };
  53483. // KeyboardEvent.key aliases
  53484. var keyNames = {
  53485. // #7880: IE11 and Edge use `Esc` for Escape key name.
  53486. esc: ['Esc', 'Escape'],
  53487. tab: 'Tab',
  53488. enter: 'Enter',
  53489. // #9112: IE11 uses `Spacebar` for Space key name.
  53490. space: [' ', 'Spacebar'],
  53491. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  53492. up: ['Up', 'ArrowUp'],
  53493. left: ['Left', 'ArrowLeft'],
  53494. right: ['Right', 'ArrowRight'],
  53495. down: ['Down', 'ArrowDown'],
  53496. // #9112: IE11 uses `Del` for Delete key name.
  53497. 'delete': ['Backspace', 'Delete', 'Del']
  53498. };
  53499. // #4868: modifiers that prevent the execution of the listener
  53500. // need to explicitly return null so that we can determine whether to remove
  53501. // the listener for .once
  53502. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  53503. var modifierCode = {
  53504. stop: '$event.stopPropagation();',
  53505. prevent: '$event.preventDefault();',
  53506. self: genGuard("$event.target !== $event.currentTarget"),
  53507. ctrl: genGuard("!$event.ctrlKey"),
  53508. shift: genGuard("!$event.shiftKey"),
  53509. alt: genGuard("!$event.altKey"),
  53510. meta: genGuard("!$event.metaKey"),
  53511. left: genGuard("'button' in $event && $event.button !== 0"),
  53512. middle: genGuard("'button' in $event && $event.button !== 1"),
  53513. right: genGuard("'button' in $event && $event.button !== 2")
  53514. };
  53515. function genHandlers (
  53516. events,
  53517. isNative
  53518. ) {
  53519. var prefix = isNative ? 'nativeOn:' : 'on:';
  53520. var staticHandlers = "";
  53521. var dynamicHandlers = "";
  53522. for (var name in events) {
  53523. var handlerCode = genHandler(events[name]);
  53524. if (events[name] && events[name].dynamic) {
  53525. dynamicHandlers += name + "," + handlerCode + ",";
  53526. } else {
  53527. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  53528. }
  53529. }
  53530. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  53531. if (dynamicHandlers) {
  53532. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  53533. } else {
  53534. return prefix + staticHandlers
  53535. }
  53536. }
  53537. function genHandler (handler) {
  53538. if (!handler) {
  53539. return 'function(){}'
  53540. }
  53541. if (Array.isArray(handler)) {
  53542. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  53543. }
  53544. var isMethodPath = simplePathRE.test(handler.value);
  53545. var isFunctionExpression = fnExpRE.test(handler.value);
  53546. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  53547. if (!handler.modifiers) {
  53548. if (isMethodPath || isFunctionExpression) {
  53549. return handler.value
  53550. }
  53551. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  53552. } else {
  53553. var code = '';
  53554. var genModifierCode = '';
  53555. var keys = [];
  53556. for (var key in handler.modifiers) {
  53557. if (modifierCode[key]) {
  53558. genModifierCode += modifierCode[key];
  53559. // left/right
  53560. if (keyCodes[key]) {
  53561. keys.push(key);
  53562. }
  53563. } else if (key === 'exact') {
  53564. var modifiers = (handler.modifiers);
  53565. genModifierCode += genGuard(
  53566. ['ctrl', 'shift', 'alt', 'meta']
  53567. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  53568. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  53569. .join('||')
  53570. );
  53571. } else {
  53572. keys.push(key);
  53573. }
  53574. }
  53575. if (keys.length) {
  53576. code += genKeyFilter(keys);
  53577. }
  53578. // Make sure modifiers like prevent and stop get executed after key filtering
  53579. if (genModifierCode) {
  53580. code += genModifierCode;
  53581. }
  53582. var handlerCode = isMethodPath
  53583. ? ("return " + (handler.value) + "($event)")
  53584. : isFunctionExpression
  53585. ? ("return (" + (handler.value) + ")($event)")
  53586. : isFunctionInvocation
  53587. ? ("return " + (handler.value))
  53588. : handler.value;
  53589. return ("function($event){" + code + handlerCode + "}")
  53590. }
  53591. }
  53592. function genKeyFilter (keys) {
  53593. return (
  53594. // make sure the key filters only apply to KeyboardEvents
  53595. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  53596. // key events that do not have keyCode property...
  53597. "if(!$event.type.indexOf('key')&&" +
  53598. (keys.map(genFilterCode).join('&&')) + ")return null;"
  53599. )
  53600. }
  53601. function genFilterCode (key) {
  53602. var keyVal = parseInt(key, 10);
  53603. if (keyVal) {
  53604. return ("$event.keyCode!==" + keyVal)
  53605. }
  53606. var keyCode = keyCodes[key];
  53607. var keyName = keyNames[key];
  53608. return (
  53609. "_k($event.keyCode," +
  53610. (JSON.stringify(key)) + "," +
  53611. (JSON.stringify(keyCode)) + "," +
  53612. "$event.key," +
  53613. "" + (JSON.stringify(keyName)) +
  53614. ")"
  53615. )
  53616. }
  53617. /* */
  53618. function on (el, dir) {
  53619. if (dir.modifiers) {
  53620. warn("v-on without argument does not support modifiers.");
  53621. }
  53622. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  53623. }
  53624. /* */
  53625. function bind$1 (el, dir) {
  53626. el.wrapData = function (code) {
  53627. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  53628. };
  53629. }
  53630. /* */
  53631. var baseDirectives = {
  53632. on: on,
  53633. bind: bind$1,
  53634. cloak: noop
  53635. };
  53636. /* */
  53637. var CodegenState = function CodegenState (options) {
  53638. this.options = options;
  53639. this.warn = options.warn || baseWarn;
  53640. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  53641. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  53642. this.directives = extend(extend({}, baseDirectives), options.directives);
  53643. var isReservedTag = options.isReservedTag || no;
  53644. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53645. this.onceId = 0;
  53646. this.staticRenderFns = [];
  53647. this.pre = false;
  53648. };
  53649. function generate (
  53650. ast,
  53651. options
  53652. ) {
  53653. var state = new CodegenState(options);
  53654. var code = ast ? genElement(ast, state) : '_c("div")';
  53655. return {
  53656. render: ("with(this){return " + code + "}"),
  53657. staticRenderFns: state.staticRenderFns
  53658. }
  53659. }
  53660. function genElement (el, state) {
  53661. if (el.parent) {
  53662. el.pre = el.pre || el.parent.pre;
  53663. }
  53664. if (el.staticRoot && !el.staticProcessed) {
  53665. return genStatic(el, state)
  53666. } else if (el.once && !el.onceProcessed) {
  53667. return genOnce(el, state)
  53668. } else if (el.for && !el.forProcessed) {
  53669. return genFor(el, state)
  53670. } else if (el.if && !el.ifProcessed) {
  53671. return genIf(el, state)
  53672. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  53673. return genChildren(el, state) || 'void 0'
  53674. } else if (el.tag === 'slot') {
  53675. return genSlot(el, state)
  53676. } else {
  53677. // component or element
  53678. var code;
  53679. if (el.component) {
  53680. code = genComponent(el.component, el, state);
  53681. } else {
  53682. var data;
  53683. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  53684. data = genData$2(el, state);
  53685. }
  53686. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53687. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  53688. }
  53689. // module transforms
  53690. for (var i = 0; i < state.transforms.length; i++) {
  53691. code = state.transforms[i](el, code);
  53692. }
  53693. return code
  53694. }
  53695. }
  53696. // hoist static sub-trees out
  53697. function genStatic (el, state) {
  53698. el.staticProcessed = true;
  53699. // Some elements (templates) need to behave differently inside of a v-pre
  53700. // node. All pre nodes are static roots, so we can use this as a location to
  53701. // wrap a state change and reset it upon exiting the pre node.
  53702. var originalPreState = state.pre;
  53703. if (el.pre) {
  53704. state.pre = el.pre;
  53705. }
  53706. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  53707. state.pre = originalPreState;
  53708. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  53709. }
  53710. // v-once
  53711. function genOnce (el, state) {
  53712. el.onceProcessed = true;
  53713. if (el.if && !el.ifProcessed) {
  53714. return genIf(el, state)
  53715. } else if (el.staticInFor) {
  53716. var key = '';
  53717. var parent = el.parent;
  53718. while (parent) {
  53719. if (parent.for) {
  53720. key = parent.key;
  53721. break
  53722. }
  53723. parent = parent.parent;
  53724. }
  53725. if (!key) {
  53726. state.warn(
  53727. "v-once can only be used inside v-for that is keyed. ",
  53728. el.rawAttrsMap['v-once']
  53729. );
  53730. return genElement(el, state)
  53731. }
  53732. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  53733. } else {
  53734. return genStatic(el, state)
  53735. }
  53736. }
  53737. function genIf (
  53738. el,
  53739. state,
  53740. altGen,
  53741. altEmpty
  53742. ) {
  53743. el.ifProcessed = true; // avoid recursion
  53744. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  53745. }
  53746. function genIfConditions (
  53747. conditions,
  53748. state,
  53749. altGen,
  53750. altEmpty
  53751. ) {
  53752. if (!conditions.length) {
  53753. return altEmpty || '_e()'
  53754. }
  53755. var condition = conditions.shift();
  53756. if (condition.exp) {
  53757. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  53758. } else {
  53759. return ("" + (genTernaryExp(condition.block)))
  53760. }
  53761. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  53762. function genTernaryExp (el) {
  53763. return altGen
  53764. ? altGen(el, state)
  53765. : el.once
  53766. ? genOnce(el, state)
  53767. : genElement(el, state)
  53768. }
  53769. }
  53770. function genFor (
  53771. el,
  53772. state,
  53773. altGen,
  53774. altHelper
  53775. ) {
  53776. var exp = el.for;
  53777. var alias = el.alias;
  53778. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  53779. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  53780. if (state.maybeComponent(el) &&
  53781. el.tag !== 'slot' &&
  53782. el.tag !== 'template' &&
  53783. !el.key
  53784. ) {
  53785. state.warn(
  53786. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  53787. "v-for should have explicit keys. " +
  53788. "See https://vuejs.org/guide/list.html#key for more info.",
  53789. el.rawAttrsMap['v-for'],
  53790. true /* tip */
  53791. );
  53792. }
  53793. el.forProcessed = true; // avoid recursion
  53794. return (altHelper || '_l') + "((" + exp + ")," +
  53795. "function(" + alias + iterator1 + iterator2 + "){" +
  53796. "return " + ((altGen || genElement)(el, state)) +
  53797. '})'
  53798. }
  53799. function genData$2 (el, state) {
  53800. var data = '{';
  53801. // directives first.
  53802. // directives may mutate the el's other properties before they are generated.
  53803. var dirs = genDirectives(el, state);
  53804. if (dirs) { data += dirs + ','; }
  53805. // key
  53806. if (el.key) {
  53807. data += "key:" + (el.key) + ",";
  53808. }
  53809. // ref
  53810. if (el.ref) {
  53811. data += "ref:" + (el.ref) + ",";
  53812. }
  53813. if (el.refInFor) {
  53814. data += "refInFor:true,";
  53815. }
  53816. // pre
  53817. if (el.pre) {
  53818. data += "pre:true,";
  53819. }
  53820. // record original tag name for components using "is" attribute
  53821. if (el.component) {
  53822. data += "tag:\"" + (el.tag) + "\",";
  53823. }
  53824. // module data generation functions
  53825. for (var i = 0; i < state.dataGenFns.length; i++) {
  53826. data += state.dataGenFns[i](el);
  53827. }
  53828. // attributes
  53829. if (el.attrs) {
  53830. data += "attrs:" + (genProps(el.attrs)) + ",";
  53831. }
  53832. // DOM props
  53833. if (el.props) {
  53834. data += "domProps:" + (genProps(el.props)) + ",";
  53835. }
  53836. // event handlers
  53837. if (el.events) {
  53838. data += (genHandlers(el.events, false)) + ",";
  53839. }
  53840. if (el.nativeEvents) {
  53841. data += (genHandlers(el.nativeEvents, true)) + ",";
  53842. }
  53843. // slot target
  53844. // only for non-scoped slots
  53845. if (el.slotTarget && !el.slotScope) {
  53846. data += "slot:" + (el.slotTarget) + ",";
  53847. }
  53848. // scoped slots
  53849. if (el.scopedSlots) {
  53850. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  53851. }
  53852. // component v-model
  53853. if (el.model) {
  53854. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  53855. }
  53856. // inline-template
  53857. if (el.inlineTemplate) {
  53858. var inlineTemplate = genInlineTemplate(el, state);
  53859. if (inlineTemplate) {
  53860. data += inlineTemplate + ",";
  53861. }
  53862. }
  53863. data = data.replace(/,$/, '') + '}';
  53864. // v-bind dynamic argument wrap
  53865. // v-bind with dynamic arguments must be applied using the same v-bind object
  53866. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  53867. if (el.dynamicAttrs) {
  53868. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  53869. }
  53870. // v-bind data wrap
  53871. if (el.wrapData) {
  53872. data = el.wrapData(data);
  53873. }
  53874. // v-on data wrap
  53875. if (el.wrapListeners) {
  53876. data = el.wrapListeners(data);
  53877. }
  53878. return data
  53879. }
  53880. function genDirectives (el, state) {
  53881. var dirs = el.directives;
  53882. if (!dirs) { return }
  53883. var res = 'directives:[';
  53884. var hasRuntime = false;
  53885. var i, l, dir, needRuntime;
  53886. for (i = 0, l = dirs.length; i < l; i++) {
  53887. dir = dirs[i];
  53888. needRuntime = true;
  53889. var gen = state.directives[dir.name];
  53890. if (gen) {
  53891. // compile-time directive that manipulates AST.
  53892. // returns true if it also needs a runtime counterpart.
  53893. needRuntime = !!gen(el, dir, state.warn);
  53894. }
  53895. if (needRuntime) {
  53896. hasRuntime = true;
  53897. 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))) : '') + "},";
  53898. }
  53899. }
  53900. if (hasRuntime) {
  53901. return res.slice(0, -1) + ']'
  53902. }
  53903. }
  53904. function genInlineTemplate (el, state) {
  53905. var ast = el.children[0];
  53906. if (el.children.length !== 1 || ast.type !== 1) {
  53907. state.warn(
  53908. 'Inline-template components must have exactly one child element.',
  53909. { start: el.start }
  53910. );
  53911. }
  53912. if (ast && ast.type === 1) {
  53913. var inlineRenderFns = generate(ast, state.options);
  53914. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  53915. }
  53916. }
  53917. function genScopedSlots (
  53918. el,
  53919. slots,
  53920. state
  53921. ) {
  53922. // by default scoped slots are considered "stable", this allows child
  53923. // components with only scoped slots to skip forced updates from parent.
  53924. // but in some cases we have to bail-out of this optimization
  53925. // for example if the slot contains dynamic names, has v-if or v-for on them...
  53926. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  53927. var slot = slots[key];
  53928. return (
  53929. slot.slotTargetDynamic ||
  53930. slot.if ||
  53931. slot.for ||
  53932. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  53933. )
  53934. });
  53935. // #9534: if a component with scoped slots is inside a conditional branch,
  53936. // it's possible for the same component to be reused but with different
  53937. // compiled slot content. To avoid that, we generate a unique key based on
  53938. // the generated code of all the slot contents.
  53939. var needsKey = !!el.if;
  53940. // OR when it is inside another scoped slot or v-for (the reactivity may be
  53941. // disconnected due to the intermediate scope variable)
  53942. // #9438, #9506
  53943. // TODO: this can be further optimized by properly analyzing in-scope bindings
  53944. // and skip force updating ones that do not actually use scope variables.
  53945. if (!needsForceUpdate) {
  53946. var parent = el.parent;
  53947. while (parent) {
  53948. if (
  53949. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  53950. parent.for
  53951. ) {
  53952. needsForceUpdate = true;
  53953. break
  53954. }
  53955. if (parent.if) {
  53956. needsKey = true;
  53957. }
  53958. parent = parent.parent;
  53959. }
  53960. }
  53961. var generatedSlots = Object.keys(slots)
  53962. .map(function (key) { return genScopedSlot(slots[key], state); })
  53963. .join(',');
  53964. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  53965. }
  53966. function hash(str) {
  53967. var hash = 5381;
  53968. var i = str.length;
  53969. while(i) {
  53970. hash = (hash * 33) ^ str.charCodeAt(--i);
  53971. }
  53972. return hash >>> 0
  53973. }
  53974. function containsSlotChild (el) {
  53975. if (el.type === 1) {
  53976. if (el.tag === 'slot') {
  53977. return true
  53978. }
  53979. return el.children.some(containsSlotChild)
  53980. }
  53981. return false
  53982. }
  53983. function genScopedSlot (
  53984. el,
  53985. state
  53986. ) {
  53987. var isLegacySyntax = el.attrsMap['slot-scope'];
  53988. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  53989. return genIf(el, state, genScopedSlot, "null")
  53990. }
  53991. if (el.for && !el.forProcessed) {
  53992. return genFor(el, state, genScopedSlot)
  53993. }
  53994. var slotScope = el.slotScope === emptySlotScopeToken
  53995. ? ""
  53996. : String(el.slotScope);
  53997. var fn = "function(" + slotScope + "){" +
  53998. "return " + (el.tag === 'template'
  53999. ? el.if && isLegacySyntax
  54000. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54001. : genChildren(el, state) || 'undefined'
  54002. : genElement(el, state)) + "}";
  54003. // reverse proxy v-slot without scope on this.$slots
  54004. var reverseProxy = slotScope ? "" : ",proxy:true";
  54005. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54006. }
  54007. function genChildren (
  54008. el,
  54009. state,
  54010. checkSkip,
  54011. altGenElement,
  54012. altGenNode
  54013. ) {
  54014. var children = el.children;
  54015. if (children.length) {
  54016. var el$1 = children[0];
  54017. // optimize single v-for
  54018. if (children.length === 1 &&
  54019. el$1.for &&
  54020. el$1.tag !== 'template' &&
  54021. el$1.tag !== 'slot'
  54022. ) {
  54023. var normalizationType = checkSkip
  54024. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54025. : "";
  54026. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54027. }
  54028. var normalizationType$1 = checkSkip
  54029. ? getNormalizationType(children, state.maybeComponent)
  54030. : 0;
  54031. var gen = altGenNode || genNode;
  54032. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54033. }
  54034. }
  54035. // determine the normalization needed for the children array.
  54036. // 0: no normalization needed
  54037. // 1: simple normalization needed (possible 1-level deep nested array)
  54038. // 2: full normalization needed
  54039. function getNormalizationType (
  54040. children,
  54041. maybeComponent
  54042. ) {
  54043. var res = 0;
  54044. for (var i = 0; i < children.length; i++) {
  54045. var el = children[i];
  54046. if (el.type !== 1) {
  54047. continue
  54048. }
  54049. if (needsNormalization(el) ||
  54050. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54051. res = 2;
  54052. break
  54053. }
  54054. if (maybeComponent(el) ||
  54055. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54056. res = 1;
  54057. }
  54058. }
  54059. return res
  54060. }
  54061. function needsNormalization (el) {
  54062. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54063. }
  54064. function genNode (node, state) {
  54065. if (node.type === 1) {
  54066. return genElement(node, state)
  54067. } else if (node.type === 3 && node.isComment) {
  54068. return genComment(node)
  54069. } else {
  54070. return genText(node)
  54071. }
  54072. }
  54073. function genText (text) {
  54074. return ("_v(" + (text.type === 2
  54075. ? text.expression // no need for () because already wrapped in _s()
  54076. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54077. }
  54078. function genComment (comment) {
  54079. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54080. }
  54081. function genSlot (el, state) {
  54082. var slotName = el.slotName || '"default"';
  54083. var children = genChildren(el, state);
  54084. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54085. var attrs = el.attrs || el.dynamicAttrs
  54086. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54087. // slot props are camelized
  54088. name: camelize(attr.name),
  54089. value: attr.value,
  54090. dynamic: attr.dynamic
  54091. }); }))
  54092. : null;
  54093. var bind$$1 = el.attrsMap['v-bind'];
  54094. if ((attrs || bind$$1) && !children) {
  54095. res += ",null";
  54096. }
  54097. if (attrs) {
  54098. res += "," + attrs;
  54099. }
  54100. if (bind$$1) {
  54101. res += (attrs ? '' : ',null') + "," + bind$$1;
  54102. }
  54103. return res + ')'
  54104. }
  54105. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54106. function genComponent (
  54107. componentName,
  54108. el,
  54109. state
  54110. ) {
  54111. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54112. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54113. }
  54114. function genProps (props) {
  54115. var staticProps = "";
  54116. var dynamicProps = "";
  54117. for (var i = 0; i < props.length; i++) {
  54118. var prop = props[i];
  54119. var value = transformSpecialNewlines(prop.value);
  54120. if (prop.dynamic) {
  54121. dynamicProps += (prop.name) + "," + value + ",";
  54122. } else {
  54123. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54124. }
  54125. }
  54126. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54127. if (dynamicProps) {
  54128. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54129. } else {
  54130. return staticProps
  54131. }
  54132. }
  54133. // #3895, #4268
  54134. function transformSpecialNewlines (text) {
  54135. return text
  54136. .replace(/\u2028/g, '\\u2028')
  54137. .replace(/\u2029/g, '\\u2029')
  54138. }
  54139. /* */
  54140. // these keywords should not appear inside expressions, but operators like
  54141. // typeof, instanceof and in are allowed
  54142. var prohibitedKeywordRE = new RegExp('\\b' + (
  54143. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54144. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54145. 'extends,finally,continue,debugger,function,arguments'
  54146. ).split(',').join('\\b|\\b') + '\\b');
  54147. // these unary operators should not be used as property/method names
  54148. var unaryOperatorsRE = new RegExp('\\b' + (
  54149. 'delete,typeof,void'
  54150. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54151. // strip strings in expressions
  54152. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54153. // detect problematic expressions in a template
  54154. function detectErrors (ast, warn) {
  54155. if (ast) {
  54156. checkNode(ast, warn);
  54157. }
  54158. }
  54159. function checkNode (node, warn) {
  54160. if (node.type === 1) {
  54161. for (var name in node.attrsMap) {
  54162. if (dirRE.test(name)) {
  54163. var value = node.attrsMap[name];
  54164. if (value) {
  54165. var range = node.rawAttrsMap[name];
  54166. if (name === 'v-for') {
  54167. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54168. } else if (name === 'v-slot' || name[0] === '#') {
  54169. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54170. } else if (onRE.test(name)) {
  54171. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54172. } else {
  54173. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54174. }
  54175. }
  54176. }
  54177. }
  54178. if (node.children) {
  54179. for (var i = 0; i < node.children.length; i++) {
  54180. checkNode(node.children[i], warn);
  54181. }
  54182. }
  54183. } else if (node.type === 2) {
  54184. checkExpression(node.expression, node.text, warn, node);
  54185. }
  54186. }
  54187. function checkEvent (exp, text, warn, range) {
  54188. var stripped = exp.replace(stripStringRE, '');
  54189. var keywordMatch = stripped.match(unaryOperatorsRE);
  54190. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54191. warn(
  54192. "avoid using JavaScript unary operator as property name: " +
  54193. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54194. range
  54195. );
  54196. }
  54197. checkExpression(exp, text, warn, range);
  54198. }
  54199. function checkFor (node, text, warn, range) {
  54200. checkExpression(node.for || '', text, warn, range);
  54201. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54202. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54203. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54204. }
  54205. function checkIdentifier (
  54206. ident,
  54207. type,
  54208. text,
  54209. warn,
  54210. range
  54211. ) {
  54212. if (typeof ident === 'string') {
  54213. try {
  54214. new Function(("var " + ident + "=_"));
  54215. } catch (e) {
  54216. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54217. }
  54218. }
  54219. }
  54220. function checkExpression (exp, text, warn, range) {
  54221. try {
  54222. new Function(("return " + exp));
  54223. } catch (e) {
  54224. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54225. if (keywordMatch) {
  54226. warn(
  54227. "avoid using JavaScript keyword as property name: " +
  54228. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54229. range
  54230. );
  54231. } else {
  54232. warn(
  54233. "invalid expression: " + (e.message) + " in\n\n" +
  54234. " " + exp + "\n\n" +
  54235. " Raw expression: " + (text.trim()) + "\n",
  54236. range
  54237. );
  54238. }
  54239. }
  54240. }
  54241. function checkFunctionParameterExpression (exp, text, warn, range) {
  54242. try {
  54243. new Function(exp, '');
  54244. } catch (e) {
  54245. warn(
  54246. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54247. " " + exp + "\n\n" +
  54248. " Raw expression: " + (text.trim()) + "\n",
  54249. range
  54250. );
  54251. }
  54252. }
  54253. /* */
  54254. var range = 2;
  54255. function generateCodeFrame (
  54256. source,
  54257. start,
  54258. end
  54259. ) {
  54260. if ( start === void 0 ) start = 0;
  54261. if ( end === void 0 ) end = source.length;
  54262. var lines = source.split(/\r?\n/);
  54263. var count = 0;
  54264. var res = [];
  54265. for (var i = 0; i < lines.length; i++) {
  54266. count += lines[i].length + 1;
  54267. if (count >= start) {
  54268. for (var j = i - range; j <= i + range || end > count; j++) {
  54269. if (j < 0 || j >= lines.length) { continue }
  54270. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54271. var lineLength = lines[j].length;
  54272. if (j === i) {
  54273. // push underline
  54274. var pad = start - (count - lineLength) + 1;
  54275. var length = end > count ? lineLength - pad : end - start;
  54276. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54277. } else if (j > i) {
  54278. if (end > count) {
  54279. var length$1 = Math.min(end - count, lineLength);
  54280. res.push(" | " + repeat$1("^", length$1));
  54281. }
  54282. count += lineLength + 1;
  54283. }
  54284. }
  54285. break
  54286. }
  54287. }
  54288. return res.join('\n')
  54289. }
  54290. function repeat$1 (str, n) {
  54291. var result = '';
  54292. if (n > 0) {
  54293. while (true) { // eslint-disable-line
  54294. if (n & 1) { result += str; }
  54295. n >>>= 1;
  54296. if (n <= 0) { break }
  54297. str += str;
  54298. }
  54299. }
  54300. return result
  54301. }
  54302. /* */
  54303. function createFunction (code, errors) {
  54304. try {
  54305. return new Function(code)
  54306. } catch (err) {
  54307. errors.push({ err: err, code: code });
  54308. return noop
  54309. }
  54310. }
  54311. function createCompileToFunctionFn (compile) {
  54312. var cache = Object.create(null);
  54313. return function compileToFunctions (
  54314. template,
  54315. options,
  54316. vm
  54317. ) {
  54318. options = extend({}, options);
  54319. var warn$$1 = options.warn || warn;
  54320. delete options.warn;
  54321. /* istanbul ignore if */
  54322. {
  54323. // detect possible CSP restriction
  54324. try {
  54325. new Function('return 1');
  54326. } catch (e) {
  54327. if (e.toString().match(/unsafe-eval|CSP/)) {
  54328. warn$$1(
  54329. 'It seems you are using the standalone build of Vue.js in an ' +
  54330. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  54331. 'The template compiler cannot work in this environment. Consider ' +
  54332. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  54333. 'templates into render functions.'
  54334. );
  54335. }
  54336. }
  54337. }
  54338. // check cache
  54339. var key = options.delimiters
  54340. ? String(options.delimiters) + template
  54341. : template;
  54342. if (cache[key]) {
  54343. return cache[key]
  54344. }
  54345. // compile
  54346. var compiled = compile(template, options);
  54347. // check compilation errors/tips
  54348. {
  54349. if (compiled.errors && compiled.errors.length) {
  54350. if (options.outputSourceRange) {
  54351. compiled.errors.forEach(function (e) {
  54352. warn$$1(
  54353. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  54354. generateCodeFrame(template, e.start, e.end),
  54355. vm
  54356. );
  54357. });
  54358. } else {
  54359. warn$$1(
  54360. "Error compiling template:\n\n" + template + "\n\n" +
  54361. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  54362. vm
  54363. );
  54364. }
  54365. }
  54366. if (compiled.tips && compiled.tips.length) {
  54367. if (options.outputSourceRange) {
  54368. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  54369. } else {
  54370. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  54371. }
  54372. }
  54373. }
  54374. // turn code into functions
  54375. var res = {};
  54376. var fnGenErrors = [];
  54377. res.render = createFunction(compiled.render, fnGenErrors);
  54378. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  54379. return createFunction(code, fnGenErrors)
  54380. });
  54381. // check function generation errors.
  54382. // this should only happen if there is a bug in the compiler itself.
  54383. // mostly for codegen development use
  54384. /* istanbul ignore if */
  54385. {
  54386. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  54387. warn$$1(
  54388. "Failed to generate render function:\n\n" +
  54389. fnGenErrors.map(function (ref) {
  54390. var err = ref.err;
  54391. var code = ref.code;
  54392. return ((err.toString()) + " in\n\n" + code + "\n");
  54393. }).join('\n'),
  54394. vm
  54395. );
  54396. }
  54397. }
  54398. return (cache[key] = res)
  54399. }
  54400. }
  54401. /* */
  54402. function createCompilerCreator (baseCompile) {
  54403. return function createCompiler (baseOptions) {
  54404. function compile (
  54405. template,
  54406. options
  54407. ) {
  54408. var finalOptions = Object.create(baseOptions);
  54409. var errors = [];
  54410. var tips = [];
  54411. var warn = function (msg, range, tip) {
  54412. (tip ? tips : errors).push(msg);
  54413. };
  54414. if (options) {
  54415. if (options.outputSourceRange) {
  54416. // $flow-disable-line
  54417. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  54418. warn = function (msg, range, tip) {
  54419. var data = { msg: msg };
  54420. if (range) {
  54421. if (range.start != null) {
  54422. data.start = range.start + leadingSpaceLength;
  54423. }
  54424. if (range.end != null) {
  54425. data.end = range.end + leadingSpaceLength;
  54426. }
  54427. }
  54428. (tip ? tips : errors).push(data);
  54429. };
  54430. }
  54431. // merge custom modules
  54432. if (options.modules) {
  54433. finalOptions.modules =
  54434. (baseOptions.modules || []).concat(options.modules);
  54435. }
  54436. // merge custom directives
  54437. if (options.directives) {
  54438. finalOptions.directives = extend(
  54439. Object.create(baseOptions.directives || null),
  54440. options.directives
  54441. );
  54442. }
  54443. // copy other options
  54444. for (var key in options) {
  54445. if (key !== 'modules' && key !== 'directives') {
  54446. finalOptions[key] = options[key];
  54447. }
  54448. }
  54449. }
  54450. finalOptions.warn = warn;
  54451. var compiled = baseCompile(template.trim(), finalOptions);
  54452. {
  54453. detectErrors(compiled.ast, warn);
  54454. }
  54455. compiled.errors = errors;
  54456. compiled.tips = tips;
  54457. return compiled
  54458. }
  54459. return {
  54460. compile: compile,
  54461. compileToFunctions: createCompileToFunctionFn(compile)
  54462. }
  54463. }
  54464. }
  54465. /* */
  54466. // `createCompilerCreator` allows creating compilers that use alternative
  54467. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  54468. // Here we just export a default compiler using the default parts.
  54469. var createCompiler = createCompilerCreator(function baseCompile (
  54470. template,
  54471. options
  54472. ) {
  54473. var ast = parse(template.trim(), options);
  54474. if (options.optimize !== false) {
  54475. optimize(ast, options);
  54476. }
  54477. var code = generate(ast, options);
  54478. return {
  54479. ast: ast,
  54480. render: code.render,
  54481. staticRenderFns: code.staticRenderFns
  54482. }
  54483. });
  54484. /* */
  54485. var ref$1 = createCompiler(baseOptions);
  54486. var compile = ref$1.compile;
  54487. var compileToFunctions = ref$1.compileToFunctions;
  54488. /* */
  54489. // check whether current browser encodes a char inside attribute values
  54490. var div;
  54491. function getShouldDecode (href) {
  54492. div = div || document.createElement('div');
  54493. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  54494. return div.innerHTML.indexOf('&#10;') > 0
  54495. }
  54496. // #3663: IE encodes newlines inside attribute values while other browsers don't
  54497. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  54498. // #6828: chrome encodes content in a[href]
  54499. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  54500. /* */
  54501. var idToTemplate = cached(function (id) {
  54502. var el = query(id);
  54503. return el && el.innerHTML
  54504. });
  54505. var mount = Vue.prototype.$mount;
  54506. Vue.prototype.$mount = function (
  54507. el,
  54508. hydrating
  54509. ) {
  54510. el = el && query(el);
  54511. /* istanbul ignore if */
  54512. if (el === document.body || el === document.documentElement) {
  54513. warn(
  54514. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  54515. );
  54516. return this
  54517. }
  54518. var options = this.$options;
  54519. // resolve template/el and convert to render function
  54520. if (!options.render) {
  54521. var template = options.template;
  54522. if (template) {
  54523. if (typeof template === 'string') {
  54524. if (template.charAt(0) === '#') {
  54525. template = idToTemplate(template);
  54526. /* istanbul ignore if */
  54527. if (!template) {
  54528. warn(
  54529. ("Template element not found or is empty: " + (options.template)),
  54530. this
  54531. );
  54532. }
  54533. }
  54534. } else if (template.nodeType) {
  54535. template = template.innerHTML;
  54536. } else {
  54537. {
  54538. warn('invalid template option:' + template, this);
  54539. }
  54540. return this
  54541. }
  54542. } else if (el) {
  54543. template = getOuterHTML(el);
  54544. }
  54545. if (template) {
  54546. /* istanbul ignore if */
  54547. if (config.performance && mark) {
  54548. mark('compile');
  54549. }
  54550. var ref = compileToFunctions(template, {
  54551. outputSourceRange: "development" !== 'production',
  54552. shouldDecodeNewlines: shouldDecodeNewlines,
  54553. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  54554. delimiters: options.delimiters,
  54555. comments: options.comments
  54556. }, this);
  54557. var render = ref.render;
  54558. var staticRenderFns = ref.staticRenderFns;
  54559. options.render = render;
  54560. options.staticRenderFns = staticRenderFns;
  54561. /* istanbul ignore if */
  54562. if (config.performance && mark) {
  54563. mark('compile end');
  54564. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  54565. }
  54566. }
  54567. }
  54568. return mount.call(this, el, hydrating)
  54569. };
  54570. /**
  54571. * Get outerHTML of elements, taking care
  54572. * of SVG elements in IE as well.
  54573. */
  54574. function getOuterHTML (el) {
  54575. if (el.outerHTML) {
  54576. return el.outerHTML
  54577. } else {
  54578. var container = document.createElement('div');
  54579. container.appendChild(el.cloneNode(true));
  54580. return container.innerHTML
  54581. }
  54582. }
  54583. Vue.compile = compileToFunctions;
  54584. module.exports = Vue;
  54585. /* 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))
  54586. /***/ }),
  54587. /***/ "./node_modules/vue/dist/vue.common.js":
  54588. /*!*********************************************!*\
  54589. !*** ./node_modules/vue/dist/vue.common.js ***!
  54590. \*********************************************/
  54591. /*! no static exports found */
  54592. /***/ (function(module, exports, __webpack_require__) {
  54593. if (false) {} else {
  54594. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  54595. }
  54596. /***/ }),
  54597. /***/ "./node_modules/webpack/buildin/global.js":
  54598. /*!***********************************!*\
  54599. !*** (webpack)/buildin/global.js ***!
  54600. \***********************************/
  54601. /*! no static exports found */
  54602. /***/ (function(module, exports) {
  54603. var g;
  54604. // This works in non-strict mode
  54605. g = (function() {
  54606. return this;
  54607. })();
  54608. try {
  54609. // This works if eval is allowed (see CSP)
  54610. g = g || new Function("return this")();
  54611. } catch (e) {
  54612. // This works if the window reference is available
  54613. if (typeof window === "object") g = window;
  54614. }
  54615. // g can still be undefined, but nothing to do about it...
  54616. // We return undefined, instead of nothing here, so it's
  54617. // easier to handle this case. if(!global) { ...}
  54618. module.exports = g;
  54619. /***/ }),
  54620. /***/ "./node_modules/webpack/buildin/module.js":
  54621. /*!***********************************!*\
  54622. !*** (webpack)/buildin/module.js ***!
  54623. \***********************************/
  54624. /*! no static exports found */
  54625. /***/ (function(module, exports) {
  54626. module.exports = function(module) {
  54627. if (!module.webpackPolyfill) {
  54628. module.deprecate = function() {};
  54629. module.paths = [];
  54630. // module.parent = undefined by default
  54631. if (!module.children) module.children = [];
  54632. Object.defineProperty(module, "loaded", {
  54633. enumerable: true,
  54634. get: function() {
  54635. return module.l;
  54636. }
  54637. });
  54638. Object.defineProperty(module, "id", {
  54639. enumerable: true,
  54640. get: function() {
  54641. return module.i;
  54642. }
  54643. });
  54644. module.webpackPolyfill = 1;
  54645. }
  54646. return module;
  54647. };
  54648. /***/ }),
  54649. /***/ "./resources/js/app.js":
  54650. /*!*****************************!*\
  54651. !*** ./resources/js/app.js ***!
  54652. \*****************************/
  54653. /*! no static exports found */
  54654. /***/ (function(module, exports, __webpack_require__) {
  54655. /**
  54656. * First we will load all of this project's JavaScript dependencies which
  54657. * includes Vue and other libraries. It is a great starting point when
  54658. * building robust, powerful web applications using Vue and Laravel.
  54659. */
  54660. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  54661. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  54662. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  54663. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  54664. /**
  54665. * The following block of code may be used to automatically register your
  54666. * Vue components. It will recursively scan this directory for the Vue
  54667. * components and automatically register them with their "basename".
  54668. *
  54669. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  54670. */
  54671. // const files = require.context('./', true, /\.vue$/i)
  54672. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  54673. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  54674. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  54675. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  54676. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  54677. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  54678. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  54679. /**
  54680. * Next, we will create a fresh Vue application instance and attach it to
  54681. * the page. Then, you may begin adding components to this application
  54682. * or customize the JavaScript scaffolding to fit your unique needs.
  54683. */
  54684. var app = new Vue({
  54685. el: '#app'
  54686. });
  54687. $(function () {
  54688. $('[data-toggle="tooltip"]').tooltip();
  54689. });
  54690. var clipboard = new Clipboard('.btn-clip');
  54691. clipboard.on('success', function (e) {
  54692. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  54693. position: "right",
  54694. className: 'success'
  54695. });
  54696. e.clearSelection();
  54697. });
  54698. /***/ }),
  54699. /***/ "./resources/js/bootstrap.js":
  54700. /*!***********************************!*\
  54701. !*** ./resources/js/bootstrap.js ***!
  54702. \***********************************/
  54703. /*! no exports provided */
  54704. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54705. "use strict";
  54706. __webpack_require__.r(__webpack_exports__);
  54707. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  54708. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  54709. /**
  54710. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  54711. * for JavaScript based Bootstrap features such as modals and tabs. This
  54712. * code may be modified to fit the specific needs of your application.
  54713. */
  54714. try {
  54715. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  54716. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  54717. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  54718. } catch (e) {}
  54719. /**
  54720. * We'll load the axios HTTP library which allows us to easily issue requests
  54721. * to our Laravel back-end. This library automatically handles sending the
  54722. * CSRF token as a header based on the value of the "XSRF" token cookie.
  54723. */
  54724. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  54725. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  54726. /**
  54727. * Echo exposes an expressive API for subscribing to channels and listening
  54728. * for events that are broadcast by Laravel. Echo and event broadcasting
  54729. * allows your team to easily build robust real-time web applications.
  54730. */
  54731. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  54732. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  54733. broadcaster: 'pusher',
  54734. key: "upccrt",
  54735. wsHost: window.location.hostname,
  54736. wsPort: 6001,
  54737. disableStats: true
  54738. });
  54739. /***/ }),
  54740. /***/ "./resources/js/components/ExampleComponent.vue":
  54741. /*!******************************************************!*\
  54742. !*** ./resources/js/components/ExampleComponent.vue ***!
  54743. \******************************************************/
  54744. /*! exports provided: default */
  54745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54746. "use strict";
  54747. __webpack_require__.r(__webpack_exports__);
  54748. /* 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&");
  54749. /* 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&");
  54750. /* 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");
  54751. /* normalize component */
  54752. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54753. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54754. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  54755. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54756. false,
  54757. null,
  54758. null,
  54759. null
  54760. )
  54761. /* hot reload */
  54762. if (false) { var api; }
  54763. component.options.__file = "resources/js/components/ExampleComponent.vue"
  54764. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54765. /***/ }),
  54766. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  54767. /*!*******************************************************************************!*\
  54768. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  54769. \*******************************************************************************/
  54770. /*! exports provided: default */
  54771. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54772. "use strict";
  54773. __webpack_require__.r(__webpack_exports__);
  54774. /* 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&");
  54775. /* 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"]);
  54776. /***/ }),
  54777. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  54778. /*!*************************************************************************************!*\
  54779. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  54780. \*************************************************************************************/
  54781. /*! exports provided: render, staticRenderFns */
  54782. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54783. "use strict";
  54784. __webpack_require__.r(__webpack_exports__);
  54785. /* 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&");
  54786. /* 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"]; });
  54787. /* 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"]; });
  54788. /***/ }),
  54789. /***/ "./resources/js/components/assetinfo.vue":
  54790. /*!***********************************************!*\
  54791. !*** ./resources/js/components/assetinfo.vue ***!
  54792. \***********************************************/
  54793. /*! exports provided: default */
  54794. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54795. "use strict";
  54796. __webpack_require__.r(__webpack_exports__);
  54797. /* 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&");
  54798. /* 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&");
  54799. /* 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");
  54800. /* normalize component */
  54801. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54802. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54803. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  54804. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54805. false,
  54806. null,
  54807. null,
  54808. null
  54809. )
  54810. /* hot reload */
  54811. if (false) { var api; }
  54812. component.options.__file = "resources/js/components/assetinfo.vue"
  54813. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54814. /***/ }),
  54815. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  54816. /*!************************************************************************!*\
  54817. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  54818. \************************************************************************/
  54819. /*! exports provided: default */
  54820. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54821. "use strict";
  54822. __webpack_require__.r(__webpack_exports__);
  54823. /* 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&");
  54824. /* 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"]);
  54825. /***/ }),
  54826. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  54827. /*!******************************************************************************!*\
  54828. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  54829. \******************************************************************************/
  54830. /*! exports provided: render, staticRenderFns */
  54831. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54832. "use strict";
  54833. __webpack_require__.r(__webpack_exports__);
  54834. /* 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&");
  54835. /* 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"]; });
  54836. /* 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"]; });
  54837. /***/ }),
  54838. /***/ "./resources/js/components/credential.vue":
  54839. /*!************************************************!*\
  54840. !*** ./resources/js/components/credential.vue ***!
  54841. \************************************************/
  54842. /*! exports provided: default */
  54843. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54844. "use strict";
  54845. __webpack_require__.r(__webpack_exports__);
  54846. /* 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&");
  54847. /* 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&");
  54848. /* 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");
  54849. /* normalize component */
  54850. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54851. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54852. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  54853. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54854. false,
  54855. null,
  54856. null,
  54857. null
  54858. )
  54859. /* hot reload */
  54860. if (false) { var api; }
  54861. component.options.__file = "resources/js/components/credential.vue"
  54862. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54863. /***/ }),
  54864. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  54865. /*!*************************************************************************!*\
  54866. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  54867. \*************************************************************************/
  54868. /*! exports provided: default */
  54869. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54870. "use strict";
  54871. __webpack_require__.r(__webpack_exports__);
  54872. /* 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&");
  54873. /* 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"]);
  54874. /***/ }),
  54875. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  54876. /*!*******************************************************************************!*\
  54877. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  54878. \*******************************************************************************/
  54879. /*! exports provided: render, staticRenderFns */
  54880. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54881. "use strict";
  54882. __webpack_require__.r(__webpack_exports__);
  54883. /* 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&");
  54884. /* 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"]; });
  54885. /* 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"]; });
  54886. /***/ }),
  54887. /***/ "./resources/js/components/modal.vue":
  54888. /*!*******************************************!*\
  54889. !*** ./resources/js/components/modal.vue ***!
  54890. \*******************************************/
  54891. /*! exports provided: default */
  54892. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54893. "use strict";
  54894. __webpack_require__.r(__webpack_exports__);
  54895. /* 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&");
  54896. /* 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");
  54897. var script = {}
  54898. /* normalize component */
  54899. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  54900. script,
  54901. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  54902. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54903. false,
  54904. null,
  54905. null,
  54906. null
  54907. )
  54908. /* hot reload */
  54909. if (false) { var api; }
  54910. component.options.__file = "resources/js/components/modal.vue"
  54911. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54912. /***/ }),
  54913. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  54914. /*!**************************************************************************!*\
  54915. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  54916. \**************************************************************************/
  54917. /*! exports provided: render, staticRenderFns */
  54918. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54919. "use strict";
  54920. __webpack_require__.r(__webpack_exports__);
  54921. /* 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&");
  54922. /* 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"]; });
  54923. /* 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"]; });
  54924. /***/ }),
  54925. /***/ "./resources/js/components/notes.vue":
  54926. /*!*******************************************!*\
  54927. !*** ./resources/js/components/notes.vue ***!
  54928. \*******************************************/
  54929. /*! exports provided: default */
  54930. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54931. "use strict";
  54932. __webpack_require__.r(__webpack_exports__);
  54933. /* 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&");
  54934. /* 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&");
  54935. /* 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");
  54936. /* normalize component */
  54937. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54938. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54939. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  54940. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54941. false,
  54942. null,
  54943. null,
  54944. null
  54945. )
  54946. /* hot reload */
  54947. if (false) { var api; }
  54948. component.options.__file = "resources/js/components/notes.vue"
  54949. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54950. /***/ }),
  54951. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  54952. /*!********************************************************************!*\
  54953. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  54954. \********************************************************************/
  54955. /*! exports provided: default */
  54956. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54957. "use strict";
  54958. __webpack_require__.r(__webpack_exports__);
  54959. /* 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&");
  54960. /* 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"]);
  54961. /***/ }),
  54962. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  54963. /*!**************************************************************************!*\
  54964. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  54965. \**************************************************************************/
  54966. /*! exports provided: render, staticRenderFns */
  54967. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54968. "use strict";
  54969. __webpack_require__.r(__webpack_exports__);
  54970. /* 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&");
  54971. /* 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"]; });
  54972. /* 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"]; });
  54973. /***/ }),
  54974. /***/ "./resources/js/components/woinfo.vue":
  54975. /*!********************************************!*\
  54976. !*** ./resources/js/components/woinfo.vue ***!
  54977. \********************************************/
  54978. /*! exports provided: default */
  54979. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54980. "use strict";
  54981. __webpack_require__.r(__webpack_exports__);
  54982. /* 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&");
  54983. /* 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&");
  54984. /* 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");
  54985. /* normalize component */
  54986. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54987. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54988. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  54989. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54990. false,
  54991. null,
  54992. null,
  54993. null
  54994. )
  54995. /* hot reload */
  54996. if (false) { var api; }
  54997. component.options.__file = "resources/js/components/woinfo.vue"
  54998. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54999. /***/ }),
  55000. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55001. /*!*********************************************************************!*\
  55002. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55003. \*********************************************************************/
  55004. /*! exports provided: default */
  55005. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55006. "use strict";
  55007. __webpack_require__.r(__webpack_exports__);
  55008. /* 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&");
  55009. /* 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"]);
  55010. /***/ }),
  55011. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55012. /*!***************************************************************************!*\
  55013. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55014. \***************************************************************************/
  55015. /*! exports provided: render, staticRenderFns */
  55016. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55017. "use strict";
  55018. __webpack_require__.r(__webpack_exports__);
  55019. /* 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&");
  55020. /* 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"]; });
  55021. /* 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"]; });
  55022. /***/ }),
  55023. /***/ "./resources/js/mixins/dateMixin.js":
  55024. /*!******************************************!*\
  55025. !*** ./resources/js/mixins/dateMixin.js ***!
  55026. \******************************************/
  55027. /*! exports provided: default */
  55028. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55029. "use strict";
  55030. __webpack_require__.r(__webpack_exports__);
  55031. /* harmony default export */ __webpack_exports__["default"] = ({
  55032. methods: {
  55033. treatAsUTC: function treatAsUTC(date) {
  55034. var result = new Date(date);
  55035. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  55036. return result;
  55037. },
  55038. daysSinceToday: function daysSinceToday(date) {
  55039. var currentDate = new Date();
  55040. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  55041. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  55042. },
  55043. getHRDate: function getHRDate(dateString) {
  55044. var date = new Date(dateString);
  55045. return date.toLocaleString('default', {
  55046. month: 'short',
  55047. day: 'numeric',
  55048. year: 'numeric',
  55049. hour: 'numeric',
  55050. minute: 'numeric'
  55051. });
  55052. },
  55053. isZero: function isZero(dateString) {
  55054. return dateString === '0000-00-00 00:00:00';
  55055. }
  55056. }
  55057. });
  55058. /***/ }),
  55059. /***/ "./resources/js/notify.min.js":
  55060. /*!************************************!*\
  55061. !*** ./resources/js/notify.min.js ***!
  55062. \************************************/
  55063. /*! no static exports found */
  55064. /***/ (function(module, exports, __webpack_require__) {
  55065. 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); }
  55066. (function (e) {
  55067. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  55068. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  55069. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  55070. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  55071. })(function (e) {
  55072. function A(t, n, i) {
  55073. typeof i == "string" && (i = {
  55074. className: i
  55075. }), 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);
  55076. }
  55077. var t = [].indexOf || function (e) {
  55078. for (var t = 0, n = this.length; t < n; t++) {
  55079. if (t in this && this[t] === e) return t;
  55080. }
  55081. return -1;
  55082. },
  55083. n = "notify",
  55084. r = n + "js",
  55085. i = n + "!blank",
  55086. s = {
  55087. t: "top",
  55088. m: "middle",
  55089. b: "bottom",
  55090. l: "left",
  55091. c: "center",
  55092. r: "right"
  55093. },
  55094. o = ["l", "c", "r"],
  55095. u = ["t", "m", "b"],
  55096. a = ["t", "b", "l", "r"],
  55097. f = {
  55098. t: "b",
  55099. m: null,
  55100. b: "t",
  55101. l: "r",
  55102. c: null,
  55103. r: "l"
  55104. },
  55105. l = function l(t) {
  55106. var n;
  55107. return n = [], e.each(t.split(/\W+/), function (e, t) {
  55108. var r;
  55109. r = t.toLowerCase().charAt(0);
  55110. if (s[r]) return n.push(r);
  55111. }), n;
  55112. },
  55113. c = {},
  55114. h = {
  55115. name: "core",
  55116. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  55117. 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}"
  55118. },
  55119. p = {
  55120. "border-radius": ["-webkit-", "-moz-"]
  55121. },
  55122. d = function d(e) {
  55123. return c[e];
  55124. },
  55125. v = function v(e) {
  55126. if (!e) throw "Missing Style name";
  55127. c[e] && delete c[e];
  55128. },
  55129. m = function m(t, i) {
  55130. if (!t) throw "Missing Style name";
  55131. if (!i) throw "Missing Style definition";
  55132. if (!i.html) throw "Missing Style HTML";
  55133. var s = c[t];
  55134. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  55135. var o = "";
  55136. i.classes && e.each(i.classes, function (t, n) {
  55137. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  55138. return p[t] && e.each(p[t], function (e, r) {
  55139. return o += " " + r + t + ": " + n + ";\n";
  55140. }), o += " " + t + ": " + n + ";\n";
  55141. }), o += "}\n";
  55142. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  55143. var u = {},
  55144. a = e(i.html);
  55145. y("html", a, u), y("text", a, u), i.fields = u;
  55146. },
  55147. g = function g(t) {
  55148. var n, r, i;
  55149. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  55150. try {
  55151. r.html(t);
  55152. } catch (s) {
  55153. r[0].styleSheet.cssText = t;
  55154. }
  55155. return r;
  55156. },
  55157. y = function y(t, n, r) {
  55158. var s;
  55159. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  55160. var n;
  55161. n = e(this).attr(s), n || (n = i), r[n] = t;
  55162. });
  55163. },
  55164. b = function b(e, t) {
  55165. return e.is(t) ? e : e.find(t);
  55166. },
  55167. w = {
  55168. clickToHide: !0,
  55169. autoHide: !0,
  55170. autoHideDelay: 5e3,
  55171. arrowShow: !0,
  55172. arrowSize: 5,
  55173. breakNewLines: !0,
  55174. elementPosition: "bottom",
  55175. globalPosition: "top right",
  55176. style: "bootstrap",
  55177. className: "error",
  55178. showAnimation: "slideDown",
  55179. showDuration: 400,
  55180. hideAnimation: "slideUp",
  55181. hideDuration: 200,
  55182. gap: 5
  55183. },
  55184. E = function E(t, n) {
  55185. var r;
  55186. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  55187. },
  55188. S = function S(t) {
  55189. return e.extend(w, t);
  55190. },
  55191. x = function x(t) {
  55192. return e("<" + t + "></" + t + ">");
  55193. },
  55194. T = {},
  55195. N = function N(t) {
  55196. var n;
  55197. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  55198. return e(r).attr("name") === t.attr("name");
  55199. }), t = n.first()), t;
  55200. },
  55201. C = function C(e, t, n) {
  55202. var r, i;
  55203. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  55204. if (isNaN(n)) return;
  55205. 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;
  55206. },
  55207. k = function k(e, t, n) {
  55208. if (e === "l" || e === "t") return 0;
  55209. if (e === "c" || e === "m") return n / 2 - t / 2;
  55210. if (e === "r" || e === "b") return n - t;
  55211. throw "Invalid alignment";
  55212. },
  55213. L = function L(e) {
  55214. return L.e = L.e || x("div"), L.e.text(e).html();
  55215. };
  55216. A.prototype.loadHTML = function () {
  55217. var t;
  55218. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  55219. }, A.prototype.show = function (e, t) {
  55220. var n, r, i, s, o;
  55221. r = function (n) {
  55222. return function () {
  55223. !e && !n.elem && n.destroy();
  55224. if (t) return t();
  55225. };
  55226. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  55227. 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 {
  55228. if (!!o || !!e) return r();
  55229. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  55230. }
  55231. return n.push(r), i[s].apply(i, n);
  55232. }, A.prototype.setGlobalPosition = function () {
  55233. var t = this.getPosition(),
  55234. n = t[0],
  55235. i = t[1],
  55236. o = s[n],
  55237. u = s[i],
  55238. a = n + "|" + i,
  55239. f = T[a];
  55240. if (!f || !document.body.contains(f[0])) {
  55241. f = T[a] = x("div");
  55242. var l = {};
  55243. 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);
  55244. }
  55245. return f.prepend(this.wrapper);
  55246. }, A.prototype.setElementPosition = function () {
  55247. 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;
  55248. 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"];
  55249. for (w = 0, S = B.length; w < S; w++) {
  55250. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  55251. }
  55252. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  55253. if (!this.options.arrowShow) this.arrow.hide();else {
  55254. 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";
  55255. for (E = 0, x = a.length; E < x; E++) {
  55256. D = a[E], P = s[D];
  55257. if (D === L) continue;
  55258. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  55259. }
  55260. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  55261. }
  55262. 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);
  55263. if (r) return this.arrow.removeAttr("style").css(r);
  55264. }, A.prototype.getPosition = function () {
  55265. var e, n, r, i, s, f, c, h;
  55266. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  55267. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  55268. 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";
  55269. return e.length === 2 && (e[2] = e[1]), e;
  55270. }, A.prototype.getStyle = function (e) {
  55271. var t;
  55272. e || (e = this.options.style), e || (e = "default"), t = c[e];
  55273. if (!t) throw "Missing style: " + e;
  55274. return t;
  55275. }, A.prototype.updateClasses = function () {
  55276. var t, n;
  55277. 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) {
  55278. return r + "-" + n.name + "-" + e;
  55279. }).join(" "), this.userContainer.attr("class", t);
  55280. }, A.prototype.run = function (t, n) {
  55281. var r, s, o, u, a;
  55282. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  55283. if (this.container && !t) {
  55284. this.show(!1);
  55285. return;
  55286. }
  55287. if (!this.container && !t) return;
  55288. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  55289. for (o in s) {
  55290. r = s[o], u = this.userFields[o];
  55291. if (!u) continue;
  55292. 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);
  55293. }
  55294. 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));
  55295. }, A.prototype.destroy = function () {
  55296. this.wrapper.data(r, null), this.wrapper.remove();
  55297. }, e[n] = function (t, r, i) {
  55298. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  55299. }, e.fn[n] = function (t, n) {
  55300. return e(this).each(function () {
  55301. var i = N(e(this)).data(r);
  55302. i && i.destroy();
  55303. var s = new A(e(this), t, n);
  55304. }), this;
  55305. }, e.extend(e[n], {
  55306. defaults: S,
  55307. addStyle: m,
  55308. removeStyle: v,
  55309. pluginOptions: w,
  55310. getStyle: d,
  55311. insertCSS: g
  55312. }), m("bootstrap", {
  55313. html: "<div>\n<span data-notify-text></span>\n</div>",
  55314. classes: {
  55315. base: {
  55316. "font-weight": "bold",
  55317. padding: "8px 15px 8px 14px",
  55318. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  55319. "background-color": "#fcf8e3",
  55320. border: "1px solid #fbeed5",
  55321. "border-radius": "4px",
  55322. "white-space": "nowrap",
  55323. "padding-left": "25px",
  55324. "background-repeat": "no-repeat",
  55325. "background-position": "3px 7px"
  55326. },
  55327. error: {
  55328. color: "#B94A48",
  55329. "background-color": "#F2DEDE",
  55330. "border-color": "#EED3D7",
  55331. "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=)"
  55332. },
  55333. success: {
  55334. color: "#468847",
  55335. "background-color": "#DFF0D8",
  55336. "border-color": "#D6E9C6",
  55337. "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==)"
  55338. },
  55339. info: {
  55340. color: "#3A87AD",
  55341. "background-color": "#D9EDF7",
  55342. "border-color": "#BCE8F1",
  55343. "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=)"
  55344. },
  55345. warn: {
  55346. color: "#C09853",
  55347. "background-color": "#FCF8E3",
  55348. "border-color": "#FBEED5",
  55349. "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)"
  55350. }
  55351. }
  55352. }), e(function () {
  55353. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  55354. e(this).trigger("notify-hide");
  55355. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  55356. var n = e(this).data(r);
  55357. n && n.show(!1);
  55358. });
  55359. });
  55360. });
  55361. /***/ }),
  55362. /***/ "./resources/sass/app.scss":
  55363. /*!*********************************!*\
  55364. !*** ./resources/sass/app.scss ***!
  55365. \*********************************/
  55366. /*! no static exports found */
  55367. /***/ (function(module, exports) {
  55368. // removed by extract-text-webpack-plugin
  55369. /***/ }),
  55370. /***/ 0:
  55371. /*!*************************************************************!*\
  55372. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  55373. \*************************************************************/
  55374. /*! no static exports found */
  55375. /***/ (function(module, exports, __webpack_require__) {
  55376. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  55377. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  55378. /***/ })
  55379. /******/ });