app.js 1.9 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826
  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/AutocompleteCustomDropdown.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/AutocompleteCustomDropdown.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. //
  1598. //
  1599. //
  1600. //
  1601. //
  1602. /* harmony default export */ __webpack_exports__["default"] = ({
  1603. props: {
  1604. value: null,
  1605. // An object with the following format
  1606. // {
  1607. // key: value,
  1608. // key: value,
  1609. // }
  1610. options: {
  1611. type: Object,
  1612. required: true
  1613. },
  1614. allowCustom: {
  1615. type: Boolean,
  1616. "default": false
  1617. }
  1618. },
  1619. data: function data() {
  1620. return {
  1621. searchText: '',
  1622. selectedOption: null,
  1623. open: false,
  1624. // allows for checking whether button was clicked or text was typed.
  1625. // If button was clicked, we show all options without having to clear
  1626. // out any searchText that was autofilled when page loaded.
  1627. isSearching: false
  1628. };
  1629. },
  1630. computed: {
  1631. matches: function matches() {
  1632. var _this = this;
  1633. // If button was clicked, show all options, if typing, filter
  1634. // options based on searchText
  1635. return Object.entries(this.options).filter(function (option) {
  1636. var optionText = option[1].toUpperCase();
  1637. if (_this.isSearching) {
  1638. return optionText.match(_this.searchText.toUpperCase());
  1639. } else {
  1640. return optionText.match('');
  1641. }
  1642. });
  1643. }
  1644. },
  1645. methods: {
  1646. // if button is clicked, show all options
  1647. setOpen: function setOpen(isOpen) {
  1648. this.open = isOpen;
  1649. this.isSearching = false;
  1650. },
  1651. // if typing in the box, start filtering options
  1652. searchChanged: function searchChanged() {
  1653. if (!this.open) {
  1654. this.open = true;
  1655. }
  1656. if (!this.isSearching) {
  1657. this.isSearching = true;
  1658. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1659. if (this.allowCustom) {
  1660. this.$emit('input', {
  1661. 'id': 'custom',
  1662. 'name': this.searchText
  1663. });
  1664. }
  1665. },
  1666. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1667. // a suggestion is selected
  1668. suggestionSelected: function suggestionSelected(suggestion) {
  1669. this.open = false;
  1670. this.searchText = suggestion[1];
  1671. this.$emit('input', {
  1672. 'id': suggestion[0],
  1673. 'name': suggestion[1]
  1674. });
  1675. },
  1676. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1677. if (this.allowCustom) {
  1678. this.searchText = this.value.name;
  1679. } else {
  1680. if (newValue.id > -1) {
  1681. // Find the matching text for the supplied option value
  1682. for (var id in this.options) {
  1683. if (this.options.hasOwnProperty(id)) {
  1684. if (this.options[id] === this.options[newValue.id]) {
  1685. this.searchText = this.options[id];
  1686. }
  1687. }
  1688. }
  1689. }
  1690. }
  1691. }
  1692. },
  1693. mounted: function mounted() {
  1694. this.updateComponentWithValue(this.value);
  1695. },
  1696. watch: {
  1697. value: function value(newValue) {
  1698. this.updateComponentWithValue(newValue);
  1699. }
  1700. }
  1701. });
  1702. /***/ }),
  1703. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  1704. /*!**************************************************************************************************************************************************************************!*\
  1705. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  1706. \**************************************************************************************************************************************************************************/
  1707. /*! exports provided: default */
  1708. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1709. "use strict";
  1710. __webpack_require__.r(__webpack_exports__);
  1711. /* harmony import */ var _components_Modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal */ "./resources/js/components/Modal.vue");
  1712. /* harmony import */ var _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1747. components: {
  1748. Modal: _components_Modal__WEBPACK_IMPORTED_MODULE_0__["default"],
  1749. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__["default"]
  1750. },
  1751. props: ['populateWith', 'storeList', 'modalId'],
  1752. data: function data() {
  1753. return {
  1754. // Copies object from prop, so it doesn't mutate the object
  1755. // from the parent component. Parent component will be updated via
  1756. // Websocket if updateWorkOrder is successful.
  1757. data: {},
  1758. id: this.modalId,
  1759. store: {},
  1760. errors: []
  1761. };
  1762. },
  1763. methods: {
  1764. updateWorkOrder: function updateWorkOrder() {
  1765. var _this = this;
  1766. this.data.storeid = this.store.id;
  1767. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  1768. $('#workordereditModal').modal('hide');
  1769. })["catch"](function (error) {
  1770. _this.errors = JSON.parse(error.response.request.response).errors;
  1771. });
  1772. }
  1773. },
  1774. watch: {
  1775. populateWith: function populateWith(value) {
  1776. this.data = JSON.parse(JSON.stringify(this.populateWith));
  1777. this.store = {
  1778. 'id': this.data.storeid,
  1779. 'name': this.storeList[this.data.storeid]
  1780. };
  1781. },
  1782. storeList: function storeList(value) {
  1783. this.store = {
  1784. 'id': this.data.storeid,
  1785. 'name': this.storeList[this.data.storeid]
  1786. };
  1787. }
  1788. }
  1789. });
  1790. /***/ }),
  1791. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  1792. /*!************************************************************************************************************************************************************************!*\
  1793. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  1794. \************************************************************************************************************************************************************************/
  1795. /*! exports provided: default */
  1796. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1797. "use strict";
  1798. __webpack_require__.r(__webpack_exports__);
  1799. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1800. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  1801. //
  1802. //
  1803. //
  1804. //
  1805. //
  1806. //
  1807. //
  1808. //
  1809. //
  1810. //
  1811. //
  1812. //
  1813. //
  1814. //
  1815. //
  1816. //
  1817. //
  1818. //
  1819. //
  1820. //
  1821. /* harmony default export */ __webpack_exports__["default"] = ({
  1822. components: {
  1823. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  1824. },
  1825. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1826. props: ['workOrder', 'stores'],
  1827. computed: {
  1828. storeList: function storeList() {
  1829. var list = {};
  1830. Object.values(this.stores).map(function (val) {
  1831. list[val.storeid] = val.storesname;
  1832. });
  1833. return list;
  1834. }
  1835. }
  1836. });
  1837. /***/ }),
  1838. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  1839. /*!*********************************************************************************************************************************************************!*\
  1840. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  1841. \*********************************************************************************************************************************************************/
  1842. /*! exports provided: default */
  1843. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1844. "use strict";
  1845. __webpack_require__.r(__webpack_exports__);
  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. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. //
  1896. //
  1897. //
  1898. //
  1899. //
  1900. //
  1901. //
  1902. //
  1903. //
  1904. //
  1905. //
  1906. //
  1907. //
  1908. //
  1909. //
  1910. //
  1911. //
  1912. //
  1913. //
  1914. //
  1915. //
  1916. //
  1917. /* harmony default export */ __webpack_exports__["default"] = ({
  1918. data: function data() {
  1919. return {
  1920. isLoggedIn: null,
  1921. username: null
  1922. };
  1923. },
  1924. mounted: function mounted() {
  1925. this.isLoggedIn = localStorage.getItem('jwt');
  1926. this.username = localStorage.getItem('user');
  1927. }
  1928. });
  1929. /***/ }),
  1930. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  1931. /*!***************************************************************************************************************************************************************!*\
  1932. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  1933. \***************************************************************************************************************************************************************/
  1934. /*! exports provided: default */
  1935. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1936. "use strict";
  1937. __webpack_require__.r(__webpack_exports__);
  1938. //
  1939. //
  1940. //
  1941. //
  1942. //
  1943. //
  1944. //
  1945. //
  1946. //
  1947. //
  1948. //
  1949. //
  1950. //
  1951. //
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. /* harmony default export */ __webpack_exports__["default"] = ({
  1962. data: function data() {
  1963. return {
  1964. workOrders: []
  1965. };
  1966. },
  1967. mounted: function mounted() {
  1968. var _this = this;
  1969. var token = localStorage.getItem('jwt');
  1970. var user = localStorage.getItem('user');
  1971. axios.defaults.headers.common['Content-Type'] = 'application/json';
  1972. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  1973. axios.get('api/users/' + user + '/workorders').then(function (response) {
  1974. _this.workOrders = response.data;
  1975. })["catch"](function (error) {
  1976. console.log(error);
  1977. });
  1978. },
  1979. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  1980. if (!localStorage.getItem('jwt')) {
  1981. return next('login');
  1982. }
  1983. next();
  1984. }
  1985. });
  1986. /***/ }),
  1987. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  1988. /*!***********************************************************************************************************************************************************!*\
  1989. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  1990. \***********************************************************************************************************************************************************/
  1991. /*! exports provided: default */
  1992. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1993. "use strict";
  1994. __webpack_require__.r(__webpack_exports__);
  1995. //
  1996. //
  1997. //
  1998. //
  1999. //
  2000. //
  2001. //
  2002. //
  2003. //
  2004. //
  2005. //
  2006. //
  2007. //
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. //
  2030. //
  2031. //
  2032. //
  2033. //
  2034. /* harmony default export */ __webpack_exports__["default"] = ({
  2035. data: function data() {
  2036. return {
  2037. username: "",
  2038. password: ""
  2039. };
  2040. },
  2041. methods: {
  2042. handleSubmit: function handleSubmit(e) {
  2043. var _this = this;
  2044. e.preventDefault();
  2045. if (this.password.length > 0) {
  2046. axios.post('api/login', {
  2047. username: this.username,
  2048. password: this.password
  2049. }).then(function (response) {
  2050. localStorage.setItem('user', response.data.success.username);
  2051. localStorage.setItem('jwt', response.data.success.token);
  2052. if (localStorage.getItem('jwt') != null) {
  2053. _this.$router.go('/dashboard');
  2054. }
  2055. })["catch"](function (error) {
  2056. console.error(error);
  2057. });
  2058. }
  2059. }
  2060. },
  2061. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2062. if (localStorage.getItem('jwt')) {
  2063. return next('board');
  2064. }
  2065. next();
  2066. }
  2067. });
  2068. /***/ }),
  2069. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2070. /*!*************************************************************************************************************************************************************!*\
  2071. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  2072. \*************************************************************************************************************************************************************/
  2073. /*! exports provided: default */
  2074. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2075. "use strict";
  2076. __webpack_require__.r(__webpack_exports__);
  2077. //
  2078. //
  2079. //
  2080. //
  2081. //
  2082. //
  2083. //
  2084. //
  2085. //
  2086. //
  2087. //
  2088. //
  2089. //
  2090. //
  2091. //
  2092. //
  2093. //
  2094. //
  2095. //
  2096. //
  2097. //
  2098. //
  2099. //
  2100. //
  2101. //
  2102. //
  2103. //
  2104. //
  2105. //
  2106. //
  2107. //
  2108. //
  2109. //
  2110. //
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. //
  2123. //
  2124. //
  2125. //
  2126. //
  2127. //
  2128. /* harmony default export */ __webpack_exports__["default"] = ({});
  2129. /***/ }),
  2130. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2131. /*!***************************************************************************************************************************************************************!*\
  2132. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  2133. \***************************************************************************************************************************************************************/
  2134. /*! exports provided: default */
  2135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2136. "use strict";
  2137. __webpack_require__.r(__webpack_exports__);
  2138. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. /* harmony default export */ __webpack_exports__["default"] = ({
  2236. components: {
  2237. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2238. },
  2239. props: ['id'],
  2240. data: function data() {
  2241. return {
  2242. workOrder: {},
  2243. stores: {}
  2244. };
  2245. },
  2246. mounted: function mounted() {
  2247. var _this = this;
  2248. var token = localStorage.getItem('jwt');
  2249. var user = localStorage.getItem('user');
  2250. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2251. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2252. axios.get('/api/workorders/' + this.id).then(function (response) {
  2253. _this.workOrder = response.data;
  2254. })["catch"](function (error) {
  2255. console.log(error);
  2256. });
  2257. axios.get('/api/stores/').then(function (response) {
  2258. _this.stores = response.data;
  2259. })["catch"](function (error) {
  2260. console.log(error);
  2261. });
  2262. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  2263. _this.workOrder = e.data;
  2264. });
  2265. }
  2266. });
  2267. /***/ }),
  2268. /***/ "./node_modules/base64-js/index.js":
  2269. /*!*****************************************!*\
  2270. !*** ./node_modules/base64-js/index.js ***!
  2271. \*****************************************/
  2272. /*! no static exports found */
  2273. /***/ (function(module, exports, __webpack_require__) {
  2274. "use strict";
  2275. exports.byteLength = byteLength
  2276. exports.toByteArray = toByteArray
  2277. exports.fromByteArray = fromByteArray
  2278. var lookup = []
  2279. var revLookup = []
  2280. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2281. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2282. for (var i = 0, len = code.length; i < len; ++i) {
  2283. lookup[i] = code[i]
  2284. revLookup[code.charCodeAt(i)] = i
  2285. }
  2286. // Support decoding URL-safe base64 strings, as Node.js does.
  2287. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2288. revLookup['-'.charCodeAt(0)] = 62
  2289. revLookup['_'.charCodeAt(0)] = 63
  2290. function getLens (b64) {
  2291. var len = b64.length
  2292. if (len % 4 > 0) {
  2293. throw new Error('Invalid string. Length must be a multiple of 4')
  2294. }
  2295. // Trim off extra bytes after placeholder bytes are found
  2296. // See: https://github.com/beatgammit/base64-js/issues/42
  2297. var validLen = b64.indexOf('=')
  2298. if (validLen === -1) validLen = len
  2299. var placeHoldersLen = validLen === len
  2300. ? 0
  2301. : 4 - (validLen % 4)
  2302. return [validLen, placeHoldersLen]
  2303. }
  2304. // base64 is 4/3 + up to two characters of the original data
  2305. function byteLength (b64) {
  2306. var lens = getLens(b64)
  2307. var validLen = lens[0]
  2308. var placeHoldersLen = lens[1]
  2309. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2310. }
  2311. function _byteLength (b64, validLen, placeHoldersLen) {
  2312. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2313. }
  2314. function toByteArray (b64) {
  2315. var tmp
  2316. var lens = getLens(b64)
  2317. var validLen = lens[0]
  2318. var placeHoldersLen = lens[1]
  2319. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2320. var curByte = 0
  2321. // if there are placeholders, only get up to the last complete 4 chars
  2322. var len = placeHoldersLen > 0
  2323. ? validLen - 4
  2324. : validLen
  2325. var i
  2326. for (i = 0; i < len; i += 4) {
  2327. tmp =
  2328. (revLookup[b64.charCodeAt(i)] << 18) |
  2329. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2330. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2331. revLookup[b64.charCodeAt(i + 3)]
  2332. arr[curByte++] = (tmp >> 16) & 0xFF
  2333. arr[curByte++] = (tmp >> 8) & 0xFF
  2334. arr[curByte++] = tmp & 0xFF
  2335. }
  2336. if (placeHoldersLen === 2) {
  2337. tmp =
  2338. (revLookup[b64.charCodeAt(i)] << 2) |
  2339. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2340. arr[curByte++] = tmp & 0xFF
  2341. }
  2342. if (placeHoldersLen === 1) {
  2343. tmp =
  2344. (revLookup[b64.charCodeAt(i)] << 10) |
  2345. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2346. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2347. arr[curByte++] = (tmp >> 8) & 0xFF
  2348. arr[curByte++] = tmp & 0xFF
  2349. }
  2350. return arr
  2351. }
  2352. function tripletToBase64 (num) {
  2353. return lookup[num >> 18 & 0x3F] +
  2354. lookup[num >> 12 & 0x3F] +
  2355. lookup[num >> 6 & 0x3F] +
  2356. lookup[num & 0x3F]
  2357. }
  2358. function encodeChunk (uint8, start, end) {
  2359. var tmp
  2360. var output = []
  2361. for (var i = start; i < end; i += 3) {
  2362. tmp =
  2363. ((uint8[i] << 16) & 0xFF0000) +
  2364. ((uint8[i + 1] << 8) & 0xFF00) +
  2365. (uint8[i + 2] & 0xFF)
  2366. output.push(tripletToBase64(tmp))
  2367. }
  2368. return output.join('')
  2369. }
  2370. function fromByteArray (uint8) {
  2371. var tmp
  2372. var len = uint8.length
  2373. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2374. var parts = []
  2375. var maxChunkLength = 16383 // must be multiple of 3
  2376. // go through the array every three bytes, we'll deal with trailing stuff later
  2377. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2378. parts.push(encodeChunk(
  2379. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2380. ))
  2381. }
  2382. // pad the end with zeros, but make sure to not forget the extra bytes
  2383. if (extraBytes === 1) {
  2384. tmp = uint8[len - 1]
  2385. parts.push(
  2386. lookup[tmp >> 2] +
  2387. lookup[(tmp << 4) & 0x3F] +
  2388. '=='
  2389. )
  2390. } else if (extraBytes === 2) {
  2391. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2392. parts.push(
  2393. lookup[tmp >> 10] +
  2394. lookup[(tmp >> 4) & 0x3F] +
  2395. lookup[(tmp << 2) & 0x3F] +
  2396. '='
  2397. )
  2398. }
  2399. return parts.join('')
  2400. }
  2401. /***/ }),
  2402. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2403. /*!*****************************************************!*\
  2404. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2405. \*****************************************************/
  2406. /*! no static exports found */
  2407. /***/ (function(module, exports, __webpack_require__) {
  2408. /*!
  2409. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2410. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2411. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2412. */
  2413. (function (global, factory) {
  2414. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2415. undefined;
  2416. }(this, (function (exports, $, Popper) { 'use strict';
  2417. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2418. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2419. function _defineProperties(target, props) {
  2420. for (var i = 0; i < props.length; i++) {
  2421. var descriptor = props[i];
  2422. descriptor.enumerable = descriptor.enumerable || false;
  2423. descriptor.configurable = true;
  2424. if ("value" in descriptor) descriptor.writable = true;
  2425. Object.defineProperty(target, descriptor.key, descriptor);
  2426. }
  2427. }
  2428. function _createClass(Constructor, protoProps, staticProps) {
  2429. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2430. if (staticProps) _defineProperties(Constructor, staticProps);
  2431. return Constructor;
  2432. }
  2433. function _defineProperty(obj, key, value) {
  2434. if (key in obj) {
  2435. Object.defineProperty(obj, key, {
  2436. value: value,
  2437. enumerable: true,
  2438. configurable: true,
  2439. writable: true
  2440. });
  2441. } else {
  2442. obj[key] = value;
  2443. }
  2444. return obj;
  2445. }
  2446. function ownKeys(object, enumerableOnly) {
  2447. var keys = Object.keys(object);
  2448. if (Object.getOwnPropertySymbols) {
  2449. var symbols = Object.getOwnPropertySymbols(object);
  2450. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2451. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2452. });
  2453. keys.push.apply(keys, symbols);
  2454. }
  2455. return keys;
  2456. }
  2457. function _objectSpread2(target) {
  2458. for (var i = 1; i < arguments.length; i++) {
  2459. var source = arguments[i] != null ? arguments[i] : {};
  2460. if (i % 2) {
  2461. ownKeys(Object(source), true).forEach(function (key) {
  2462. _defineProperty(target, key, source[key]);
  2463. });
  2464. } else if (Object.getOwnPropertyDescriptors) {
  2465. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2466. } else {
  2467. ownKeys(Object(source)).forEach(function (key) {
  2468. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2469. });
  2470. }
  2471. }
  2472. return target;
  2473. }
  2474. function _inheritsLoose(subClass, superClass) {
  2475. subClass.prototype = Object.create(superClass.prototype);
  2476. subClass.prototype.constructor = subClass;
  2477. subClass.__proto__ = superClass;
  2478. }
  2479. /**
  2480. * --------------------------------------------------------------------------
  2481. * Bootstrap (v4.4.1): util.js
  2482. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2483. * --------------------------------------------------------------------------
  2484. */
  2485. /**
  2486. * ------------------------------------------------------------------------
  2487. * Private TransitionEnd Helpers
  2488. * ------------------------------------------------------------------------
  2489. */
  2490. var TRANSITION_END = 'transitionend';
  2491. var MAX_UID = 1000000;
  2492. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2493. function toType(obj) {
  2494. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2495. }
  2496. function getSpecialTransitionEndEvent() {
  2497. return {
  2498. bindType: TRANSITION_END,
  2499. delegateType: TRANSITION_END,
  2500. handle: function handle(event) {
  2501. if ($(event.target).is(this)) {
  2502. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2503. }
  2504. return undefined; // eslint-disable-line no-undefined
  2505. }
  2506. };
  2507. }
  2508. function transitionEndEmulator(duration) {
  2509. var _this = this;
  2510. var called = false;
  2511. $(this).one(Util.TRANSITION_END, function () {
  2512. called = true;
  2513. });
  2514. setTimeout(function () {
  2515. if (!called) {
  2516. Util.triggerTransitionEnd(_this);
  2517. }
  2518. }, duration);
  2519. return this;
  2520. }
  2521. function setTransitionEndSupport() {
  2522. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2523. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2524. }
  2525. /**
  2526. * --------------------------------------------------------------------------
  2527. * Public Util Api
  2528. * --------------------------------------------------------------------------
  2529. */
  2530. var Util = {
  2531. TRANSITION_END: 'bsTransitionEnd',
  2532. getUID: function getUID(prefix) {
  2533. do {
  2534. // eslint-disable-next-line no-bitwise
  2535. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2536. } while (document.getElementById(prefix));
  2537. return prefix;
  2538. },
  2539. getSelectorFromElement: function getSelectorFromElement(element) {
  2540. var selector = element.getAttribute('data-target');
  2541. if (!selector || selector === '#') {
  2542. var hrefAttr = element.getAttribute('href');
  2543. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2544. }
  2545. try {
  2546. return document.querySelector(selector) ? selector : null;
  2547. } catch (err) {
  2548. return null;
  2549. }
  2550. },
  2551. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2552. if (!element) {
  2553. return 0;
  2554. } // Get transition-duration of the element
  2555. var transitionDuration = $(element).css('transition-duration');
  2556. var transitionDelay = $(element).css('transition-delay');
  2557. var floatTransitionDuration = parseFloat(transitionDuration);
  2558. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2559. if (!floatTransitionDuration && !floatTransitionDelay) {
  2560. return 0;
  2561. } // If multiple durations are defined, take the first
  2562. transitionDuration = transitionDuration.split(',')[0];
  2563. transitionDelay = transitionDelay.split(',')[0];
  2564. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2565. },
  2566. reflow: function reflow(element) {
  2567. return element.offsetHeight;
  2568. },
  2569. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2570. $(element).trigger(TRANSITION_END);
  2571. },
  2572. // TODO: Remove in v5
  2573. supportsTransitionEnd: function supportsTransitionEnd() {
  2574. return Boolean(TRANSITION_END);
  2575. },
  2576. isElement: function isElement(obj) {
  2577. return (obj[0] || obj).nodeType;
  2578. },
  2579. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2580. for (var property in configTypes) {
  2581. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2582. var expectedTypes = configTypes[property];
  2583. var value = config[property];
  2584. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2585. if (!new RegExp(expectedTypes).test(valueType)) {
  2586. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2587. }
  2588. }
  2589. }
  2590. },
  2591. findShadowRoot: function findShadowRoot(element) {
  2592. if (!document.documentElement.attachShadow) {
  2593. return null;
  2594. } // Can find the shadow root otherwise it'll return the document
  2595. if (typeof element.getRootNode === 'function') {
  2596. var root = element.getRootNode();
  2597. return root instanceof ShadowRoot ? root : null;
  2598. }
  2599. if (element instanceof ShadowRoot) {
  2600. return element;
  2601. } // when we don't find a shadow root
  2602. if (!element.parentNode) {
  2603. return null;
  2604. }
  2605. return Util.findShadowRoot(element.parentNode);
  2606. },
  2607. jQueryDetection: function jQueryDetection() {
  2608. if (typeof $ === 'undefined') {
  2609. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2610. }
  2611. var version = $.fn.jquery.split(' ')[0].split('.');
  2612. var minMajor = 1;
  2613. var ltMajor = 2;
  2614. var minMinor = 9;
  2615. var minPatch = 1;
  2616. var maxMajor = 4;
  2617. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2618. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2619. }
  2620. }
  2621. };
  2622. Util.jQueryDetection();
  2623. setTransitionEndSupport();
  2624. /**
  2625. * ------------------------------------------------------------------------
  2626. * Constants
  2627. * ------------------------------------------------------------------------
  2628. */
  2629. var NAME = 'alert';
  2630. var VERSION = '4.4.1';
  2631. var DATA_KEY = 'bs.alert';
  2632. var EVENT_KEY = "." + DATA_KEY;
  2633. var DATA_API_KEY = '.data-api';
  2634. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2635. var Selector = {
  2636. DISMISS: '[data-dismiss="alert"]'
  2637. };
  2638. var Event = {
  2639. CLOSE: "close" + EVENT_KEY,
  2640. CLOSED: "closed" + EVENT_KEY,
  2641. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2642. };
  2643. var ClassName = {
  2644. ALERT: 'alert',
  2645. FADE: 'fade',
  2646. SHOW: 'show'
  2647. };
  2648. /**
  2649. * ------------------------------------------------------------------------
  2650. * Class Definition
  2651. * ------------------------------------------------------------------------
  2652. */
  2653. var Alert =
  2654. /*#__PURE__*/
  2655. function () {
  2656. function Alert(element) {
  2657. this._element = element;
  2658. } // Getters
  2659. var _proto = Alert.prototype;
  2660. // Public
  2661. _proto.close = function close(element) {
  2662. var rootElement = this._element;
  2663. if (element) {
  2664. rootElement = this._getRootElement(element);
  2665. }
  2666. var customEvent = this._triggerCloseEvent(rootElement);
  2667. if (customEvent.isDefaultPrevented()) {
  2668. return;
  2669. }
  2670. this._removeElement(rootElement);
  2671. };
  2672. _proto.dispose = function dispose() {
  2673. $.removeData(this._element, DATA_KEY);
  2674. this._element = null;
  2675. } // Private
  2676. ;
  2677. _proto._getRootElement = function _getRootElement(element) {
  2678. var selector = Util.getSelectorFromElement(element);
  2679. var parent = false;
  2680. if (selector) {
  2681. parent = document.querySelector(selector);
  2682. }
  2683. if (!parent) {
  2684. parent = $(element).closest("." + ClassName.ALERT)[0];
  2685. }
  2686. return parent;
  2687. };
  2688. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2689. var closeEvent = $.Event(Event.CLOSE);
  2690. $(element).trigger(closeEvent);
  2691. return closeEvent;
  2692. };
  2693. _proto._removeElement = function _removeElement(element) {
  2694. var _this = this;
  2695. $(element).removeClass(ClassName.SHOW);
  2696. if (!$(element).hasClass(ClassName.FADE)) {
  2697. this._destroyElement(element);
  2698. return;
  2699. }
  2700. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2701. $(element).one(Util.TRANSITION_END, function (event) {
  2702. return _this._destroyElement(element, event);
  2703. }).emulateTransitionEnd(transitionDuration);
  2704. };
  2705. _proto._destroyElement = function _destroyElement(element) {
  2706. $(element).detach().trigger(Event.CLOSED).remove();
  2707. } // Static
  2708. ;
  2709. Alert._jQueryInterface = function _jQueryInterface(config) {
  2710. return this.each(function () {
  2711. var $element = $(this);
  2712. var data = $element.data(DATA_KEY);
  2713. if (!data) {
  2714. data = new Alert(this);
  2715. $element.data(DATA_KEY, data);
  2716. }
  2717. if (config === 'close') {
  2718. data[config](this);
  2719. }
  2720. });
  2721. };
  2722. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2723. return function (event) {
  2724. if (event) {
  2725. event.preventDefault();
  2726. }
  2727. alertInstance.close(this);
  2728. };
  2729. };
  2730. _createClass(Alert, null, [{
  2731. key: "VERSION",
  2732. get: function get() {
  2733. return VERSION;
  2734. }
  2735. }]);
  2736. return Alert;
  2737. }();
  2738. /**
  2739. * ------------------------------------------------------------------------
  2740. * Data Api implementation
  2741. * ------------------------------------------------------------------------
  2742. */
  2743. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2744. /**
  2745. * ------------------------------------------------------------------------
  2746. * jQuery
  2747. * ------------------------------------------------------------------------
  2748. */
  2749. $.fn[NAME] = Alert._jQueryInterface;
  2750. $.fn[NAME].Constructor = Alert;
  2751. $.fn[NAME].noConflict = function () {
  2752. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2753. return Alert._jQueryInterface;
  2754. };
  2755. /**
  2756. * ------------------------------------------------------------------------
  2757. * Constants
  2758. * ------------------------------------------------------------------------
  2759. */
  2760. var NAME$1 = 'button';
  2761. var VERSION$1 = '4.4.1';
  2762. var DATA_KEY$1 = 'bs.button';
  2763. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2764. var DATA_API_KEY$1 = '.data-api';
  2765. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2766. var ClassName$1 = {
  2767. ACTIVE: 'active',
  2768. BUTTON: 'btn',
  2769. FOCUS: 'focus'
  2770. };
  2771. var Selector$1 = {
  2772. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2773. DATA_TOGGLES: '[data-toggle="buttons"]',
  2774. DATA_TOGGLE: '[data-toggle="button"]',
  2775. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2776. INPUT: 'input:not([type="hidden"])',
  2777. ACTIVE: '.active',
  2778. BUTTON: '.btn'
  2779. };
  2780. var Event$1 = {
  2781. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2782. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2783. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2784. };
  2785. /**
  2786. * ------------------------------------------------------------------------
  2787. * Class Definition
  2788. * ------------------------------------------------------------------------
  2789. */
  2790. var Button =
  2791. /*#__PURE__*/
  2792. function () {
  2793. function Button(element) {
  2794. this._element = element;
  2795. } // Getters
  2796. var _proto = Button.prototype;
  2797. // Public
  2798. _proto.toggle = function toggle() {
  2799. var triggerChangeEvent = true;
  2800. var addAriaPressed = true;
  2801. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2802. if (rootElement) {
  2803. var input = this._element.querySelector(Selector$1.INPUT);
  2804. if (input) {
  2805. if (input.type === 'radio') {
  2806. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2807. triggerChangeEvent = false;
  2808. } else {
  2809. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2810. if (activeElement) {
  2811. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2812. }
  2813. }
  2814. } else if (input.type === 'checkbox') {
  2815. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2816. triggerChangeEvent = false;
  2817. }
  2818. } else {
  2819. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2820. triggerChangeEvent = false;
  2821. }
  2822. if (triggerChangeEvent) {
  2823. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2824. $(input).trigger('change');
  2825. }
  2826. input.focus();
  2827. addAriaPressed = false;
  2828. }
  2829. }
  2830. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2831. if (addAriaPressed) {
  2832. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2833. }
  2834. if (triggerChangeEvent) {
  2835. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2836. }
  2837. }
  2838. };
  2839. _proto.dispose = function dispose() {
  2840. $.removeData(this._element, DATA_KEY$1);
  2841. this._element = null;
  2842. } // Static
  2843. ;
  2844. Button._jQueryInterface = function _jQueryInterface(config) {
  2845. return this.each(function () {
  2846. var data = $(this).data(DATA_KEY$1);
  2847. if (!data) {
  2848. data = new Button(this);
  2849. $(this).data(DATA_KEY$1, data);
  2850. }
  2851. if (config === 'toggle') {
  2852. data[config]();
  2853. }
  2854. });
  2855. };
  2856. _createClass(Button, null, [{
  2857. key: "VERSION",
  2858. get: function get() {
  2859. return VERSION$1;
  2860. }
  2861. }]);
  2862. return Button;
  2863. }();
  2864. /**
  2865. * ------------------------------------------------------------------------
  2866. * Data Api implementation
  2867. * ------------------------------------------------------------------------
  2868. */
  2869. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2870. var button = event.target;
  2871. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2872. button = $(button).closest(Selector$1.BUTTON)[0];
  2873. }
  2874. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2875. event.preventDefault(); // work around Firefox bug #1540995
  2876. } else {
  2877. var inputBtn = button.querySelector(Selector$1.INPUT);
  2878. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2879. event.preventDefault(); // work around Firefox bug #1540995
  2880. return;
  2881. }
  2882. Button._jQueryInterface.call($(button), 'toggle');
  2883. }
  2884. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2885. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2886. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2887. });
  2888. $(window).on(Event$1.LOAD_DATA_API, function () {
  2889. // ensure correct active class is set to match the controls' actual values/states
  2890. // find all checkboxes/readio buttons inside data-toggle groups
  2891. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2892. for (var i = 0, len = buttons.length; i < len; i++) {
  2893. var button = buttons[i];
  2894. var input = button.querySelector(Selector$1.INPUT);
  2895. if (input.checked || input.hasAttribute('checked')) {
  2896. button.classList.add(ClassName$1.ACTIVE);
  2897. } else {
  2898. button.classList.remove(ClassName$1.ACTIVE);
  2899. }
  2900. } // find all button toggles
  2901. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2902. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2903. var _button = buttons[_i];
  2904. if (_button.getAttribute('aria-pressed') === 'true') {
  2905. _button.classList.add(ClassName$1.ACTIVE);
  2906. } else {
  2907. _button.classList.remove(ClassName$1.ACTIVE);
  2908. }
  2909. }
  2910. });
  2911. /**
  2912. * ------------------------------------------------------------------------
  2913. * jQuery
  2914. * ------------------------------------------------------------------------
  2915. */
  2916. $.fn[NAME$1] = Button._jQueryInterface;
  2917. $.fn[NAME$1].Constructor = Button;
  2918. $.fn[NAME$1].noConflict = function () {
  2919. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2920. return Button._jQueryInterface;
  2921. };
  2922. /**
  2923. * ------------------------------------------------------------------------
  2924. * Constants
  2925. * ------------------------------------------------------------------------
  2926. */
  2927. var NAME$2 = 'carousel';
  2928. var VERSION$2 = '4.4.1';
  2929. var DATA_KEY$2 = 'bs.carousel';
  2930. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2931. var DATA_API_KEY$2 = '.data-api';
  2932. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2933. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2934. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2935. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2936. var SWIPE_THRESHOLD = 40;
  2937. var Default = {
  2938. interval: 5000,
  2939. keyboard: true,
  2940. slide: false,
  2941. pause: 'hover',
  2942. wrap: true,
  2943. touch: true
  2944. };
  2945. var DefaultType = {
  2946. interval: '(number|boolean)',
  2947. keyboard: 'boolean',
  2948. slide: '(boolean|string)',
  2949. pause: '(string|boolean)',
  2950. wrap: 'boolean',
  2951. touch: 'boolean'
  2952. };
  2953. var Direction = {
  2954. NEXT: 'next',
  2955. PREV: 'prev',
  2956. LEFT: 'left',
  2957. RIGHT: 'right'
  2958. };
  2959. var Event$2 = {
  2960. SLIDE: "slide" + EVENT_KEY$2,
  2961. SLID: "slid" + EVENT_KEY$2,
  2962. KEYDOWN: "keydown" + EVENT_KEY$2,
  2963. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2964. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2965. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2966. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2967. TOUCHEND: "touchend" + EVENT_KEY$2,
  2968. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2969. POINTERUP: "pointerup" + EVENT_KEY$2,
  2970. DRAG_START: "dragstart" + EVENT_KEY$2,
  2971. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2972. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2973. };
  2974. var ClassName$2 = {
  2975. CAROUSEL: 'carousel',
  2976. ACTIVE: 'active',
  2977. SLIDE: 'slide',
  2978. RIGHT: 'carousel-item-right',
  2979. LEFT: 'carousel-item-left',
  2980. NEXT: 'carousel-item-next',
  2981. PREV: 'carousel-item-prev',
  2982. ITEM: 'carousel-item',
  2983. POINTER_EVENT: 'pointer-event'
  2984. };
  2985. var Selector$2 = {
  2986. ACTIVE: '.active',
  2987. ACTIVE_ITEM: '.active.carousel-item',
  2988. ITEM: '.carousel-item',
  2989. ITEM_IMG: '.carousel-item img',
  2990. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2991. INDICATORS: '.carousel-indicators',
  2992. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2993. DATA_RIDE: '[data-ride="carousel"]'
  2994. };
  2995. var PointerType = {
  2996. TOUCH: 'touch',
  2997. PEN: 'pen'
  2998. };
  2999. /**
  3000. * ------------------------------------------------------------------------
  3001. * Class Definition
  3002. * ------------------------------------------------------------------------
  3003. */
  3004. var Carousel =
  3005. /*#__PURE__*/
  3006. function () {
  3007. function Carousel(element, config) {
  3008. this._items = null;
  3009. this._interval = null;
  3010. this._activeElement = null;
  3011. this._isPaused = false;
  3012. this._isSliding = false;
  3013. this.touchTimeout = null;
  3014. this.touchStartX = 0;
  3015. this.touchDeltaX = 0;
  3016. this._config = this._getConfig(config);
  3017. this._element = element;
  3018. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3019. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3020. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3021. this._addEventListeners();
  3022. } // Getters
  3023. var _proto = Carousel.prototype;
  3024. // Public
  3025. _proto.next = function next() {
  3026. if (!this._isSliding) {
  3027. this._slide(Direction.NEXT);
  3028. }
  3029. };
  3030. _proto.nextWhenVisible = function nextWhenVisible() {
  3031. // Don't call next when the page isn't visible
  3032. // or the carousel or its parent isn't visible
  3033. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3034. this.next();
  3035. }
  3036. };
  3037. _proto.prev = function prev() {
  3038. if (!this._isSliding) {
  3039. this._slide(Direction.PREV);
  3040. }
  3041. };
  3042. _proto.pause = function pause(event) {
  3043. if (!event) {
  3044. this._isPaused = true;
  3045. }
  3046. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3047. Util.triggerTransitionEnd(this._element);
  3048. this.cycle(true);
  3049. }
  3050. clearInterval(this._interval);
  3051. this._interval = null;
  3052. };
  3053. _proto.cycle = function cycle(event) {
  3054. if (!event) {
  3055. this._isPaused = false;
  3056. }
  3057. if (this._interval) {
  3058. clearInterval(this._interval);
  3059. this._interval = null;
  3060. }
  3061. if (this._config.interval && !this._isPaused) {
  3062. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3063. }
  3064. };
  3065. _proto.to = function to(index) {
  3066. var _this = this;
  3067. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3068. var activeIndex = this._getItemIndex(this._activeElement);
  3069. if (index > this._items.length - 1 || index < 0) {
  3070. return;
  3071. }
  3072. if (this._isSliding) {
  3073. $(this._element).one(Event$2.SLID, function () {
  3074. return _this.to(index);
  3075. });
  3076. return;
  3077. }
  3078. if (activeIndex === index) {
  3079. this.pause();
  3080. this.cycle();
  3081. return;
  3082. }
  3083. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3084. this._slide(direction, this._items[index]);
  3085. };
  3086. _proto.dispose = function dispose() {
  3087. $(this._element).off(EVENT_KEY$2);
  3088. $.removeData(this._element, DATA_KEY$2);
  3089. this._items = null;
  3090. this._config = null;
  3091. this._element = null;
  3092. this._interval = null;
  3093. this._isPaused = null;
  3094. this._isSliding = null;
  3095. this._activeElement = null;
  3096. this._indicatorsElement = null;
  3097. } // Private
  3098. ;
  3099. _proto._getConfig = function _getConfig(config) {
  3100. config = _objectSpread2({}, Default, {}, config);
  3101. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3102. return config;
  3103. };
  3104. _proto._handleSwipe = function _handleSwipe() {
  3105. var absDeltax = Math.abs(this.touchDeltaX);
  3106. if (absDeltax <= SWIPE_THRESHOLD) {
  3107. return;
  3108. }
  3109. var direction = absDeltax / this.touchDeltaX;
  3110. this.touchDeltaX = 0; // swipe left
  3111. if (direction > 0) {
  3112. this.prev();
  3113. } // swipe right
  3114. if (direction < 0) {
  3115. this.next();
  3116. }
  3117. };
  3118. _proto._addEventListeners = function _addEventListeners() {
  3119. var _this2 = this;
  3120. if (this._config.keyboard) {
  3121. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3122. return _this2._keydown(event);
  3123. });
  3124. }
  3125. if (this._config.pause === 'hover') {
  3126. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3127. return _this2.pause(event);
  3128. }).on(Event$2.MOUSELEAVE, function (event) {
  3129. return _this2.cycle(event);
  3130. });
  3131. }
  3132. if (this._config.touch) {
  3133. this._addTouchEventListeners();
  3134. }
  3135. };
  3136. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3137. var _this3 = this;
  3138. if (!this._touchSupported) {
  3139. return;
  3140. }
  3141. var start = function start(event) {
  3142. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3143. _this3.touchStartX = event.originalEvent.clientX;
  3144. } else if (!_this3._pointerEvent) {
  3145. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3146. }
  3147. };
  3148. var move = function move(event) {
  3149. // ensure swiping with one touch and not pinching
  3150. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3151. _this3.touchDeltaX = 0;
  3152. } else {
  3153. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3154. }
  3155. };
  3156. var end = function end(event) {
  3157. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3158. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3159. }
  3160. _this3._handleSwipe();
  3161. if (_this3._config.pause === 'hover') {
  3162. // If it's a touch-enabled device, mouseenter/leave are fired as
  3163. // part of the mouse compatibility events on first tap - the carousel
  3164. // would stop cycling until user tapped out of it;
  3165. // here, we listen for touchend, explicitly pause the carousel
  3166. // (as if it's the second time we tap on it, mouseenter compat event
  3167. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3168. // events to fire) we explicitly restart cycling
  3169. _this3.pause();
  3170. if (_this3.touchTimeout) {
  3171. clearTimeout(_this3.touchTimeout);
  3172. }
  3173. _this3.touchTimeout = setTimeout(function (event) {
  3174. return _this3.cycle(event);
  3175. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3176. }
  3177. };
  3178. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3179. return e.preventDefault();
  3180. });
  3181. if (this._pointerEvent) {
  3182. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3183. return start(event);
  3184. });
  3185. $(this._element).on(Event$2.POINTERUP, function (event) {
  3186. return end(event);
  3187. });
  3188. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3189. } else {
  3190. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3191. return start(event);
  3192. });
  3193. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3194. return move(event);
  3195. });
  3196. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3197. return end(event);
  3198. });
  3199. }
  3200. };
  3201. _proto._keydown = function _keydown(event) {
  3202. if (/input|textarea/i.test(event.target.tagName)) {
  3203. return;
  3204. }
  3205. switch (event.which) {
  3206. case ARROW_LEFT_KEYCODE:
  3207. event.preventDefault();
  3208. this.prev();
  3209. break;
  3210. case ARROW_RIGHT_KEYCODE:
  3211. event.preventDefault();
  3212. this.next();
  3213. break;
  3214. }
  3215. };
  3216. _proto._getItemIndex = function _getItemIndex(element) {
  3217. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3218. return this._items.indexOf(element);
  3219. };
  3220. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3221. var isNextDirection = direction === Direction.NEXT;
  3222. var isPrevDirection = direction === Direction.PREV;
  3223. var activeIndex = this._getItemIndex(activeElement);
  3224. var lastItemIndex = this._items.length - 1;
  3225. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3226. if (isGoingToWrap && !this._config.wrap) {
  3227. return activeElement;
  3228. }
  3229. var delta = direction === Direction.PREV ? -1 : 1;
  3230. var itemIndex = (activeIndex + delta) % this._items.length;
  3231. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3232. };
  3233. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3234. var targetIndex = this._getItemIndex(relatedTarget);
  3235. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3236. var slideEvent = $.Event(Event$2.SLIDE, {
  3237. relatedTarget: relatedTarget,
  3238. direction: eventDirectionName,
  3239. from: fromIndex,
  3240. to: targetIndex
  3241. });
  3242. $(this._element).trigger(slideEvent);
  3243. return slideEvent;
  3244. };
  3245. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3246. if (this._indicatorsElement) {
  3247. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3248. $(indicators).removeClass(ClassName$2.ACTIVE);
  3249. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3250. if (nextIndicator) {
  3251. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3252. }
  3253. }
  3254. };
  3255. _proto._slide = function _slide(direction, element) {
  3256. var _this4 = this;
  3257. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3258. var activeElementIndex = this._getItemIndex(activeElement);
  3259. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3260. var nextElementIndex = this._getItemIndex(nextElement);
  3261. var isCycling = Boolean(this._interval);
  3262. var directionalClassName;
  3263. var orderClassName;
  3264. var eventDirectionName;
  3265. if (direction === Direction.NEXT) {
  3266. directionalClassName = ClassName$2.LEFT;
  3267. orderClassName = ClassName$2.NEXT;
  3268. eventDirectionName = Direction.LEFT;
  3269. } else {
  3270. directionalClassName = ClassName$2.RIGHT;
  3271. orderClassName = ClassName$2.PREV;
  3272. eventDirectionName = Direction.RIGHT;
  3273. }
  3274. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3275. this._isSliding = false;
  3276. return;
  3277. }
  3278. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3279. if (slideEvent.isDefaultPrevented()) {
  3280. return;
  3281. }
  3282. if (!activeElement || !nextElement) {
  3283. // Some weirdness is happening, so we bail
  3284. return;
  3285. }
  3286. this._isSliding = true;
  3287. if (isCycling) {
  3288. this.pause();
  3289. }
  3290. this._setActiveIndicatorElement(nextElement);
  3291. var slidEvent = $.Event(Event$2.SLID, {
  3292. relatedTarget: nextElement,
  3293. direction: eventDirectionName,
  3294. from: activeElementIndex,
  3295. to: nextElementIndex
  3296. });
  3297. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3298. $(nextElement).addClass(orderClassName);
  3299. Util.reflow(nextElement);
  3300. $(activeElement).addClass(directionalClassName);
  3301. $(nextElement).addClass(directionalClassName);
  3302. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3303. if (nextElementInterval) {
  3304. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3305. this._config.interval = nextElementInterval;
  3306. } else {
  3307. this._config.interval = this._config.defaultInterval || this._config.interval;
  3308. }
  3309. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3310. $(activeElement).one(Util.TRANSITION_END, function () {
  3311. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3312. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3313. _this4._isSliding = false;
  3314. setTimeout(function () {
  3315. return $(_this4._element).trigger(slidEvent);
  3316. }, 0);
  3317. }).emulateTransitionEnd(transitionDuration);
  3318. } else {
  3319. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3320. $(nextElement).addClass(ClassName$2.ACTIVE);
  3321. this._isSliding = false;
  3322. $(this._element).trigger(slidEvent);
  3323. }
  3324. if (isCycling) {
  3325. this.cycle();
  3326. }
  3327. } // Static
  3328. ;
  3329. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3330. return this.each(function () {
  3331. var data = $(this).data(DATA_KEY$2);
  3332. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3333. if (typeof config === 'object') {
  3334. _config = _objectSpread2({}, _config, {}, config);
  3335. }
  3336. var action = typeof config === 'string' ? config : _config.slide;
  3337. if (!data) {
  3338. data = new Carousel(this, _config);
  3339. $(this).data(DATA_KEY$2, data);
  3340. }
  3341. if (typeof config === 'number') {
  3342. data.to(config);
  3343. } else if (typeof action === 'string') {
  3344. if (typeof data[action] === 'undefined') {
  3345. throw new TypeError("No method named \"" + action + "\"");
  3346. }
  3347. data[action]();
  3348. } else if (_config.interval && _config.ride) {
  3349. data.pause();
  3350. data.cycle();
  3351. }
  3352. });
  3353. };
  3354. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3355. var selector = Util.getSelectorFromElement(this);
  3356. if (!selector) {
  3357. return;
  3358. }
  3359. var target = $(selector)[0];
  3360. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3361. return;
  3362. }
  3363. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3364. var slideIndex = this.getAttribute('data-slide-to');
  3365. if (slideIndex) {
  3366. config.interval = false;
  3367. }
  3368. Carousel._jQueryInterface.call($(target), config);
  3369. if (slideIndex) {
  3370. $(target).data(DATA_KEY$2).to(slideIndex);
  3371. }
  3372. event.preventDefault();
  3373. };
  3374. _createClass(Carousel, null, [{
  3375. key: "VERSION",
  3376. get: function get() {
  3377. return VERSION$2;
  3378. }
  3379. }, {
  3380. key: "Default",
  3381. get: function get() {
  3382. return Default;
  3383. }
  3384. }]);
  3385. return Carousel;
  3386. }();
  3387. /**
  3388. * ------------------------------------------------------------------------
  3389. * Data Api implementation
  3390. * ------------------------------------------------------------------------
  3391. */
  3392. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3393. $(window).on(Event$2.LOAD_DATA_API, function () {
  3394. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3395. for (var i = 0, len = carousels.length; i < len; i++) {
  3396. var $carousel = $(carousels[i]);
  3397. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3398. }
  3399. });
  3400. /**
  3401. * ------------------------------------------------------------------------
  3402. * jQuery
  3403. * ------------------------------------------------------------------------
  3404. */
  3405. $.fn[NAME$2] = Carousel._jQueryInterface;
  3406. $.fn[NAME$2].Constructor = Carousel;
  3407. $.fn[NAME$2].noConflict = function () {
  3408. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3409. return Carousel._jQueryInterface;
  3410. };
  3411. /**
  3412. * ------------------------------------------------------------------------
  3413. * Constants
  3414. * ------------------------------------------------------------------------
  3415. */
  3416. var NAME$3 = 'collapse';
  3417. var VERSION$3 = '4.4.1';
  3418. var DATA_KEY$3 = 'bs.collapse';
  3419. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3420. var DATA_API_KEY$3 = '.data-api';
  3421. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3422. var Default$1 = {
  3423. toggle: true,
  3424. parent: ''
  3425. };
  3426. var DefaultType$1 = {
  3427. toggle: 'boolean',
  3428. parent: '(string|element)'
  3429. };
  3430. var Event$3 = {
  3431. SHOW: "show" + EVENT_KEY$3,
  3432. SHOWN: "shown" + EVENT_KEY$3,
  3433. HIDE: "hide" + EVENT_KEY$3,
  3434. HIDDEN: "hidden" + EVENT_KEY$3,
  3435. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3436. };
  3437. var ClassName$3 = {
  3438. SHOW: 'show',
  3439. COLLAPSE: 'collapse',
  3440. COLLAPSING: 'collapsing',
  3441. COLLAPSED: 'collapsed'
  3442. };
  3443. var Dimension = {
  3444. WIDTH: 'width',
  3445. HEIGHT: 'height'
  3446. };
  3447. var Selector$3 = {
  3448. ACTIVES: '.show, .collapsing',
  3449. DATA_TOGGLE: '[data-toggle="collapse"]'
  3450. };
  3451. /**
  3452. * ------------------------------------------------------------------------
  3453. * Class Definition
  3454. * ------------------------------------------------------------------------
  3455. */
  3456. var Collapse =
  3457. /*#__PURE__*/
  3458. function () {
  3459. function Collapse(element, config) {
  3460. this._isTransitioning = false;
  3461. this._element = element;
  3462. this._config = this._getConfig(config);
  3463. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3464. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3465. for (var i = 0, len = toggleList.length; i < len; i++) {
  3466. var elem = toggleList[i];
  3467. var selector = Util.getSelectorFromElement(elem);
  3468. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3469. return foundElem === element;
  3470. });
  3471. if (selector !== null && filterElement.length > 0) {
  3472. this._selector = selector;
  3473. this._triggerArray.push(elem);
  3474. }
  3475. }
  3476. this._parent = this._config.parent ? this._getParent() : null;
  3477. if (!this._config.parent) {
  3478. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3479. }
  3480. if (this._config.toggle) {
  3481. this.toggle();
  3482. }
  3483. } // Getters
  3484. var _proto = Collapse.prototype;
  3485. // Public
  3486. _proto.toggle = function toggle() {
  3487. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3488. this.hide();
  3489. } else {
  3490. this.show();
  3491. }
  3492. };
  3493. _proto.show = function show() {
  3494. var _this = this;
  3495. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3496. return;
  3497. }
  3498. var actives;
  3499. var activesData;
  3500. if (this._parent) {
  3501. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3502. if (typeof _this._config.parent === 'string') {
  3503. return elem.getAttribute('data-parent') === _this._config.parent;
  3504. }
  3505. return elem.classList.contains(ClassName$3.COLLAPSE);
  3506. });
  3507. if (actives.length === 0) {
  3508. actives = null;
  3509. }
  3510. }
  3511. if (actives) {
  3512. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3513. if (activesData && activesData._isTransitioning) {
  3514. return;
  3515. }
  3516. }
  3517. var startEvent = $.Event(Event$3.SHOW);
  3518. $(this._element).trigger(startEvent);
  3519. if (startEvent.isDefaultPrevented()) {
  3520. return;
  3521. }
  3522. if (actives) {
  3523. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3524. if (!activesData) {
  3525. $(actives).data(DATA_KEY$3, null);
  3526. }
  3527. }
  3528. var dimension = this._getDimension();
  3529. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3530. this._element.style[dimension] = 0;
  3531. if (this._triggerArray.length) {
  3532. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3533. }
  3534. this.setTransitioning(true);
  3535. var complete = function complete() {
  3536. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3537. _this._element.style[dimension] = '';
  3538. _this.setTransitioning(false);
  3539. $(_this._element).trigger(Event$3.SHOWN);
  3540. };
  3541. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3542. var scrollSize = "scroll" + capitalizedDimension;
  3543. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3544. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3545. this._element.style[dimension] = this._element[scrollSize] + "px";
  3546. };
  3547. _proto.hide = function hide() {
  3548. var _this2 = this;
  3549. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3550. return;
  3551. }
  3552. var startEvent = $.Event(Event$3.HIDE);
  3553. $(this._element).trigger(startEvent);
  3554. if (startEvent.isDefaultPrevented()) {
  3555. return;
  3556. }
  3557. var dimension = this._getDimension();
  3558. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3559. Util.reflow(this._element);
  3560. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3561. var triggerArrayLength = this._triggerArray.length;
  3562. if (triggerArrayLength > 0) {
  3563. for (var i = 0; i < triggerArrayLength; i++) {
  3564. var trigger = this._triggerArray[i];
  3565. var selector = Util.getSelectorFromElement(trigger);
  3566. if (selector !== null) {
  3567. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3568. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3569. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3570. }
  3571. }
  3572. }
  3573. }
  3574. this.setTransitioning(true);
  3575. var complete = function complete() {
  3576. _this2.setTransitioning(false);
  3577. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3578. };
  3579. this._element.style[dimension] = '';
  3580. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3581. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3582. };
  3583. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3584. this._isTransitioning = isTransitioning;
  3585. };
  3586. _proto.dispose = function dispose() {
  3587. $.removeData(this._element, DATA_KEY$3);
  3588. this._config = null;
  3589. this._parent = null;
  3590. this._element = null;
  3591. this._triggerArray = null;
  3592. this._isTransitioning = null;
  3593. } // Private
  3594. ;
  3595. _proto._getConfig = function _getConfig(config) {
  3596. config = _objectSpread2({}, Default$1, {}, config);
  3597. config.toggle = Boolean(config.toggle); // Coerce string values
  3598. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3599. return config;
  3600. };
  3601. _proto._getDimension = function _getDimension() {
  3602. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3603. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3604. };
  3605. _proto._getParent = function _getParent() {
  3606. var _this3 = this;
  3607. var parent;
  3608. if (Util.isElement(this._config.parent)) {
  3609. parent = this._config.parent; // It's a jQuery object
  3610. if (typeof this._config.parent.jquery !== 'undefined') {
  3611. parent = this._config.parent[0];
  3612. }
  3613. } else {
  3614. parent = document.querySelector(this._config.parent);
  3615. }
  3616. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3617. var children = [].slice.call(parent.querySelectorAll(selector));
  3618. $(children).each(function (i, element) {
  3619. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3620. });
  3621. return parent;
  3622. };
  3623. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3624. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3625. if (triggerArray.length) {
  3626. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3627. }
  3628. } // Static
  3629. ;
  3630. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3631. var selector = Util.getSelectorFromElement(element);
  3632. return selector ? document.querySelector(selector) : null;
  3633. };
  3634. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3635. return this.each(function () {
  3636. var $this = $(this);
  3637. var data = $this.data(DATA_KEY$3);
  3638. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3639. if (!data && _config.toggle && /show|hide/.test(config)) {
  3640. _config.toggle = false;
  3641. }
  3642. if (!data) {
  3643. data = new Collapse(this, _config);
  3644. $this.data(DATA_KEY$3, data);
  3645. }
  3646. if (typeof config === 'string') {
  3647. if (typeof data[config] === 'undefined') {
  3648. throw new TypeError("No method named \"" + config + "\"");
  3649. }
  3650. data[config]();
  3651. }
  3652. });
  3653. };
  3654. _createClass(Collapse, null, [{
  3655. key: "VERSION",
  3656. get: function get() {
  3657. return VERSION$3;
  3658. }
  3659. }, {
  3660. key: "Default",
  3661. get: function get() {
  3662. return Default$1;
  3663. }
  3664. }]);
  3665. return Collapse;
  3666. }();
  3667. /**
  3668. * ------------------------------------------------------------------------
  3669. * Data Api implementation
  3670. * ------------------------------------------------------------------------
  3671. */
  3672. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3673. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3674. if (event.currentTarget.tagName === 'A') {
  3675. event.preventDefault();
  3676. }
  3677. var $trigger = $(this);
  3678. var selector = Util.getSelectorFromElement(this);
  3679. var selectors = [].slice.call(document.querySelectorAll(selector));
  3680. $(selectors).each(function () {
  3681. var $target = $(this);
  3682. var data = $target.data(DATA_KEY$3);
  3683. var config = data ? 'toggle' : $trigger.data();
  3684. Collapse._jQueryInterface.call($target, config);
  3685. });
  3686. });
  3687. /**
  3688. * ------------------------------------------------------------------------
  3689. * jQuery
  3690. * ------------------------------------------------------------------------
  3691. */
  3692. $.fn[NAME$3] = Collapse._jQueryInterface;
  3693. $.fn[NAME$3].Constructor = Collapse;
  3694. $.fn[NAME$3].noConflict = function () {
  3695. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3696. return Collapse._jQueryInterface;
  3697. };
  3698. /**
  3699. * ------------------------------------------------------------------------
  3700. * Constants
  3701. * ------------------------------------------------------------------------
  3702. */
  3703. var NAME$4 = 'dropdown';
  3704. var VERSION$4 = '4.4.1';
  3705. var DATA_KEY$4 = 'bs.dropdown';
  3706. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3707. var DATA_API_KEY$4 = '.data-api';
  3708. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3709. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3710. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3711. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3712. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3713. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3714. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3715. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3716. var Event$4 = {
  3717. HIDE: "hide" + EVENT_KEY$4,
  3718. HIDDEN: "hidden" + EVENT_KEY$4,
  3719. SHOW: "show" + EVENT_KEY$4,
  3720. SHOWN: "shown" + EVENT_KEY$4,
  3721. CLICK: "click" + EVENT_KEY$4,
  3722. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3723. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3724. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3725. };
  3726. var ClassName$4 = {
  3727. DISABLED: 'disabled',
  3728. SHOW: 'show',
  3729. DROPUP: 'dropup',
  3730. DROPRIGHT: 'dropright',
  3731. DROPLEFT: 'dropleft',
  3732. MENURIGHT: 'dropdown-menu-right',
  3733. MENULEFT: 'dropdown-menu-left',
  3734. POSITION_STATIC: 'position-static'
  3735. };
  3736. var Selector$4 = {
  3737. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3738. FORM_CHILD: '.dropdown form',
  3739. MENU: '.dropdown-menu',
  3740. NAVBAR_NAV: '.navbar-nav',
  3741. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3742. };
  3743. var AttachmentMap = {
  3744. TOP: 'top-start',
  3745. TOPEND: 'top-end',
  3746. BOTTOM: 'bottom-start',
  3747. BOTTOMEND: 'bottom-end',
  3748. RIGHT: 'right-start',
  3749. RIGHTEND: 'right-end',
  3750. LEFT: 'left-start',
  3751. LEFTEND: 'left-end'
  3752. };
  3753. var Default$2 = {
  3754. offset: 0,
  3755. flip: true,
  3756. boundary: 'scrollParent',
  3757. reference: 'toggle',
  3758. display: 'dynamic',
  3759. popperConfig: null
  3760. };
  3761. var DefaultType$2 = {
  3762. offset: '(number|string|function)',
  3763. flip: 'boolean',
  3764. boundary: '(string|element)',
  3765. reference: '(string|element)',
  3766. display: 'string',
  3767. popperConfig: '(null|object)'
  3768. };
  3769. /**
  3770. * ------------------------------------------------------------------------
  3771. * Class Definition
  3772. * ------------------------------------------------------------------------
  3773. */
  3774. var Dropdown =
  3775. /*#__PURE__*/
  3776. function () {
  3777. function Dropdown(element, config) {
  3778. this._element = element;
  3779. this._popper = null;
  3780. this._config = this._getConfig(config);
  3781. this._menu = this._getMenuElement();
  3782. this._inNavbar = this._detectNavbar();
  3783. this._addEventListeners();
  3784. } // Getters
  3785. var _proto = Dropdown.prototype;
  3786. // Public
  3787. _proto.toggle = function toggle() {
  3788. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3789. return;
  3790. }
  3791. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3792. Dropdown._clearMenus();
  3793. if (isActive) {
  3794. return;
  3795. }
  3796. this.show(true);
  3797. };
  3798. _proto.show = function show(usePopper) {
  3799. if (usePopper === void 0) {
  3800. usePopper = false;
  3801. }
  3802. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3803. return;
  3804. }
  3805. var relatedTarget = {
  3806. relatedTarget: this._element
  3807. };
  3808. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3809. var parent = Dropdown._getParentFromElement(this._element);
  3810. $(parent).trigger(showEvent);
  3811. if (showEvent.isDefaultPrevented()) {
  3812. return;
  3813. } // Disable totally Popper.js for Dropdown in Navbar
  3814. if (!this._inNavbar && usePopper) {
  3815. /**
  3816. * Check for Popper dependency
  3817. * Popper - https://popper.js.org
  3818. */
  3819. if (typeof Popper === 'undefined') {
  3820. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3821. }
  3822. var referenceElement = this._element;
  3823. if (this._config.reference === 'parent') {
  3824. referenceElement = parent;
  3825. } else if (Util.isElement(this._config.reference)) {
  3826. referenceElement = this._config.reference; // Check if it's jQuery element
  3827. if (typeof this._config.reference.jquery !== 'undefined') {
  3828. referenceElement = this._config.reference[0];
  3829. }
  3830. } // If boundary is not `scrollParent`, then set position to `static`
  3831. // to allow the menu to "escape" the scroll parent's boundaries
  3832. // https://github.com/twbs/bootstrap/issues/24251
  3833. if (this._config.boundary !== 'scrollParent') {
  3834. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3835. }
  3836. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3837. } // If this is a touch-enabled device we add extra
  3838. // empty mouseover listeners to the body's immediate children;
  3839. // only needed because of broken event delegation on iOS
  3840. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3841. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3842. $(document.body).children().on('mouseover', null, $.noop);
  3843. }
  3844. this._element.focus();
  3845. this._element.setAttribute('aria-expanded', true);
  3846. $(this._menu).toggleClass(ClassName$4.SHOW);
  3847. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3848. };
  3849. _proto.hide = function hide() {
  3850. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3851. return;
  3852. }
  3853. var relatedTarget = {
  3854. relatedTarget: this._element
  3855. };
  3856. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3857. var parent = Dropdown._getParentFromElement(this._element);
  3858. $(parent).trigger(hideEvent);
  3859. if (hideEvent.isDefaultPrevented()) {
  3860. return;
  3861. }
  3862. if (this._popper) {
  3863. this._popper.destroy();
  3864. }
  3865. $(this._menu).toggleClass(ClassName$4.SHOW);
  3866. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3867. };
  3868. _proto.dispose = function dispose() {
  3869. $.removeData(this._element, DATA_KEY$4);
  3870. $(this._element).off(EVENT_KEY$4);
  3871. this._element = null;
  3872. this._menu = null;
  3873. if (this._popper !== null) {
  3874. this._popper.destroy();
  3875. this._popper = null;
  3876. }
  3877. };
  3878. _proto.update = function update() {
  3879. this._inNavbar = this._detectNavbar();
  3880. if (this._popper !== null) {
  3881. this._popper.scheduleUpdate();
  3882. }
  3883. } // Private
  3884. ;
  3885. _proto._addEventListeners = function _addEventListeners() {
  3886. var _this = this;
  3887. $(this._element).on(Event$4.CLICK, function (event) {
  3888. event.preventDefault();
  3889. event.stopPropagation();
  3890. _this.toggle();
  3891. });
  3892. };
  3893. _proto._getConfig = function _getConfig(config) {
  3894. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3895. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3896. return config;
  3897. };
  3898. _proto._getMenuElement = function _getMenuElement() {
  3899. if (!this._menu) {
  3900. var parent = Dropdown._getParentFromElement(this._element);
  3901. if (parent) {
  3902. this._menu = parent.querySelector(Selector$4.MENU);
  3903. }
  3904. }
  3905. return this._menu;
  3906. };
  3907. _proto._getPlacement = function _getPlacement() {
  3908. var $parentDropdown = $(this._element.parentNode);
  3909. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3910. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3911. placement = AttachmentMap.TOP;
  3912. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3913. placement = AttachmentMap.TOPEND;
  3914. }
  3915. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3916. placement = AttachmentMap.RIGHT;
  3917. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3918. placement = AttachmentMap.LEFT;
  3919. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3920. placement = AttachmentMap.BOTTOMEND;
  3921. }
  3922. return placement;
  3923. };
  3924. _proto._detectNavbar = function _detectNavbar() {
  3925. return $(this._element).closest('.navbar').length > 0;
  3926. };
  3927. _proto._getOffset = function _getOffset() {
  3928. var _this2 = this;
  3929. var offset = {};
  3930. if (typeof this._config.offset === 'function') {
  3931. offset.fn = function (data) {
  3932. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3933. return data;
  3934. };
  3935. } else {
  3936. offset.offset = this._config.offset;
  3937. }
  3938. return offset;
  3939. };
  3940. _proto._getPopperConfig = function _getPopperConfig() {
  3941. var popperConfig = {
  3942. placement: this._getPlacement(),
  3943. modifiers: {
  3944. offset: this._getOffset(),
  3945. flip: {
  3946. enabled: this._config.flip
  3947. },
  3948. preventOverflow: {
  3949. boundariesElement: this._config.boundary
  3950. }
  3951. }
  3952. }; // Disable Popper.js if we have a static display
  3953. if (this._config.display === 'static') {
  3954. popperConfig.modifiers.applyStyle = {
  3955. enabled: false
  3956. };
  3957. }
  3958. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3959. } // Static
  3960. ;
  3961. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3962. return this.each(function () {
  3963. var data = $(this).data(DATA_KEY$4);
  3964. var _config = typeof config === 'object' ? config : null;
  3965. if (!data) {
  3966. data = new Dropdown(this, _config);
  3967. $(this).data(DATA_KEY$4, data);
  3968. }
  3969. if (typeof config === 'string') {
  3970. if (typeof data[config] === 'undefined') {
  3971. throw new TypeError("No method named \"" + config + "\"");
  3972. }
  3973. data[config]();
  3974. }
  3975. });
  3976. };
  3977. Dropdown._clearMenus = function _clearMenus(event) {
  3978. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3979. return;
  3980. }
  3981. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3982. for (var i = 0, len = toggles.length; i < len; i++) {
  3983. var parent = Dropdown._getParentFromElement(toggles[i]);
  3984. var context = $(toggles[i]).data(DATA_KEY$4);
  3985. var relatedTarget = {
  3986. relatedTarget: toggles[i]
  3987. };
  3988. if (event && event.type === 'click') {
  3989. relatedTarget.clickEvent = event;
  3990. }
  3991. if (!context) {
  3992. continue;
  3993. }
  3994. var dropdownMenu = context._menu;
  3995. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3996. continue;
  3997. }
  3998. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3999. continue;
  4000. }
  4001. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4002. $(parent).trigger(hideEvent);
  4003. if (hideEvent.isDefaultPrevented()) {
  4004. continue;
  4005. } // If this is a touch-enabled device we remove the extra
  4006. // empty mouseover listeners we added for iOS support
  4007. if ('ontouchstart' in document.documentElement) {
  4008. $(document.body).children().off('mouseover', null, $.noop);
  4009. }
  4010. toggles[i].setAttribute('aria-expanded', 'false');
  4011. if (context._popper) {
  4012. context._popper.destroy();
  4013. }
  4014. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4015. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4016. }
  4017. };
  4018. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4019. var parent;
  4020. var selector = Util.getSelectorFromElement(element);
  4021. if (selector) {
  4022. parent = document.querySelector(selector);
  4023. }
  4024. return parent || element.parentNode;
  4025. } // eslint-disable-next-line complexity
  4026. ;
  4027. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4028. // If not input/textarea:
  4029. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4030. // If input/textarea:
  4031. // - If space key => not a dropdown command
  4032. // - If key is other than escape
  4033. // - If key is not up or down => not a dropdown command
  4034. // - If trigger inside the menu => not a dropdown command
  4035. 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)) {
  4036. return;
  4037. }
  4038. event.preventDefault();
  4039. event.stopPropagation();
  4040. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4041. return;
  4042. }
  4043. var parent = Dropdown._getParentFromElement(this);
  4044. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4045. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4046. return;
  4047. }
  4048. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4049. if (event.which === ESCAPE_KEYCODE) {
  4050. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4051. $(toggle).trigger('focus');
  4052. }
  4053. $(this).trigger('click');
  4054. return;
  4055. }
  4056. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4057. return $(item).is(':visible');
  4058. });
  4059. if (items.length === 0) {
  4060. return;
  4061. }
  4062. var index = items.indexOf(event.target);
  4063. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4064. // Up
  4065. index--;
  4066. }
  4067. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4068. // Down
  4069. index++;
  4070. }
  4071. if (index < 0) {
  4072. index = 0;
  4073. }
  4074. items[index].focus();
  4075. };
  4076. _createClass(Dropdown, null, [{
  4077. key: "VERSION",
  4078. get: function get() {
  4079. return VERSION$4;
  4080. }
  4081. }, {
  4082. key: "Default",
  4083. get: function get() {
  4084. return Default$2;
  4085. }
  4086. }, {
  4087. key: "DefaultType",
  4088. get: function get() {
  4089. return DefaultType$2;
  4090. }
  4091. }]);
  4092. return Dropdown;
  4093. }();
  4094. /**
  4095. * ------------------------------------------------------------------------
  4096. * Data Api implementation
  4097. * ------------------------------------------------------------------------
  4098. */
  4099. $(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) {
  4100. event.preventDefault();
  4101. event.stopPropagation();
  4102. Dropdown._jQueryInterface.call($(this), 'toggle');
  4103. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4104. e.stopPropagation();
  4105. });
  4106. /**
  4107. * ------------------------------------------------------------------------
  4108. * jQuery
  4109. * ------------------------------------------------------------------------
  4110. */
  4111. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4112. $.fn[NAME$4].Constructor = Dropdown;
  4113. $.fn[NAME$4].noConflict = function () {
  4114. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4115. return Dropdown._jQueryInterface;
  4116. };
  4117. /**
  4118. * ------------------------------------------------------------------------
  4119. * Constants
  4120. * ------------------------------------------------------------------------
  4121. */
  4122. var NAME$5 = 'modal';
  4123. var VERSION$5 = '4.4.1';
  4124. var DATA_KEY$5 = 'bs.modal';
  4125. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4126. var DATA_API_KEY$5 = '.data-api';
  4127. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4128. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4129. var Default$3 = {
  4130. backdrop: true,
  4131. keyboard: true,
  4132. focus: true,
  4133. show: true
  4134. };
  4135. var DefaultType$3 = {
  4136. backdrop: '(boolean|string)',
  4137. keyboard: 'boolean',
  4138. focus: 'boolean',
  4139. show: 'boolean'
  4140. };
  4141. var Event$5 = {
  4142. HIDE: "hide" + EVENT_KEY$5,
  4143. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4144. HIDDEN: "hidden" + EVENT_KEY$5,
  4145. SHOW: "show" + EVENT_KEY$5,
  4146. SHOWN: "shown" + EVENT_KEY$5,
  4147. FOCUSIN: "focusin" + EVENT_KEY$5,
  4148. RESIZE: "resize" + EVENT_KEY$5,
  4149. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4150. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4151. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4152. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4153. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4154. };
  4155. var ClassName$5 = {
  4156. SCROLLABLE: 'modal-dialog-scrollable',
  4157. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4158. BACKDROP: 'modal-backdrop',
  4159. OPEN: 'modal-open',
  4160. FADE: 'fade',
  4161. SHOW: 'show',
  4162. STATIC: 'modal-static'
  4163. };
  4164. var Selector$5 = {
  4165. DIALOG: '.modal-dialog',
  4166. MODAL_BODY: '.modal-body',
  4167. DATA_TOGGLE: '[data-toggle="modal"]',
  4168. DATA_DISMISS: '[data-dismiss="modal"]',
  4169. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4170. STICKY_CONTENT: '.sticky-top'
  4171. };
  4172. /**
  4173. * ------------------------------------------------------------------------
  4174. * Class Definition
  4175. * ------------------------------------------------------------------------
  4176. */
  4177. var Modal =
  4178. /*#__PURE__*/
  4179. function () {
  4180. function Modal(element, config) {
  4181. this._config = this._getConfig(config);
  4182. this._element = element;
  4183. this._dialog = element.querySelector(Selector$5.DIALOG);
  4184. this._backdrop = null;
  4185. this._isShown = false;
  4186. this._isBodyOverflowing = false;
  4187. this._ignoreBackdropClick = false;
  4188. this._isTransitioning = false;
  4189. this._scrollbarWidth = 0;
  4190. } // Getters
  4191. var _proto = Modal.prototype;
  4192. // Public
  4193. _proto.toggle = function toggle(relatedTarget) {
  4194. return this._isShown ? this.hide() : this.show(relatedTarget);
  4195. };
  4196. _proto.show = function show(relatedTarget) {
  4197. var _this = this;
  4198. if (this._isShown || this._isTransitioning) {
  4199. return;
  4200. }
  4201. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4202. this._isTransitioning = true;
  4203. }
  4204. var showEvent = $.Event(Event$5.SHOW, {
  4205. relatedTarget: relatedTarget
  4206. });
  4207. $(this._element).trigger(showEvent);
  4208. if (this._isShown || showEvent.isDefaultPrevented()) {
  4209. return;
  4210. }
  4211. this._isShown = true;
  4212. this._checkScrollbar();
  4213. this._setScrollbar();
  4214. this._adjustDialog();
  4215. this._setEscapeEvent();
  4216. this._setResizeEvent();
  4217. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4218. return _this.hide(event);
  4219. });
  4220. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4221. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4222. if ($(event.target).is(_this._element)) {
  4223. _this._ignoreBackdropClick = true;
  4224. }
  4225. });
  4226. });
  4227. this._showBackdrop(function () {
  4228. return _this._showElement(relatedTarget);
  4229. });
  4230. };
  4231. _proto.hide = function hide(event) {
  4232. var _this2 = this;
  4233. if (event) {
  4234. event.preventDefault();
  4235. }
  4236. if (!this._isShown || this._isTransitioning) {
  4237. return;
  4238. }
  4239. var hideEvent = $.Event(Event$5.HIDE);
  4240. $(this._element).trigger(hideEvent);
  4241. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4242. return;
  4243. }
  4244. this._isShown = false;
  4245. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4246. if (transition) {
  4247. this._isTransitioning = true;
  4248. }
  4249. this._setEscapeEvent();
  4250. this._setResizeEvent();
  4251. $(document).off(Event$5.FOCUSIN);
  4252. $(this._element).removeClass(ClassName$5.SHOW);
  4253. $(this._element).off(Event$5.CLICK_DISMISS);
  4254. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4255. if (transition) {
  4256. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4257. $(this._element).one(Util.TRANSITION_END, function (event) {
  4258. return _this2._hideModal(event);
  4259. }).emulateTransitionEnd(transitionDuration);
  4260. } else {
  4261. this._hideModal();
  4262. }
  4263. };
  4264. _proto.dispose = function dispose() {
  4265. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4266. return $(htmlElement).off(EVENT_KEY$5);
  4267. });
  4268. /**
  4269. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4270. * Do not move `document` in `htmlElements` array
  4271. * It will remove `Event.CLICK_DATA_API` event that should remain
  4272. */
  4273. $(document).off(Event$5.FOCUSIN);
  4274. $.removeData(this._element, DATA_KEY$5);
  4275. this._config = null;
  4276. this._element = null;
  4277. this._dialog = null;
  4278. this._backdrop = null;
  4279. this._isShown = null;
  4280. this._isBodyOverflowing = null;
  4281. this._ignoreBackdropClick = null;
  4282. this._isTransitioning = null;
  4283. this._scrollbarWidth = null;
  4284. };
  4285. _proto.handleUpdate = function handleUpdate() {
  4286. this._adjustDialog();
  4287. } // Private
  4288. ;
  4289. _proto._getConfig = function _getConfig(config) {
  4290. config = _objectSpread2({}, Default$3, {}, config);
  4291. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4292. return config;
  4293. };
  4294. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4295. var _this3 = this;
  4296. if (this._config.backdrop === 'static') {
  4297. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4298. $(this._element).trigger(hideEventPrevented);
  4299. if (hideEventPrevented.defaultPrevented) {
  4300. return;
  4301. }
  4302. this._element.classList.add(ClassName$5.STATIC);
  4303. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4304. $(this._element).one(Util.TRANSITION_END, function () {
  4305. _this3._element.classList.remove(ClassName$5.STATIC);
  4306. }).emulateTransitionEnd(modalTransitionDuration);
  4307. this._element.focus();
  4308. } else {
  4309. this.hide();
  4310. }
  4311. };
  4312. _proto._showElement = function _showElement(relatedTarget) {
  4313. var _this4 = this;
  4314. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4315. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4316. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4317. // Don't move modal's DOM position
  4318. document.body.appendChild(this._element);
  4319. }
  4320. this._element.style.display = 'block';
  4321. this._element.removeAttribute('aria-hidden');
  4322. this._element.setAttribute('aria-modal', true);
  4323. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4324. modalBody.scrollTop = 0;
  4325. } else {
  4326. this._element.scrollTop = 0;
  4327. }
  4328. if (transition) {
  4329. Util.reflow(this._element);
  4330. }
  4331. $(this._element).addClass(ClassName$5.SHOW);
  4332. if (this._config.focus) {
  4333. this._enforceFocus();
  4334. }
  4335. var shownEvent = $.Event(Event$5.SHOWN, {
  4336. relatedTarget: relatedTarget
  4337. });
  4338. var transitionComplete = function transitionComplete() {
  4339. if (_this4._config.focus) {
  4340. _this4._element.focus();
  4341. }
  4342. _this4._isTransitioning = false;
  4343. $(_this4._element).trigger(shownEvent);
  4344. };
  4345. if (transition) {
  4346. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4347. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4348. } else {
  4349. transitionComplete();
  4350. }
  4351. };
  4352. _proto._enforceFocus = function _enforceFocus() {
  4353. var _this5 = this;
  4354. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4355. .on(Event$5.FOCUSIN, function (event) {
  4356. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4357. _this5._element.focus();
  4358. }
  4359. });
  4360. };
  4361. _proto._setEscapeEvent = function _setEscapeEvent() {
  4362. var _this6 = this;
  4363. if (this._isShown && this._config.keyboard) {
  4364. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4365. if (event.which === ESCAPE_KEYCODE$1) {
  4366. _this6._triggerBackdropTransition();
  4367. }
  4368. });
  4369. } else if (!this._isShown) {
  4370. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4371. }
  4372. };
  4373. _proto._setResizeEvent = function _setResizeEvent() {
  4374. var _this7 = this;
  4375. if (this._isShown) {
  4376. $(window).on(Event$5.RESIZE, function (event) {
  4377. return _this7.handleUpdate(event);
  4378. });
  4379. } else {
  4380. $(window).off(Event$5.RESIZE);
  4381. }
  4382. };
  4383. _proto._hideModal = function _hideModal() {
  4384. var _this8 = this;
  4385. this._element.style.display = 'none';
  4386. this._element.setAttribute('aria-hidden', true);
  4387. this._element.removeAttribute('aria-modal');
  4388. this._isTransitioning = false;
  4389. this._showBackdrop(function () {
  4390. $(document.body).removeClass(ClassName$5.OPEN);
  4391. _this8._resetAdjustments();
  4392. _this8._resetScrollbar();
  4393. $(_this8._element).trigger(Event$5.HIDDEN);
  4394. });
  4395. };
  4396. _proto._removeBackdrop = function _removeBackdrop() {
  4397. if (this._backdrop) {
  4398. $(this._backdrop).remove();
  4399. this._backdrop = null;
  4400. }
  4401. };
  4402. _proto._showBackdrop = function _showBackdrop(callback) {
  4403. var _this9 = this;
  4404. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4405. if (this._isShown && this._config.backdrop) {
  4406. this._backdrop = document.createElement('div');
  4407. this._backdrop.className = ClassName$5.BACKDROP;
  4408. if (animate) {
  4409. this._backdrop.classList.add(animate);
  4410. }
  4411. $(this._backdrop).appendTo(document.body);
  4412. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4413. if (_this9._ignoreBackdropClick) {
  4414. _this9._ignoreBackdropClick = false;
  4415. return;
  4416. }
  4417. if (event.target !== event.currentTarget) {
  4418. return;
  4419. }
  4420. _this9._triggerBackdropTransition();
  4421. });
  4422. if (animate) {
  4423. Util.reflow(this._backdrop);
  4424. }
  4425. $(this._backdrop).addClass(ClassName$5.SHOW);
  4426. if (!callback) {
  4427. return;
  4428. }
  4429. if (!animate) {
  4430. callback();
  4431. return;
  4432. }
  4433. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4434. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4435. } else if (!this._isShown && this._backdrop) {
  4436. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4437. var callbackRemove = function callbackRemove() {
  4438. _this9._removeBackdrop();
  4439. if (callback) {
  4440. callback();
  4441. }
  4442. };
  4443. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4444. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4445. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4446. } else {
  4447. callbackRemove();
  4448. }
  4449. } else if (callback) {
  4450. callback();
  4451. }
  4452. } // ----------------------------------------------------------------------
  4453. // the following methods are used to handle overflowing modals
  4454. // todo (fat): these should probably be refactored out of modal.js
  4455. // ----------------------------------------------------------------------
  4456. ;
  4457. _proto._adjustDialog = function _adjustDialog() {
  4458. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4459. if (!this._isBodyOverflowing && isModalOverflowing) {
  4460. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4461. }
  4462. if (this._isBodyOverflowing && !isModalOverflowing) {
  4463. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4464. }
  4465. };
  4466. _proto._resetAdjustments = function _resetAdjustments() {
  4467. this._element.style.paddingLeft = '';
  4468. this._element.style.paddingRight = '';
  4469. };
  4470. _proto._checkScrollbar = function _checkScrollbar() {
  4471. var rect = document.body.getBoundingClientRect();
  4472. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4473. this._scrollbarWidth = this._getScrollbarWidth();
  4474. };
  4475. _proto._setScrollbar = function _setScrollbar() {
  4476. var _this10 = this;
  4477. if (this._isBodyOverflowing) {
  4478. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4479. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4480. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4481. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4482. $(fixedContent).each(function (index, element) {
  4483. var actualPadding = element.style.paddingRight;
  4484. var calculatedPadding = $(element).css('padding-right');
  4485. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4486. }); // Adjust sticky content margin
  4487. $(stickyContent).each(function (index, element) {
  4488. var actualMargin = element.style.marginRight;
  4489. var calculatedMargin = $(element).css('margin-right');
  4490. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4491. }); // Adjust body padding
  4492. var actualPadding = document.body.style.paddingRight;
  4493. var calculatedPadding = $(document.body).css('padding-right');
  4494. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4495. }
  4496. $(document.body).addClass(ClassName$5.OPEN);
  4497. };
  4498. _proto._resetScrollbar = function _resetScrollbar() {
  4499. // Restore fixed content padding
  4500. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4501. $(fixedContent).each(function (index, element) {
  4502. var padding = $(element).data('padding-right');
  4503. $(element).removeData('padding-right');
  4504. element.style.paddingRight = padding ? padding : '';
  4505. }); // Restore sticky content
  4506. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4507. $(elements).each(function (index, element) {
  4508. var margin = $(element).data('margin-right');
  4509. if (typeof margin !== 'undefined') {
  4510. $(element).css('margin-right', margin).removeData('margin-right');
  4511. }
  4512. }); // Restore body padding
  4513. var padding = $(document.body).data('padding-right');
  4514. $(document.body).removeData('padding-right');
  4515. document.body.style.paddingRight = padding ? padding : '';
  4516. };
  4517. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4518. // thx d.walsh
  4519. var scrollDiv = document.createElement('div');
  4520. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4521. document.body.appendChild(scrollDiv);
  4522. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4523. document.body.removeChild(scrollDiv);
  4524. return scrollbarWidth;
  4525. } // Static
  4526. ;
  4527. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4528. return this.each(function () {
  4529. var data = $(this).data(DATA_KEY$5);
  4530. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4531. if (!data) {
  4532. data = new Modal(this, _config);
  4533. $(this).data(DATA_KEY$5, data);
  4534. }
  4535. if (typeof config === 'string') {
  4536. if (typeof data[config] === 'undefined') {
  4537. throw new TypeError("No method named \"" + config + "\"");
  4538. }
  4539. data[config](relatedTarget);
  4540. } else if (_config.show) {
  4541. data.show(relatedTarget);
  4542. }
  4543. });
  4544. };
  4545. _createClass(Modal, null, [{
  4546. key: "VERSION",
  4547. get: function get() {
  4548. return VERSION$5;
  4549. }
  4550. }, {
  4551. key: "Default",
  4552. get: function get() {
  4553. return Default$3;
  4554. }
  4555. }]);
  4556. return Modal;
  4557. }();
  4558. /**
  4559. * ------------------------------------------------------------------------
  4560. * Data Api implementation
  4561. * ------------------------------------------------------------------------
  4562. */
  4563. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4564. var _this11 = this;
  4565. var target;
  4566. var selector = Util.getSelectorFromElement(this);
  4567. if (selector) {
  4568. target = document.querySelector(selector);
  4569. }
  4570. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4571. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4572. event.preventDefault();
  4573. }
  4574. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4575. if (showEvent.isDefaultPrevented()) {
  4576. // Only register focus restorer if modal will actually get shown
  4577. return;
  4578. }
  4579. $target.one(Event$5.HIDDEN, function () {
  4580. if ($(_this11).is(':visible')) {
  4581. _this11.focus();
  4582. }
  4583. });
  4584. });
  4585. Modal._jQueryInterface.call($(target), config, this);
  4586. });
  4587. /**
  4588. * ------------------------------------------------------------------------
  4589. * jQuery
  4590. * ------------------------------------------------------------------------
  4591. */
  4592. $.fn[NAME$5] = Modal._jQueryInterface;
  4593. $.fn[NAME$5].Constructor = Modal;
  4594. $.fn[NAME$5].noConflict = function () {
  4595. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4596. return Modal._jQueryInterface;
  4597. };
  4598. /**
  4599. * --------------------------------------------------------------------------
  4600. * Bootstrap (v4.4.1): tools/sanitizer.js
  4601. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4602. * --------------------------------------------------------------------------
  4603. */
  4604. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4605. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4606. var DefaultWhitelist = {
  4607. // Global attributes allowed on any supplied element below.
  4608. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4609. a: ['target', 'href', 'title', 'rel'],
  4610. area: [],
  4611. b: [],
  4612. br: [],
  4613. col: [],
  4614. code: [],
  4615. div: [],
  4616. em: [],
  4617. hr: [],
  4618. h1: [],
  4619. h2: [],
  4620. h3: [],
  4621. h4: [],
  4622. h5: [],
  4623. h6: [],
  4624. i: [],
  4625. img: ['src', 'alt', 'title', 'width', 'height'],
  4626. li: [],
  4627. ol: [],
  4628. p: [],
  4629. pre: [],
  4630. s: [],
  4631. small: [],
  4632. span: [],
  4633. sub: [],
  4634. sup: [],
  4635. strong: [],
  4636. u: [],
  4637. ul: []
  4638. };
  4639. /**
  4640. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4641. *
  4642. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4643. */
  4644. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4645. /**
  4646. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4647. *
  4648. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4649. */
  4650. 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;
  4651. function allowedAttribute(attr, allowedAttributeList) {
  4652. var attrName = attr.nodeName.toLowerCase();
  4653. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4654. if (uriAttrs.indexOf(attrName) !== -1) {
  4655. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4656. }
  4657. return true;
  4658. }
  4659. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4660. return attrRegex instanceof RegExp;
  4661. }); // Check if a regular expression validates the attribute.
  4662. for (var i = 0, l = regExp.length; i < l; i++) {
  4663. if (attrName.match(regExp[i])) {
  4664. return true;
  4665. }
  4666. }
  4667. return false;
  4668. }
  4669. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4670. if (unsafeHtml.length === 0) {
  4671. return unsafeHtml;
  4672. }
  4673. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4674. return sanitizeFn(unsafeHtml);
  4675. }
  4676. var domParser = new window.DOMParser();
  4677. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4678. var whitelistKeys = Object.keys(whiteList);
  4679. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4680. var _loop = function _loop(i, len) {
  4681. var el = elements[i];
  4682. var elName = el.nodeName.toLowerCase();
  4683. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4684. el.parentNode.removeChild(el);
  4685. return "continue";
  4686. }
  4687. var attributeList = [].slice.call(el.attributes);
  4688. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4689. attributeList.forEach(function (attr) {
  4690. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4691. el.removeAttribute(attr.nodeName);
  4692. }
  4693. });
  4694. };
  4695. for (var i = 0, len = elements.length; i < len; i++) {
  4696. var _ret = _loop(i);
  4697. if (_ret === "continue") continue;
  4698. }
  4699. return createdDocument.body.innerHTML;
  4700. }
  4701. /**
  4702. * ------------------------------------------------------------------------
  4703. * Constants
  4704. * ------------------------------------------------------------------------
  4705. */
  4706. var NAME$6 = 'tooltip';
  4707. var VERSION$6 = '4.4.1';
  4708. var DATA_KEY$6 = 'bs.tooltip';
  4709. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4710. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4711. var CLASS_PREFIX = 'bs-tooltip';
  4712. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4713. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4714. var DefaultType$4 = {
  4715. animation: 'boolean',
  4716. template: 'string',
  4717. title: '(string|element|function)',
  4718. trigger: 'string',
  4719. delay: '(number|object)',
  4720. html: 'boolean',
  4721. selector: '(string|boolean)',
  4722. placement: '(string|function)',
  4723. offset: '(number|string|function)',
  4724. container: '(string|element|boolean)',
  4725. fallbackPlacement: '(string|array)',
  4726. boundary: '(string|element)',
  4727. sanitize: 'boolean',
  4728. sanitizeFn: '(null|function)',
  4729. whiteList: 'object',
  4730. popperConfig: '(null|object)'
  4731. };
  4732. var AttachmentMap$1 = {
  4733. AUTO: 'auto',
  4734. TOP: 'top',
  4735. RIGHT: 'right',
  4736. BOTTOM: 'bottom',
  4737. LEFT: 'left'
  4738. };
  4739. var Default$4 = {
  4740. animation: true,
  4741. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4742. trigger: 'hover focus',
  4743. title: '',
  4744. delay: 0,
  4745. html: false,
  4746. selector: false,
  4747. placement: 'top',
  4748. offset: 0,
  4749. container: false,
  4750. fallbackPlacement: 'flip',
  4751. boundary: 'scrollParent',
  4752. sanitize: true,
  4753. sanitizeFn: null,
  4754. whiteList: DefaultWhitelist,
  4755. popperConfig: null
  4756. };
  4757. var HoverState = {
  4758. SHOW: 'show',
  4759. OUT: 'out'
  4760. };
  4761. var Event$6 = {
  4762. HIDE: "hide" + EVENT_KEY$6,
  4763. HIDDEN: "hidden" + EVENT_KEY$6,
  4764. SHOW: "show" + EVENT_KEY$6,
  4765. SHOWN: "shown" + EVENT_KEY$6,
  4766. INSERTED: "inserted" + EVENT_KEY$6,
  4767. CLICK: "click" + EVENT_KEY$6,
  4768. FOCUSIN: "focusin" + EVENT_KEY$6,
  4769. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4770. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4771. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4772. };
  4773. var ClassName$6 = {
  4774. FADE: 'fade',
  4775. SHOW: 'show'
  4776. };
  4777. var Selector$6 = {
  4778. TOOLTIP: '.tooltip',
  4779. TOOLTIP_INNER: '.tooltip-inner',
  4780. ARROW: '.arrow'
  4781. };
  4782. var Trigger = {
  4783. HOVER: 'hover',
  4784. FOCUS: 'focus',
  4785. CLICK: 'click',
  4786. MANUAL: 'manual'
  4787. };
  4788. /**
  4789. * ------------------------------------------------------------------------
  4790. * Class Definition
  4791. * ------------------------------------------------------------------------
  4792. */
  4793. var Tooltip =
  4794. /*#__PURE__*/
  4795. function () {
  4796. function Tooltip(element, config) {
  4797. if (typeof Popper === 'undefined') {
  4798. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4799. } // private
  4800. this._isEnabled = true;
  4801. this._timeout = 0;
  4802. this._hoverState = '';
  4803. this._activeTrigger = {};
  4804. this._popper = null; // Protected
  4805. this.element = element;
  4806. this.config = this._getConfig(config);
  4807. this.tip = null;
  4808. this._setListeners();
  4809. } // Getters
  4810. var _proto = Tooltip.prototype;
  4811. // Public
  4812. _proto.enable = function enable() {
  4813. this._isEnabled = true;
  4814. };
  4815. _proto.disable = function disable() {
  4816. this._isEnabled = false;
  4817. };
  4818. _proto.toggleEnabled = function toggleEnabled() {
  4819. this._isEnabled = !this._isEnabled;
  4820. };
  4821. _proto.toggle = function toggle(event) {
  4822. if (!this._isEnabled) {
  4823. return;
  4824. }
  4825. if (event) {
  4826. var dataKey = this.constructor.DATA_KEY;
  4827. var context = $(event.currentTarget).data(dataKey);
  4828. if (!context) {
  4829. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4830. $(event.currentTarget).data(dataKey, context);
  4831. }
  4832. context._activeTrigger.click = !context._activeTrigger.click;
  4833. if (context._isWithActiveTrigger()) {
  4834. context._enter(null, context);
  4835. } else {
  4836. context._leave(null, context);
  4837. }
  4838. } else {
  4839. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4840. this._leave(null, this);
  4841. return;
  4842. }
  4843. this._enter(null, this);
  4844. }
  4845. };
  4846. _proto.dispose = function dispose() {
  4847. clearTimeout(this._timeout);
  4848. $.removeData(this.element, this.constructor.DATA_KEY);
  4849. $(this.element).off(this.constructor.EVENT_KEY);
  4850. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4851. if (this.tip) {
  4852. $(this.tip).remove();
  4853. }
  4854. this._isEnabled = null;
  4855. this._timeout = null;
  4856. this._hoverState = null;
  4857. this._activeTrigger = null;
  4858. if (this._popper) {
  4859. this._popper.destroy();
  4860. }
  4861. this._popper = null;
  4862. this.element = null;
  4863. this.config = null;
  4864. this.tip = null;
  4865. };
  4866. _proto.show = function show() {
  4867. var _this = this;
  4868. if ($(this.element).css('display') === 'none') {
  4869. throw new Error('Please use show on visible elements');
  4870. }
  4871. var showEvent = $.Event(this.constructor.Event.SHOW);
  4872. if (this.isWithContent() && this._isEnabled) {
  4873. $(this.element).trigger(showEvent);
  4874. var shadowRoot = Util.findShadowRoot(this.element);
  4875. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4876. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4877. return;
  4878. }
  4879. var tip = this.getTipElement();
  4880. var tipId = Util.getUID(this.constructor.NAME);
  4881. tip.setAttribute('id', tipId);
  4882. this.element.setAttribute('aria-describedby', tipId);
  4883. this.setContent();
  4884. if (this.config.animation) {
  4885. $(tip).addClass(ClassName$6.FADE);
  4886. }
  4887. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4888. var attachment = this._getAttachment(placement);
  4889. this.addAttachmentClass(attachment);
  4890. var container = this._getContainer();
  4891. $(tip).data(this.constructor.DATA_KEY, this);
  4892. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4893. $(tip).appendTo(container);
  4894. }
  4895. $(this.element).trigger(this.constructor.Event.INSERTED);
  4896. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4897. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4898. // empty mouseover listeners to the body's immediate children;
  4899. // only needed because of broken event delegation on iOS
  4900. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4901. if ('ontouchstart' in document.documentElement) {
  4902. $(document.body).children().on('mouseover', null, $.noop);
  4903. }
  4904. var complete = function complete() {
  4905. if (_this.config.animation) {
  4906. _this._fixTransition();
  4907. }
  4908. var prevHoverState = _this._hoverState;
  4909. _this._hoverState = null;
  4910. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4911. if (prevHoverState === HoverState.OUT) {
  4912. _this._leave(null, _this);
  4913. }
  4914. };
  4915. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4916. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4917. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4918. } else {
  4919. complete();
  4920. }
  4921. }
  4922. };
  4923. _proto.hide = function hide(callback) {
  4924. var _this2 = this;
  4925. var tip = this.getTipElement();
  4926. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4927. var complete = function complete() {
  4928. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4929. tip.parentNode.removeChild(tip);
  4930. }
  4931. _this2._cleanTipClass();
  4932. _this2.element.removeAttribute('aria-describedby');
  4933. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4934. if (_this2._popper !== null) {
  4935. _this2._popper.destroy();
  4936. }
  4937. if (callback) {
  4938. callback();
  4939. }
  4940. };
  4941. $(this.element).trigger(hideEvent);
  4942. if (hideEvent.isDefaultPrevented()) {
  4943. return;
  4944. }
  4945. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4946. // empty mouseover listeners we added for iOS support
  4947. if ('ontouchstart' in document.documentElement) {
  4948. $(document.body).children().off('mouseover', null, $.noop);
  4949. }
  4950. this._activeTrigger[Trigger.CLICK] = false;
  4951. this._activeTrigger[Trigger.FOCUS] = false;
  4952. this._activeTrigger[Trigger.HOVER] = false;
  4953. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4954. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4955. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4956. } else {
  4957. complete();
  4958. }
  4959. this._hoverState = '';
  4960. };
  4961. _proto.update = function update() {
  4962. if (this._popper !== null) {
  4963. this._popper.scheduleUpdate();
  4964. }
  4965. } // Protected
  4966. ;
  4967. _proto.isWithContent = function isWithContent() {
  4968. return Boolean(this.getTitle());
  4969. };
  4970. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4971. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4972. };
  4973. _proto.getTipElement = function getTipElement() {
  4974. this.tip = this.tip || $(this.config.template)[0];
  4975. return this.tip;
  4976. };
  4977. _proto.setContent = function setContent() {
  4978. var tip = this.getTipElement();
  4979. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4980. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4981. };
  4982. _proto.setElementContent = function setElementContent($element, content) {
  4983. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4984. // Content is a DOM node or a jQuery
  4985. if (this.config.html) {
  4986. if (!$(content).parent().is($element)) {
  4987. $element.empty().append(content);
  4988. }
  4989. } else {
  4990. $element.text($(content).text());
  4991. }
  4992. return;
  4993. }
  4994. if (this.config.html) {
  4995. if (this.config.sanitize) {
  4996. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4997. }
  4998. $element.html(content);
  4999. } else {
  5000. $element.text(content);
  5001. }
  5002. };
  5003. _proto.getTitle = function getTitle() {
  5004. var title = this.element.getAttribute('data-original-title');
  5005. if (!title) {
  5006. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5007. }
  5008. return title;
  5009. } // Private
  5010. ;
  5011. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5012. var _this3 = this;
  5013. var defaultBsConfig = {
  5014. placement: attachment,
  5015. modifiers: {
  5016. offset: this._getOffset(),
  5017. flip: {
  5018. behavior: this.config.fallbackPlacement
  5019. },
  5020. arrow: {
  5021. element: Selector$6.ARROW
  5022. },
  5023. preventOverflow: {
  5024. boundariesElement: this.config.boundary
  5025. }
  5026. },
  5027. onCreate: function onCreate(data) {
  5028. if (data.originalPlacement !== data.placement) {
  5029. _this3._handlePopperPlacementChange(data);
  5030. }
  5031. },
  5032. onUpdate: function onUpdate(data) {
  5033. return _this3._handlePopperPlacementChange(data);
  5034. }
  5035. };
  5036. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5037. };
  5038. _proto._getOffset = function _getOffset() {
  5039. var _this4 = this;
  5040. var offset = {};
  5041. if (typeof this.config.offset === 'function') {
  5042. offset.fn = function (data) {
  5043. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5044. return data;
  5045. };
  5046. } else {
  5047. offset.offset = this.config.offset;
  5048. }
  5049. return offset;
  5050. };
  5051. _proto._getContainer = function _getContainer() {
  5052. if (this.config.container === false) {
  5053. return document.body;
  5054. }
  5055. if (Util.isElement(this.config.container)) {
  5056. return $(this.config.container);
  5057. }
  5058. return $(document).find(this.config.container);
  5059. };
  5060. _proto._getAttachment = function _getAttachment(placement) {
  5061. return AttachmentMap$1[placement.toUpperCase()];
  5062. };
  5063. _proto._setListeners = function _setListeners() {
  5064. var _this5 = this;
  5065. var triggers = this.config.trigger.split(' ');
  5066. triggers.forEach(function (trigger) {
  5067. if (trigger === 'click') {
  5068. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5069. return _this5.toggle(event);
  5070. });
  5071. } else if (trigger !== Trigger.MANUAL) {
  5072. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5073. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5074. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5075. return _this5._enter(event);
  5076. }).on(eventOut, _this5.config.selector, function (event) {
  5077. return _this5._leave(event);
  5078. });
  5079. }
  5080. });
  5081. this._hideModalHandler = function () {
  5082. if (_this5.element) {
  5083. _this5.hide();
  5084. }
  5085. };
  5086. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5087. if (this.config.selector) {
  5088. this.config = _objectSpread2({}, this.config, {
  5089. trigger: 'manual',
  5090. selector: ''
  5091. });
  5092. } else {
  5093. this._fixTitle();
  5094. }
  5095. };
  5096. _proto._fixTitle = function _fixTitle() {
  5097. var titleType = typeof this.element.getAttribute('data-original-title');
  5098. if (this.element.getAttribute('title') || titleType !== 'string') {
  5099. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5100. this.element.setAttribute('title', '');
  5101. }
  5102. };
  5103. _proto._enter = function _enter(event, context) {
  5104. var dataKey = this.constructor.DATA_KEY;
  5105. context = context || $(event.currentTarget).data(dataKey);
  5106. if (!context) {
  5107. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5108. $(event.currentTarget).data(dataKey, context);
  5109. }
  5110. if (event) {
  5111. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5112. }
  5113. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5114. context._hoverState = HoverState.SHOW;
  5115. return;
  5116. }
  5117. clearTimeout(context._timeout);
  5118. context._hoverState = HoverState.SHOW;
  5119. if (!context.config.delay || !context.config.delay.show) {
  5120. context.show();
  5121. return;
  5122. }
  5123. context._timeout = setTimeout(function () {
  5124. if (context._hoverState === HoverState.SHOW) {
  5125. context.show();
  5126. }
  5127. }, context.config.delay.show);
  5128. };
  5129. _proto._leave = function _leave(event, context) {
  5130. var dataKey = this.constructor.DATA_KEY;
  5131. context = context || $(event.currentTarget).data(dataKey);
  5132. if (!context) {
  5133. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5134. $(event.currentTarget).data(dataKey, context);
  5135. }
  5136. if (event) {
  5137. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5138. }
  5139. if (context._isWithActiveTrigger()) {
  5140. return;
  5141. }
  5142. clearTimeout(context._timeout);
  5143. context._hoverState = HoverState.OUT;
  5144. if (!context.config.delay || !context.config.delay.hide) {
  5145. context.hide();
  5146. return;
  5147. }
  5148. context._timeout = setTimeout(function () {
  5149. if (context._hoverState === HoverState.OUT) {
  5150. context.hide();
  5151. }
  5152. }, context.config.delay.hide);
  5153. };
  5154. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5155. for (var trigger in this._activeTrigger) {
  5156. if (this._activeTrigger[trigger]) {
  5157. return true;
  5158. }
  5159. }
  5160. return false;
  5161. };
  5162. _proto._getConfig = function _getConfig(config) {
  5163. var dataAttributes = $(this.element).data();
  5164. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5165. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5166. delete dataAttributes[dataAttr];
  5167. }
  5168. });
  5169. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5170. if (typeof config.delay === 'number') {
  5171. config.delay = {
  5172. show: config.delay,
  5173. hide: config.delay
  5174. };
  5175. }
  5176. if (typeof config.title === 'number') {
  5177. config.title = config.title.toString();
  5178. }
  5179. if (typeof config.content === 'number') {
  5180. config.content = config.content.toString();
  5181. }
  5182. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5183. if (config.sanitize) {
  5184. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5185. }
  5186. return config;
  5187. };
  5188. _proto._getDelegateConfig = function _getDelegateConfig() {
  5189. var config = {};
  5190. if (this.config) {
  5191. for (var key in this.config) {
  5192. if (this.constructor.Default[key] !== this.config[key]) {
  5193. config[key] = this.config[key];
  5194. }
  5195. }
  5196. }
  5197. return config;
  5198. };
  5199. _proto._cleanTipClass = function _cleanTipClass() {
  5200. var $tip = $(this.getTipElement());
  5201. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5202. if (tabClass !== null && tabClass.length) {
  5203. $tip.removeClass(tabClass.join(''));
  5204. }
  5205. };
  5206. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5207. var popperInstance = popperData.instance;
  5208. this.tip = popperInstance.popper;
  5209. this._cleanTipClass();
  5210. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5211. };
  5212. _proto._fixTransition = function _fixTransition() {
  5213. var tip = this.getTipElement();
  5214. var initConfigAnimation = this.config.animation;
  5215. if (tip.getAttribute('x-placement') !== null) {
  5216. return;
  5217. }
  5218. $(tip).removeClass(ClassName$6.FADE);
  5219. this.config.animation = false;
  5220. this.hide();
  5221. this.show();
  5222. this.config.animation = initConfigAnimation;
  5223. } // Static
  5224. ;
  5225. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5226. return this.each(function () {
  5227. var data = $(this).data(DATA_KEY$6);
  5228. var _config = typeof config === 'object' && config;
  5229. if (!data && /dispose|hide/.test(config)) {
  5230. return;
  5231. }
  5232. if (!data) {
  5233. data = new Tooltip(this, _config);
  5234. $(this).data(DATA_KEY$6, data);
  5235. }
  5236. if (typeof config === 'string') {
  5237. if (typeof data[config] === 'undefined') {
  5238. throw new TypeError("No method named \"" + config + "\"");
  5239. }
  5240. data[config]();
  5241. }
  5242. });
  5243. };
  5244. _createClass(Tooltip, null, [{
  5245. key: "VERSION",
  5246. get: function get() {
  5247. return VERSION$6;
  5248. }
  5249. }, {
  5250. key: "Default",
  5251. get: function get() {
  5252. return Default$4;
  5253. }
  5254. }, {
  5255. key: "NAME",
  5256. get: function get() {
  5257. return NAME$6;
  5258. }
  5259. }, {
  5260. key: "DATA_KEY",
  5261. get: function get() {
  5262. return DATA_KEY$6;
  5263. }
  5264. }, {
  5265. key: "Event",
  5266. get: function get() {
  5267. return Event$6;
  5268. }
  5269. }, {
  5270. key: "EVENT_KEY",
  5271. get: function get() {
  5272. return EVENT_KEY$6;
  5273. }
  5274. }, {
  5275. key: "DefaultType",
  5276. get: function get() {
  5277. return DefaultType$4;
  5278. }
  5279. }]);
  5280. return Tooltip;
  5281. }();
  5282. /**
  5283. * ------------------------------------------------------------------------
  5284. * jQuery
  5285. * ------------------------------------------------------------------------
  5286. */
  5287. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5288. $.fn[NAME$6].Constructor = Tooltip;
  5289. $.fn[NAME$6].noConflict = function () {
  5290. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5291. return Tooltip._jQueryInterface;
  5292. };
  5293. /**
  5294. * ------------------------------------------------------------------------
  5295. * Constants
  5296. * ------------------------------------------------------------------------
  5297. */
  5298. var NAME$7 = 'popover';
  5299. var VERSION$7 = '4.4.1';
  5300. var DATA_KEY$7 = 'bs.popover';
  5301. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5302. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5303. var CLASS_PREFIX$1 = 'bs-popover';
  5304. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5305. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5306. placement: 'right',
  5307. trigger: 'click',
  5308. content: '',
  5309. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5310. });
  5311. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5312. content: '(string|element|function)'
  5313. });
  5314. var ClassName$7 = {
  5315. FADE: 'fade',
  5316. SHOW: 'show'
  5317. };
  5318. var Selector$7 = {
  5319. TITLE: '.popover-header',
  5320. CONTENT: '.popover-body'
  5321. };
  5322. var Event$7 = {
  5323. HIDE: "hide" + EVENT_KEY$7,
  5324. HIDDEN: "hidden" + EVENT_KEY$7,
  5325. SHOW: "show" + EVENT_KEY$7,
  5326. SHOWN: "shown" + EVENT_KEY$7,
  5327. INSERTED: "inserted" + EVENT_KEY$7,
  5328. CLICK: "click" + EVENT_KEY$7,
  5329. FOCUSIN: "focusin" + EVENT_KEY$7,
  5330. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5331. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5332. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5333. };
  5334. /**
  5335. * ------------------------------------------------------------------------
  5336. * Class Definition
  5337. * ------------------------------------------------------------------------
  5338. */
  5339. var Popover =
  5340. /*#__PURE__*/
  5341. function (_Tooltip) {
  5342. _inheritsLoose(Popover, _Tooltip);
  5343. function Popover() {
  5344. return _Tooltip.apply(this, arguments) || this;
  5345. }
  5346. var _proto = Popover.prototype;
  5347. // Overrides
  5348. _proto.isWithContent = function isWithContent() {
  5349. return this.getTitle() || this._getContent();
  5350. };
  5351. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5352. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5353. };
  5354. _proto.getTipElement = function getTipElement() {
  5355. this.tip = this.tip || $(this.config.template)[0];
  5356. return this.tip;
  5357. };
  5358. _proto.setContent = function setContent() {
  5359. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5360. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5361. var content = this._getContent();
  5362. if (typeof content === 'function') {
  5363. content = content.call(this.element);
  5364. }
  5365. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5366. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5367. } // Private
  5368. ;
  5369. _proto._getContent = function _getContent() {
  5370. return this.element.getAttribute('data-content') || this.config.content;
  5371. };
  5372. _proto._cleanTipClass = function _cleanTipClass() {
  5373. var $tip = $(this.getTipElement());
  5374. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5375. if (tabClass !== null && tabClass.length > 0) {
  5376. $tip.removeClass(tabClass.join(''));
  5377. }
  5378. } // Static
  5379. ;
  5380. Popover._jQueryInterface = function _jQueryInterface(config) {
  5381. return this.each(function () {
  5382. var data = $(this).data(DATA_KEY$7);
  5383. var _config = typeof config === 'object' ? config : null;
  5384. if (!data && /dispose|hide/.test(config)) {
  5385. return;
  5386. }
  5387. if (!data) {
  5388. data = new Popover(this, _config);
  5389. $(this).data(DATA_KEY$7, data);
  5390. }
  5391. if (typeof config === 'string') {
  5392. if (typeof data[config] === 'undefined') {
  5393. throw new TypeError("No method named \"" + config + "\"");
  5394. }
  5395. data[config]();
  5396. }
  5397. });
  5398. };
  5399. _createClass(Popover, null, [{
  5400. key: "VERSION",
  5401. // Getters
  5402. get: function get() {
  5403. return VERSION$7;
  5404. }
  5405. }, {
  5406. key: "Default",
  5407. get: function get() {
  5408. return Default$5;
  5409. }
  5410. }, {
  5411. key: "NAME",
  5412. get: function get() {
  5413. return NAME$7;
  5414. }
  5415. }, {
  5416. key: "DATA_KEY",
  5417. get: function get() {
  5418. return DATA_KEY$7;
  5419. }
  5420. }, {
  5421. key: "Event",
  5422. get: function get() {
  5423. return Event$7;
  5424. }
  5425. }, {
  5426. key: "EVENT_KEY",
  5427. get: function get() {
  5428. return EVENT_KEY$7;
  5429. }
  5430. }, {
  5431. key: "DefaultType",
  5432. get: function get() {
  5433. return DefaultType$5;
  5434. }
  5435. }]);
  5436. return Popover;
  5437. }(Tooltip);
  5438. /**
  5439. * ------------------------------------------------------------------------
  5440. * jQuery
  5441. * ------------------------------------------------------------------------
  5442. */
  5443. $.fn[NAME$7] = Popover._jQueryInterface;
  5444. $.fn[NAME$7].Constructor = Popover;
  5445. $.fn[NAME$7].noConflict = function () {
  5446. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5447. return Popover._jQueryInterface;
  5448. };
  5449. /**
  5450. * ------------------------------------------------------------------------
  5451. * Constants
  5452. * ------------------------------------------------------------------------
  5453. */
  5454. var NAME$8 = 'scrollspy';
  5455. var VERSION$8 = '4.4.1';
  5456. var DATA_KEY$8 = 'bs.scrollspy';
  5457. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5458. var DATA_API_KEY$6 = '.data-api';
  5459. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5460. var Default$6 = {
  5461. offset: 10,
  5462. method: 'auto',
  5463. target: ''
  5464. };
  5465. var DefaultType$6 = {
  5466. offset: 'number',
  5467. method: 'string',
  5468. target: '(string|element)'
  5469. };
  5470. var Event$8 = {
  5471. ACTIVATE: "activate" + EVENT_KEY$8,
  5472. SCROLL: "scroll" + EVENT_KEY$8,
  5473. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5474. };
  5475. var ClassName$8 = {
  5476. DROPDOWN_ITEM: 'dropdown-item',
  5477. DROPDOWN_MENU: 'dropdown-menu',
  5478. ACTIVE: 'active'
  5479. };
  5480. var Selector$8 = {
  5481. DATA_SPY: '[data-spy="scroll"]',
  5482. ACTIVE: '.active',
  5483. NAV_LIST_GROUP: '.nav, .list-group',
  5484. NAV_LINKS: '.nav-link',
  5485. NAV_ITEMS: '.nav-item',
  5486. LIST_ITEMS: '.list-group-item',
  5487. DROPDOWN: '.dropdown',
  5488. DROPDOWN_ITEMS: '.dropdown-item',
  5489. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5490. };
  5491. var OffsetMethod = {
  5492. OFFSET: 'offset',
  5493. POSITION: 'position'
  5494. };
  5495. /**
  5496. * ------------------------------------------------------------------------
  5497. * Class Definition
  5498. * ------------------------------------------------------------------------
  5499. */
  5500. var ScrollSpy =
  5501. /*#__PURE__*/
  5502. function () {
  5503. function ScrollSpy(element, config) {
  5504. var _this = this;
  5505. this._element = element;
  5506. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5507. this._config = this._getConfig(config);
  5508. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5509. this._offsets = [];
  5510. this._targets = [];
  5511. this._activeTarget = null;
  5512. this._scrollHeight = 0;
  5513. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5514. return _this._process(event);
  5515. });
  5516. this.refresh();
  5517. this._process();
  5518. } // Getters
  5519. var _proto = ScrollSpy.prototype;
  5520. // Public
  5521. _proto.refresh = function refresh() {
  5522. var _this2 = this;
  5523. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5524. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5525. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5526. this._offsets = [];
  5527. this._targets = [];
  5528. this._scrollHeight = this._getScrollHeight();
  5529. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5530. targets.map(function (element) {
  5531. var target;
  5532. var targetSelector = Util.getSelectorFromElement(element);
  5533. if (targetSelector) {
  5534. target = document.querySelector(targetSelector);
  5535. }
  5536. if (target) {
  5537. var targetBCR = target.getBoundingClientRect();
  5538. if (targetBCR.width || targetBCR.height) {
  5539. // TODO (fat): remove sketch reliance on jQuery position/offset
  5540. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5541. }
  5542. }
  5543. return null;
  5544. }).filter(function (item) {
  5545. return item;
  5546. }).sort(function (a, b) {
  5547. return a[0] - b[0];
  5548. }).forEach(function (item) {
  5549. _this2._offsets.push(item[0]);
  5550. _this2._targets.push(item[1]);
  5551. });
  5552. };
  5553. _proto.dispose = function dispose() {
  5554. $.removeData(this._element, DATA_KEY$8);
  5555. $(this._scrollElement).off(EVENT_KEY$8);
  5556. this._element = null;
  5557. this._scrollElement = null;
  5558. this._config = null;
  5559. this._selector = null;
  5560. this._offsets = null;
  5561. this._targets = null;
  5562. this._activeTarget = null;
  5563. this._scrollHeight = null;
  5564. } // Private
  5565. ;
  5566. _proto._getConfig = function _getConfig(config) {
  5567. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5568. if (typeof config.target !== 'string') {
  5569. var id = $(config.target).attr('id');
  5570. if (!id) {
  5571. id = Util.getUID(NAME$8);
  5572. $(config.target).attr('id', id);
  5573. }
  5574. config.target = "#" + id;
  5575. }
  5576. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5577. return config;
  5578. };
  5579. _proto._getScrollTop = function _getScrollTop() {
  5580. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5581. };
  5582. _proto._getScrollHeight = function _getScrollHeight() {
  5583. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5584. };
  5585. _proto._getOffsetHeight = function _getOffsetHeight() {
  5586. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5587. };
  5588. _proto._process = function _process() {
  5589. var scrollTop = this._getScrollTop() + this._config.offset;
  5590. var scrollHeight = this._getScrollHeight();
  5591. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5592. if (this._scrollHeight !== scrollHeight) {
  5593. this.refresh();
  5594. }
  5595. if (scrollTop >= maxScroll) {
  5596. var target = this._targets[this._targets.length - 1];
  5597. if (this._activeTarget !== target) {
  5598. this._activate(target);
  5599. }
  5600. return;
  5601. }
  5602. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5603. this._activeTarget = null;
  5604. this._clear();
  5605. return;
  5606. }
  5607. var offsetLength = this._offsets.length;
  5608. for (var i = offsetLength; i--;) {
  5609. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5610. if (isActiveTarget) {
  5611. this._activate(this._targets[i]);
  5612. }
  5613. }
  5614. };
  5615. _proto._activate = function _activate(target) {
  5616. this._activeTarget = target;
  5617. this._clear();
  5618. var queries = this._selector.split(',').map(function (selector) {
  5619. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5620. });
  5621. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5622. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5623. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5624. $link.addClass(ClassName$8.ACTIVE);
  5625. } else {
  5626. // Set triggered link as active
  5627. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5628. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5629. $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
  5630. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5631. }
  5632. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5633. relatedTarget: target
  5634. });
  5635. };
  5636. _proto._clear = function _clear() {
  5637. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5638. return node.classList.contains(ClassName$8.ACTIVE);
  5639. }).forEach(function (node) {
  5640. return node.classList.remove(ClassName$8.ACTIVE);
  5641. });
  5642. } // Static
  5643. ;
  5644. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5645. return this.each(function () {
  5646. var data = $(this).data(DATA_KEY$8);
  5647. var _config = typeof config === 'object' && config;
  5648. if (!data) {
  5649. data = new ScrollSpy(this, _config);
  5650. $(this).data(DATA_KEY$8, data);
  5651. }
  5652. if (typeof config === 'string') {
  5653. if (typeof data[config] === 'undefined') {
  5654. throw new TypeError("No method named \"" + config + "\"");
  5655. }
  5656. data[config]();
  5657. }
  5658. });
  5659. };
  5660. _createClass(ScrollSpy, null, [{
  5661. key: "VERSION",
  5662. get: function get() {
  5663. return VERSION$8;
  5664. }
  5665. }, {
  5666. key: "Default",
  5667. get: function get() {
  5668. return Default$6;
  5669. }
  5670. }]);
  5671. return ScrollSpy;
  5672. }();
  5673. /**
  5674. * ------------------------------------------------------------------------
  5675. * Data Api implementation
  5676. * ------------------------------------------------------------------------
  5677. */
  5678. $(window).on(Event$8.LOAD_DATA_API, function () {
  5679. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5680. var scrollSpysLength = scrollSpys.length;
  5681. for (var i = scrollSpysLength; i--;) {
  5682. var $spy = $(scrollSpys[i]);
  5683. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5684. }
  5685. });
  5686. /**
  5687. * ------------------------------------------------------------------------
  5688. * jQuery
  5689. * ------------------------------------------------------------------------
  5690. */
  5691. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5692. $.fn[NAME$8].Constructor = ScrollSpy;
  5693. $.fn[NAME$8].noConflict = function () {
  5694. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5695. return ScrollSpy._jQueryInterface;
  5696. };
  5697. /**
  5698. * ------------------------------------------------------------------------
  5699. * Constants
  5700. * ------------------------------------------------------------------------
  5701. */
  5702. var NAME$9 = 'tab';
  5703. var VERSION$9 = '4.4.1';
  5704. var DATA_KEY$9 = 'bs.tab';
  5705. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5706. var DATA_API_KEY$7 = '.data-api';
  5707. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5708. var Event$9 = {
  5709. HIDE: "hide" + EVENT_KEY$9,
  5710. HIDDEN: "hidden" + EVENT_KEY$9,
  5711. SHOW: "show" + EVENT_KEY$9,
  5712. SHOWN: "shown" + EVENT_KEY$9,
  5713. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5714. };
  5715. var ClassName$9 = {
  5716. DROPDOWN_MENU: 'dropdown-menu',
  5717. ACTIVE: 'active',
  5718. DISABLED: 'disabled',
  5719. FADE: 'fade',
  5720. SHOW: 'show'
  5721. };
  5722. var Selector$9 = {
  5723. DROPDOWN: '.dropdown',
  5724. NAV_LIST_GROUP: '.nav, .list-group',
  5725. ACTIVE: '.active',
  5726. ACTIVE_UL: '> li > .active',
  5727. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5728. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5729. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5730. };
  5731. /**
  5732. * ------------------------------------------------------------------------
  5733. * Class Definition
  5734. * ------------------------------------------------------------------------
  5735. */
  5736. var Tab =
  5737. /*#__PURE__*/
  5738. function () {
  5739. function Tab(element) {
  5740. this._element = element;
  5741. } // Getters
  5742. var _proto = Tab.prototype;
  5743. // Public
  5744. _proto.show = function show() {
  5745. var _this = this;
  5746. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5747. return;
  5748. }
  5749. var target;
  5750. var previous;
  5751. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5752. var selector = Util.getSelectorFromElement(this._element);
  5753. if (listElement) {
  5754. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5755. previous = $.makeArray($(listElement).find(itemSelector));
  5756. previous = previous[previous.length - 1];
  5757. }
  5758. var hideEvent = $.Event(Event$9.HIDE, {
  5759. relatedTarget: this._element
  5760. });
  5761. var showEvent = $.Event(Event$9.SHOW, {
  5762. relatedTarget: previous
  5763. });
  5764. if (previous) {
  5765. $(previous).trigger(hideEvent);
  5766. }
  5767. $(this._element).trigger(showEvent);
  5768. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5769. return;
  5770. }
  5771. if (selector) {
  5772. target = document.querySelector(selector);
  5773. }
  5774. this._activate(this._element, listElement);
  5775. var complete = function complete() {
  5776. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5777. relatedTarget: _this._element
  5778. });
  5779. var shownEvent = $.Event(Event$9.SHOWN, {
  5780. relatedTarget: previous
  5781. });
  5782. $(previous).trigger(hiddenEvent);
  5783. $(_this._element).trigger(shownEvent);
  5784. };
  5785. if (target) {
  5786. this._activate(target, target.parentNode, complete);
  5787. } else {
  5788. complete();
  5789. }
  5790. };
  5791. _proto.dispose = function dispose() {
  5792. $.removeData(this._element, DATA_KEY$9);
  5793. this._element = null;
  5794. } // Private
  5795. ;
  5796. _proto._activate = function _activate(element, container, callback) {
  5797. var _this2 = this;
  5798. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5799. var active = activeElements[0];
  5800. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5801. var complete = function complete() {
  5802. return _this2._transitionComplete(element, active, callback);
  5803. };
  5804. if (active && isTransitioning) {
  5805. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5806. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5807. } else {
  5808. complete();
  5809. }
  5810. };
  5811. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5812. if (active) {
  5813. $(active).removeClass(ClassName$9.ACTIVE);
  5814. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5815. if (dropdownChild) {
  5816. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5817. }
  5818. if (active.getAttribute('role') === 'tab') {
  5819. active.setAttribute('aria-selected', false);
  5820. }
  5821. }
  5822. $(element).addClass(ClassName$9.ACTIVE);
  5823. if (element.getAttribute('role') === 'tab') {
  5824. element.setAttribute('aria-selected', true);
  5825. }
  5826. Util.reflow(element);
  5827. if (element.classList.contains(ClassName$9.FADE)) {
  5828. element.classList.add(ClassName$9.SHOW);
  5829. }
  5830. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5831. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5832. if (dropdownElement) {
  5833. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5834. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5835. }
  5836. element.setAttribute('aria-expanded', true);
  5837. }
  5838. if (callback) {
  5839. callback();
  5840. }
  5841. } // Static
  5842. ;
  5843. Tab._jQueryInterface = function _jQueryInterface(config) {
  5844. return this.each(function () {
  5845. var $this = $(this);
  5846. var data = $this.data(DATA_KEY$9);
  5847. if (!data) {
  5848. data = new Tab(this);
  5849. $this.data(DATA_KEY$9, data);
  5850. }
  5851. if (typeof config === 'string') {
  5852. if (typeof data[config] === 'undefined') {
  5853. throw new TypeError("No method named \"" + config + "\"");
  5854. }
  5855. data[config]();
  5856. }
  5857. });
  5858. };
  5859. _createClass(Tab, null, [{
  5860. key: "VERSION",
  5861. get: function get() {
  5862. return VERSION$9;
  5863. }
  5864. }]);
  5865. return Tab;
  5866. }();
  5867. /**
  5868. * ------------------------------------------------------------------------
  5869. * Data Api implementation
  5870. * ------------------------------------------------------------------------
  5871. */
  5872. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5873. event.preventDefault();
  5874. Tab._jQueryInterface.call($(this), 'show');
  5875. });
  5876. /**
  5877. * ------------------------------------------------------------------------
  5878. * jQuery
  5879. * ------------------------------------------------------------------------
  5880. */
  5881. $.fn[NAME$9] = Tab._jQueryInterface;
  5882. $.fn[NAME$9].Constructor = Tab;
  5883. $.fn[NAME$9].noConflict = function () {
  5884. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5885. return Tab._jQueryInterface;
  5886. };
  5887. /**
  5888. * ------------------------------------------------------------------------
  5889. * Constants
  5890. * ------------------------------------------------------------------------
  5891. */
  5892. var NAME$a = 'toast';
  5893. var VERSION$a = '4.4.1';
  5894. var DATA_KEY$a = 'bs.toast';
  5895. var EVENT_KEY$a = "." + DATA_KEY$a;
  5896. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5897. var Event$a = {
  5898. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5899. HIDE: "hide" + EVENT_KEY$a,
  5900. HIDDEN: "hidden" + EVENT_KEY$a,
  5901. SHOW: "show" + EVENT_KEY$a,
  5902. SHOWN: "shown" + EVENT_KEY$a
  5903. };
  5904. var ClassName$a = {
  5905. FADE: 'fade',
  5906. HIDE: 'hide',
  5907. SHOW: 'show',
  5908. SHOWING: 'showing'
  5909. };
  5910. var DefaultType$7 = {
  5911. animation: 'boolean',
  5912. autohide: 'boolean',
  5913. delay: 'number'
  5914. };
  5915. var Default$7 = {
  5916. animation: true,
  5917. autohide: true,
  5918. delay: 500
  5919. };
  5920. var Selector$a = {
  5921. DATA_DISMISS: '[data-dismiss="toast"]'
  5922. };
  5923. /**
  5924. * ------------------------------------------------------------------------
  5925. * Class Definition
  5926. * ------------------------------------------------------------------------
  5927. */
  5928. var Toast =
  5929. /*#__PURE__*/
  5930. function () {
  5931. function Toast(element, config) {
  5932. this._element = element;
  5933. this._config = this._getConfig(config);
  5934. this._timeout = null;
  5935. this._setListeners();
  5936. } // Getters
  5937. var _proto = Toast.prototype;
  5938. // Public
  5939. _proto.show = function show() {
  5940. var _this = this;
  5941. var showEvent = $.Event(Event$a.SHOW);
  5942. $(this._element).trigger(showEvent);
  5943. if (showEvent.isDefaultPrevented()) {
  5944. return;
  5945. }
  5946. if (this._config.animation) {
  5947. this._element.classList.add(ClassName$a.FADE);
  5948. }
  5949. var complete = function complete() {
  5950. _this._element.classList.remove(ClassName$a.SHOWING);
  5951. _this._element.classList.add(ClassName$a.SHOW);
  5952. $(_this._element).trigger(Event$a.SHOWN);
  5953. if (_this._config.autohide) {
  5954. _this._timeout = setTimeout(function () {
  5955. _this.hide();
  5956. }, _this._config.delay);
  5957. }
  5958. };
  5959. this._element.classList.remove(ClassName$a.HIDE);
  5960. Util.reflow(this._element);
  5961. this._element.classList.add(ClassName$a.SHOWING);
  5962. if (this._config.animation) {
  5963. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5964. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5965. } else {
  5966. complete();
  5967. }
  5968. };
  5969. _proto.hide = function hide() {
  5970. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5971. return;
  5972. }
  5973. var hideEvent = $.Event(Event$a.HIDE);
  5974. $(this._element).trigger(hideEvent);
  5975. if (hideEvent.isDefaultPrevented()) {
  5976. return;
  5977. }
  5978. this._close();
  5979. };
  5980. _proto.dispose = function dispose() {
  5981. clearTimeout(this._timeout);
  5982. this._timeout = null;
  5983. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5984. this._element.classList.remove(ClassName$a.SHOW);
  5985. }
  5986. $(this._element).off(Event$a.CLICK_DISMISS);
  5987. $.removeData(this._element, DATA_KEY$a);
  5988. this._element = null;
  5989. this._config = null;
  5990. } // Private
  5991. ;
  5992. _proto._getConfig = function _getConfig(config) {
  5993. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5994. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5995. return config;
  5996. };
  5997. _proto._setListeners = function _setListeners() {
  5998. var _this2 = this;
  5999. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6000. return _this2.hide();
  6001. });
  6002. };
  6003. _proto._close = function _close() {
  6004. var _this3 = this;
  6005. var complete = function complete() {
  6006. _this3._element.classList.add(ClassName$a.HIDE);
  6007. $(_this3._element).trigger(Event$a.HIDDEN);
  6008. };
  6009. this._element.classList.remove(ClassName$a.SHOW);
  6010. if (this._config.animation) {
  6011. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6012. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6013. } else {
  6014. complete();
  6015. }
  6016. } // Static
  6017. ;
  6018. Toast._jQueryInterface = function _jQueryInterface(config) {
  6019. return this.each(function () {
  6020. var $element = $(this);
  6021. var data = $element.data(DATA_KEY$a);
  6022. var _config = typeof config === 'object' && config;
  6023. if (!data) {
  6024. data = new Toast(this, _config);
  6025. $element.data(DATA_KEY$a, data);
  6026. }
  6027. if (typeof config === 'string') {
  6028. if (typeof data[config] === 'undefined') {
  6029. throw new TypeError("No method named \"" + config + "\"");
  6030. }
  6031. data[config](this);
  6032. }
  6033. });
  6034. };
  6035. _createClass(Toast, null, [{
  6036. key: "VERSION",
  6037. get: function get() {
  6038. return VERSION$a;
  6039. }
  6040. }, {
  6041. key: "DefaultType",
  6042. get: function get() {
  6043. return DefaultType$7;
  6044. }
  6045. }, {
  6046. key: "Default",
  6047. get: function get() {
  6048. return Default$7;
  6049. }
  6050. }]);
  6051. return Toast;
  6052. }();
  6053. /**
  6054. * ------------------------------------------------------------------------
  6055. * jQuery
  6056. * ------------------------------------------------------------------------
  6057. */
  6058. $.fn[NAME$a] = Toast._jQueryInterface;
  6059. $.fn[NAME$a].Constructor = Toast;
  6060. $.fn[NAME$a].noConflict = function () {
  6061. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6062. return Toast._jQueryInterface;
  6063. };
  6064. exports.Alert = Alert;
  6065. exports.Button = Button;
  6066. exports.Carousel = Carousel;
  6067. exports.Collapse = Collapse;
  6068. exports.Dropdown = Dropdown;
  6069. exports.Modal = Modal;
  6070. exports.Popover = Popover;
  6071. exports.Scrollspy = ScrollSpy;
  6072. exports.Tab = Tab;
  6073. exports.Toast = Toast;
  6074. exports.Tooltip = Tooltip;
  6075. exports.Util = Util;
  6076. Object.defineProperty(exports, '__esModule', { value: true });
  6077. })));
  6078. //# sourceMappingURL=bootstrap.js.map
  6079. /***/ }),
  6080. /***/ "./node_modules/buffer/index.js":
  6081. /*!**************************************!*\
  6082. !*** ./node_modules/buffer/index.js ***!
  6083. \**************************************/
  6084. /*! no static exports found */
  6085. /***/ (function(module, exports, __webpack_require__) {
  6086. "use strict";
  6087. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6088. * The buffer module from node.js, for the browser.
  6089. *
  6090. * @author Feross Aboukhadijeh <http://feross.org>
  6091. * @license MIT
  6092. */
  6093. /* eslint-disable no-proto */
  6094. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6095. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6096. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6097. exports.Buffer = Buffer
  6098. exports.SlowBuffer = SlowBuffer
  6099. exports.INSPECT_MAX_BYTES = 50
  6100. /**
  6101. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6102. * === true Use Uint8Array implementation (fastest)
  6103. * === false Use Object implementation (most compatible, even IE6)
  6104. *
  6105. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6106. * Opera 11.6+, iOS 4.2+.
  6107. *
  6108. * Due to various browser bugs, sometimes the Object implementation will be used even
  6109. * when the browser supports typed arrays.
  6110. *
  6111. * Note:
  6112. *
  6113. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6114. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6115. *
  6116. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6117. *
  6118. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6119. * incorrect length in some situations.
  6120. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6121. * get the Object implementation, which is slower but behaves correctly.
  6122. */
  6123. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6124. ? global.TYPED_ARRAY_SUPPORT
  6125. : typedArraySupport()
  6126. /*
  6127. * Export kMaxLength after typed array support is determined.
  6128. */
  6129. exports.kMaxLength = kMaxLength()
  6130. function typedArraySupport () {
  6131. try {
  6132. var arr = new Uint8Array(1)
  6133. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6134. return arr.foo() === 42 && // typed array instances can be augmented
  6135. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6136. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6137. } catch (e) {
  6138. return false
  6139. }
  6140. }
  6141. function kMaxLength () {
  6142. return Buffer.TYPED_ARRAY_SUPPORT
  6143. ? 0x7fffffff
  6144. : 0x3fffffff
  6145. }
  6146. function createBuffer (that, length) {
  6147. if (kMaxLength() < length) {
  6148. throw new RangeError('Invalid typed array length')
  6149. }
  6150. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6151. // Return an augmented `Uint8Array` instance, for best performance
  6152. that = new Uint8Array(length)
  6153. that.__proto__ = Buffer.prototype
  6154. } else {
  6155. // Fallback: Return an object instance of the Buffer class
  6156. if (that === null) {
  6157. that = new Buffer(length)
  6158. }
  6159. that.length = length
  6160. }
  6161. return that
  6162. }
  6163. /**
  6164. * The Buffer constructor returns instances of `Uint8Array` that have their
  6165. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6166. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6167. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6168. * returns a single octet.
  6169. *
  6170. * The `Uint8Array` prototype remains unmodified.
  6171. */
  6172. function Buffer (arg, encodingOrOffset, length) {
  6173. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6174. return new Buffer(arg, encodingOrOffset, length)
  6175. }
  6176. // Common case.
  6177. if (typeof arg === 'number') {
  6178. if (typeof encodingOrOffset === 'string') {
  6179. throw new Error(
  6180. 'If encoding is specified then the first argument must be a string'
  6181. )
  6182. }
  6183. return allocUnsafe(this, arg)
  6184. }
  6185. return from(this, arg, encodingOrOffset, length)
  6186. }
  6187. Buffer.poolSize = 8192 // not used by this implementation
  6188. // TODO: Legacy, not needed anymore. Remove in next major version.
  6189. Buffer._augment = function (arr) {
  6190. arr.__proto__ = Buffer.prototype
  6191. return arr
  6192. }
  6193. function from (that, value, encodingOrOffset, length) {
  6194. if (typeof value === 'number') {
  6195. throw new TypeError('"value" argument must not be a number')
  6196. }
  6197. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6198. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6199. }
  6200. if (typeof value === 'string') {
  6201. return fromString(that, value, encodingOrOffset)
  6202. }
  6203. return fromObject(that, value)
  6204. }
  6205. /**
  6206. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6207. * if value is a number.
  6208. * Buffer.from(str[, encoding])
  6209. * Buffer.from(array)
  6210. * Buffer.from(buffer)
  6211. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6212. **/
  6213. Buffer.from = function (value, encodingOrOffset, length) {
  6214. return from(null, value, encodingOrOffset, length)
  6215. }
  6216. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6217. Buffer.prototype.__proto__ = Uint8Array.prototype
  6218. Buffer.__proto__ = Uint8Array
  6219. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6220. Buffer[Symbol.species] === Buffer) {
  6221. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6222. Object.defineProperty(Buffer, Symbol.species, {
  6223. value: null,
  6224. configurable: true
  6225. })
  6226. }
  6227. }
  6228. function assertSize (size) {
  6229. if (typeof size !== 'number') {
  6230. throw new TypeError('"size" argument must be a number')
  6231. } else if (size < 0) {
  6232. throw new RangeError('"size" argument must not be negative')
  6233. }
  6234. }
  6235. function alloc (that, size, fill, encoding) {
  6236. assertSize(size)
  6237. if (size <= 0) {
  6238. return createBuffer(that, size)
  6239. }
  6240. if (fill !== undefined) {
  6241. // Only pay attention to encoding if it's a string. This
  6242. // prevents accidentally sending in a number that would
  6243. // be interpretted as a start offset.
  6244. return typeof encoding === 'string'
  6245. ? createBuffer(that, size).fill(fill, encoding)
  6246. : createBuffer(that, size).fill(fill)
  6247. }
  6248. return createBuffer(that, size)
  6249. }
  6250. /**
  6251. * Creates a new filled Buffer instance.
  6252. * alloc(size[, fill[, encoding]])
  6253. **/
  6254. Buffer.alloc = function (size, fill, encoding) {
  6255. return alloc(null, size, fill, encoding)
  6256. }
  6257. function allocUnsafe (that, size) {
  6258. assertSize(size)
  6259. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6260. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6261. for (var i = 0; i < size; ++i) {
  6262. that[i] = 0
  6263. }
  6264. }
  6265. return that
  6266. }
  6267. /**
  6268. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6269. * */
  6270. Buffer.allocUnsafe = function (size) {
  6271. return allocUnsafe(null, size)
  6272. }
  6273. /**
  6274. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6275. */
  6276. Buffer.allocUnsafeSlow = function (size) {
  6277. return allocUnsafe(null, size)
  6278. }
  6279. function fromString (that, string, encoding) {
  6280. if (typeof encoding !== 'string' || encoding === '') {
  6281. encoding = 'utf8'
  6282. }
  6283. if (!Buffer.isEncoding(encoding)) {
  6284. throw new TypeError('"encoding" must be a valid string encoding')
  6285. }
  6286. var length = byteLength(string, encoding) | 0
  6287. that = createBuffer(that, length)
  6288. var actual = that.write(string, encoding)
  6289. if (actual !== length) {
  6290. // Writing a hex string, for example, that contains invalid characters will
  6291. // cause everything after the first invalid character to be ignored. (e.g.
  6292. // 'abxxcd' will be treated as 'ab')
  6293. that = that.slice(0, actual)
  6294. }
  6295. return that
  6296. }
  6297. function fromArrayLike (that, array) {
  6298. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6299. that = createBuffer(that, length)
  6300. for (var i = 0; i < length; i += 1) {
  6301. that[i] = array[i] & 255
  6302. }
  6303. return that
  6304. }
  6305. function fromArrayBuffer (that, array, byteOffset, length) {
  6306. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6307. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6308. throw new RangeError('\'offset\' is out of bounds')
  6309. }
  6310. if (array.byteLength < byteOffset + (length || 0)) {
  6311. throw new RangeError('\'length\' is out of bounds')
  6312. }
  6313. if (byteOffset === undefined && length === undefined) {
  6314. array = new Uint8Array(array)
  6315. } else if (length === undefined) {
  6316. array = new Uint8Array(array, byteOffset)
  6317. } else {
  6318. array = new Uint8Array(array, byteOffset, length)
  6319. }
  6320. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6321. // Return an augmented `Uint8Array` instance, for best performance
  6322. that = array
  6323. that.__proto__ = Buffer.prototype
  6324. } else {
  6325. // Fallback: Return an object instance of the Buffer class
  6326. that = fromArrayLike(that, array)
  6327. }
  6328. return that
  6329. }
  6330. function fromObject (that, obj) {
  6331. if (Buffer.isBuffer(obj)) {
  6332. var len = checked(obj.length) | 0
  6333. that = createBuffer(that, len)
  6334. if (that.length === 0) {
  6335. return that
  6336. }
  6337. obj.copy(that, 0, 0, len)
  6338. return that
  6339. }
  6340. if (obj) {
  6341. if ((typeof ArrayBuffer !== 'undefined' &&
  6342. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6343. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6344. return createBuffer(that, 0)
  6345. }
  6346. return fromArrayLike(that, obj)
  6347. }
  6348. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6349. return fromArrayLike(that, obj.data)
  6350. }
  6351. }
  6352. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6353. }
  6354. function checked (length) {
  6355. // Note: cannot use `length < kMaxLength()` here because that fails when
  6356. // length is NaN (which is otherwise coerced to zero.)
  6357. if (length >= kMaxLength()) {
  6358. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6359. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6360. }
  6361. return length | 0
  6362. }
  6363. function SlowBuffer (length) {
  6364. if (+length != length) { // eslint-disable-line eqeqeq
  6365. length = 0
  6366. }
  6367. return Buffer.alloc(+length)
  6368. }
  6369. Buffer.isBuffer = function isBuffer (b) {
  6370. return !!(b != null && b._isBuffer)
  6371. }
  6372. Buffer.compare = function compare (a, b) {
  6373. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6374. throw new TypeError('Arguments must be Buffers')
  6375. }
  6376. if (a === b) return 0
  6377. var x = a.length
  6378. var y = b.length
  6379. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6380. if (a[i] !== b[i]) {
  6381. x = a[i]
  6382. y = b[i]
  6383. break
  6384. }
  6385. }
  6386. if (x < y) return -1
  6387. if (y < x) return 1
  6388. return 0
  6389. }
  6390. Buffer.isEncoding = function isEncoding (encoding) {
  6391. switch (String(encoding).toLowerCase()) {
  6392. case 'hex':
  6393. case 'utf8':
  6394. case 'utf-8':
  6395. case 'ascii':
  6396. case 'latin1':
  6397. case 'binary':
  6398. case 'base64':
  6399. case 'ucs2':
  6400. case 'ucs-2':
  6401. case 'utf16le':
  6402. case 'utf-16le':
  6403. return true
  6404. default:
  6405. return false
  6406. }
  6407. }
  6408. Buffer.concat = function concat (list, length) {
  6409. if (!isArray(list)) {
  6410. throw new TypeError('"list" argument must be an Array of Buffers')
  6411. }
  6412. if (list.length === 0) {
  6413. return Buffer.alloc(0)
  6414. }
  6415. var i
  6416. if (length === undefined) {
  6417. length = 0
  6418. for (i = 0; i < list.length; ++i) {
  6419. length += list[i].length
  6420. }
  6421. }
  6422. var buffer = Buffer.allocUnsafe(length)
  6423. var pos = 0
  6424. for (i = 0; i < list.length; ++i) {
  6425. var buf = list[i]
  6426. if (!Buffer.isBuffer(buf)) {
  6427. throw new TypeError('"list" argument must be an Array of Buffers')
  6428. }
  6429. buf.copy(buffer, pos)
  6430. pos += buf.length
  6431. }
  6432. return buffer
  6433. }
  6434. function byteLength (string, encoding) {
  6435. if (Buffer.isBuffer(string)) {
  6436. return string.length
  6437. }
  6438. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6439. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6440. return string.byteLength
  6441. }
  6442. if (typeof string !== 'string') {
  6443. string = '' + string
  6444. }
  6445. var len = string.length
  6446. if (len === 0) return 0
  6447. // Use a for loop to avoid recursion
  6448. var loweredCase = false
  6449. for (;;) {
  6450. switch (encoding) {
  6451. case 'ascii':
  6452. case 'latin1':
  6453. case 'binary':
  6454. return len
  6455. case 'utf8':
  6456. case 'utf-8':
  6457. case undefined:
  6458. return utf8ToBytes(string).length
  6459. case 'ucs2':
  6460. case 'ucs-2':
  6461. case 'utf16le':
  6462. case 'utf-16le':
  6463. return len * 2
  6464. case 'hex':
  6465. return len >>> 1
  6466. case 'base64':
  6467. return base64ToBytes(string).length
  6468. default:
  6469. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6470. encoding = ('' + encoding).toLowerCase()
  6471. loweredCase = true
  6472. }
  6473. }
  6474. }
  6475. Buffer.byteLength = byteLength
  6476. function slowToString (encoding, start, end) {
  6477. var loweredCase = false
  6478. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6479. // property of a typed array.
  6480. // This behaves neither like String nor Uint8Array in that we set start/end
  6481. // to their upper/lower bounds if the value passed is out of range.
  6482. // undefined is handled specially as per ECMA-262 6th Edition,
  6483. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6484. if (start === undefined || start < 0) {
  6485. start = 0
  6486. }
  6487. // Return early if start > this.length. Done here to prevent potential uint32
  6488. // coercion fail below.
  6489. if (start > this.length) {
  6490. return ''
  6491. }
  6492. if (end === undefined || end > this.length) {
  6493. end = this.length
  6494. }
  6495. if (end <= 0) {
  6496. return ''
  6497. }
  6498. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6499. end >>>= 0
  6500. start >>>= 0
  6501. if (end <= start) {
  6502. return ''
  6503. }
  6504. if (!encoding) encoding = 'utf8'
  6505. while (true) {
  6506. switch (encoding) {
  6507. case 'hex':
  6508. return hexSlice(this, start, end)
  6509. case 'utf8':
  6510. case 'utf-8':
  6511. return utf8Slice(this, start, end)
  6512. case 'ascii':
  6513. return asciiSlice(this, start, end)
  6514. case 'latin1':
  6515. case 'binary':
  6516. return latin1Slice(this, start, end)
  6517. case 'base64':
  6518. return base64Slice(this, start, end)
  6519. case 'ucs2':
  6520. case 'ucs-2':
  6521. case 'utf16le':
  6522. case 'utf-16le':
  6523. return utf16leSlice(this, start, end)
  6524. default:
  6525. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6526. encoding = (encoding + '').toLowerCase()
  6527. loweredCase = true
  6528. }
  6529. }
  6530. }
  6531. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6532. // Buffer instances.
  6533. Buffer.prototype._isBuffer = true
  6534. function swap (b, n, m) {
  6535. var i = b[n]
  6536. b[n] = b[m]
  6537. b[m] = i
  6538. }
  6539. Buffer.prototype.swap16 = function swap16 () {
  6540. var len = this.length
  6541. if (len % 2 !== 0) {
  6542. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6543. }
  6544. for (var i = 0; i < len; i += 2) {
  6545. swap(this, i, i + 1)
  6546. }
  6547. return this
  6548. }
  6549. Buffer.prototype.swap32 = function swap32 () {
  6550. var len = this.length
  6551. if (len % 4 !== 0) {
  6552. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6553. }
  6554. for (var i = 0; i < len; i += 4) {
  6555. swap(this, i, i + 3)
  6556. swap(this, i + 1, i + 2)
  6557. }
  6558. return this
  6559. }
  6560. Buffer.prototype.swap64 = function swap64 () {
  6561. var len = this.length
  6562. if (len % 8 !== 0) {
  6563. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6564. }
  6565. for (var i = 0; i < len; i += 8) {
  6566. swap(this, i, i + 7)
  6567. swap(this, i + 1, i + 6)
  6568. swap(this, i + 2, i + 5)
  6569. swap(this, i + 3, i + 4)
  6570. }
  6571. return this
  6572. }
  6573. Buffer.prototype.toString = function toString () {
  6574. var length = this.length | 0
  6575. if (length === 0) return ''
  6576. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6577. return slowToString.apply(this, arguments)
  6578. }
  6579. Buffer.prototype.equals = function equals (b) {
  6580. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6581. if (this === b) return true
  6582. return Buffer.compare(this, b) === 0
  6583. }
  6584. Buffer.prototype.inspect = function inspect () {
  6585. var str = ''
  6586. var max = exports.INSPECT_MAX_BYTES
  6587. if (this.length > 0) {
  6588. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6589. if (this.length > max) str += ' ... '
  6590. }
  6591. return '<Buffer ' + str + '>'
  6592. }
  6593. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6594. if (!Buffer.isBuffer(target)) {
  6595. throw new TypeError('Argument must be a Buffer')
  6596. }
  6597. if (start === undefined) {
  6598. start = 0
  6599. }
  6600. if (end === undefined) {
  6601. end = target ? target.length : 0
  6602. }
  6603. if (thisStart === undefined) {
  6604. thisStart = 0
  6605. }
  6606. if (thisEnd === undefined) {
  6607. thisEnd = this.length
  6608. }
  6609. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6610. throw new RangeError('out of range index')
  6611. }
  6612. if (thisStart >= thisEnd && start >= end) {
  6613. return 0
  6614. }
  6615. if (thisStart >= thisEnd) {
  6616. return -1
  6617. }
  6618. if (start >= end) {
  6619. return 1
  6620. }
  6621. start >>>= 0
  6622. end >>>= 0
  6623. thisStart >>>= 0
  6624. thisEnd >>>= 0
  6625. if (this === target) return 0
  6626. var x = thisEnd - thisStart
  6627. var y = end - start
  6628. var len = Math.min(x, y)
  6629. var thisCopy = this.slice(thisStart, thisEnd)
  6630. var targetCopy = target.slice(start, end)
  6631. for (var i = 0; i < len; ++i) {
  6632. if (thisCopy[i] !== targetCopy[i]) {
  6633. x = thisCopy[i]
  6634. y = targetCopy[i]
  6635. break
  6636. }
  6637. }
  6638. if (x < y) return -1
  6639. if (y < x) return 1
  6640. return 0
  6641. }
  6642. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6643. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6644. //
  6645. // Arguments:
  6646. // - buffer - a Buffer to search
  6647. // - val - a string, Buffer, or number
  6648. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6649. // - encoding - an optional encoding, relevant is val is a string
  6650. // - dir - true for indexOf, false for lastIndexOf
  6651. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6652. // Empty buffer means no match
  6653. if (buffer.length === 0) return -1
  6654. // Normalize byteOffset
  6655. if (typeof byteOffset === 'string') {
  6656. encoding = byteOffset
  6657. byteOffset = 0
  6658. } else if (byteOffset > 0x7fffffff) {
  6659. byteOffset = 0x7fffffff
  6660. } else if (byteOffset < -0x80000000) {
  6661. byteOffset = -0x80000000
  6662. }
  6663. byteOffset = +byteOffset // Coerce to Number.
  6664. if (isNaN(byteOffset)) {
  6665. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6666. byteOffset = dir ? 0 : (buffer.length - 1)
  6667. }
  6668. // Normalize byteOffset: negative offsets start from the end of the buffer
  6669. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6670. if (byteOffset >= buffer.length) {
  6671. if (dir) return -1
  6672. else byteOffset = buffer.length - 1
  6673. } else if (byteOffset < 0) {
  6674. if (dir) byteOffset = 0
  6675. else return -1
  6676. }
  6677. // Normalize val
  6678. if (typeof val === 'string') {
  6679. val = Buffer.from(val, encoding)
  6680. }
  6681. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6682. if (Buffer.isBuffer(val)) {
  6683. // Special case: looking for empty string/buffer always fails
  6684. if (val.length === 0) {
  6685. return -1
  6686. }
  6687. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6688. } else if (typeof val === 'number') {
  6689. val = val & 0xFF // Search for a byte value [0-255]
  6690. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6691. typeof Uint8Array.prototype.indexOf === 'function') {
  6692. if (dir) {
  6693. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6694. } else {
  6695. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6696. }
  6697. }
  6698. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6699. }
  6700. throw new TypeError('val must be string, number or Buffer')
  6701. }
  6702. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6703. var indexSize = 1
  6704. var arrLength = arr.length
  6705. var valLength = val.length
  6706. if (encoding !== undefined) {
  6707. encoding = String(encoding).toLowerCase()
  6708. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6709. encoding === 'utf16le' || encoding === 'utf-16le') {
  6710. if (arr.length < 2 || val.length < 2) {
  6711. return -1
  6712. }
  6713. indexSize = 2
  6714. arrLength /= 2
  6715. valLength /= 2
  6716. byteOffset /= 2
  6717. }
  6718. }
  6719. function read (buf, i) {
  6720. if (indexSize === 1) {
  6721. return buf[i]
  6722. } else {
  6723. return buf.readUInt16BE(i * indexSize)
  6724. }
  6725. }
  6726. var i
  6727. if (dir) {
  6728. var foundIndex = -1
  6729. for (i = byteOffset; i < arrLength; i++) {
  6730. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6731. if (foundIndex === -1) foundIndex = i
  6732. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6733. } else {
  6734. if (foundIndex !== -1) i -= i - foundIndex
  6735. foundIndex = -1
  6736. }
  6737. }
  6738. } else {
  6739. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6740. for (i = byteOffset; i >= 0; i--) {
  6741. var found = true
  6742. for (var j = 0; j < valLength; j++) {
  6743. if (read(arr, i + j) !== read(val, j)) {
  6744. found = false
  6745. break
  6746. }
  6747. }
  6748. if (found) return i
  6749. }
  6750. }
  6751. return -1
  6752. }
  6753. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6754. return this.indexOf(val, byteOffset, encoding) !== -1
  6755. }
  6756. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6757. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6758. }
  6759. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6760. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6761. }
  6762. function hexWrite (buf, string, offset, length) {
  6763. offset = Number(offset) || 0
  6764. var remaining = buf.length - offset
  6765. if (!length) {
  6766. length = remaining
  6767. } else {
  6768. length = Number(length)
  6769. if (length > remaining) {
  6770. length = remaining
  6771. }
  6772. }
  6773. // must be an even number of digits
  6774. var strLen = string.length
  6775. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6776. if (length > strLen / 2) {
  6777. length = strLen / 2
  6778. }
  6779. for (var i = 0; i < length; ++i) {
  6780. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6781. if (isNaN(parsed)) return i
  6782. buf[offset + i] = parsed
  6783. }
  6784. return i
  6785. }
  6786. function utf8Write (buf, string, offset, length) {
  6787. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6788. }
  6789. function asciiWrite (buf, string, offset, length) {
  6790. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6791. }
  6792. function latin1Write (buf, string, offset, length) {
  6793. return asciiWrite(buf, string, offset, length)
  6794. }
  6795. function base64Write (buf, string, offset, length) {
  6796. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6797. }
  6798. function ucs2Write (buf, string, offset, length) {
  6799. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6800. }
  6801. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6802. // Buffer#write(string)
  6803. if (offset === undefined) {
  6804. encoding = 'utf8'
  6805. length = this.length
  6806. offset = 0
  6807. // Buffer#write(string, encoding)
  6808. } else if (length === undefined && typeof offset === 'string') {
  6809. encoding = offset
  6810. length = this.length
  6811. offset = 0
  6812. // Buffer#write(string, offset[, length][, encoding])
  6813. } else if (isFinite(offset)) {
  6814. offset = offset | 0
  6815. if (isFinite(length)) {
  6816. length = length | 0
  6817. if (encoding === undefined) encoding = 'utf8'
  6818. } else {
  6819. encoding = length
  6820. length = undefined
  6821. }
  6822. // legacy write(string, encoding, offset, length) - remove in v0.13
  6823. } else {
  6824. throw new Error(
  6825. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6826. )
  6827. }
  6828. var remaining = this.length - offset
  6829. if (length === undefined || length > remaining) length = remaining
  6830. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6831. throw new RangeError('Attempt to write outside buffer bounds')
  6832. }
  6833. if (!encoding) encoding = 'utf8'
  6834. var loweredCase = false
  6835. for (;;) {
  6836. switch (encoding) {
  6837. case 'hex':
  6838. return hexWrite(this, string, offset, length)
  6839. case 'utf8':
  6840. case 'utf-8':
  6841. return utf8Write(this, string, offset, length)
  6842. case 'ascii':
  6843. return asciiWrite(this, string, offset, length)
  6844. case 'latin1':
  6845. case 'binary':
  6846. return latin1Write(this, string, offset, length)
  6847. case 'base64':
  6848. // Warning: maxLength not taken into account in base64Write
  6849. return base64Write(this, string, offset, length)
  6850. case 'ucs2':
  6851. case 'ucs-2':
  6852. case 'utf16le':
  6853. case 'utf-16le':
  6854. return ucs2Write(this, string, offset, length)
  6855. default:
  6856. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6857. encoding = ('' + encoding).toLowerCase()
  6858. loweredCase = true
  6859. }
  6860. }
  6861. }
  6862. Buffer.prototype.toJSON = function toJSON () {
  6863. return {
  6864. type: 'Buffer',
  6865. data: Array.prototype.slice.call(this._arr || this, 0)
  6866. }
  6867. }
  6868. function base64Slice (buf, start, end) {
  6869. if (start === 0 && end === buf.length) {
  6870. return base64.fromByteArray(buf)
  6871. } else {
  6872. return base64.fromByteArray(buf.slice(start, end))
  6873. }
  6874. }
  6875. function utf8Slice (buf, start, end) {
  6876. end = Math.min(buf.length, end)
  6877. var res = []
  6878. var i = start
  6879. while (i < end) {
  6880. var firstByte = buf[i]
  6881. var codePoint = null
  6882. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6883. : (firstByte > 0xDF) ? 3
  6884. : (firstByte > 0xBF) ? 2
  6885. : 1
  6886. if (i + bytesPerSequence <= end) {
  6887. var secondByte, thirdByte, fourthByte, tempCodePoint
  6888. switch (bytesPerSequence) {
  6889. case 1:
  6890. if (firstByte < 0x80) {
  6891. codePoint = firstByte
  6892. }
  6893. break
  6894. case 2:
  6895. secondByte = buf[i + 1]
  6896. if ((secondByte & 0xC0) === 0x80) {
  6897. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6898. if (tempCodePoint > 0x7F) {
  6899. codePoint = tempCodePoint
  6900. }
  6901. }
  6902. break
  6903. case 3:
  6904. secondByte = buf[i + 1]
  6905. thirdByte = buf[i + 2]
  6906. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6907. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6908. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6909. codePoint = tempCodePoint
  6910. }
  6911. }
  6912. break
  6913. case 4:
  6914. secondByte = buf[i + 1]
  6915. thirdByte = buf[i + 2]
  6916. fourthByte = buf[i + 3]
  6917. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6918. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6919. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6920. codePoint = tempCodePoint
  6921. }
  6922. }
  6923. }
  6924. }
  6925. if (codePoint === null) {
  6926. // we did not generate a valid codePoint so insert a
  6927. // replacement char (U+FFFD) and advance only 1 byte
  6928. codePoint = 0xFFFD
  6929. bytesPerSequence = 1
  6930. } else if (codePoint > 0xFFFF) {
  6931. // encode to utf16 (surrogate pair dance)
  6932. codePoint -= 0x10000
  6933. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6934. codePoint = 0xDC00 | codePoint & 0x3FF
  6935. }
  6936. res.push(codePoint)
  6937. i += bytesPerSequence
  6938. }
  6939. return decodeCodePointsArray(res)
  6940. }
  6941. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6942. // the lowest limit is Chrome, with 0x10000 args.
  6943. // We go 1 magnitude less, for safety
  6944. var MAX_ARGUMENTS_LENGTH = 0x1000
  6945. function decodeCodePointsArray (codePoints) {
  6946. var len = codePoints.length
  6947. if (len <= MAX_ARGUMENTS_LENGTH) {
  6948. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6949. }
  6950. // Decode in chunks to avoid "call stack size exceeded".
  6951. var res = ''
  6952. var i = 0
  6953. while (i < len) {
  6954. res += String.fromCharCode.apply(
  6955. String,
  6956. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6957. )
  6958. }
  6959. return res
  6960. }
  6961. function asciiSlice (buf, start, end) {
  6962. var ret = ''
  6963. end = Math.min(buf.length, end)
  6964. for (var i = start; i < end; ++i) {
  6965. ret += String.fromCharCode(buf[i] & 0x7F)
  6966. }
  6967. return ret
  6968. }
  6969. function latin1Slice (buf, start, end) {
  6970. var ret = ''
  6971. end = Math.min(buf.length, end)
  6972. for (var i = start; i < end; ++i) {
  6973. ret += String.fromCharCode(buf[i])
  6974. }
  6975. return ret
  6976. }
  6977. function hexSlice (buf, start, end) {
  6978. var len = buf.length
  6979. if (!start || start < 0) start = 0
  6980. if (!end || end < 0 || end > len) end = len
  6981. var out = ''
  6982. for (var i = start; i < end; ++i) {
  6983. out += toHex(buf[i])
  6984. }
  6985. return out
  6986. }
  6987. function utf16leSlice (buf, start, end) {
  6988. var bytes = buf.slice(start, end)
  6989. var res = ''
  6990. for (var i = 0; i < bytes.length; i += 2) {
  6991. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6992. }
  6993. return res
  6994. }
  6995. Buffer.prototype.slice = function slice (start, end) {
  6996. var len = this.length
  6997. start = ~~start
  6998. end = end === undefined ? len : ~~end
  6999. if (start < 0) {
  7000. start += len
  7001. if (start < 0) start = 0
  7002. } else if (start > len) {
  7003. start = len
  7004. }
  7005. if (end < 0) {
  7006. end += len
  7007. if (end < 0) end = 0
  7008. } else if (end > len) {
  7009. end = len
  7010. }
  7011. if (end < start) end = start
  7012. var newBuf
  7013. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7014. newBuf = this.subarray(start, end)
  7015. newBuf.__proto__ = Buffer.prototype
  7016. } else {
  7017. var sliceLen = end - start
  7018. newBuf = new Buffer(sliceLen, undefined)
  7019. for (var i = 0; i < sliceLen; ++i) {
  7020. newBuf[i] = this[i + start]
  7021. }
  7022. }
  7023. return newBuf
  7024. }
  7025. /*
  7026. * Need to make sure that buffer isn't trying to write out of bounds.
  7027. */
  7028. function checkOffset (offset, ext, length) {
  7029. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7030. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7031. }
  7032. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7033. offset = offset | 0
  7034. byteLength = byteLength | 0
  7035. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7036. var val = this[offset]
  7037. var mul = 1
  7038. var i = 0
  7039. while (++i < byteLength && (mul *= 0x100)) {
  7040. val += this[offset + i] * mul
  7041. }
  7042. return val
  7043. }
  7044. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7045. offset = offset | 0
  7046. byteLength = byteLength | 0
  7047. if (!noAssert) {
  7048. checkOffset(offset, byteLength, this.length)
  7049. }
  7050. var val = this[offset + --byteLength]
  7051. var mul = 1
  7052. while (byteLength > 0 && (mul *= 0x100)) {
  7053. val += this[offset + --byteLength] * mul
  7054. }
  7055. return val
  7056. }
  7057. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7058. if (!noAssert) checkOffset(offset, 1, this.length)
  7059. return this[offset]
  7060. }
  7061. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7062. if (!noAssert) checkOffset(offset, 2, this.length)
  7063. return this[offset] | (this[offset + 1] << 8)
  7064. }
  7065. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7066. if (!noAssert) checkOffset(offset, 2, this.length)
  7067. return (this[offset] << 8) | this[offset + 1]
  7068. }
  7069. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7070. if (!noAssert) checkOffset(offset, 4, this.length)
  7071. return ((this[offset]) |
  7072. (this[offset + 1] << 8) |
  7073. (this[offset + 2] << 16)) +
  7074. (this[offset + 3] * 0x1000000)
  7075. }
  7076. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7077. if (!noAssert) checkOffset(offset, 4, this.length)
  7078. return (this[offset] * 0x1000000) +
  7079. ((this[offset + 1] << 16) |
  7080. (this[offset + 2] << 8) |
  7081. this[offset + 3])
  7082. }
  7083. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7084. offset = offset | 0
  7085. byteLength = byteLength | 0
  7086. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7087. var val = this[offset]
  7088. var mul = 1
  7089. var i = 0
  7090. while (++i < byteLength && (mul *= 0x100)) {
  7091. val += this[offset + i] * mul
  7092. }
  7093. mul *= 0x80
  7094. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7095. return val
  7096. }
  7097. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7098. offset = offset | 0
  7099. byteLength = byteLength | 0
  7100. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7101. var i = byteLength
  7102. var mul = 1
  7103. var val = this[offset + --i]
  7104. while (i > 0 && (mul *= 0x100)) {
  7105. val += this[offset + --i] * mul
  7106. }
  7107. mul *= 0x80
  7108. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7109. return val
  7110. }
  7111. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7112. if (!noAssert) checkOffset(offset, 1, this.length)
  7113. if (!(this[offset] & 0x80)) return (this[offset])
  7114. return ((0xff - this[offset] + 1) * -1)
  7115. }
  7116. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7117. if (!noAssert) checkOffset(offset, 2, this.length)
  7118. var val = this[offset] | (this[offset + 1] << 8)
  7119. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7120. }
  7121. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7122. if (!noAssert) checkOffset(offset, 2, this.length)
  7123. var val = this[offset + 1] | (this[offset] << 8)
  7124. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7125. }
  7126. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7127. if (!noAssert) checkOffset(offset, 4, this.length)
  7128. return (this[offset]) |
  7129. (this[offset + 1] << 8) |
  7130. (this[offset + 2] << 16) |
  7131. (this[offset + 3] << 24)
  7132. }
  7133. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7134. if (!noAssert) checkOffset(offset, 4, this.length)
  7135. return (this[offset] << 24) |
  7136. (this[offset + 1] << 16) |
  7137. (this[offset + 2] << 8) |
  7138. (this[offset + 3])
  7139. }
  7140. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7141. if (!noAssert) checkOffset(offset, 4, this.length)
  7142. return ieee754.read(this, offset, true, 23, 4)
  7143. }
  7144. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7145. if (!noAssert) checkOffset(offset, 4, this.length)
  7146. return ieee754.read(this, offset, false, 23, 4)
  7147. }
  7148. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7149. if (!noAssert) checkOffset(offset, 8, this.length)
  7150. return ieee754.read(this, offset, true, 52, 8)
  7151. }
  7152. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7153. if (!noAssert) checkOffset(offset, 8, this.length)
  7154. return ieee754.read(this, offset, false, 52, 8)
  7155. }
  7156. function checkInt (buf, value, offset, ext, max, min) {
  7157. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7158. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7159. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7160. }
  7161. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7162. value = +value
  7163. offset = offset | 0
  7164. byteLength = byteLength | 0
  7165. if (!noAssert) {
  7166. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7167. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7168. }
  7169. var mul = 1
  7170. var i = 0
  7171. this[offset] = value & 0xFF
  7172. while (++i < byteLength && (mul *= 0x100)) {
  7173. this[offset + i] = (value / mul) & 0xFF
  7174. }
  7175. return offset + byteLength
  7176. }
  7177. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7178. value = +value
  7179. offset = offset | 0
  7180. byteLength = byteLength | 0
  7181. if (!noAssert) {
  7182. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7183. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7184. }
  7185. var i = byteLength - 1
  7186. var mul = 1
  7187. this[offset + i] = value & 0xFF
  7188. while (--i >= 0 && (mul *= 0x100)) {
  7189. this[offset + i] = (value / mul) & 0xFF
  7190. }
  7191. return offset + byteLength
  7192. }
  7193. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7194. value = +value
  7195. offset = offset | 0
  7196. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7197. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7198. this[offset] = (value & 0xff)
  7199. return offset + 1
  7200. }
  7201. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7202. if (value < 0) value = 0xffff + value + 1
  7203. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7204. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7205. (littleEndian ? i : 1 - i) * 8
  7206. }
  7207. }
  7208. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7209. value = +value
  7210. offset = offset | 0
  7211. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7212. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7213. this[offset] = (value & 0xff)
  7214. this[offset + 1] = (value >>> 8)
  7215. } else {
  7216. objectWriteUInt16(this, value, offset, true)
  7217. }
  7218. return offset + 2
  7219. }
  7220. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7221. value = +value
  7222. offset = offset | 0
  7223. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7224. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7225. this[offset] = (value >>> 8)
  7226. this[offset + 1] = (value & 0xff)
  7227. } else {
  7228. objectWriteUInt16(this, value, offset, false)
  7229. }
  7230. return offset + 2
  7231. }
  7232. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7233. if (value < 0) value = 0xffffffff + value + 1
  7234. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7235. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7236. }
  7237. }
  7238. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7239. value = +value
  7240. offset = offset | 0
  7241. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7242. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7243. this[offset + 3] = (value >>> 24)
  7244. this[offset + 2] = (value >>> 16)
  7245. this[offset + 1] = (value >>> 8)
  7246. this[offset] = (value & 0xff)
  7247. } else {
  7248. objectWriteUInt32(this, value, offset, true)
  7249. }
  7250. return offset + 4
  7251. }
  7252. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7253. value = +value
  7254. offset = offset | 0
  7255. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7256. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7257. this[offset] = (value >>> 24)
  7258. this[offset + 1] = (value >>> 16)
  7259. this[offset + 2] = (value >>> 8)
  7260. this[offset + 3] = (value & 0xff)
  7261. } else {
  7262. objectWriteUInt32(this, value, offset, false)
  7263. }
  7264. return offset + 4
  7265. }
  7266. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7267. value = +value
  7268. offset = offset | 0
  7269. if (!noAssert) {
  7270. var limit = Math.pow(2, 8 * byteLength - 1)
  7271. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7272. }
  7273. var i = 0
  7274. var mul = 1
  7275. var sub = 0
  7276. this[offset] = value & 0xFF
  7277. while (++i < byteLength && (mul *= 0x100)) {
  7278. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7279. sub = 1
  7280. }
  7281. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7282. }
  7283. return offset + byteLength
  7284. }
  7285. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7286. value = +value
  7287. offset = offset | 0
  7288. if (!noAssert) {
  7289. var limit = Math.pow(2, 8 * byteLength - 1)
  7290. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7291. }
  7292. var i = byteLength - 1
  7293. var mul = 1
  7294. var sub = 0
  7295. this[offset + i] = value & 0xFF
  7296. while (--i >= 0 && (mul *= 0x100)) {
  7297. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7298. sub = 1
  7299. }
  7300. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7301. }
  7302. return offset + byteLength
  7303. }
  7304. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7305. value = +value
  7306. offset = offset | 0
  7307. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7308. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7309. if (value < 0) value = 0xff + value + 1
  7310. this[offset] = (value & 0xff)
  7311. return offset + 1
  7312. }
  7313. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7314. value = +value
  7315. offset = offset | 0
  7316. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7317. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7318. this[offset] = (value & 0xff)
  7319. this[offset + 1] = (value >>> 8)
  7320. } else {
  7321. objectWriteUInt16(this, value, offset, true)
  7322. }
  7323. return offset + 2
  7324. }
  7325. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7326. value = +value
  7327. offset = offset | 0
  7328. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7329. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7330. this[offset] = (value >>> 8)
  7331. this[offset + 1] = (value & 0xff)
  7332. } else {
  7333. objectWriteUInt16(this, value, offset, false)
  7334. }
  7335. return offset + 2
  7336. }
  7337. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7338. value = +value
  7339. offset = offset | 0
  7340. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7341. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7342. this[offset] = (value & 0xff)
  7343. this[offset + 1] = (value >>> 8)
  7344. this[offset + 2] = (value >>> 16)
  7345. this[offset + 3] = (value >>> 24)
  7346. } else {
  7347. objectWriteUInt32(this, value, offset, true)
  7348. }
  7349. return offset + 4
  7350. }
  7351. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7352. value = +value
  7353. offset = offset | 0
  7354. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7355. if (value < 0) value = 0xffffffff + value + 1
  7356. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7357. this[offset] = (value >>> 24)
  7358. this[offset + 1] = (value >>> 16)
  7359. this[offset + 2] = (value >>> 8)
  7360. this[offset + 3] = (value & 0xff)
  7361. } else {
  7362. objectWriteUInt32(this, value, offset, false)
  7363. }
  7364. return offset + 4
  7365. }
  7366. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7367. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7368. if (offset < 0) throw new RangeError('Index out of range')
  7369. }
  7370. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7371. if (!noAssert) {
  7372. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7373. }
  7374. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7375. return offset + 4
  7376. }
  7377. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7378. return writeFloat(this, value, offset, true, noAssert)
  7379. }
  7380. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7381. return writeFloat(this, value, offset, false, noAssert)
  7382. }
  7383. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7384. if (!noAssert) {
  7385. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7386. }
  7387. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7388. return offset + 8
  7389. }
  7390. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7391. return writeDouble(this, value, offset, true, noAssert)
  7392. }
  7393. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7394. return writeDouble(this, value, offset, false, noAssert)
  7395. }
  7396. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7397. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7398. if (!start) start = 0
  7399. if (!end && end !== 0) end = this.length
  7400. if (targetStart >= target.length) targetStart = target.length
  7401. if (!targetStart) targetStart = 0
  7402. if (end > 0 && end < start) end = start
  7403. // Copy 0 bytes; we're done
  7404. if (end === start) return 0
  7405. if (target.length === 0 || this.length === 0) return 0
  7406. // Fatal error conditions
  7407. if (targetStart < 0) {
  7408. throw new RangeError('targetStart out of bounds')
  7409. }
  7410. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7411. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7412. // Are we oob?
  7413. if (end > this.length) end = this.length
  7414. if (target.length - targetStart < end - start) {
  7415. end = target.length - targetStart + start
  7416. }
  7417. var len = end - start
  7418. var i
  7419. if (this === target && start < targetStart && targetStart < end) {
  7420. // descending copy from end
  7421. for (i = len - 1; i >= 0; --i) {
  7422. target[i + targetStart] = this[i + start]
  7423. }
  7424. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7425. // ascending copy from start
  7426. for (i = 0; i < len; ++i) {
  7427. target[i + targetStart] = this[i + start]
  7428. }
  7429. } else {
  7430. Uint8Array.prototype.set.call(
  7431. target,
  7432. this.subarray(start, start + len),
  7433. targetStart
  7434. )
  7435. }
  7436. return len
  7437. }
  7438. // Usage:
  7439. // buffer.fill(number[, offset[, end]])
  7440. // buffer.fill(buffer[, offset[, end]])
  7441. // buffer.fill(string[, offset[, end]][, encoding])
  7442. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7443. // Handle string cases:
  7444. if (typeof val === 'string') {
  7445. if (typeof start === 'string') {
  7446. encoding = start
  7447. start = 0
  7448. end = this.length
  7449. } else if (typeof end === 'string') {
  7450. encoding = end
  7451. end = this.length
  7452. }
  7453. if (val.length === 1) {
  7454. var code = val.charCodeAt(0)
  7455. if (code < 256) {
  7456. val = code
  7457. }
  7458. }
  7459. if (encoding !== undefined && typeof encoding !== 'string') {
  7460. throw new TypeError('encoding must be a string')
  7461. }
  7462. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7463. throw new TypeError('Unknown encoding: ' + encoding)
  7464. }
  7465. } else if (typeof val === 'number') {
  7466. val = val & 255
  7467. }
  7468. // Invalid ranges are not set to a default, so can range check early.
  7469. if (start < 0 || this.length < start || this.length < end) {
  7470. throw new RangeError('Out of range index')
  7471. }
  7472. if (end <= start) {
  7473. return this
  7474. }
  7475. start = start >>> 0
  7476. end = end === undefined ? this.length : end >>> 0
  7477. if (!val) val = 0
  7478. var i
  7479. if (typeof val === 'number') {
  7480. for (i = start; i < end; ++i) {
  7481. this[i] = val
  7482. }
  7483. } else {
  7484. var bytes = Buffer.isBuffer(val)
  7485. ? val
  7486. : utf8ToBytes(new Buffer(val, encoding).toString())
  7487. var len = bytes.length
  7488. for (i = 0; i < end - start; ++i) {
  7489. this[i + start] = bytes[i % len]
  7490. }
  7491. }
  7492. return this
  7493. }
  7494. // HELPER FUNCTIONS
  7495. // ================
  7496. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7497. function base64clean (str) {
  7498. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7499. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7500. // Node converts strings with length < 2 to ''
  7501. if (str.length < 2) return ''
  7502. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7503. while (str.length % 4 !== 0) {
  7504. str = str + '='
  7505. }
  7506. return str
  7507. }
  7508. function stringtrim (str) {
  7509. if (str.trim) return str.trim()
  7510. return str.replace(/^\s+|\s+$/g, '')
  7511. }
  7512. function toHex (n) {
  7513. if (n < 16) return '0' + n.toString(16)
  7514. return n.toString(16)
  7515. }
  7516. function utf8ToBytes (string, units) {
  7517. units = units || Infinity
  7518. var codePoint
  7519. var length = string.length
  7520. var leadSurrogate = null
  7521. var bytes = []
  7522. for (var i = 0; i < length; ++i) {
  7523. codePoint = string.charCodeAt(i)
  7524. // is surrogate component
  7525. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7526. // last char was a lead
  7527. if (!leadSurrogate) {
  7528. // no lead yet
  7529. if (codePoint > 0xDBFF) {
  7530. // unexpected trail
  7531. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7532. continue
  7533. } else if (i + 1 === length) {
  7534. // unpaired lead
  7535. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7536. continue
  7537. }
  7538. // valid lead
  7539. leadSurrogate = codePoint
  7540. continue
  7541. }
  7542. // 2 leads in a row
  7543. if (codePoint < 0xDC00) {
  7544. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7545. leadSurrogate = codePoint
  7546. continue
  7547. }
  7548. // valid surrogate pair
  7549. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7550. } else if (leadSurrogate) {
  7551. // valid bmp char, but last char was a lead
  7552. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7553. }
  7554. leadSurrogate = null
  7555. // encode utf8
  7556. if (codePoint < 0x80) {
  7557. if ((units -= 1) < 0) break
  7558. bytes.push(codePoint)
  7559. } else if (codePoint < 0x800) {
  7560. if ((units -= 2) < 0) break
  7561. bytes.push(
  7562. codePoint >> 0x6 | 0xC0,
  7563. codePoint & 0x3F | 0x80
  7564. )
  7565. } else if (codePoint < 0x10000) {
  7566. if ((units -= 3) < 0) break
  7567. bytes.push(
  7568. codePoint >> 0xC | 0xE0,
  7569. codePoint >> 0x6 & 0x3F | 0x80,
  7570. codePoint & 0x3F | 0x80
  7571. )
  7572. } else if (codePoint < 0x110000) {
  7573. if ((units -= 4) < 0) break
  7574. bytes.push(
  7575. codePoint >> 0x12 | 0xF0,
  7576. codePoint >> 0xC & 0x3F | 0x80,
  7577. codePoint >> 0x6 & 0x3F | 0x80,
  7578. codePoint & 0x3F | 0x80
  7579. )
  7580. } else {
  7581. throw new Error('Invalid code point')
  7582. }
  7583. }
  7584. return bytes
  7585. }
  7586. function asciiToBytes (str) {
  7587. var byteArray = []
  7588. for (var i = 0; i < str.length; ++i) {
  7589. // Node's code seems to be doing this and not & 0x7F..
  7590. byteArray.push(str.charCodeAt(i) & 0xFF)
  7591. }
  7592. return byteArray
  7593. }
  7594. function utf16leToBytes (str, units) {
  7595. var c, hi, lo
  7596. var byteArray = []
  7597. for (var i = 0; i < str.length; ++i) {
  7598. if ((units -= 2) < 0) break
  7599. c = str.charCodeAt(i)
  7600. hi = c >> 8
  7601. lo = c % 256
  7602. byteArray.push(lo)
  7603. byteArray.push(hi)
  7604. }
  7605. return byteArray
  7606. }
  7607. function base64ToBytes (str) {
  7608. return base64.toByteArray(base64clean(str))
  7609. }
  7610. function blitBuffer (src, dst, offset, length) {
  7611. for (var i = 0; i < length; ++i) {
  7612. if ((i + offset >= dst.length) || (i >= src.length)) break
  7613. dst[i + offset] = src[i]
  7614. }
  7615. return i
  7616. }
  7617. function isnan (val) {
  7618. return val !== val // eslint-disable-line no-self-compare
  7619. }
  7620. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7621. /***/ }),
  7622. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7623. /*!**************************************************!*\
  7624. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7625. \**************************************************/
  7626. /*! no static exports found */
  7627. /***/ (function(module, exports, __webpack_require__) {
  7628. /*!
  7629. * clipboard.js v2.0.4
  7630. * https://zenorocha.github.io/clipboard.js
  7631. *
  7632. * Licensed MIT © Zeno Rocha
  7633. */
  7634. (function webpackUniversalModuleDefinition(root, factory) {
  7635. if(true)
  7636. module.exports = factory();
  7637. else {}
  7638. })(this, function() {
  7639. return /******/ (function(modules) { // webpackBootstrap
  7640. /******/ // The module cache
  7641. /******/ var installedModules = {};
  7642. /******/
  7643. /******/ // The require function
  7644. /******/ function __webpack_require__(moduleId) {
  7645. /******/
  7646. /******/ // Check if module is in cache
  7647. /******/ if(installedModules[moduleId]) {
  7648. /******/ return installedModules[moduleId].exports;
  7649. /******/ }
  7650. /******/ // Create a new module (and put it into the cache)
  7651. /******/ var module = installedModules[moduleId] = {
  7652. /******/ i: moduleId,
  7653. /******/ l: false,
  7654. /******/ exports: {}
  7655. /******/ };
  7656. /******/
  7657. /******/ // Execute the module function
  7658. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7659. /******/
  7660. /******/ // Flag the module as loaded
  7661. /******/ module.l = true;
  7662. /******/
  7663. /******/ // Return the exports of the module
  7664. /******/ return module.exports;
  7665. /******/ }
  7666. /******/
  7667. /******/
  7668. /******/ // expose the modules object (__webpack_modules__)
  7669. /******/ __webpack_require__.m = modules;
  7670. /******/
  7671. /******/ // expose the module cache
  7672. /******/ __webpack_require__.c = installedModules;
  7673. /******/
  7674. /******/ // define getter function for harmony exports
  7675. /******/ __webpack_require__.d = function(exports, name, getter) {
  7676. /******/ if(!__webpack_require__.o(exports, name)) {
  7677. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7678. /******/ }
  7679. /******/ };
  7680. /******/
  7681. /******/ // define __esModule on exports
  7682. /******/ __webpack_require__.r = function(exports) {
  7683. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7684. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7685. /******/ }
  7686. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7687. /******/ };
  7688. /******/
  7689. /******/ // create a fake namespace object
  7690. /******/ // mode & 1: value is a module id, require it
  7691. /******/ // mode & 2: merge all properties of value into the ns
  7692. /******/ // mode & 4: return value when already ns object
  7693. /******/ // mode & 8|1: behave like require
  7694. /******/ __webpack_require__.t = function(value, mode) {
  7695. /******/ if(mode & 1) value = __webpack_require__(value);
  7696. /******/ if(mode & 8) return value;
  7697. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7698. /******/ var ns = Object.create(null);
  7699. /******/ __webpack_require__.r(ns);
  7700. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7701. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7702. /******/ return ns;
  7703. /******/ };
  7704. /******/
  7705. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7706. /******/ __webpack_require__.n = function(module) {
  7707. /******/ var getter = module && module.__esModule ?
  7708. /******/ function getDefault() { return module['default']; } :
  7709. /******/ function getModuleExports() { return module; };
  7710. /******/ __webpack_require__.d(getter, 'a', getter);
  7711. /******/ return getter;
  7712. /******/ };
  7713. /******/
  7714. /******/ // Object.prototype.hasOwnProperty.call
  7715. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7716. /******/
  7717. /******/ // __webpack_public_path__
  7718. /******/ __webpack_require__.p = "";
  7719. /******/
  7720. /******/
  7721. /******/ // Load entry module and return exports
  7722. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7723. /******/ })
  7724. /************************************************************************/
  7725. /******/ ([
  7726. /* 0 */
  7727. /***/ (function(module, exports, __webpack_require__) {
  7728. "use strict";
  7729. 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; };
  7730. 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; }; }();
  7731. var _clipboardAction = __webpack_require__(1);
  7732. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7733. var _tinyEmitter = __webpack_require__(3);
  7734. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7735. var _goodListener = __webpack_require__(4);
  7736. var _goodListener2 = _interopRequireDefault(_goodListener);
  7737. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7738. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7739. 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; }
  7740. 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; }
  7741. /**
  7742. * Base class which takes one or more elements, adds event listeners to them,
  7743. * and instantiates a new `ClipboardAction` on each click.
  7744. */
  7745. var Clipboard = function (_Emitter) {
  7746. _inherits(Clipboard, _Emitter);
  7747. /**
  7748. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7749. * @param {Object} options
  7750. */
  7751. function Clipboard(trigger, options) {
  7752. _classCallCheck(this, Clipboard);
  7753. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7754. _this.resolveOptions(options);
  7755. _this.listenClick(trigger);
  7756. return _this;
  7757. }
  7758. /**
  7759. * Defines if attributes would be resolved using internal setter functions
  7760. * or custom functions that were passed in the constructor.
  7761. * @param {Object} options
  7762. */
  7763. _createClass(Clipboard, [{
  7764. key: 'resolveOptions',
  7765. value: function resolveOptions() {
  7766. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7767. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7768. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7769. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7770. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7771. }
  7772. /**
  7773. * Adds a click event listener to the passed trigger.
  7774. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7775. */
  7776. }, {
  7777. key: 'listenClick',
  7778. value: function listenClick(trigger) {
  7779. var _this2 = this;
  7780. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7781. return _this2.onClick(e);
  7782. });
  7783. }
  7784. /**
  7785. * Defines a new `ClipboardAction` on each click event.
  7786. * @param {Event} e
  7787. */
  7788. }, {
  7789. key: 'onClick',
  7790. value: function onClick(e) {
  7791. var trigger = e.delegateTarget || e.currentTarget;
  7792. if (this.clipboardAction) {
  7793. this.clipboardAction = null;
  7794. }
  7795. this.clipboardAction = new _clipboardAction2.default({
  7796. action: this.action(trigger),
  7797. target: this.target(trigger),
  7798. text: this.text(trigger),
  7799. container: this.container,
  7800. trigger: trigger,
  7801. emitter: this
  7802. });
  7803. }
  7804. /**
  7805. * Default `action` lookup function.
  7806. * @param {Element} trigger
  7807. */
  7808. }, {
  7809. key: 'defaultAction',
  7810. value: function defaultAction(trigger) {
  7811. return getAttributeValue('action', trigger);
  7812. }
  7813. /**
  7814. * Default `target` lookup function.
  7815. * @param {Element} trigger
  7816. */
  7817. }, {
  7818. key: 'defaultTarget',
  7819. value: function defaultTarget(trigger) {
  7820. var selector = getAttributeValue('target', trigger);
  7821. if (selector) {
  7822. return document.querySelector(selector);
  7823. }
  7824. }
  7825. /**
  7826. * Returns the support of the given action, or all actions if no action is
  7827. * given.
  7828. * @param {String} [action]
  7829. */
  7830. }, {
  7831. key: 'defaultText',
  7832. /**
  7833. * Default `text` lookup function.
  7834. * @param {Element} trigger
  7835. */
  7836. value: function defaultText(trigger) {
  7837. return getAttributeValue('text', trigger);
  7838. }
  7839. /**
  7840. * Destroy lifecycle.
  7841. */
  7842. }, {
  7843. key: 'destroy',
  7844. value: function destroy() {
  7845. this.listener.destroy();
  7846. if (this.clipboardAction) {
  7847. this.clipboardAction.destroy();
  7848. this.clipboardAction = null;
  7849. }
  7850. }
  7851. }], [{
  7852. key: 'isSupported',
  7853. value: function isSupported() {
  7854. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7855. var actions = typeof action === 'string' ? [action] : action;
  7856. var support = !!document.queryCommandSupported;
  7857. actions.forEach(function (action) {
  7858. support = support && !!document.queryCommandSupported(action);
  7859. });
  7860. return support;
  7861. }
  7862. }]);
  7863. return Clipboard;
  7864. }(_tinyEmitter2.default);
  7865. /**
  7866. * Helper function to retrieve attribute value.
  7867. * @param {String} suffix
  7868. * @param {Element} element
  7869. */
  7870. function getAttributeValue(suffix, element) {
  7871. var attribute = 'data-clipboard-' + suffix;
  7872. if (!element.hasAttribute(attribute)) {
  7873. return;
  7874. }
  7875. return element.getAttribute(attribute);
  7876. }
  7877. module.exports = Clipboard;
  7878. /***/ }),
  7879. /* 1 */
  7880. /***/ (function(module, exports, __webpack_require__) {
  7881. "use strict";
  7882. 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; };
  7883. 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; }; }();
  7884. var _select = __webpack_require__(2);
  7885. var _select2 = _interopRequireDefault(_select);
  7886. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7887. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7888. /**
  7889. * Inner class which performs selection from either `text` or `target`
  7890. * properties and then executes copy or cut operations.
  7891. */
  7892. var ClipboardAction = function () {
  7893. /**
  7894. * @param {Object} options
  7895. */
  7896. function ClipboardAction(options) {
  7897. _classCallCheck(this, ClipboardAction);
  7898. this.resolveOptions(options);
  7899. this.initSelection();
  7900. }
  7901. /**
  7902. * Defines base properties passed from constructor.
  7903. * @param {Object} options
  7904. */
  7905. _createClass(ClipboardAction, [{
  7906. key: 'resolveOptions',
  7907. value: function resolveOptions() {
  7908. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7909. this.action = options.action;
  7910. this.container = options.container;
  7911. this.emitter = options.emitter;
  7912. this.target = options.target;
  7913. this.text = options.text;
  7914. this.trigger = options.trigger;
  7915. this.selectedText = '';
  7916. }
  7917. /**
  7918. * Decides which selection strategy is going to be applied based
  7919. * on the existence of `text` and `target` properties.
  7920. */
  7921. }, {
  7922. key: 'initSelection',
  7923. value: function initSelection() {
  7924. if (this.text) {
  7925. this.selectFake();
  7926. } else if (this.target) {
  7927. this.selectTarget();
  7928. }
  7929. }
  7930. /**
  7931. * Creates a fake textarea element, sets its value from `text` property,
  7932. * and makes a selection on it.
  7933. */
  7934. }, {
  7935. key: 'selectFake',
  7936. value: function selectFake() {
  7937. var _this = this;
  7938. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7939. this.removeFake();
  7940. this.fakeHandlerCallback = function () {
  7941. return _this.removeFake();
  7942. };
  7943. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7944. this.fakeElem = document.createElement('textarea');
  7945. // Prevent zooming on iOS
  7946. this.fakeElem.style.fontSize = '12pt';
  7947. // Reset box model
  7948. this.fakeElem.style.border = '0';
  7949. this.fakeElem.style.padding = '0';
  7950. this.fakeElem.style.margin = '0';
  7951. // Move element out of screen horizontally
  7952. this.fakeElem.style.position = 'absolute';
  7953. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7954. // Move element to the same position vertically
  7955. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7956. this.fakeElem.style.top = yPosition + 'px';
  7957. this.fakeElem.setAttribute('readonly', '');
  7958. this.fakeElem.value = this.text;
  7959. this.container.appendChild(this.fakeElem);
  7960. this.selectedText = (0, _select2.default)(this.fakeElem);
  7961. this.copyText();
  7962. }
  7963. /**
  7964. * Only removes the fake element after another click event, that way
  7965. * a user can hit `Ctrl+C` to copy because selection still exists.
  7966. */
  7967. }, {
  7968. key: 'removeFake',
  7969. value: function removeFake() {
  7970. if (this.fakeHandler) {
  7971. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7972. this.fakeHandler = null;
  7973. this.fakeHandlerCallback = null;
  7974. }
  7975. if (this.fakeElem) {
  7976. this.container.removeChild(this.fakeElem);
  7977. this.fakeElem = null;
  7978. }
  7979. }
  7980. /**
  7981. * Selects the content from element passed on `target` property.
  7982. */
  7983. }, {
  7984. key: 'selectTarget',
  7985. value: function selectTarget() {
  7986. this.selectedText = (0, _select2.default)(this.target);
  7987. this.copyText();
  7988. }
  7989. /**
  7990. * Executes the copy operation based on the current selection.
  7991. */
  7992. }, {
  7993. key: 'copyText',
  7994. value: function copyText() {
  7995. var succeeded = void 0;
  7996. try {
  7997. succeeded = document.execCommand(this.action);
  7998. } catch (err) {
  7999. succeeded = false;
  8000. }
  8001. this.handleResult(succeeded);
  8002. }
  8003. /**
  8004. * Fires an event based on the copy operation result.
  8005. * @param {Boolean} succeeded
  8006. */
  8007. }, {
  8008. key: 'handleResult',
  8009. value: function handleResult(succeeded) {
  8010. this.emitter.emit(succeeded ? 'success' : 'error', {
  8011. action: this.action,
  8012. text: this.selectedText,
  8013. trigger: this.trigger,
  8014. clearSelection: this.clearSelection.bind(this)
  8015. });
  8016. }
  8017. /**
  8018. * Moves focus away from `target` and back to the trigger, removes current selection.
  8019. */
  8020. }, {
  8021. key: 'clearSelection',
  8022. value: function clearSelection() {
  8023. if (this.trigger) {
  8024. this.trigger.focus();
  8025. }
  8026. window.getSelection().removeAllRanges();
  8027. }
  8028. /**
  8029. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8030. * @param {String} action
  8031. */
  8032. }, {
  8033. key: 'destroy',
  8034. /**
  8035. * Destroy lifecycle.
  8036. */
  8037. value: function destroy() {
  8038. this.removeFake();
  8039. }
  8040. }, {
  8041. key: 'action',
  8042. set: function set() {
  8043. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8044. this._action = action;
  8045. if (this._action !== 'copy' && this._action !== 'cut') {
  8046. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8047. }
  8048. }
  8049. /**
  8050. * Gets the `action` property.
  8051. * @return {String}
  8052. */
  8053. ,
  8054. get: function get() {
  8055. return this._action;
  8056. }
  8057. /**
  8058. * Sets the `target` property using an element
  8059. * that will be have its content copied.
  8060. * @param {Element} target
  8061. */
  8062. }, {
  8063. key: 'target',
  8064. set: function set(target) {
  8065. if (target !== undefined) {
  8066. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8067. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8068. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8069. }
  8070. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8071. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8072. }
  8073. this._target = target;
  8074. } else {
  8075. throw new Error('Invalid "target" value, use a valid Element');
  8076. }
  8077. }
  8078. }
  8079. /**
  8080. * Gets the `target` property.
  8081. * @return {String|HTMLElement}
  8082. */
  8083. ,
  8084. get: function get() {
  8085. return this._target;
  8086. }
  8087. }]);
  8088. return ClipboardAction;
  8089. }();
  8090. module.exports = ClipboardAction;
  8091. /***/ }),
  8092. /* 2 */
  8093. /***/ (function(module, exports) {
  8094. function select(element) {
  8095. var selectedText;
  8096. if (element.nodeName === 'SELECT') {
  8097. element.focus();
  8098. selectedText = element.value;
  8099. }
  8100. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8101. var isReadOnly = element.hasAttribute('readonly');
  8102. if (!isReadOnly) {
  8103. element.setAttribute('readonly', '');
  8104. }
  8105. element.select();
  8106. element.setSelectionRange(0, element.value.length);
  8107. if (!isReadOnly) {
  8108. element.removeAttribute('readonly');
  8109. }
  8110. selectedText = element.value;
  8111. }
  8112. else {
  8113. if (element.hasAttribute('contenteditable')) {
  8114. element.focus();
  8115. }
  8116. var selection = window.getSelection();
  8117. var range = document.createRange();
  8118. range.selectNodeContents(element);
  8119. selection.removeAllRanges();
  8120. selection.addRange(range);
  8121. selectedText = selection.toString();
  8122. }
  8123. return selectedText;
  8124. }
  8125. module.exports = select;
  8126. /***/ }),
  8127. /* 3 */
  8128. /***/ (function(module, exports) {
  8129. function E () {
  8130. // Keep this empty so it's easier to inherit from
  8131. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8132. }
  8133. E.prototype = {
  8134. on: function (name, callback, ctx) {
  8135. var e = this.e || (this.e = {});
  8136. (e[name] || (e[name] = [])).push({
  8137. fn: callback,
  8138. ctx: ctx
  8139. });
  8140. return this;
  8141. },
  8142. once: function (name, callback, ctx) {
  8143. var self = this;
  8144. function listener () {
  8145. self.off(name, listener);
  8146. callback.apply(ctx, arguments);
  8147. };
  8148. listener._ = callback
  8149. return this.on(name, listener, ctx);
  8150. },
  8151. emit: function (name) {
  8152. var data = [].slice.call(arguments, 1);
  8153. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8154. var i = 0;
  8155. var len = evtArr.length;
  8156. for (i; i < len; i++) {
  8157. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8158. }
  8159. return this;
  8160. },
  8161. off: function (name, callback) {
  8162. var e = this.e || (this.e = {});
  8163. var evts = e[name];
  8164. var liveEvents = [];
  8165. if (evts && callback) {
  8166. for (var i = 0, len = evts.length; i < len; i++) {
  8167. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8168. liveEvents.push(evts[i]);
  8169. }
  8170. }
  8171. // Remove event from queue to prevent memory leak
  8172. // Suggested by https://github.com/lazd
  8173. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8174. (liveEvents.length)
  8175. ? e[name] = liveEvents
  8176. : delete e[name];
  8177. return this;
  8178. }
  8179. };
  8180. module.exports = E;
  8181. /***/ }),
  8182. /* 4 */
  8183. /***/ (function(module, exports, __webpack_require__) {
  8184. var is = __webpack_require__(5);
  8185. var delegate = __webpack_require__(6);
  8186. /**
  8187. * Validates all params and calls the right
  8188. * listener function based on its target type.
  8189. *
  8190. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8191. * @param {String} type
  8192. * @param {Function} callback
  8193. * @return {Object}
  8194. */
  8195. function listen(target, type, callback) {
  8196. if (!target && !type && !callback) {
  8197. throw new Error('Missing required arguments');
  8198. }
  8199. if (!is.string(type)) {
  8200. throw new TypeError('Second argument must be a String');
  8201. }
  8202. if (!is.fn(callback)) {
  8203. throw new TypeError('Third argument must be a Function');
  8204. }
  8205. if (is.node(target)) {
  8206. return listenNode(target, type, callback);
  8207. }
  8208. else if (is.nodeList(target)) {
  8209. return listenNodeList(target, type, callback);
  8210. }
  8211. else if (is.string(target)) {
  8212. return listenSelector(target, type, callback);
  8213. }
  8214. else {
  8215. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8216. }
  8217. }
  8218. /**
  8219. * Adds an event listener to a HTML element
  8220. * and returns a remove listener function.
  8221. *
  8222. * @param {HTMLElement} node
  8223. * @param {String} type
  8224. * @param {Function} callback
  8225. * @return {Object}
  8226. */
  8227. function listenNode(node, type, callback) {
  8228. node.addEventListener(type, callback);
  8229. return {
  8230. destroy: function() {
  8231. node.removeEventListener(type, callback);
  8232. }
  8233. }
  8234. }
  8235. /**
  8236. * Add an event listener to a list of HTML elements
  8237. * and returns a remove listener function.
  8238. *
  8239. * @param {NodeList|HTMLCollection} nodeList
  8240. * @param {String} type
  8241. * @param {Function} callback
  8242. * @return {Object}
  8243. */
  8244. function listenNodeList(nodeList, type, callback) {
  8245. Array.prototype.forEach.call(nodeList, function(node) {
  8246. node.addEventListener(type, callback);
  8247. });
  8248. return {
  8249. destroy: function() {
  8250. Array.prototype.forEach.call(nodeList, function(node) {
  8251. node.removeEventListener(type, callback);
  8252. });
  8253. }
  8254. }
  8255. }
  8256. /**
  8257. * Add an event listener to a selector
  8258. * and returns a remove listener function.
  8259. *
  8260. * @param {String} selector
  8261. * @param {String} type
  8262. * @param {Function} callback
  8263. * @return {Object}
  8264. */
  8265. function listenSelector(selector, type, callback) {
  8266. return delegate(document.body, selector, type, callback);
  8267. }
  8268. module.exports = listen;
  8269. /***/ }),
  8270. /* 5 */
  8271. /***/ (function(module, exports) {
  8272. /**
  8273. * Check if argument is a HTML element.
  8274. *
  8275. * @param {Object} value
  8276. * @return {Boolean}
  8277. */
  8278. exports.node = function(value) {
  8279. return value !== undefined
  8280. && value instanceof HTMLElement
  8281. && value.nodeType === 1;
  8282. };
  8283. /**
  8284. * Check if argument is a list of HTML elements.
  8285. *
  8286. * @param {Object} value
  8287. * @return {Boolean}
  8288. */
  8289. exports.nodeList = function(value) {
  8290. var type = Object.prototype.toString.call(value);
  8291. return value !== undefined
  8292. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8293. && ('length' in value)
  8294. && (value.length === 0 || exports.node(value[0]));
  8295. };
  8296. /**
  8297. * Check if argument is a string.
  8298. *
  8299. * @param {Object} value
  8300. * @return {Boolean}
  8301. */
  8302. exports.string = function(value) {
  8303. return typeof value === 'string'
  8304. || value instanceof String;
  8305. };
  8306. /**
  8307. * Check if argument is a function.
  8308. *
  8309. * @param {Object} value
  8310. * @return {Boolean}
  8311. */
  8312. exports.fn = function(value) {
  8313. var type = Object.prototype.toString.call(value);
  8314. return type === '[object Function]';
  8315. };
  8316. /***/ }),
  8317. /* 6 */
  8318. /***/ (function(module, exports, __webpack_require__) {
  8319. var closest = __webpack_require__(7);
  8320. /**
  8321. * Delegates event to a selector.
  8322. *
  8323. * @param {Element} element
  8324. * @param {String} selector
  8325. * @param {String} type
  8326. * @param {Function} callback
  8327. * @param {Boolean} useCapture
  8328. * @return {Object}
  8329. */
  8330. function _delegate(element, selector, type, callback, useCapture) {
  8331. var listenerFn = listener.apply(this, arguments);
  8332. element.addEventListener(type, listenerFn, useCapture);
  8333. return {
  8334. destroy: function() {
  8335. element.removeEventListener(type, listenerFn, useCapture);
  8336. }
  8337. }
  8338. }
  8339. /**
  8340. * Delegates event to a selector.
  8341. *
  8342. * @param {Element|String|Array} [elements]
  8343. * @param {String} selector
  8344. * @param {String} type
  8345. * @param {Function} callback
  8346. * @param {Boolean} useCapture
  8347. * @return {Object}
  8348. */
  8349. function delegate(elements, selector, type, callback, useCapture) {
  8350. // Handle the regular Element usage
  8351. if (typeof elements.addEventListener === 'function') {
  8352. return _delegate.apply(null, arguments);
  8353. }
  8354. // Handle Element-less usage, it defaults to global delegation
  8355. if (typeof type === 'function') {
  8356. // Use `document` as the first parameter, then apply arguments
  8357. // This is a short way to .unshift `arguments` without running into deoptimizations
  8358. return _delegate.bind(null, document).apply(null, arguments);
  8359. }
  8360. // Handle Selector-based usage
  8361. if (typeof elements === 'string') {
  8362. elements = document.querySelectorAll(elements);
  8363. }
  8364. // Handle Array-like based usage
  8365. return Array.prototype.map.call(elements, function (element) {
  8366. return _delegate(element, selector, type, callback, useCapture);
  8367. });
  8368. }
  8369. /**
  8370. * Finds closest match and invokes callback.
  8371. *
  8372. * @param {Element} element
  8373. * @param {String} selector
  8374. * @param {String} type
  8375. * @param {Function} callback
  8376. * @return {Function}
  8377. */
  8378. function listener(element, selector, type, callback) {
  8379. return function(e) {
  8380. e.delegateTarget = closest(e.target, selector);
  8381. if (e.delegateTarget) {
  8382. callback.call(element, e);
  8383. }
  8384. }
  8385. }
  8386. module.exports = delegate;
  8387. /***/ }),
  8388. /* 7 */
  8389. /***/ (function(module, exports) {
  8390. var DOCUMENT_NODE_TYPE = 9;
  8391. /**
  8392. * A polyfill for Element.matches()
  8393. */
  8394. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8395. var proto = Element.prototype;
  8396. proto.matches = proto.matchesSelector ||
  8397. proto.mozMatchesSelector ||
  8398. proto.msMatchesSelector ||
  8399. proto.oMatchesSelector ||
  8400. proto.webkitMatchesSelector;
  8401. }
  8402. /**
  8403. * Finds the closest parent that matches a selector.
  8404. *
  8405. * @param {Element} element
  8406. * @param {String} selector
  8407. * @return {Function}
  8408. */
  8409. function closest (element, selector) {
  8410. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8411. if (typeof element.matches === 'function' &&
  8412. element.matches(selector)) {
  8413. return element;
  8414. }
  8415. element = element.parentNode;
  8416. }
  8417. }
  8418. module.exports = closest;
  8419. /***/ })
  8420. /******/ ]);
  8421. });
  8422. /***/ }),
  8423. /***/ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  8424. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  8425. !*** ./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  8426. \********************************************************************************************************************************************************************************************************************************************************************************************/
  8427. /*! no static exports found */
  8428. /***/ (function(module, exports, __webpack_require__) {
  8429. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8430. // imports
  8431. // module
  8432. exports.push([module.i, "\n.full-height[data-v-1ae8ae93] {\n height: 100vh;\n}\n.flex-center[data-v-1ae8ae93] {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n.position-ref[data-v-1ae8ae93] {\n position: relative;\n}\n.top-right[data-v-1ae8ae93] {\n position: absolute;\n right: 10px;\n top: 18px;\n}\n.content[data-v-1ae8ae93] {\n text-align: center;\n}\n.title[data-v-1ae8ae93] {\n font-size: 60px;\n}\n.links > a[data-v-1ae8ae93] {\n color: #636b6f;\n padding: 0 25px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: .1rem;\n text-decoration: none;\n text-transform: uppercase;\n}\n.m-b-md[data-v-1ae8ae93] {\n margin-bottom: 30px;\n color: #000000;\n}\n", ""]);
  8433. // exports
  8434. /***/ }),
  8435. /***/ "./node_modules/css-loader/lib/css-base.js":
  8436. /*!*************************************************!*\
  8437. !*** ./node_modules/css-loader/lib/css-base.js ***!
  8438. \*************************************************/
  8439. /*! no static exports found */
  8440. /***/ (function(module, exports) {
  8441. /*
  8442. MIT License http://www.opensource.org/licenses/mit-license.php
  8443. Author Tobias Koppers @sokra
  8444. */
  8445. // css base code, injected by the css-loader
  8446. module.exports = function(useSourceMap) {
  8447. var list = [];
  8448. // return the list of modules as css string
  8449. list.toString = function toString() {
  8450. return this.map(function (item) {
  8451. var content = cssWithMappingToString(item, useSourceMap);
  8452. if(item[2]) {
  8453. return "@media " + item[2] + "{" + content + "}";
  8454. } else {
  8455. return content;
  8456. }
  8457. }).join("");
  8458. };
  8459. // import a list of modules into the list
  8460. list.i = function(modules, mediaQuery) {
  8461. if(typeof modules === "string")
  8462. modules = [[null, modules, ""]];
  8463. var alreadyImportedModules = {};
  8464. for(var i = 0; i < this.length; i++) {
  8465. var id = this[i][0];
  8466. if(typeof id === "number")
  8467. alreadyImportedModules[id] = true;
  8468. }
  8469. for(i = 0; i < modules.length; i++) {
  8470. var item = modules[i];
  8471. // skip already imported module
  8472. // this implementation is not 100% perfect for weird media query combinations
  8473. // when a module is imported multiple times with different media queries.
  8474. // I hope this will never occur (Hey this way we have smaller bundles)
  8475. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  8476. if(mediaQuery && !item[2]) {
  8477. item[2] = mediaQuery;
  8478. } else if(mediaQuery) {
  8479. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  8480. }
  8481. list.push(item);
  8482. }
  8483. }
  8484. };
  8485. return list;
  8486. };
  8487. function cssWithMappingToString(item, useSourceMap) {
  8488. var content = item[1] || '';
  8489. var cssMapping = item[3];
  8490. if (!cssMapping) {
  8491. return content;
  8492. }
  8493. if (useSourceMap && typeof btoa === 'function') {
  8494. var sourceMapping = toComment(cssMapping);
  8495. var sourceURLs = cssMapping.sources.map(function (source) {
  8496. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  8497. });
  8498. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  8499. }
  8500. return [content].join('\n');
  8501. }
  8502. // Adapted from convert-source-map (MIT)
  8503. function toComment(sourceMap) {
  8504. // eslint-disable-next-line no-undef
  8505. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  8506. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  8507. return '/*# ' + data + ' */';
  8508. }
  8509. /***/ }),
  8510. /***/ "./node_modules/ieee754/index.js":
  8511. /*!***************************************!*\
  8512. !*** ./node_modules/ieee754/index.js ***!
  8513. \***************************************/
  8514. /*! no static exports found */
  8515. /***/ (function(module, exports) {
  8516. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8517. var e, m
  8518. var eLen = (nBytes * 8) - mLen - 1
  8519. var eMax = (1 << eLen) - 1
  8520. var eBias = eMax >> 1
  8521. var nBits = -7
  8522. var i = isLE ? (nBytes - 1) : 0
  8523. var d = isLE ? -1 : 1
  8524. var s = buffer[offset + i]
  8525. i += d
  8526. e = s & ((1 << (-nBits)) - 1)
  8527. s >>= (-nBits)
  8528. nBits += eLen
  8529. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8530. m = e & ((1 << (-nBits)) - 1)
  8531. e >>= (-nBits)
  8532. nBits += mLen
  8533. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8534. if (e === 0) {
  8535. e = 1 - eBias
  8536. } else if (e === eMax) {
  8537. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8538. } else {
  8539. m = m + Math.pow(2, mLen)
  8540. e = e - eBias
  8541. }
  8542. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8543. }
  8544. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8545. var e, m, c
  8546. var eLen = (nBytes * 8) - mLen - 1
  8547. var eMax = (1 << eLen) - 1
  8548. var eBias = eMax >> 1
  8549. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8550. var i = isLE ? 0 : (nBytes - 1)
  8551. var d = isLE ? 1 : -1
  8552. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8553. value = Math.abs(value)
  8554. if (isNaN(value) || value === Infinity) {
  8555. m = isNaN(value) ? 1 : 0
  8556. e = eMax
  8557. } else {
  8558. e = Math.floor(Math.log(value) / Math.LN2)
  8559. if (value * (c = Math.pow(2, -e)) < 1) {
  8560. e--
  8561. c *= 2
  8562. }
  8563. if (e + eBias >= 1) {
  8564. value += rt / c
  8565. } else {
  8566. value += rt * Math.pow(2, 1 - eBias)
  8567. }
  8568. if (value * c >= 2) {
  8569. e++
  8570. c /= 2
  8571. }
  8572. if (e + eBias >= eMax) {
  8573. m = 0
  8574. e = eMax
  8575. } else if (e + eBias >= 1) {
  8576. m = ((value * c) - 1) * Math.pow(2, mLen)
  8577. e = e + eBias
  8578. } else {
  8579. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8580. e = 0
  8581. }
  8582. }
  8583. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8584. e = (e << mLen) | m
  8585. eLen += mLen
  8586. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8587. buffer[offset + i - d] |= s * 128
  8588. }
  8589. /***/ }),
  8590. /***/ "./node_modules/isarray/index.js":
  8591. /*!***************************************!*\
  8592. !*** ./node_modules/isarray/index.js ***!
  8593. \***************************************/
  8594. /*! no static exports found */
  8595. /***/ (function(module, exports) {
  8596. var toString = {}.toString;
  8597. module.exports = Array.isArray || function (arr) {
  8598. return toString.call(arr) == '[object Array]';
  8599. };
  8600. /***/ }),
  8601. /***/ "./node_modules/jquery/dist/jquery.js":
  8602. /*!********************************************!*\
  8603. !*** ./node_modules/jquery/dist/jquery.js ***!
  8604. \********************************************/
  8605. /*! no static exports found */
  8606. /***/ (function(module, exports, __webpack_require__) {
  8607. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8608. * jQuery JavaScript Library v3.4.1
  8609. * https://jquery.com/
  8610. *
  8611. * Includes Sizzle.js
  8612. * https://sizzlejs.com/
  8613. *
  8614. * Copyright JS Foundation and other contributors
  8615. * Released under the MIT license
  8616. * https://jquery.org/license
  8617. *
  8618. * Date: 2019-05-01T21:04Z
  8619. */
  8620. ( function( global, factory ) {
  8621. "use strict";
  8622. if ( true && typeof module.exports === "object" ) {
  8623. // For CommonJS and CommonJS-like environments where a proper `window`
  8624. // is present, execute the factory and get jQuery.
  8625. // For environments that do not have a `window` with a `document`
  8626. // (such as Node.js), expose a factory as module.exports.
  8627. // This accentuates the need for the creation of a real `window`.
  8628. // e.g. var jQuery = require("jquery")(window);
  8629. // See ticket #14549 for more info.
  8630. module.exports = global.document ?
  8631. factory( global, true ) :
  8632. function( w ) {
  8633. if ( !w.document ) {
  8634. throw new Error( "jQuery requires a window with a document" );
  8635. }
  8636. return factory( w );
  8637. };
  8638. } else {
  8639. factory( global );
  8640. }
  8641. // Pass this if window is not defined yet
  8642. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8643. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8644. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8645. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8646. // enough that all such attempts are guarded in a try block.
  8647. "use strict";
  8648. var arr = [];
  8649. var document = window.document;
  8650. var getProto = Object.getPrototypeOf;
  8651. var slice = arr.slice;
  8652. var concat = arr.concat;
  8653. var push = arr.push;
  8654. var indexOf = arr.indexOf;
  8655. var class2type = {};
  8656. var toString = class2type.toString;
  8657. var hasOwn = class2type.hasOwnProperty;
  8658. var fnToString = hasOwn.toString;
  8659. var ObjectFunctionString = fnToString.call( Object );
  8660. var support = {};
  8661. var isFunction = function isFunction( obj ) {
  8662. // Support: Chrome <=57, Firefox <=52
  8663. // In some browsers, typeof returns "function" for HTML <object> elements
  8664. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8665. // We don't want to classify *any* DOM node as a function.
  8666. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8667. };
  8668. var isWindow = function isWindow( obj ) {
  8669. return obj != null && obj === obj.window;
  8670. };
  8671. var preservedScriptAttributes = {
  8672. type: true,
  8673. src: true,
  8674. nonce: true,
  8675. noModule: true
  8676. };
  8677. function DOMEval( code, node, doc ) {
  8678. doc = doc || document;
  8679. var i, val,
  8680. script = doc.createElement( "script" );
  8681. script.text = code;
  8682. if ( node ) {
  8683. for ( i in preservedScriptAttributes ) {
  8684. // Support: Firefox 64+, Edge 18+
  8685. // Some browsers don't support the "nonce" property on scripts.
  8686. // On the other hand, just using `getAttribute` is not enough as
  8687. // the `nonce` attribute is reset to an empty string whenever it
  8688. // becomes browsing-context connected.
  8689. // See https://github.com/whatwg/html/issues/2369
  8690. // See https://html.spec.whatwg.org/#nonce-attributes
  8691. // The `node.getAttribute` check was added for the sake of
  8692. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8693. // via an object.
  8694. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8695. if ( val ) {
  8696. script.setAttribute( i, val );
  8697. }
  8698. }
  8699. }
  8700. doc.head.appendChild( script ).parentNode.removeChild( script );
  8701. }
  8702. function toType( obj ) {
  8703. if ( obj == null ) {
  8704. return obj + "";
  8705. }
  8706. // Support: Android <=2.3 only (functionish RegExp)
  8707. return typeof obj === "object" || typeof obj === "function" ?
  8708. class2type[ toString.call( obj ) ] || "object" :
  8709. typeof obj;
  8710. }
  8711. /* global Symbol */
  8712. // Defining this global in .eslintrc.json would create a danger of using the global
  8713. // unguarded in another place, it seems safer to define global only for this module
  8714. var
  8715. version = "3.4.1",
  8716. // Define a local copy of jQuery
  8717. jQuery = function( selector, context ) {
  8718. // The jQuery object is actually just the init constructor 'enhanced'
  8719. // Need init if jQuery is called (just allow error to be thrown if not included)
  8720. return new jQuery.fn.init( selector, context );
  8721. },
  8722. // Support: Android <=4.0 only
  8723. // Make sure we trim BOM and NBSP
  8724. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8725. jQuery.fn = jQuery.prototype = {
  8726. // The current version of jQuery being used
  8727. jquery: version,
  8728. constructor: jQuery,
  8729. // The default length of a jQuery object is 0
  8730. length: 0,
  8731. toArray: function() {
  8732. return slice.call( this );
  8733. },
  8734. // Get the Nth element in the matched element set OR
  8735. // Get the whole matched element set as a clean array
  8736. get: function( num ) {
  8737. // Return all the elements in a clean array
  8738. if ( num == null ) {
  8739. return slice.call( this );
  8740. }
  8741. // Return just the one element from the set
  8742. return num < 0 ? this[ num + this.length ] : this[ num ];
  8743. },
  8744. // Take an array of elements and push it onto the stack
  8745. // (returning the new matched element set)
  8746. pushStack: function( elems ) {
  8747. // Build a new jQuery matched element set
  8748. var ret = jQuery.merge( this.constructor(), elems );
  8749. // Add the old object onto the stack (as a reference)
  8750. ret.prevObject = this;
  8751. // Return the newly-formed element set
  8752. return ret;
  8753. },
  8754. // Execute a callback for every element in the matched set.
  8755. each: function( callback ) {
  8756. return jQuery.each( this, callback );
  8757. },
  8758. map: function( callback ) {
  8759. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8760. return callback.call( elem, i, elem );
  8761. } ) );
  8762. },
  8763. slice: function() {
  8764. return this.pushStack( slice.apply( this, arguments ) );
  8765. },
  8766. first: function() {
  8767. return this.eq( 0 );
  8768. },
  8769. last: function() {
  8770. return this.eq( -1 );
  8771. },
  8772. eq: function( i ) {
  8773. var len = this.length,
  8774. j = +i + ( i < 0 ? len : 0 );
  8775. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8776. },
  8777. end: function() {
  8778. return this.prevObject || this.constructor();
  8779. },
  8780. // For internal use only.
  8781. // Behaves like an Array's method, not like a jQuery method.
  8782. push: push,
  8783. sort: arr.sort,
  8784. splice: arr.splice
  8785. };
  8786. jQuery.extend = jQuery.fn.extend = function() {
  8787. var options, name, src, copy, copyIsArray, clone,
  8788. target = arguments[ 0 ] || {},
  8789. i = 1,
  8790. length = arguments.length,
  8791. deep = false;
  8792. // Handle a deep copy situation
  8793. if ( typeof target === "boolean" ) {
  8794. deep = target;
  8795. // Skip the boolean and the target
  8796. target = arguments[ i ] || {};
  8797. i++;
  8798. }
  8799. // Handle case when target is a string or something (possible in deep copy)
  8800. if ( typeof target !== "object" && !isFunction( target ) ) {
  8801. target = {};
  8802. }
  8803. // Extend jQuery itself if only one argument is passed
  8804. if ( i === length ) {
  8805. target = this;
  8806. i--;
  8807. }
  8808. for ( ; i < length; i++ ) {
  8809. // Only deal with non-null/undefined values
  8810. if ( ( options = arguments[ i ] ) != null ) {
  8811. // Extend the base object
  8812. for ( name in options ) {
  8813. copy = options[ name ];
  8814. // Prevent Object.prototype pollution
  8815. // Prevent never-ending loop
  8816. if ( name === "__proto__" || target === copy ) {
  8817. continue;
  8818. }
  8819. // Recurse if we're merging plain objects or arrays
  8820. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8821. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8822. src = target[ name ];
  8823. // Ensure proper type for the source value
  8824. if ( copyIsArray && !Array.isArray( src ) ) {
  8825. clone = [];
  8826. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8827. clone = {};
  8828. } else {
  8829. clone = src;
  8830. }
  8831. copyIsArray = false;
  8832. // Never move original objects, clone them
  8833. target[ name ] = jQuery.extend( deep, clone, copy );
  8834. // Don't bring in undefined values
  8835. } else if ( copy !== undefined ) {
  8836. target[ name ] = copy;
  8837. }
  8838. }
  8839. }
  8840. }
  8841. // Return the modified object
  8842. return target;
  8843. };
  8844. jQuery.extend( {
  8845. // Unique for each copy of jQuery on the page
  8846. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8847. // Assume jQuery is ready without the ready module
  8848. isReady: true,
  8849. error: function( msg ) {
  8850. throw new Error( msg );
  8851. },
  8852. noop: function() {},
  8853. isPlainObject: function( obj ) {
  8854. var proto, Ctor;
  8855. // Detect obvious negatives
  8856. // Use toString instead of jQuery.type to catch host objects
  8857. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8858. return false;
  8859. }
  8860. proto = getProto( obj );
  8861. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8862. if ( !proto ) {
  8863. return true;
  8864. }
  8865. // Objects with prototype are plain iff they were constructed by a global Object function
  8866. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8867. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8868. },
  8869. isEmptyObject: function( obj ) {
  8870. var name;
  8871. for ( name in obj ) {
  8872. return false;
  8873. }
  8874. return true;
  8875. },
  8876. // Evaluates a script in a global context
  8877. globalEval: function( code, options ) {
  8878. DOMEval( code, { nonce: options && options.nonce } );
  8879. },
  8880. each: function( obj, callback ) {
  8881. var length, i = 0;
  8882. if ( isArrayLike( obj ) ) {
  8883. length = obj.length;
  8884. for ( ; i < length; i++ ) {
  8885. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8886. break;
  8887. }
  8888. }
  8889. } else {
  8890. for ( i in obj ) {
  8891. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8892. break;
  8893. }
  8894. }
  8895. }
  8896. return obj;
  8897. },
  8898. // Support: Android <=4.0 only
  8899. trim: function( text ) {
  8900. return text == null ?
  8901. "" :
  8902. ( text + "" ).replace( rtrim, "" );
  8903. },
  8904. // results is for internal usage only
  8905. makeArray: function( arr, results ) {
  8906. var ret = results || [];
  8907. if ( arr != null ) {
  8908. if ( isArrayLike( Object( arr ) ) ) {
  8909. jQuery.merge( ret,
  8910. typeof arr === "string" ?
  8911. [ arr ] : arr
  8912. );
  8913. } else {
  8914. push.call( ret, arr );
  8915. }
  8916. }
  8917. return ret;
  8918. },
  8919. inArray: function( elem, arr, i ) {
  8920. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8921. },
  8922. // Support: Android <=4.0 only, PhantomJS 1 only
  8923. // push.apply(_, arraylike) throws on ancient WebKit
  8924. merge: function( first, second ) {
  8925. var len = +second.length,
  8926. j = 0,
  8927. i = first.length;
  8928. for ( ; j < len; j++ ) {
  8929. first[ i++ ] = second[ j ];
  8930. }
  8931. first.length = i;
  8932. return first;
  8933. },
  8934. grep: function( elems, callback, invert ) {
  8935. var callbackInverse,
  8936. matches = [],
  8937. i = 0,
  8938. length = elems.length,
  8939. callbackExpect = !invert;
  8940. // Go through the array, only saving the items
  8941. // that pass the validator function
  8942. for ( ; i < length; i++ ) {
  8943. callbackInverse = !callback( elems[ i ], i );
  8944. if ( callbackInverse !== callbackExpect ) {
  8945. matches.push( elems[ i ] );
  8946. }
  8947. }
  8948. return matches;
  8949. },
  8950. // arg is for internal usage only
  8951. map: function( elems, callback, arg ) {
  8952. var length, value,
  8953. i = 0,
  8954. ret = [];
  8955. // Go through the array, translating each of the items to their new values
  8956. if ( isArrayLike( elems ) ) {
  8957. length = elems.length;
  8958. for ( ; i < length; i++ ) {
  8959. value = callback( elems[ i ], i, arg );
  8960. if ( value != null ) {
  8961. ret.push( value );
  8962. }
  8963. }
  8964. // Go through every key on the object,
  8965. } else {
  8966. for ( i in elems ) {
  8967. value = callback( elems[ i ], i, arg );
  8968. if ( value != null ) {
  8969. ret.push( value );
  8970. }
  8971. }
  8972. }
  8973. // Flatten any nested arrays
  8974. return concat.apply( [], ret );
  8975. },
  8976. // A global GUID counter for objects
  8977. guid: 1,
  8978. // jQuery.support is not used in Core but other projects attach their
  8979. // properties to it so it needs to exist.
  8980. support: support
  8981. } );
  8982. if ( typeof Symbol === "function" ) {
  8983. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8984. }
  8985. // Populate the class2type map
  8986. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8987. function( i, name ) {
  8988. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8989. } );
  8990. function isArrayLike( obj ) {
  8991. // Support: real iOS 8.2 only (not reproducible in simulator)
  8992. // `in` check used to prevent JIT error (gh-2145)
  8993. // hasOwn isn't used here due to false negatives
  8994. // regarding Nodelist length in IE
  8995. var length = !!obj && "length" in obj && obj.length,
  8996. type = toType( obj );
  8997. if ( isFunction( obj ) || isWindow( obj ) ) {
  8998. return false;
  8999. }
  9000. return type === "array" || length === 0 ||
  9001. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9002. }
  9003. var Sizzle =
  9004. /*!
  9005. * Sizzle CSS Selector Engine v2.3.4
  9006. * https://sizzlejs.com/
  9007. *
  9008. * Copyright JS Foundation and other contributors
  9009. * Released under the MIT license
  9010. * https://js.foundation/
  9011. *
  9012. * Date: 2019-04-08
  9013. */
  9014. (function( window ) {
  9015. var i,
  9016. support,
  9017. Expr,
  9018. getText,
  9019. isXML,
  9020. tokenize,
  9021. compile,
  9022. select,
  9023. outermostContext,
  9024. sortInput,
  9025. hasDuplicate,
  9026. // Local document vars
  9027. setDocument,
  9028. document,
  9029. docElem,
  9030. documentIsHTML,
  9031. rbuggyQSA,
  9032. rbuggyMatches,
  9033. matches,
  9034. contains,
  9035. // Instance-specific data
  9036. expando = "sizzle" + 1 * new Date(),
  9037. preferredDoc = window.document,
  9038. dirruns = 0,
  9039. done = 0,
  9040. classCache = createCache(),
  9041. tokenCache = createCache(),
  9042. compilerCache = createCache(),
  9043. nonnativeSelectorCache = createCache(),
  9044. sortOrder = function( a, b ) {
  9045. if ( a === b ) {
  9046. hasDuplicate = true;
  9047. }
  9048. return 0;
  9049. },
  9050. // Instance methods
  9051. hasOwn = ({}).hasOwnProperty,
  9052. arr = [],
  9053. pop = arr.pop,
  9054. push_native = arr.push,
  9055. push = arr.push,
  9056. slice = arr.slice,
  9057. // Use a stripped-down indexOf as it's faster than native
  9058. // https://jsperf.com/thor-indexof-vs-for/5
  9059. indexOf = function( list, elem ) {
  9060. var i = 0,
  9061. len = list.length;
  9062. for ( ; i < len; i++ ) {
  9063. if ( list[i] === elem ) {
  9064. return i;
  9065. }
  9066. }
  9067. return -1;
  9068. },
  9069. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9070. // Regular expressions
  9071. // http://www.w3.org/TR/css3-selectors/#whitespace
  9072. whitespace = "[\\x20\\t\\r\\n\\f]",
  9073. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9074. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9075. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9076. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9077. // Operator (capture 2)
  9078. "*([*^$|!~]?=)" + whitespace +
  9079. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9080. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9081. "*\\]",
  9082. pseudos = ":(" + identifier + ")(?:\\((" +
  9083. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9084. // 1. quoted (capture 3; capture 4 or capture 5)
  9085. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9086. // 2. simple (capture 6)
  9087. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9088. // 3. anything else (capture 2)
  9089. ".*" +
  9090. ")\\)|)",
  9091. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9092. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9093. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9094. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9095. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9096. rdescend = new RegExp( whitespace + "|>" ),
  9097. rpseudo = new RegExp( pseudos ),
  9098. ridentifier = new RegExp( "^" + identifier + "$" ),
  9099. matchExpr = {
  9100. "ID": new RegExp( "^#(" + identifier + ")" ),
  9101. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9102. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9103. "ATTR": new RegExp( "^" + attributes ),
  9104. "PSEUDO": new RegExp( "^" + pseudos ),
  9105. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9106. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9107. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9108. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9109. // For use in libraries implementing .is()
  9110. // We use this for POS matching in `select`
  9111. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9112. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9113. },
  9114. rhtml = /HTML$/i,
  9115. rinputs = /^(?:input|select|textarea|button)$/i,
  9116. rheader = /^h\d$/i,
  9117. rnative = /^[^{]+\{\s*\[native \w/,
  9118. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9119. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9120. rsibling = /[+~]/,
  9121. // CSS escapes
  9122. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9123. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9124. funescape = function( _, escaped, escapedWhitespace ) {
  9125. var high = "0x" + escaped - 0x10000;
  9126. // NaN means non-codepoint
  9127. // Support: Firefox<24
  9128. // Workaround erroneous numeric interpretation of +"0x"
  9129. return high !== high || escapedWhitespace ?
  9130. escaped :
  9131. high < 0 ?
  9132. // BMP codepoint
  9133. String.fromCharCode( high + 0x10000 ) :
  9134. // Supplemental Plane codepoint (surrogate pair)
  9135. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9136. },
  9137. // CSS string/identifier serialization
  9138. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9139. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9140. fcssescape = function( ch, asCodePoint ) {
  9141. if ( asCodePoint ) {
  9142. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9143. if ( ch === "\0" ) {
  9144. return "\uFFFD";
  9145. }
  9146. // Control characters and (dependent upon position) numbers get escaped as code points
  9147. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9148. }
  9149. // Other potentially-special ASCII characters get backslash-escaped
  9150. return "\\" + ch;
  9151. },
  9152. // Used for iframes
  9153. // See setDocument()
  9154. // Removing the function wrapper causes a "Permission Denied"
  9155. // error in IE
  9156. unloadHandler = function() {
  9157. setDocument();
  9158. },
  9159. inDisabledFieldset = addCombinator(
  9160. function( elem ) {
  9161. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9162. },
  9163. { dir: "parentNode", next: "legend" }
  9164. );
  9165. // Optimize for push.apply( _, NodeList )
  9166. try {
  9167. push.apply(
  9168. (arr = slice.call( preferredDoc.childNodes )),
  9169. preferredDoc.childNodes
  9170. );
  9171. // Support: Android<4.0
  9172. // Detect silently failing push.apply
  9173. arr[ preferredDoc.childNodes.length ].nodeType;
  9174. } catch ( e ) {
  9175. push = { apply: arr.length ?
  9176. // Leverage slice if possible
  9177. function( target, els ) {
  9178. push_native.apply( target, slice.call(els) );
  9179. } :
  9180. // Support: IE<9
  9181. // Otherwise append directly
  9182. function( target, els ) {
  9183. var j = target.length,
  9184. i = 0;
  9185. // Can't trust NodeList.length
  9186. while ( (target[j++] = els[i++]) ) {}
  9187. target.length = j - 1;
  9188. }
  9189. };
  9190. }
  9191. function Sizzle( selector, context, results, seed ) {
  9192. var m, i, elem, nid, match, groups, newSelector,
  9193. newContext = context && context.ownerDocument,
  9194. // nodeType defaults to 9, since context defaults to document
  9195. nodeType = context ? context.nodeType : 9;
  9196. results = results || [];
  9197. // Return early from calls with invalid selector or context
  9198. if ( typeof selector !== "string" || !selector ||
  9199. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9200. return results;
  9201. }
  9202. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9203. if ( !seed ) {
  9204. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9205. setDocument( context );
  9206. }
  9207. context = context || document;
  9208. if ( documentIsHTML ) {
  9209. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9210. // (excepting DocumentFragment context, where the methods don't exist)
  9211. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9212. // ID selector
  9213. if ( (m = match[1]) ) {
  9214. // Document context
  9215. if ( nodeType === 9 ) {
  9216. if ( (elem = context.getElementById( m )) ) {
  9217. // Support: IE, Opera, Webkit
  9218. // TODO: identify versions
  9219. // getElementById can match elements by name instead of ID
  9220. if ( elem.id === m ) {
  9221. results.push( elem );
  9222. return results;
  9223. }
  9224. } else {
  9225. return results;
  9226. }
  9227. // Element context
  9228. } else {
  9229. // Support: IE, Opera, Webkit
  9230. // TODO: identify versions
  9231. // getElementById can match elements by name instead of ID
  9232. if ( newContext && (elem = newContext.getElementById( m )) &&
  9233. contains( context, elem ) &&
  9234. elem.id === m ) {
  9235. results.push( elem );
  9236. return results;
  9237. }
  9238. }
  9239. // Type selector
  9240. } else if ( match[2] ) {
  9241. push.apply( results, context.getElementsByTagName( selector ) );
  9242. return results;
  9243. // Class selector
  9244. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9245. context.getElementsByClassName ) {
  9246. push.apply( results, context.getElementsByClassName( m ) );
  9247. return results;
  9248. }
  9249. }
  9250. // Take advantage of querySelectorAll
  9251. if ( support.qsa &&
  9252. !nonnativeSelectorCache[ selector + " " ] &&
  9253. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9254. // Support: IE 8 only
  9255. // Exclude object elements
  9256. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9257. newSelector = selector;
  9258. newContext = context;
  9259. // qSA considers elements outside a scoping root when evaluating child or
  9260. // descendant combinators, which is not what we want.
  9261. // In such cases, we work around the behavior by prefixing every selector in the
  9262. // list with an ID selector referencing the scope context.
  9263. // Thanks to Andrew Dupont for this technique.
  9264. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9265. // Capture the context ID, setting it first if necessary
  9266. if ( (nid = context.getAttribute( "id" )) ) {
  9267. nid = nid.replace( rcssescape, fcssescape );
  9268. } else {
  9269. context.setAttribute( "id", (nid = expando) );
  9270. }
  9271. // Prefix every selector in the list
  9272. groups = tokenize( selector );
  9273. i = groups.length;
  9274. while ( i-- ) {
  9275. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9276. }
  9277. newSelector = groups.join( "," );
  9278. // Expand context for sibling selectors
  9279. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9280. context;
  9281. }
  9282. try {
  9283. push.apply( results,
  9284. newContext.querySelectorAll( newSelector )
  9285. );
  9286. return results;
  9287. } catch ( qsaError ) {
  9288. nonnativeSelectorCache( selector, true );
  9289. } finally {
  9290. if ( nid === expando ) {
  9291. context.removeAttribute( "id" );
  9292. }
  9293. }
  9294. }
  9295. }
  9296. }
  9297. // All others
  9298. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9299. }
  9300. /**
  9301. * Create key-value caches of limited size
  9302. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9303. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9304. * deleting the oldest entry
  9305. */
  9306. function createCache() {
  9307. var keys = [];
  9308. function cache( key, value ) {
  9309. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9310. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9311. // Only keep the most recent entries
  9312. delete cache[ keys.shift() ];
  9313. }
  9314. return (cache[ key + " " ] = value);
  9315. }
  9316. return cache;
  9317. }
  9318. /**
  9319. * Mark a function for special use by Sizzle
  9320. * @param {Function} fn The function to mark
  9321. */
  9322. function markFunction( fn ) {
  9323. fn[ expando ] = true;
  9324. return fn;
  9325. }
  9326. /**
  9327. * Support testing using an element
  9328. * @param {Function} fn Passed the created element and returns a boolean result
  9329. */
  9330. function assert( fn ) {
  9331. var el = document.createElement("fieldset");
  9332. try {
  9333. return !!fn( el );
  9334. } catch (e) {
  9335. return false;
  9336. } finally {
  9337. // Remove from its parent by default
  9338. if ( el.parentNode ) {
  9339. el.parentNode.removeChild( el );
  9340. }
  9341. // release memory in IE
  9342. el = null;
  9343. }
  9344. }
  9345. /**
  9346. * Adds the same handler for all of the specified attrs
  9347. * @param {String} attrs Pipe-separated list of attributes
  9348. * @param {Function} handler The method that will be applied
  9349. */
  9350. function addHandle( attrs, handler ) {
  9351. var arr = attrs.split("|"),
  9352. i = arr.length;
  9353. while ( i-- ) {
  9354. Expr.attrHandle[ arr[i] ] = handler;
  9355. }
  9356. }
  9357. /**
  9358. * Checks document order of two siblings
  9359. * @param {Element} a
  9360. * @param {Element} b
  9361. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9362. */
  9363. function siblingCheck( a, b ) {
  9364. var cur = b && a,
  9365. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9366. a.sourceIndex - b.sourceIndex;
  9367. // Use IE sourceIndex if available on both nodes
  9368. if ( diff ) {
  9369. return diff;
  9370. }
  9371. // Check if b follows a
  9372. if ( cur ) {
  9373. while ( (cur = cur.nextSibling) ) {
  9374. if ( cur === b ) {
  9375. return -1;
  9376. }
  9377. }
  9378. }
  9379. return a ? 1 : -1;
  9380. }
  9381. /**
  9382. * Returns a function to use in pseudos for input types
  9383. * @param {String} type
  9384. */
  9385. function createInputPseudo( type ) {
  9386. return function( elem ) {
  9387. var name = elem.nodeName.toLowerCase();
  9388. return name === "input" && elem.type === type;
  9389. };
  9390. }
  9391. /**
  9392. * Returns a function to use in pseudos for buttons
  9393. * @param {String} type
  9394. */
  9395. function createButtonPseudo( type ) {
  9396. return function( elem ) {
  9397. var name = elem.nodeName.toLowerCase();
  9398. return (name === "input" || name === "button") && elem.type === type;
  9399. };
  9400. }
  9401. /**
  9402. * Returns a function to use in pseudos for :enabled/:disabled
  9403. * @param {Boolean} disabled true for :disabled; false for :enabled
  9404. */
  9405. function createDisabledPseudo( disabled ) {
  9406. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9407. return function( elem ) {
  9408. // Only certain elements can match :enabled or :disabled
  9409. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9410. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9411. if ( "form" in elem ) {
  9412. // Check for inherited disabledness on relevant non-disabled elements:
  9413. // * listed form-associated elements in a disabled fieldset
  9414. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9415. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9416. // * option elements in a disabled optgroup
  9417. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9418. // All such elements have a "form" property.
  9419. if ( elem.parentNode && elem.disabled === false ) {
  9420. // Option elements defer to a parent optgroup if present
  9421. if ( "label" in elem ) {
  9422. if ( "label" in elem.parentNode ) {
  9423. return elem.parentNode.disabled === disabled;
  9424. } else {
  9425. return elem.disabled === disabled;
  9426. }
  9427. }
  9428. // Support: IE 6 - 11
  9429. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9430. return elem.isDisabled === disabled ||
  9431. // Where there is no isDisabled, check manually
  9432. /* jshint -W018 */
  9433. elem.isDisabled !== !disabled &&
  9434. inDisabledFieldset( elem ) === disabled;
  9435. }
  9436. return elem.disabled === disabled;
  9437. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9438. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9439. // even exist on them, let alone have a boolean value.
  9440. } else if ( "label" in elem ) {
  9441. return elem.disabled === disabled;
  9442. }
  9443. // Remaining elements are neither :enabled nor :disabled
  9444. return false;
  9445. };
  9446. }
  9447. /**
  9448. * Returns a function to use in pseudos for positionals
  9449. * @param {Function} fn
  9450. */
  9451. function createPositionalPseudo( fn ) {
  9452. return markFunction(function( argument ) {
  9453. argument = +argument;
  9454. return markFunction(function( seed, matches ) {
  9455. var j,
  9456. matchIndexes = fn( [], seed.length, argument ),
  9457. i = matchIndexes.length;
  9458. // Match elements found at the specified indexes
  9459. while ( i-- ) {
  9460. if ( seed[ (j = matchIndexes[i]) ] ) {
  9461. seed[j] = !(matches[j] = seed[j]);
  9462. }
  9463. }
  9464. });
  9465. });
  9466. }
  9467. /**
  9468. * Checks a node for validity as a Sizzle context
  9469. * @param {Element|Object=} context
  9470. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9471. */
  9472. function testContext( context ) {
  9473. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9474. }
  9475. // Expose support vars for convenience
  9476. support = Sizzle.support = {};
  9477. /**
  9478. * Detects XML nodes
  9479. * @param {Element|Object} elem An element or a document
  9480. * @returns {Boolean} True iff elem is a non-HTML XML node
  9481. */
  9482. isXML = Sizzle.isXML = function( elem ) {
  9483. var namespace = elem.namespaceURI,
  9484. docElem = (elem.ownerDocument || elem).documentElement;
  9485. // Support: IE <=8
  9486. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9487. // https://bugs.jquery.com/ticket/4833
  9488. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9489. };
  9490. /**
  9491. * Sets document-related variables once based on the current document
  9492. * @param {Element|Object} [doc] An element or document object to use to set the document
  9493. * @returns {Object} Returns the current document
  9494. */
  9495. setDocument = Sizzle.setDocument = function( node ) {
  9496. var hasCompare, subWindow,
  9497. doc = node ? node.ownerDocument || node : preferredDoc;
  9498. // Return early if doc is invalid or already selected
  9499. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9500. return document;
  9501. }
  9502. // Update global variables
  9503. document = doc;
  9504. docElem = document.documentElement;
  9505. documentIsHTML = !isXML( document );
  9506. // Support: IE 9-11, Edge
  9507. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9508. if ( preferredDoc !== document &&
  9509. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9510. // Support: IE 11, Edge
  9511. if ( subWindow.addEventListener ) {
  9512. subWindow.addEventListener( "unload", unloadHandler, false );
  9513. // Support: IE 9 - 10 only
  9514. } else if ( subWindow.attachEvent ) {
  9515. subWindow.attachEvent( "onunload", unloadHandler );
  9516. }
  9517. }
  9518. /* Attributes
  9519. ---------------------------------------------------------------------- */
  9520. // Support: IE<8
  9521. // Verify that getAttribute really returns attributes and not properties
  9522. // (excepting IE8 booleans)
  9523. support.attributes = assert(function( el ) {
  9524. el.className = "i";
  9525. return !el.getAttribute("className");
  9526. });
  9527. /* getElement(s)By*
  9528. ---------------------------------------------------------------------- */
  9529. // Check if getElementsByTagName("*") returns only elements
  9530. support.getElementsByTagName = assert(function( el ) {
  9531. el.appendChild( document.createComment("") );
  9532. return !el.getElementsByTagName("*").length;
  9533. });
  9534. // Support: IE<9
  9535. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9536. // Support: IE<10
  9537. // Check if getElementById returns elements by name
  9538. // The broken getElementById methods don't pick up programmatically-set names,
  9539. // so use a roundabout getElementsByName test
  9540. support.getById = assert(function( el ) {
  9541. docElem.appendChild( el ).id = expando;
  9542. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9543. });
  9544. // ID filter and find
  9545. if ( support.getById ) {
  9546. Expr.filter["ID"] = function( id ) {
  9547. var attrId = id.replace( runescape, funescape );
  9548. return function( elem ) {
  9549. return elem.getAttribute("id") === attrId;
  9550. };
  9551. };
  9552. Expr.find["ID"] = function( id, context ) {
  9553. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9554. var elem = context.getElementById( id );
  9555. return elem ? [ elem ] : [];
  9556. }
  9557. };
  9558. } else {
  9559. Expr.filter["ID"] = function( id ) {
  9560. var attrId = id.replace( runescape, funescape );
  9561. return function( elem ) {
  9562. var node = typeof elem.getAttributeNode !== "undefined" &&
  9563. elem.getAttributeNode("id");
  9564. return node && node.value === attrId;
  9565. };
  9566. };
  9567. // Support: IE 6 - 7 only
  9568. // getElementById is not reliable as a find shortcut
  9569. Expr.find["ID"] = function( id, context ) {
  9570. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9571. var node, i, elems,
  9572. elem = context.getElementById( id );
  9573. if ( elem ) {
  9574. // Verify the id attribute
  9575. node = elem.getAttributeNode("id");
  9576. if ( node && node.value === id ) {
  9577. return [ elem ];
  9578. }
  9579. // Fall back on getElementsByName
  9580. elems = context.getElementsByName( id );
  9581. i = 0;
  9582. while ( (elem = elems[i++]) ) {
  9583. node = elem.getAttributeNode("id");
  9584. if ( node && node.value === id ) {
  9585. return [ elem ];
  9586. }
  9587. }
  9588. }
  9589. return [];
  9590. }
  9591. };
  9592. }
  9593. // Tag
  9594. Expr.find["TAG"] = support.getElementsByTagName ?
  9595. function( tag, context ) {
  9596. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9597. return context.getElementsByTagName( tag );
  9598. // DocumentFragment nodes don't have gEBTN
  9599. } else if ( support.qsa ) {
  9600. return context.querySelectorAll( tag );
  9601. }
  9602. } :
  9603. function( tag, context ) {
  9604. var elem,
  9605. tmp = [],
  9606. i = 0,
  9607. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9608. results = context.getElementsByTagName( tag );
  9609. // Filter out possible comments
  9610. if ( tag === "*" ) {
  9611. while ( (elem = results[i++]) ) {
  9612. if ( elem.nodeType === 1 ) {
  9613. tmp.push( elem );
  9614. }
  9615. }
  9616. return tmp;
  9617. }
  9618. return results;
  9619. };
  9620. // Class
  9621. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9622. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9623. return context.getElementsByClassName( className );
  9624. }
  9625. };
  9626. /* QSA/matchesSelector
  9627. ---------------------------------------------------------------------- */
  9628. // QSA and matchesSelector support
  9629. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9630. rbuggyMatches = [];
  9631. // qSa(:focus) reports false when true (Chrome 21)
  9632. // We allow this because of a bug in IE8/9 that throws an error
  9633. // whenever `document.activeElement` is accessed on an iframe
  9634. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9635. // See https://bugs.jquery.com/ticket/13378
  9636. rbuggyQSA = [];
  9637. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9638. // Build QSA regex
  9639. // Regex strategy adopted from Diego Perini
  9640. assert(function( el ) {
  9641. // Select is set to empty string on purpose
  9642. // This is to test IE's treatment of not explicitly
  9643. // setting a boolean content attribute,
  9644. // since its presence should be enough
  9645. // https://bugs.jquery.com/ticket/12359
  9646. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9647. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9648. "<option selected=''></option></select>";
  9649. // Support: IE8, Opera 11-12.16
  9650. // Nothing should be selected when empty strings follow ^= or $= or *=
  9651. // The test attribute must be unknown in Opera but "safe" for WinRT
  9652. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9653. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9654. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9655. }
  9656. // Support: IE8
  9657. // Boolean attributes and "value" are not treated correctly
  9658. if ( !el.querySelectorAll("[selected]").length ) {
  9659. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9660. }
  9661. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9662. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9663. rbuggyQSA.push("~=");
  9664. }
  9665. // Webkit/Opera - :checked should return selected option elements
  9666. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9667. // IE8 throws error here and will not see later tests
  9668. if ( !el.querySelectorAll(":checked").length ) {
  9669. rbuggyQSA.push(":checked");
  9670. }
  9671. // Support: Safari 8+, iOS 8+
  9672. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9673. // In-page `selector#id sibling-combinator selector` fails
  9674. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9675. rbuggyQSA.push(".#.+[+~]");
  9676. }
  9677. });
  9678. assert(function( el ) {
  9679. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9680. "<select disabled='disabled'><option/></select>";
  9681. // Support: Windows 8 Native Apps
  9682. // The type and name attributes are restricted during .innerHTML assignment
  9683. var input = document.createElement("input");
  9684. input.setAttribute( "type", "hidden" );
  9685. el.appendChild( input ).setAttribute( "name", "D" );
  9686. // Support: IE8
  9687. // Enforce case-sensitivity of name attribute
  9688. if ( el.querySelectorAll("[name=d]").length ) {
  9689. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9690. }
  9691. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9692. // IE8 throws error here and will not see later tests
  9693. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9694. rbuggyQSA.push( ":enabled", ":disabled" );
  9695. }
  9696. // Support: IE9-11+
  9697. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9698. docElem.appendChild( el ).disabled = true;
  9699. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9700. rbuggyQSA.push( ":enabled", ":disabled" );
  9701. }
  9702. // Opera 10-11 does not throw on post-comma invalid pseudos
  9703. el.querySelectorAll("*,:x");
  9704. rbuggyQSA.push(",.*:");
  9705. });
  9706. }
  9707. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9708. docElem.webkitMatchesSelector ||
  9709. docElem.mozMatchesSelector ||
  9710. docElem.oMatchesSelector ||
  9711. docElem.msMatchesSelector) )) ) {
  9712. assert(function( el ) {
  9713. // Check to see if it's possible to do matchesSelector
  9714. // on a disconnected node (IE 9)
  9715. support.disconnectedMatch = matches.call( el, "*" );
  9716. // This should fail with an exception
  9717. // Gecko does not error, returns false instead
  9718. matches.call( el, "[s!='']:x" );
  9719. rbuggyMatches.push( "!=", pseudos );
  9720. });
  9721. }
  9722. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9723. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9724. /* Contains
  9725. ---------------------------------------------------------------------- */
  9726. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9727. // Element contains another
  9728. // Purposefully self-exclusive
  9729. // As in, an element does not contain itself
  9730. contains = hasCompare || rnative.test( docElem.contains ) ?
  9731. function( a, b ) {
  9732. var adown = a.nodeType === 9 ? a.documentElement : a,
  9733. bup = b && b.parentNode;
  9734. return a === bup || !!( bup && bup.nodeType === 1 && (
  9735. adown.contains ?
  9736. adown.contains( bup ) :
  9737. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9738. ));
  9739. } :
  9740. function( a, b ) {
  9741. if ( b ) {
  9742. while ( (b = b.parentNode) ) {
  9743. if ( b === a ) {
  9744. return true;
  9745. }
  9746. }
  9747. }
  9748. return false;
  9749. };
  9750. /* Sorting
  9751. ---------------------------------------------------------------------- */
  9752. // Document order sorting
  9753. sortOrder = hasCompare ?
  9754. function( a, b ) {
  9755. // Flag for duplicate removal
  9756. if ( a === b ) {
  9757. hasDuplicate = true;
  9758. return 0;
  9759. }
  9760. // Sort on method existence if only one input has compareDocumentPosition
  9761. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9762. if ( compare ) {
  9763. return compare;
  9764. }
  9765. // Calculate position if both inputs belong to the same document
  9766. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9767. a.compareDocumentPosition( b ) :
  9768. // Otherwise we know they are disconnected
  9769. 1;
  9770. // Disconnected nodes
  9771. if ( compare & 1 ||
  9772. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9773. // Choose the first element that is related to our preferred document
  9774. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9775. return -1;
  9776. }
  9777. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9778. return 1;
  9779. }
  9780. // Maintain original order
  9781. return sortInput ?
  9782. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9783. 0;
  9784. }
  9785. return compare & 4 ? -1 : 1;
  9786. } :
  9787. function( a, b ) {
  9788. // Exit early if the nodes are identical
  9789. if ( a === b ) {
  9790. hasDuplicate = true;
  9791. return 0;
  9792. }
  9793. var cur,
  9794. i = 0,
  9795. aup = a.parentNode,
  9796. bup = b.parentNode,
  9797. ap = [ a ],
  9798. bp = [ b ];
  9799. // Parentless nodes are either documents or disconnected
  9800. if ( !aup || !bup ) {
  9801. return a === document ? -1 :
  9802. b === document ? 1 :
  9803. aup ? -1 :
  9804. bup ? 1 :
  9805. sortInput ?
  9806. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9807. 0;
  9808. // If the nodes are siblings, we can do a quick check
  9809. } else if ( aup === bup ) {
  9810. return siblingCheck( a, b );
  9811. }
  9812. // Otherwise we need full lists of their ancestors for comparison
  9813. cur = a;
  9814. while ( (cur = cur.parentNode) ) {
  9815. ap.unshift( cur );
  9816. }
  9817. cur = b;
  9818. while ( (cur = cur.parentNode) ) {
  9819. bp.unshift( cur );
  9820. }
  9821. // Walk down the tree looking for a discrepancy
  9822. while ( ap[i] === bp[i] ) {
  9823. i++;
  9824. }
  9825. return i ?
  9826. // Do a sibling check if the nodes have a common ancestor
  9827. siblingCheck( ap[i], bp[i] ) :
  9828. // Otherwise nodes in our document sort first
  9829. ap[i] === preferredDoc ? -1 :
  9830. bp[i] === preferredDoc ? 1 :
  9831. 0;
  9832. };
  9833. return document;
  9834. };
  9835. Sizzle.matches = function( expr, elements ) {
  9836. return Sizzle( expr, null, null, elements );
  9837. };
  9838. Sizzle.matchesSelector = function( elem, expr ) {
  9839. // Set document vars if needed
  9840. if ( ( elem.ownerDocument || elem ) !== document ) {
  9841. setDocument( elem );
  9842. }
  9843. if ( support.matchesSelector && documentIsHTML &&
  9844. !nonnativeSelectorCache[ expr + " " ] &&
  9845. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9846. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9847. try {
  9848. var ret = matches.call( elem, expr );
  9849. // IE 9's matchesSelector returns false on disconnected nodes
  9850. if ( ret || support.disconnectedMatch ||
  9851. // As well, disconnected nodes are said to be in a document
  9852. // fragment in IE 9
  9853. elem.document && elem.document.nodeType !== 11 ) {
  9854. return ret;
  9855. }
  9856. } catch (e) {
  9857. nonnativeSelectorCache( expr, true );
  9858. }
  9859. }
  9860. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9861. };
  9862. Sizzle.contains = function( context, elem ) {
  9863. // Set document vars if needed
  9864. if ( ( context.ownerDocument || context ) !== document ) {
  9865. setDocument( context );
  9866. }
  9867. return contains( context, elem );
  9868. };
  9869. Sizzle.attr = function( elem, name ) {
  9870. // Set document vars if needed
  9871. if ( ( elem.ownerDocument || elem ) !== document ) {
  9872. setDocument( elem );
  9873. }
  9874. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9875. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9876. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9877. fn( elem, name, !documentIsHTML ) :
  9878. undefined;
  9879. return val !== undefined ?
  9880. val :
  9881. support.attributes || !documentIsHTML ?
  9882. elem.getAttribute( name ) :
  9883. (val = elem.getAttributeNode(name)) && val.specified ?
  9884. val.value :
  9885. null;
  9886. };
  9887. Sizzle.escape = function( sel ) {
  9888. return (sel + "").replace( rcssescape, fcssescape );
  9889. };
  9890. Sizzle.error = function( msg ) {
  9891. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9892. };
  9893. /**
  9894. * Document sorting and removing duplicates
  9895. * @param {ArrayLike} results
  9896. */
  9897. Sizzle.uniqueSort = function( results ) {
  9898. var elem,
  9899. duplicates = [],
  9900. j = 0,
  9901. i = 0;
  9902. // Unless we *know* we can detect duplicates, assume their presence
  9903. hasDuplicate = !support.detectDuplicates;
  9904. sortInput = !support.sortStable && results.slice( 0 );
  9905. results.sort( sortOrder );
  9906. if ( hasDuplicate ) {
  9907. while ( (elem = results[i++]) ) {
  9908. if ( elem === results[ i ] ) {
  9909. j = duplicates.push( i );
  9910. }
  9911. }
  9912. while ( j-- ) {
  9913. results.splice( duplicates[ j ], 1 );
  9914. }
  9915. }
  9916. // Clear input after sorting to release objects
  9917. // See https://github.com/jquery/sizzle/pull/225
  9918. sortInput = null;
  9919. return results;
  9920. };
  9921. /**
  9922. * Utility function for retrieving the text value of an array of DOM nodes
  9923. * @param {Array|Element} elem
  9924. */
  9925. getText = Sizzle.getText = function( elem ) {
  9926. var node,
  9927. ret = "",
  9928. i = 0,
  9929. nodeType = elem.nodeType;
  9930. if ( !nodeType ) {
  9931. // If no nodeType, this is expected to be an array
  9932. while ( (node = elem[i++]) ) {
  9933. // Do not traverse comment nodes
  9934. ret += getText( node );
  9935. }
  9936. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9937. // Use textContent for elements
  9938. // innerText usage removed for consistency of new lines (jQuery #11153)
  9939. if ( typeof elem.textContent === "string" ) {
  9940. return elem.textContent;
  9941. } else {
  9942. // Traverse its children
  9943. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9944. ret += getText( elem );
  9945. }
  9946. }
  9947. } else if ( nodeType === 3 || nodeType === 4 ) {
  9948. return elem.nodeValue;
  9949. }
  9950. // Do not include comment or processing instruction nodes
  9951. return ret;
  9952. };
  9953. Expr = Sizzle.selectors = {
  9954. // Can be adjusted by the user
  9955. cacheLength: 50,
  9956. createPseudo: markFunction,
  9957. match: matchExpr,
  9958. attrHandle: {},
  9959. find: {},
  9960. relative: {
  9961. ">": { dir: "parentNode", first: true },
  9962. " ": { dir: "parentNode" },
  9963. "+": { dir: "previousSibling", first: true },
  9964. "~": { dir: "previousSibling" }
  9965. },
  9966. preFilter: {
  9967. "ATTR": function( match ) {
  9968. match[1] = match[1].replace( runescape, funescape );
  9969. // Move the given value to match[3] whether quoted or unquoted
  9970. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9971. if ( match[2] === "~=" ) {
  9972. match[3] = " " + match[3] + " ";
  9973. }
  9974. return match.slice( 0, 4 );
  9975. },
  9976. "CHILD": function( match ) {
  9977. /* matches from matchExpr["CHILD"]
  9978. 1 type (only|nth|...)
  9979. 2 what (child|of-type)
  9980. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9981. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9982. 5 sign of xn-component
  9983. 6 x of xn-component
  9984. 7 sign of y-component
  9985. 8 y of y-component
  9986. */
  9987. match[1] = match[1].toLowerCase();
  9988. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9989. // nth-* requires argument
  9990. if ( !match[3] ) {
  9991. Sizzle.error( match[0] );
  9992. }
  9993. // numeric x and y parameters for Expr.filter.CHILD
  9994. // remember that false/true cast respectively to 0/1
  9995. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9996. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9997. // other types prohibit arguments
  9998. } else if ( match[3] ) {
  9999. Sizzle.error( match[0] );
  10000. }
  10001. return match;
  10002. },
  10003. "PSEUDO": function( match ) {
  10004. var excess,
  10005. unquoted = !match[6] && match[2];
  10006. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10007. return null;
  10008. }
  10009. // Accept quoted arguments as-is
  10010. if ( match[3] ) {
  10011. match[2] = match[4] || match[5] || "";
  10012. // Strip excess characters from unquoted arguments
  10013. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10014. // Get excess from tokenize (recursively)
  10015. (excess = tokenize( unquoted, true )) &&
  10016. // advance to the next closing parenthesis
  10017. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10018. // excess is a negative index
  10019. match[0] = match[0].slice( 0, excess );
  10020. match[2] = unquoted.slice( 0, excess );
  10021. }
  10022. // Return only captures needed by the pseudo filter method (type and argument)
  10023. return match.slice( 0, 3 );
  10024. }
  10025. },
  10026. filter: {
  10027. "TAG": function( nodeNameSelector ) {
  10028. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10029. return nodeNameSelector === "*" ?
  10030. function() { return true; } :
  10031. function( elem ) {
  10032. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10033. };
  10034. },
  10035. "CLASS": function( className ) {
  10036. var pattern = classCache[ className + " " ];
  10037. return pattern ||
  10038. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10039. classCache( className, function( elem ) {
  10040. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10041. });
  10042. },
  10043. "ATTR": function( name, operator, check ) {
  10044. return function( elem ) {
  10045. var result = Sizzle.attr( elem, name );
  10046. if ( result == null ) {
  10047. return operator === "!=";
  10048. }
  10049. if ( !operator ) {
  10050. return true;
  10051. }
  10052. result += "";
  10053. return operator === "=" ? result === check :
  10054. operator === "!=" ? result !== check :
  10055. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10056. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10057. operator === "$=" ? check && result.slice( -check.length ) === check :
  10058. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10059. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10060. false;
  10061. };
  10062. },
  10063. "CHILD": function( type, what, argument, first, last ) {
  10064. var simple = type.slice( 0, 3 ) !== "nth",
  10065. forward = type.slice( -4 ) !== "last",
  10066. ofType = what === "of-type";
  10067. return first === 1 && last === 0 ?
  10068. // Shortcut for :nth-*(n)
  10069. function( elem ) {
  10070. return !!elem.parentNode;
  10071. } :
  10072. function( elem, context, xml ) {
  10073. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10074. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10075. parent = elem.parentNode,
  10076. name = ofType && elem.nodeName.toLowerCase(),
  10077. useCache = !xml && !ofType,
  10078. diff = false;
  10079. if ( parent ) {
  10080. // :(first|last|only)-(child|of-type)
  10081. if ( simple ) {
  10082. while ( dir ) {
  10083. node = elem;
  10084. while ( (node = node[ dir ]) ) {
  10085. if ( ofType ?
  10086. node.nodeName.toLowerCase() === name :
  10087. node.nodeType === 1 ) {
  10088. return false;
  10089. }
  10090. }
  10091. // Reverse direction for :only-* (if we haven't yet done so)
  10092. start = dir = type === "only" && !start && "nextSibling";
  10093. }
  10094. return true;
  10095. }
  10096. start = [ forward ? parent.firstChild : parent.lastChild ];
  10097. // non-xml :nth-child(...) stores cache data on `parent`
  10098. if ( forward && useCache ) {
  10099. // Seek `elem` from a previously-cached index
  10100. // ...in a gzip-friendly way
  10101. node = parent;
  10102. outerCache = node[ expando ] || (node[ expando ] = {});
  10103. // Support: IE <9 only
  10104. // Defend against cloned attroperties (jQuery gh-1709)
  10105. uniqueCache = outerCache[ node.uniqueID ] ||
  10106. (outerCache[ node.uniqueID ] = {});
  10107. cache = uniqueCache[ type ] || [];
  10108. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10109. diff = nodeIndex && cache[ 2 ];
  10110. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10111. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10112. // Fallback to seeking `elem` from the start
  10113. (diff = nodeIndex = 0) || start.pop()) ) {
  10114. // When found, cache indexes on `parent` and break
  10115. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10116. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10117. break;
  10118. }
  10119. }
  10120. } else {
  10121. // Use previously-cached element index if available
  10122. if ( useCache ) {
  10123. // ...in a gzip-friendly way
  10124. node = elem;
  10125. outerCache = node[ expando ] || (node[ expando ] = {});
  10126. // Support: IE <9 only
  10127. // Defend against cloned attroperties (jQuery gh-1709)
  10128. uniqueCache = outerCache[ node.uniqueID ] ||
  10129. (outerCache[ node.uniqueID ] = {});
  10130. cache = uniqueCache[ type ] || [];
  10131. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10132. diff = nodeIndex;
  10133. }
  10134. // xml :nth-child(...)
  10135. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10136. if ( diff === false ) {
  10137. // Use the same loop as above to seek `elem` from the start
  10138. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10139. (diff = nodeIndex = 0) || start.pop()) ) {
  10140. if ( ( ofType ?
  10141. node.nodeName.toLowerCase() === name :
  10142. node.nodeType === 1 ) &&
  10143. ++diff ) {
  10144. // Cache the index of each encountered element
  10145. if ( useCache ) {
  10146. outerCache = node[ expando ] || (node[ expando ] = {});
  10147. // Support: IE <9 only
  10148. // Defend against cloned attroperties (jQuery gh-1709)
  10149. uniqueCache = outerCache[ node.uniqueID ] ||
  10150. (outerCache[ node.uniqueID ] = {});
  10151. uniqueCache[ type ] = [ dirruns, diff ];
  10152. }
  10153. if ( node === elem ) {
  10154. break;
  10155. }
  10156. }
  10157. }
  10158. }
  10159. }
  10160. // Incorporate the offset, then check against cycle size
  10161. diff -= last;
  10162. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10163. }
  10164. };
  10165. },
  10166. "PSEUDO": function( pseudo, argument ) {
  10167. // pseudo-class names are case-insensitive
  10168. // http://www.w3.org/TR/selectors/#pseudo-classes
  10169. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10170. // Remember that setFilters inherits from pseudos
  10171. var args,
  10172. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10173. Sizzle.error( "unsupported pseudo: " + pseudo );
  10174. // The user may use createPseudo to indicate that
  10175. // arguments are needed to create the filter function
  10176. // just as Sizzle does
  10177. if ( fn[ expando ] ) {
  10178. return fn( argument );
  10179. }
  10180. // But maintain support for old signatures
  10181. if ( fn.length > 1 ) {
  10182. args = [ pseudo, pseudo, "", argument ];
  10183. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10184. markFunction(function( seed, matches ) {
  10185. var idx,
  10186. matched = fn( seed, argument ),
  10187. i = matched.length;
  10188. while ( i-- ) {
  10189. idx = indexOf( seed, matched[i] );
  10190. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10191. }
  10192. }) :
  10193. function( elem ) {
  10194. return fn( elem, 0, args );
  10195. };
  10196. }
  10197. return fn;
  10198. }
  10199. },
  10200. pseudos: {
  10201. // Potentially complex pseudos
  10202. "not": markFunction(function( selector ) {
  10203. // Trim the selector passed to compile
  10204. // to avoid treating leading and trailing
  10205. // spaces as combinators
  10206. var input = [],
  10207. results = [],
  10208. matcher = compile( selector.replace( rtrim, "$1" ) );
  10209. return matcher[ expando ] ?
  10210. markFunction(function( seed, matches, context, xml ) {
  10211. var elem,
  10212. unmatched = matcher( seed, null, xml, [] ),
  10213. i = seed.length;
  10214. // Match elements unmatched by `matcher`
  10215. while ( i-- ) {
  10216. if ( (elem = unmatched[i]) ) {
  10217. seed[i] = !(matches[i] = elem);
  10218. }
  10219. }
  10220. }) :
  10221. function( elem, context, xml ) {
  10222. input[0] = elem;
  10223. matcher( input, null, xml, results );
  10224. // Don't keep the element (issue #299)
  10225. input[0] = null;
  10226. return !results.pop();
  10227. };
  10228. }),
  10229. "has": markFunction(function( selector ) {
  10230. return function( elem ) {
  10231. return Sizzle( selector, elem ).length > 0;
  10232. };
  10233. }),
  10234. "contains": markFunction(function( text ) {
  10235. text = text.replace( runescape, funescape );
  10236. return function( elem ) {
  10237. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10238. };
  10239. }),
  10240. // "Whether an element is represented by a :lang() selector
  10241. // is based solely on the element's language value
  10242. // being equal to the identifier C,
  10243. // or beginning with the identifier C immediately followed by "-".
  10244. // The matching of C against the element's language value is performed case-insensitively.
  10245. // The identifier C does not have to be a valid language name."
  10246. // http://www.w3.org/TR/selectors/#lang-pseudo
  10247. "lang": markFunction( function( lang ) {
  10248. // lang value must be a valid identifier
  10249. if ( !ridentifier.test(lang || "") ) {
  10250. Sizzle.error( "unsupported lang: " + lang );
  10251. }
  10252. lang = lang.replace( runescape, funescape ).toLowerCase();
  10253. return function( elem ) {
  10254. var elemLang;
  10255. do {
  10256. if ( (elemLang = documentIsHTML ?
  10257. elem.lang :
  10258. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10259. elemLang = elemLang.toLowerCase();
  10260. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10261. }
  10262. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10263. return false;
  10264. };
  10265. }),
  10266. // Miscellaneous
  10267. "target": function( elem ) {
  10268. var hash = window.location && window.location.hash;
  10269. return hash && hash.slice( 1 ) === elem.id;
  10270. },
  10271. "root": function( elem ) {
  10272. return elem === docElem;
  10273. },
  10274. "focus": function( elem ) {
  10275. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10276. },
  10277. // Boolean properties
  10278. "enabled": createDisabledPseudo( false ),
  10279. "disabled": createDisabledPseudo( true ),
  10280. "checked": function( elem ) {
  10281. // In CSS3, :checked should return both checked and selected elements
  10282. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10283. var nodeName = elem.nodeName.toLowerCase();
  10284. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10285. },
  10286. "selected": function( elem ) {
  10287. // Accessing this property makes selected-by-default
  10288. // options in Safari work properly
  10289. if ( elem.parentNode ) {
  10290. elem.parentNode.selectedIndex;
  10291. }
  10292. return elem.selected === true;
  10293. },
  10294. // Contents
  10295. "empty": function( elem ) {
  10296. // http://www.w3.org/TR/selectors/#empty-pseudo
  10297. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10298. // but not by others (comment: 8; processing instruction: 7; etc.)
  10299. // nodeType < 6 works because attributes (2) do not appear as children
  10300. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10301. if ( elem.nodeType < 6 ) {
  10302. return false;
  10303. }
  10304. }
  10305. return true;
  10306. },
  10307. "parent": function( elem ) {
  10308. return !Expr.pseudos["empty"]( elem );
  10309. },
  10310. // Element/input types
  10311. "header": function( elem ) {
  10312. return rheader.test( elem.nodeName );
  10313. },
  10314. "input": function( elem ) {
  10315. return rinputs.test( elem.nodeName );
  10316. },
  10317. "button": function( elem ) {
  10318. var name = elem.nodeName.toLowerCase();
  10319. return name === "input" && elem.type === "button" || name === "button";
  10320. },
  10321. "text": function( elem ) {
  10322. var attr;
  10323. return elem.nodeName.toLowerCase() === "input" &&
  10324. elem.type === "text" &&
  10325. // Support: IE<8
  10326. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10327. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10328. },
  10329. // Position-in-collection
  10330. "first": createPositionalPseudo(function() {
  10331. return [ 0 ];
  10332. }),
  10333. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10334. return [ length - 1 ];
  10335. }),
  10336. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10337. return [ argument < 0 ? argument + length : argument ];
  10338. }),
  10339. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10340. var i = 0;
  10341. for ( ; i < length; i += 2 ) {
  10342. matchIndexes.push( i );
  10343. }
  10344. return matchIndexes;
  10345. }),
  10346. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10347. var i = 1;
  10348. for ( ; i < length; i += 2 ) {
  10349. matchIndexes.push( i );
  10350. }
  10351. return matchIndexes;
  10352. }),
  10353. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10354. var i = argument < 0 ?
  10355. argument + length :
  10356. argument > length ?
  10357. length :
  10358. argument;
  10359. for ( ; --i >= 0; ) {
  10360. matchIndexes.push( i );
  10361. }
  10362. return matchIndexes;
  10363. }),
  10364. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10365. var i = argument < 0 ? argument + length : argument;
  10366. for ( ; ++i < length; ) {
  10367. matchIndexes.push( i );
  10368. }
  10369. return matchIndexes;
  10370. })
  10371. }
  10372. };
  10373. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10374. // Add button/input type pseudos
  10375. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10376. Expr.pseudos[ i ] = createInputPseudo( i );
  10377. }
  10378. for ( i in { submit: true, reset: true } ) {
  10379. Expr.pseudos[ i ] = createButtonPseudo( i );
  10380. }
  10381. // Easy API for creating new setFilters
  10382. function setFilters() {}
  10383. setFilters.prototype = Expr.filters = Expr.pseudos;
  10384. Expr.setFilters = new setFilters();
  10385. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10386. var matched, match, tokens, type,
  10387. soFar, groups, preFilters,
  10388. cached = tokenCache[ selector + " " ];
  10389. if ( cached ) {
  10390. return parseOnly ? 0 : cached.slice( 0 );
  10391. }
  10392. soFar = selector;
  10393. groups = [];
  10394. preFilters = Expr.preFilter;
  10395. while ( soFar ) {
  10396. // Comma and first run
  10397. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10398. if ( match ) {
  10399. // Don't consume trailing commas as valid
  10400. soFar = soFar.slice( match[0].length ) || soFar;
  10401. }
  10402. groups.push( (tokens = []) );
  10403. }
  10404. matched = false;
  10405. // Combinators
  10406. if ( (match = rcombinators.exec( soFar )) ) {
  10407. matched = match.shift();
  10408. tokens.push({
  10409. value: matched,
  10410. // Cast descendant combinators to space
  10411. type: match[0].replace( rtrim, " " )
  10412. });
  10413. soFar = soFar.slice( matched.length );
  10414. }
  10415. // Filters
  10416. for ( type in Expr.filter ) {
  10417. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10418. (match = preFilters[ type ]( match ))) ) {
  10419. matched = match.shift();
  10420. tokens.push({
  10421. value: matched,
  10422. type: type,
  10423. matches: match
  10424. });
  10425. soFar = soFar.slice( matched.length );
  10426. }
  10427. }
  10428. if ( !matched ) {
  10429. break;
  10430. }
  10431. }
  10432. // Return the length of the invalid excess
  10433. // if we're just parsing
  10434. // Otherwise, throw an error or return tokens
  10435. return parseOnly ?
  10436. soFar.length :
  10437. soFar ?
  10438. Sizzle.error( selector ) :
  10439. // Cache the tokens
  10440. tokenCache( selector, groups ).slice( 0 );
  10441. };
  10442. function toSelector( tokens ) {
  10443. var i = 0,
  10444. len = tokens.length,
  10445. selector = "";
  10446. for ( ; i < len; i++ ) {
  10447. selector += tokens[i].value;
  10448. }
  10449. return selector;
  10450. }
  10451. function addCombinator( matcher, combinator, base ) {
  10452. var dir = combinator.dir,
  10453. skip = combinator.next,
  10454. key = skip || dir,
  10455. checkNonElements = base && key === "parentNode",
  10456. doneName = done++;
  10457. return combinator.first ?
  10458. // Check against closest ancestor/preceding element
  10459. function( elem, context, xml ) {
  10460. while ( (elem = elem[ dir ]) ) {
  10461. if ( elem.nodeType === 1 || checkNonElements ) {
  10462. return matcher( elem, context, xml );
  10463. }
  10464. }
  10465. return false;
  10466. } :
  10467. // Check against all ancestor/preceding elements
  10468. function( elem, context, xml ) {
  10469. var oldCache, uniqueCache, outerCache,
  10470. newCache = [ dirruns, doneName ];
  10471. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10472. if ( xml ) {
  10473. while ( (elem = elem[ dir ]) ) {
  10474. if ( elem.nodeType === 1 || checkNonElements ) {
  10475. if ( matcher( elem, context, xml ) ) {
  10476. return true;
  10477. }
  10478. }
  10479. }
  10480. } else {
  10481. while ( (elem = elem[ dir ]) ) {
  10482. if ( elem.nodeType === 1 || checkNonElements ) {
  10483. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10484. // Support: IE <9 only
  10485. // Defend against cloned attroperties (jQuery gh-1709)
  10486. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10487. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10488. elem = elem[ dir ] || elem;
  10489. } else if ( (oldCache = uniqueCache[ key ]) &&
  10490. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10491. // Assign to newCache so results back-propagate to previous elements
  10492. return (newCache[ 2 ] = oldCache[ 2 ]);
  10493. } else {
  10494. // Reuse newcache so results back-propagate to previous elements
  10495. uniqueCache[ key ] = newCache;
  10496. // A match means we're done; a fail means we have to keep checking
  10497. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10498. return true;
  10499. }
  10500. }
  10501. }
  10502. }
  10503. }
  10504. return false;
  10505. };
  10506. }
  10507. function elementMatcher( matchers ) {
  10508. return matchers.length > 1 ?
  10509. function( elem, context, xml ) {
  10510. var i = matchers.length;
  10511. while ( i-- ) {
  10512. if ( !matchers[i]( elem, context, xml ) ) {
  10513. return false;
  10514. }
  10515. }
  10516. return true;
  10517. } :
  10518. matchers[0];
  10519. }
  10520. function multipleContexts( selector, contexts, results ) {
  10521. var i = 0,
  10522. len = contexts.length;
  10523. for ( ; i < len; i++ ) {
  10524. Sizzle( selector, contexts[i], results );
  10525. }
  10526. return results;
  10527. }
  10528. function condense( unmatched, map, filter, context, xml ) {
  10529. var elem,
  10530. newUnmatched = [],
  10531. i = 0,
  10532. len = unmatched.length,
  10533. mapped = map != null;
  10534. for ( ; i < len; i++ ) {
  10535. if ( (elem = unmatched[i]) ) {
  10536. if ( !filter || filter( elem, context, xml ) ) {
  10537. newUnmatched.push( elem );
  10538. if ( mapped ) {
  10539. map.push( i );
  10540. }
  10541. }
  10542. }
  10543. }
  10544. return newUnmatched;
  10545. }
  10546. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10547. if ( postFilter && !postFilter[ expando ] ) {
  10548. postFilter = setMatcher( postFilter );
  10549. }
  10550. if ( postFinder && !postFinder[ expando ] ) {
  10551. postFinder = setMatcher( postFinder, postSelector );
  10552. }
  10553. return markFunction(function( seed, results, context, xml ) {
  10554. var temp, i, elem,
  10555. preMap = [],
  10556. postMap = [],
  10557. preexisting = results.length,
  10558. // Get initial elements from seed or context
  10559. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10560. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10561. matcherIn = preFilter && ( seed || !selector ) ?
  10562. condense( elems, preMap, preFilter, context, xml ) :
  10563. elems,
  10564. matcherOut = matcher ?
  10565. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10566. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10567. // ...intermediate processing is necessary
  10568. [] :
  10569. // ...otherwise use results directly
  10570. results :
  10571. matcherIn;
  10572. // Find primary matches
  10573. if ( matcher ) {
  10574. matcher( matcherIn, matcherOut, context, xml );
  10575. }
  10576. // Apply postFilter
  10577. if ( postFilter ) {
  10578. temp = condense( matcherOut, postMap );
  10579. postFilter( temp, [], context, xml );
  10580. // Un-match failing elements by moving them back to matcherIn
  10581. i = temp.length;
  10582. while ( i-- ) {
  10583. if ( (elem = temp[i]) ) {
  10584. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10585. }
  10586. }
  10587. }
  10588. if ( seed ) {
  10589. if ( postFinder || preFilter ) {
  10590. if ( postFinder ) {
  10591. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10592. temp = [];
  10593. i = matcherOut.length;
  10594. while ( i-- ) {
  10595. if ( (elem = matcherOut[i]) ) {
  10596. // Restore matcherIn since elem is not yet a final match
  10597. temp.push( (matcherIn[i] = elem) );
  10598. }
  10599. }
  10600. postFinder( null, (matcherOut = []), temp, xml );
  10601. }
  10602. // Move matched elements from seed to results to keep them synchronized
  10603. i = matcherOut.length;
  10604. while ( i-- ) {
  10605. if ( (elem = matcherOut[i]) &&
  10606. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10607. seed[temp] = !(results[temp] = elem);
  10608. }
  10609. }
  10610. }
  10611. // Add elements to results, through postFinder if defined
  10612. } else {
  10613. matcherOut = condense(
  10614. matcherOut === results ?
  10615. matcherOut.splice( preexisting, matcherOut.length ) :
  10616. matcherOut
  10617. );
  10618. if ( postFinder ) {
  10619. postFinder( null, results, matcherOut, xml );
  10620. } else {
  10621. push.apply( results, matcherOut );
  10622. }
  10623. }
  10624. });
  10625. }
  10626. function matcherFromTokens( tokens ) {
  10627. var checkContext, matcher, j,
  10628. len = tokens.length,
  10629. leadingRelative = Expr.relative[ tokens[0].type ],
  10630. implicitRelative = leadingRelative || Expr.relative[" "],
  10631. i = leadingRelative ? 1 : 0,
  10632. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10633. matchContext = addCombinator( function( elem ) {
  10634. return elem === checkContext;
  10635. }, implicitRelative, true ),
  10636. matchAnyContext = addCombinator( function( elem ) {
  10637. return indexOf( checkContext, elem ) > -1;
  10638. }, implicitRelative, true ),
  10639. matchers = [ function( elem, context, xml ) {
  10640. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10641. (checkContext = context).nodeType ?
  10642. matchContext( elem, context, xml ) :
  10643. matchAnyContext( elem, context, xml ) );
  10644. // Avoid hanging onto element (issue #299)
  10645. checkContext = null;
  10646. return ret;
  10647. } ];
  10648. for ( ; i < len; i++ ) {
  10649. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10650. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10651. } else {
  10652. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10653. // Return special upon seeing a positional matcher
  10654. if ( matcher[ expando ] ) {
  10655. // Find the next relative operator (if any) for proper handling
  10656. j = ++i;
  10657. for ( ; j < len; j++ ) {
  10658. if ( Expr.relative[ tokens[j].type ] ) {
  10659. break;
  10660. }
  10661. }
  10662. return setMatcher(
  10663. i > 1 && elementMatcher( matchers ),
  10664. i > 1 && toSelector(
  10665. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10666. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10667. ).replace( rtrim, "$1" ),
  10668. matcher,
  10669. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10670. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10671. j < len && toSelector( tokens )
  10672. );
  10673. }
  10674. matchers.push( matcher );
  10675. }
  10676. }
  10677. return elementMatcher( matchers );
  10678. }
  10679. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10680. var bySet = setMatchers.length > 0,
  10681. byElement = elementMatchers.length > 0,
  10682. superMatcher = function( seed, context, xml, results, outermost ) {
  10683. var elem, j, matcher,
  10684. matchedCount = 0,
  10685. i = "0",
  10686. unmatched = seed && [],
  10687. setMatched = [],
  10688. contextBackup = outermostContext,
  10689. // We must always have either seed elements or outermost context
  10690. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10691. // Use integer dirruns iff this is the outermost matcher
  10692. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10693. len = elems.length;
  10694. if ( outermost ) {
  10695. outermostContext = context === document || context || outermost;
  10696. }
  10697. // Add elements passing elementMatchers directly to results
  10698. // Support: IE<9, Safari
  10699. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10700. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10701. if ( byElement && elem ) {
  10702. j = 0;
  10703. if ( !context && elem.ownerDocument !== document ) {
  10704. setDocument( elem );
  10705. xml = !documentIsHTML;
  10706. }
  10707. while ( (matcher = elementMatchers[j++]) ) {
  10708. if ( matcher( elem, context || document, xml) ) {
  10709. results.push( elem );
  10710. break;
  10711. }
  10712. }
  10713. if ( outermost ) {
  10714. dirruns = dirrunsUnique;
  10715. }
  10716. }
  10717. // Track unmatched elements for set filters
  10718. if ( bySet ) {
  10719. // They will have gone through all possible matchers
  10720. if ( (elem = !matcher && elem) ) {
  10721. matchedCount--;
  10722. }
  10723. // Lengthen the array for every element, matched or not
  10724. if ( seed ) {
  10725. unmatched.push( elem );
  10726. }
  10727. }
  10728. }
  10729. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10730. // makes the latter nonnegative.
  10731. matchedCount += i;
  10732. // Apply set filters to unmatched elements
  10733. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10734. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10735. // no element matchers and no seed.
  10736. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10737. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10738. // numerically zero.
  10739. if ( bySet && i !== matchedCount ) {
  10740. j = 0;
  10741. while ( (matcher = setMatchers[j++]) ) {
  10742. matcher( unmatched, setMatched, context, xml );
  10743. }
  10744. if ( seed ) {
  10745. // Reintegrate element matches to eliminate the need for sorting
  10746. if ( matchedCount > 0 ) {
  10747. while ( i-- ) {
  10748. if ( !(unmatched[i] || setMatched[i]) ) {
  10749. setMatched[i] = pop.call( results );
  10750. }
  10751. }
  10752. }
  10753. // Discard index placeholder values to get only actual matches
  10754. setMatched = condense( setMatched );
  10755. }
  10756. // Add matches to results
  10757. push.apply( results, setMatched );
  10758. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10759. if ( outermost && !seed && setMatched.length > 0 &&
  10760. ( matchedCount + setMatchers.length ) > 1 ) {
  10761. Sizzle.uniqueSort( results );
  10762. }
  10763. }
  10764. // Override manipulation of globals by nested matchers
  10765. if ( outermost ) {
  10766. dirruns = dirrunsUnique;
  10767. outermostContext = contextBackup;
  10768. }
  10769. return unmatched;
  10770. };
  10771. return bySet ?
  10772. markFunction( superMatcher ) :
  10773. superMatcher;
  10774. }
  10775. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10776. var i,
  10777. setMatchers = [],
  10778. elementMatchers = [],
  10779. cached = compilerCache[ selector + " " ];
  10780. if ( !cached ) {
  10781. // Generate a function of recursive functions that can be used to check each element
  10782. if ( !match ) {
  10783. match = tokenize( selector );
  10784. }
  10785. i = match.length;
  10786. while ( i-- ) {
  10787. cached = matcherFromTokens( match[i] );
  10788. if ( cached[ expando ] ) {
  10789. setMatchers.push( cached );
  10790. } else {
  10791. elementMatchers.push( cached );
  10792. }
  10793. }
  10794. // Cache the compiled function
  10795. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10796. // Save selector and tokenization
  10797. cached.selector = selector;
  10798. }
  10799. return cached;
  10800. };
  10801. /**
  10802. * A low-level selection function that works with Sizzle's compiled
  10803. * selector functions
  10804. * @param {String|Function} selector A selector or a pre-compiled
  10805. * selector function built with Sizzle.compile
  10806. * @param {Element} context
  10807. * @param {Array} [results]
  10808. * @param {Array} [seed] A set of elements to match against
  10809. */
  10810. select = Sizzle.select = function( selector, context, results, seed ) {
  10811. var i, tokens, token, type, find,
  10812. compiled = typeof selector === "function" && selector,
  10813. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10814. results = results || [];
  10815. // Try to minimize operations if there is only one selector in the list and no seed
  10816. // (the latter of which guarantees us context)
  10817. if ( match.length === 1 ) {
  10818. // Reduce context if the leading compound selector is an ID
  10819. tokens = match[0] = match[0].slice( 0 );
  10820. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10821. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10822. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10823. if ( !context ) {
  10824. return results;
  10825. // Precompiled matchers will still verify ancestry, so step up a level
  10826. } else if ( compiled ) {
  10827. context = context.parentNode;
  10828. }
  10829. selector = selector.slice( tokens.shift().value.length );
  10830. }
  10831. // Fetch a seed set for right-to-left matching
  10832. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10833. while ( i-- ) {
  10834. token = tokens[i];
  10835. // Abort if we hit a combinator
  10836. if ( Expr.relative[ (type = token.type) ] ) {
  10837. break;
  10838. }
  10839. if ( (find = Expr.find[ type ]) ) {
  10840. // Search, expanding context for leading sibling combinators
  10841. if ( (seed = find(
  10842. token.matches[0].replace( runescape, funescape ),
  10843. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10844. )) ) {
  10845. // If seed is empty or no tokens remain, we can return early
  10846. tokens.splice( i, 1 );
  10847. selector = seed.length && toSelector( tokens );
  10848. if ( !selector ) {
  10849. push.apply( results, seed );
  10850. return results;
  10851. }
  10852. break;
  10853. }
  10854. }
  10855. }
  10856. }
  10857. // Compile and execute a filtering function if one is not provided
  10858. // Provide `match` to avoid retokenization if we modified the selector above
  10859. ( compiled || compile( selector, match ) )(
  10860. seed,
  10861. context,
  10862. !documentIsHTML,
  10863. results,
  10864. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10865. );
  10866. return results;
  10867. };
  10868. // One-time assignments
  10869. // Sort stability
  10870. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10871. // Support: Chrome 14-35+
  10872. // Always assume duplicates if they aren't passed to the comparison function
  10873. support.detectDuplicates = !!hasDuplicate;
  10874. // Initialize against the default document
  10875. setDocument();
  10876. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10877. // Detached nodes confoundingly follow *each other*
  10878. support.sortDetached = assert(function( el ) {
  10879. // Should return 1, but returns 4 (following)
  10880. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10881. });
  10882. // Support: IE<8
  10883. // Prevent attribute/property "interpolation"
  10884. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10885. if ( !assert(function( el ) {
  10886. el.innerHTML = "<a href='#'></a>";
  10887. return el.firstChild.getAttribute("href") === "#" ;
  10888. }) ) {
  10889. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10890. if ( !isXML ) {
  10891. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10892. }
  10893. });
  10894. }
  10895. // Support: IE<9
  10896. // Use defaultValue in place of getAttribute("value")
  10897. if ( !support.attributes || !assert(function( el ) {
  10898. el.innerHTML = "<input/>";
  10899. el.firstChild.setAttribute( "value", "" );
  10900. return el.firstChild.getAttribute( "value" ) === "";
  10901. }) ) {
  10902. addHandle( "value", function( elem, name, isXML ) {
  10903. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10904. return elem.defaultValue;
  10905. }
  10906. });
  10907. }
  10908. // Support: IE<9
  10909. // Use getAttributeNode to fetch booleans when getAttribute lies
  10910. if ( !assert(function( el ) {
  10911. return el.getAttribute("disabled") == null;
  10912. }) ) {
  10913. addHandle( booleans, function( elem, name, isXML ) {
  10914. var val;
  10915. if ( !isXML ) {
  10916. return elem[ name ] === true ? name.toLowerCase() :
  10917. (val = elem.getAttributeNode( name )) && val.specified ?
  10918. val.value :
  10919. null;
  10920. }
  10921. });
  10922. }
  10923. return Sizzle;
  10924. })( window );
  10925. jQuery.find = Sizzle;
  10926. jQuery.expr = Sizzle.selectors;
  10927. // Deprecated
  10928. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10929. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10930. jQuery.text = Sizzle.getText;
  10931. jQuery.isXMLDoc = Sizzle.isXML;
  10932. jQuery.contains = Sizzle.contains;
  10933. jQuery.escapeSelector = Sizzle.escape;
  10934. var dir = function( elem, dir, until ) {
  10935. var matched = [],
  10936. truncate = until !== undefined;
  10937. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10938. if ( elem.nodeType === 1 ) {
  10939. if ( truncate && jQuery( elem ).is( until ) ) {
  10940. break;
  10941. }
  10942. matched.push( elem );
  10943. }
  10944. }
  10945. return matched;
  10946. };
  10947. var siblings = function( n, elem ) {
  10948. var matched = [];
  10949. for ( ; n; n = n.nextSibling ) {
  10950. if ( n.nodeType === 1 && n !== elem ) {
  10951. matched.push( n );
  10952. }
  10953. }
  10954. return matched;
  10955. };
  10956. var rneedsContext = jQuery.expr.match.needsContext;
  10957. function nodeName( elem, name ) {
  10958. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10959. };
  10960. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10961. // Implement the identical functionality for filter and not
  10962. function winnow( elements, qualifier, not ) {
  10963. if ( isFunction( qualifier ) ) {
  10964. return jQuery.grep( elements, function( elem, i ) {
  10965. return !!qualifier.call( elem, i, elem ) !== not;
  10966. } );
  10967. }
  10968. // Single element
  10969. if ( qualifier.nodeType ) {
  10970. return jQuery.grep( elements, function( elem ) {
  10971. return ( elem === qualifier ) !== not;
  10972. } );
  10973. }
  10974. // Arraylike of elements (jQuery, arguments, Array)
  10975. if ( typeof qualifier !== "string" ) {
  10976. return jQuery.grep( elements, function( elem ) {
  10977. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10978. } );
  10979. }
  10980. // Filtered directly for both simple and complex selectors
  10981. return jQuery.filter( qualifier, elements, not );
  10982. }
  10983. jQuery.filter = function( expr, elems, not ) {
  10984. var elem = elems[ 0 ];
  10985. if ( not ) {
  10986. expr = ":not(" + expr + ")";
  10987. }
  10988. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10989. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10990. }
  10991. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10992. return elem.nodeType === 1;
  10993. } ) );
  10994. };
  10995. jQuery.fn.extend( {
  10996. find: function( selector ) {
  10997. var i, ret,
  10998. len = this.length,
  10999. self = this;
  11000. if ( typeof selector !== "string" ) {
  11001. return this.pushStack( jQuery( selector ).filter( function() {
  11002. for ( i = 0; i < len; i++ ) {
  11003. if ( jQuery.contains( self[ i ], this ) ) {
  11004. return true;
  11005. }
  11006. }
  11007. } ) );
  11008. }
  11009. ret = this.pushStack( [] );
  11010. for ( i = 0; i < len; i++ ) {
  11011. jQuery.find( selector, self[ i ], ret );
  11012. }
  11013. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11014. },
  11015. filter: function( selector ) {
  11016. return this.pushStack( winnow( this, selector || [], false ) );
  11017. },
  11018. not: function( selector ) {
  11019. return this.pushStack( winnow( this, selector || [], true ) );
  11020. },
  11021. is: function( selector ) {
  11022. return !!winnow(
  11023. this,
  11024. // If this is a positional/relative selector, check membership in the returned set
  11025. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11026. typeof selector === "string" && rneedsContext.test( selector ) ?
  11027. jQuery( selector ) :
  11028. selector || [],
  11029. false
  11030. ).length;
  11031. }
  11032. } );
  11033. // Initialize a jQuery object
  11034. // A central reference to the root jQuery(document)
  11035. var rootjQuery,
  11036. // A simple way to check for HTML strings
  11037. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11038. // Strict HTML recognition (#11290: must start with <)
  11039. // Shortcut simple #id case for speed
  11040. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11041. init = jQuery.fn.init = function( selector, context, root ) {
  11042. var match, elem;
  11043. // HANDLE: $(""), $(null), $(undefined), $(false)
  11044. if ( !selector ) {
  11045. return this;
  11046. }
  11047. // Method init() accepts an alternate rootjQuery
  11048. // so migrate can support jQuery.sub (gh-2101)
  11049. root = root || rootjQuery;
  11050. // Handle HTML strings
  11051. if ( typeof selector === "string" ) {
  11052. if ( selector[ 0 ] === "<" &&
  11053. selector[ selector.length - 1 ] === ">" &&
  11054. selector.length >= 3 ) {
  11055. // Assume that strings that start and end with <> are HTML and skip the regex check
  11056. match = [ null, selector, null ];
  11057. } else {
  11058. match = rquickExpr.exec( selector );
  11059. }
  11060. // Match html or make sure no context is specified for #id
  11061. if ( match && ( match[ 1 ] || !context ) ) {
  11062. // HANDLE: $(html) -> $(array)
  11063. if ( match[ 1 ] ) {
  11064. context = context instanceof jQuery ? context[ 0 ] : context;
  11065. // Option to run scripts is true for back-compat
  11066. // Intentionally let the error be thrown if parseHTML is not present
  11067. jQuery.merge( this, jQuery.parseHTML(
  11068. match[ 1 ],
  11069. context && context.nodeType ? context.ownerDocument || context : document,
  11070. true
  11071. ) );
  11072. // HANDLE: $(html, props)
  11073. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11074. for ( match in context ) {
  11075. // Properties of context are called as methods if possible
  11076. if ( isFunction( this[ match ] ) ) {
  11077. this[ match ]( context[ match ] );
  11078. // ...and otherwise set as attributes
  11079. } else {
  11080. this.attr( match, context[ match ] );
  11081. }
  11082. }
  11083. }
  11084. return this;
  11085. // HANDLE: $(#id)
  11086. } else {
  11087. elem = document.getElementById( match[ 2 ] );
  11088. if ( elem ) {
  11089. // Inject the element directly into the jQuery object
  11090. this[ 0 ] = elem;
  11091. this.length = 1;
  11092. }
  11093. return this;
  11094. }
  11095. // HANDLE: $(expr, $(...))
  11096. } else if ( !context || context.jquery ) {
  11097. return ( context || root ).find( selector );
  11098. // HANDLE: $(expr, context)
  11099. // (which is just equivalent to: $(context).find(expr)
  11100. } else {
  11101. return this.constructor( context ).find( selector );
  11102. }
  11103. // HANDLE: $(DOMElement)
  11104. } else if ( selector.nodeType ) {
  11105. this[ 0 ] = selector;
  11106. this.length = 1;
  11107. return this;
  11108. // HANDLE: $(function)
  11109. // Shortcut for document ready
  11110. } else if ( isFunction( selector ) ) {
  11111. return root.ready !== undefined ?
  11112. root.ready( selector ) :
  11113. // Execute immediately if ready is not present
  11114. selector( jQuery );
  11115. }
  11116. return jQuery.makeArray( selector, this );
  11117. };
  11118. // Give the init function the jQuery prototype for later instantiation
  11119. init.prototype = jQuery.fn;
  11120. // Initialize central reference
  11121. rootjQuery = jQuery( document );
  11122. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11123. // Methods guaranteed to produce a unique set when starting from a unique set
  11124. guaranteedUnique = {
  11125. children: true,
  11126. contents: true,
  11127. next: true,
  11128. prev: true
  11129. };
  11130. jQuery.fn.extend( {
  11131. has: function( target ) {
  11132. var targets = jQuery( target, this ),
  11133. l = targets.length;
  11134. return this.filter( function() {
  11135. var i = 0;
  11136. for ( ; i < l; i++ ) {
  11137. if ( jQuery.contains( this, targets[ i ] ) ) {
  11138. return true;
  11139. }
  11140. }
  11141. } );
  11142. },
  11143. closest: function( selectors, context ) {
  11144. var cur,
  11145. i = 0,
  11146. l = this.length,
  11147. matched = [],
  11148. targets = typeof selectors !== "string" && jQuery( selectors );
  11149. // Positional selectors never match, since there's no _selection_ context
  11150. if ( !rneedsContext.test( selectors ) ) {
  11151. for ( ; i < l; i++ ) {
  11152. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11153. // Always skip document fragments
  11154. if ( cur.nodeType < 11 && ( targets ?
  11155. targets.index( cur ) > -1 :
  11156. // Don't pass non-elements to Sizzle
  11157. cur.nodeType === 1 &&
  11158. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11159. matched.push( cur );
  11160. break;
  11161. }
  11162. }
  11163. }
  11164. }
  11165. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11166. },
  11167. // Determine the position of an element within the set
  11168. index: function( elem ) {
  11169. // No argument, return index in parent
  11170. if ( !elem ) {
  11171. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11172. }
  11173. // Index in selector
  11174. if ( typeof elem === "string" ) {
  11175. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11176. }
  11177. // Locate the position of the desired element
  11178. return indexOf.call( this,
  11179. // If it receives a jQuery object, the first element is used
  11180. elem.jquery ? elem[ 0 ] : elem
  11181. );
  11182. },
  11183. add: function( selector, context ) {
  11184. return this.pushStack(
  11185. jQuery.uniqueSort(
  11186. jQuery.merge( this.get(), jQuery( selector, context ) )
  11187. )
  11188. );
  11189. },
  11190. addBack: function( selector ) {
  11191. return this.add( selector == null ?
  11192. this.prevObject : this.prevObject.filter( selector )
  11193. );
  11194. }
  11195. } );
  11196. function sibling( cur, dir ) {
  11197. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11198. return cur;
  11199. }
  11200. jQuery.each( {
  11201. parent: function( elem ) {
  11202. var parent = elem.parentNode;
  11203. return parent && parent.nodeType !== 11 ? parent : null;
  11204. },
  11205. parents: function( elem ) {
  11206. return dir( elem, "parentNode" );
  11207. },
  11208. parentsUntil: function( elem, i, until ) {
  11209. return dir( elem, "parentNode", until );
  11210. },
  11211. next: function( elem ) {
  11212. return sibling( elem, "nextSibling" );
  11213. },
  11214. prev: function( elem ) {
  11215. return sibling( elem, "previousSibling" );
  11216. },
  11217. nextAll: function( elem ) {
  11218. return dir( elem, "nextSibling" );
  11219. },
  11220. prevAll: function( elem ) {
  11221. return dir( elem, "previousSibling" );
  11222. },
  11223. nextUntil: function( elem, i, until ) {
  11224. return dir( elem, "nextSibling", until );
  11225. },
  11226. prevUntil: function( elem, i, until ) {
  11227. return dir( elem, "previousSibling", until );
  11228. },
  11229. siblings: function( elem ) {
  11230. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11231. },
  11232. children: function( elem ) {
  11233. return siblings( elem.firstChild );
  11234. },
  11235. contents: function( elem ) {
  11236. if ( typeof elem.contentDocument !== "undefined" ) {
  11237. return elem.contentDocument;
  11238. }
  11239. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11240. // Treat the template element as a regular one in browsers that
  11241. // don't support it.
  11242. if ( nodeName( elem, "template" ) ) {
  11243. elem = elem.content || elem;
  11244. }
  11245. return jQuery.merge( [], elem.childNodes );
  11246. }
  11247. }, function( name, fn ) {
  11248. jQuery.fn[ name ] = function( until, selector ) {
  11249. var matched = jQuery.map( this, fn, until );
  11250. if ( name.slice( -5 ) !== "Until" ) {
  11251. selector = until;
  11252. }
  11253. if ( selector && typeof selector === "string" ) {
  11254. matched = jQuery.filter( selector, matched );
  11255. }
  11256. if ( this.length > 1 ) {
  11257. // Remove duplicates
  11258. if ( !guaranteedUnique[ name ] ) {
  11259. jQuery.uniqueSort( matched );
  11260. }
  11261. // Reverse order for parents* and prev-derivatives
  11262. if ( rparentsprev.test( name ) ) {
  11263. matched.reverse();
  11264. }
  11265. }
  11266. return this.pushStack( matched );
  11267. };
  11268. } );
  11269. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11270. // Convert String-formatted options into Object-formatted ones
  11271. function createOptions( options ) {
  11272. var object = {};
  11273. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11274. object[ flag ] = true;
  11275. } );
  11276. return object;
  11277. }
  11278. /*
  11279. * Create a callback list using the following parameters:
  11280. *
  11281. * options: an optional list of space-separated options that will change how
  11282. * the callback list behaves or a more traditional option object
  11283. *
  11284. * By default a callback list will act like an event callback list and can be
  11285. * "fired" multiple times.
  11286. *
  11287. * Possible options:
  11288. *
  11289. * once: will ensure the callback list can only be fired once (like a Deferred)
  11290. *
  11291. * memory: will keep track of previous values and will call any callback added
  11292. * after the list has been fired right away with the latest "memorized"
  11293. * values (like a Deferred)
  11294. *
  11295. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11296. *
  11297. * stopOnFalse: interrupt callings when a callback returns false
  11298. *
  11299. */
  11300. jQuery.Callbacks = function( options ) {
  11301. // Convert options from String-formatted to Object-formatted if needed
  11302. // (we check in cache first)
  11303. options = typeof options === "string" ?
  11304. createOptions( options ) :
  11305. jQuery.extend( {}, options );
  11306. var // Flag to know if list is currently firing
  11307. firing,
  11308. // Last fire value for non-forgettable lists
  11309. memory,
  11310. // Flag to know if list was already fired
  11311. fired,
  11312. // Flag to prevent firing
  11313. locked,
  11314. // Actual callback list
  11315. list = [],
  11316. // Queue of execution data for repeatable lists
  11317. queue = [],
  11318. // Index of currently firing callback (modified by add/remove as needed)
  11319. firingIndex = -1,
  11320. // Fire callbacks
  11321. fire = function() {
  11322. // Enforce single-firing
  11323. locked = locked || options.once;
  11324. // Execute callbacks for all pending executions,
  11325. // respecting firingIndex overrides and runtime changes
  11326. fired = firing = true;
  11327. for ( ; queue.length; firingIndex = -1 ) {
  11328. memory = queue.shift();
  11329. while ( ++firingIndex < list.length ) {
  11330. // Run callback and check for early termination
  11331. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11332. options.stopOnFalse ) {
  11333. // Jump to end and forget the data so .add doesn't re-fire
  11334. firingIndex = list.length;
  11335. memory = false;
  11336. }
  11337. }
  11338. }
  11339. // Forget the data if we're done with it
  11340. if ( !options.memory ) {
  11341. memory = false;
  11342. }
  11343. firing = false;
  11344. // Clean up if we're done firing for good
  11345. if ( locked ) {
  11346. // Keep an empty list if we have data for future add calls
  11347. if ( memory ) {
  11348. list = [];
  11349. // Otherwise, this object is spent
  11350. } else {
  11351. list = "";
  11352. }
  11353. }
  11354. },
  11355. // Actual Callbacks object
  11356. self = {
  11357. // Add a callback or a collection of callbacks to the list
  11358. add: function() {
  11359. if ( list ) {
  11360. // If we have memory from a past run, we should fire after adding
  11361. if ( memory && !firing ) {
  11362. firingIndex = list.length - 1;
  11363. queue.push( memory );
  11364. }
  11365. ( function add( args ) {
  11366. jQuery.each( args, function( _, arg ) {
  11367. if ( isFunction( arg ) ) {
  11368. if ( !options.unique || !self.has( arg ) ) {
  11369. list.push( arg );
  11370. }
  11371. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11372. // Inspect recursively
  11373. add( arg );
  11374. }
  11375. } );
  11376. } )( arguments );
  11377. if ( memory && !firing ) {
  11378. fire();
  11379. }
  11380. }
  11381. return this;
  11382. },
  11383. // Remove a callback from the list
  11384. remove: function() {
  11385. jQuery.each( arguments, function( _, arg ) {
  11386. var index;
  11387. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11388. list.splice( index, 1 );
  11389. // Handle firing indexes
  11390. if ( index <= firingIndex ) {
  11391. firingIndex--;
  11392. }
  11393. }
  11394. } );
  11395. return this;
  11396. },
  11397. // Check if a given callback is in the list.
  11398. // If no argument is given, return whether or not list has callbacks attached.
  11399. has: function( fn ) {
  11400. return fn ?
  11401. jQuery.inArray( fn, list ) > -1 :
  11402. list.length > 0;
  11403. },
  11404. // Remove all callbacks from the list
  11405. empty: function() {
  11406. if ( list ) {
  11407. list = [];
  11408. }
  11409. return this;
  11410. },
  11411. // Disable .fire and .add
  11412. // Abort any current/pending executions
  11413. // Clear all callbacks and values
  11414. disable: function() {
  11415. locked = queue = [];
  11416. list = memory = "";
  11417. return this;
  11418. },
  11419. disabled: function() {
  11420. return !list;
  11421. },
  11422. // Disable .fire
  11423. // Also disable .add unless we have memory (since it would have no effect)
  11424. // Abort any pending executions
  11425. lock: function() {
  11426. locked = queue = [];
  11427. if ( !memory && !firing ) {
  11428. list = memory = "";
  11429. }
  11430. return this;
  11431. },
  11432. locked: function() {
  11433. return !!locked;
  11434. },
  11435. // Call all callbacks with the given context and arguments
  11436. fireWith: function( context, args ) {
  11437. if ( !locked ) {
  11438. args = args || [];
  11439. args = [ context, args.slice ? args.slice() : args ];
  11440. queue.push( args );
  11441. if ( !firing ) {
  11442. fire();
  11443. }
  11444. }
  11445. return this;
  11446. },
  11447. // Call all the callbacks with the given arguments
  11448. fire: function() {
  11449. self.fireWith( this, arguments );
  11450. return this;
  11451. },
  11452. // To know if the callbacks have already been called at least once
  11453. fired: function() {
  11454. return !!fired;
  11455. }
  11456. };
  11457. return self;
  11458. };
  11459. function Identity( v ) {
  11460. return v;
  11461. }
  11462. function Thrower( ex ) {
  11463. throw ex;
  11464. }
  11465. function adoptValue( value, resolve, reject, noValue ) {
  11466. var method;
  11467. try {
  11468. // Check for promise aspect first to privilege synchronous behavior
  11469. if ( value && isFunction( ( method = value.promise ) ) ) {
  11470. method.call( value ).done( resolve ).fail( reject );
  11471. // Other thenables
  11472. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11473. method.call( value, resolve, reject );
  11474. // Other non-thenables
  11475. } else {
  11476. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11477. // * false: [ value ].slice( 0 ) => resolve( value )
  11478. // * true: [ value ].slice( 1 ) => resolve()
  11479. resolve.apply( undefined, [ value ].slice( noValue ) );
  11480. }
  11481. // For Promises/A+, convert exceptions into rejections
  11482. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11483. // Deferred#then to conditionally suppress rejection.
  11484. } catch ( value ) {
  11485. // Support: Android 4.0 only
  11486. // Strict mode functions invoked without .call/.apply get global-object context
  11487. reject.apply( undefined, [ value ] );
  11488. }
  11489. }
  11490. jQuery.extend( {
  11491. Deferred: function( func ) {
  11492. var tuples = [
  11493. // action, add listener, callbacks,
  11494. // ... .then handlers, argument index, [final state]
  11495. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11496. jQuery.Callbacks( "memory" ), 2 ],
  11497. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11498. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11499. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11500. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11501. ],
  11502. state = "pending",
  11503. promise = {
  11504. state: function() {
  11505. return state;
  11506. },
  11507. always: function() {
  11508. deferred.done( arguments ).fail( arguments );
  11509. return this;
  11510. },
  11511. "catch": function( fn ) {
  11512. return promise.then( null, fn );
  11513. },
  11514. // Keep pipe for back-compat
  11515. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11516. var fns = arguments;
  11517. return jQuery.Deferred( function( newDefer ) {
  11518. jQuery.each( tuples, function( i, tuple ) {
  11519. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11520. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11521. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11522. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11523. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11524. deferred[ tuple[ 1 ] ]( function() {
  11525. var returned = fn && fn.apply( this, arguments );
  11526. if ( returned && isFunction( returned.promise ) ) {
  11527. returned.promise()
  11528. .progress( newDefer.notify )
  11529. .done( newDefer.resolve )
  11530. .fail( newDefer.reject );
  11531. } else {
  11532. newDefer[ tuple[ 0 ] + "With" ](
  11533. this,
  11534. fn ? [ returned ] : arguments
  11535. );
  11536. }
  11537. } );
  11538. } );
  11539. fns = null;
  11540. } ).promise();
  11541. },
  11542. then: function( onFulfilled, onRejected, onProgress ) {
  11543. var maxDepth = 0;
  11544. function resolve( depth, deferred, handler, special ) {
  11545. return function() {
  11546. var that = this,
  11547. args = arguments,
  11548. mightThrow = function() {
  11549. var returned, then;
  11550. // Support: Promises/A+ section 2.3.3.3.3
  11551. // https://promisesaplus.com/#point-59
  11552. // Ignore double-resolution attempts
  11553. if ( depth < maxDepth ) {
  11554. return;
  11555. }
  11556. returned = handler.apply( that, args );
  11557. // Support: Promises/A+ section 2.3.1
  11558. // https://promisesaplus.com/#point-48
  11559. if ( returned === deferred.promise() ) {
  11560. throw new TypeError( "Thenable self-resolution" );
  11561. }
  11562. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11563. // https://promisesaplus.com/#point-54
  11564. // https://promisesaplus.com/#point-75
  11565. // Retrieve `then` only once
  11566. then = returned &&
  11567. // Support: Promises/A+ section 2.3.4
  11568. // https://promisesaplus.com/#point-64
  11569. // Only check objects and functions for thenability
  11570. ( typeof returned === "object" ||
  11571. typeof returned === "function" ) &&
  11572. returned.then;
  11573. // Handle a returned thenable
  11574. if ( isFunction( then ) ) {
  11575. // Special processors (notify) just wait for resolution
  11576. if ( special ) {
  11577. then.call(
  11578. returned,
  11579. resolve( maxDepth, deferred, Identity, special ),
  11580. resolve( maxDepth, deferred, Thrower, special )
  11581. );
  11582. // Normal processors (resolve) also hook into progress
  11583. } else {
  11584. // ...and disregard older resolution values
  11585. maxDepth++;
  11586. then.call(
  11587. returned,
  11588. resolve( maxDepth, deferred, Identity, special ),
  11589. resolve( maxDepth, deferred, Thrower, special ),
  11590. resolve( maxDepth, deferred, Identity,
  11591. deferred.notifyWith )
  11592. );
  11593. }
  11594. // Handle all other returned values
  11595. } else {
  11596. // Only substitute handlers pass on context
  11597. // and multiple values (non-spec behavior)
  11598. if ( handler !== Identity ) {
  11599. that = undefined;
  11600. args = [ returned ];
  11601. }
  11602. // Process the value(s)
  11603. // Default process is resolve
  11604. ( special || deferred.resolveWith )( that, args );
  11605. }
  11606. },
  11607. // Only normal processors (resolve) catch and reject exceptions
  11608. process = special ?
  11609. mightThrow :
  11610. function() {
  11611. try {
  11612. mightThrow();
  11613. } catch ( e ) {
  11614. if ( jQuery.Deferred.exceptionHook ) {
  11615. jQuery.Deferred.exceptionHook( e,
  11616. process.stackTrace );
  11617. }
  11618. // Support: Promises/A+ section 2.3.3.3.4.1
  11619. // https://promisesaplus.com/#point-61
  11620. // Ignore post-resolution exceptions
  11621. if ( depth + 1 >= maxDepth ) {
  11622. // Only substitute handlers pass on context
  11623. // and multiple values (non-spec behavior)
  11624. if ( handler !== Thrower ) {
  11625. that = undefined;
  11626. args = [ e ];
  11627. }
  11628. deferred.rejectWith( that, args );
  11629. }
  11630. }
  11631. };
  11632. // Support: Promises/A+ section 2.3.3.3.1
  11633. // https://promisesaplus.com/#point-57
  11634. // Re-resolve promises immediately to dodge false rejection from
  11635. // subsequent errors
  11636. if ( depth ) {
  11637. process();
  11638. } else {
  11639. // Call an optional hook to record the stack, in case of exception
  11640. // since it's otherwise lost when execution goes async
  11641. if ( jQuery.Deferred.getStackHook ) {
  11642. process.stackTrace = jQuery.Deferred.getStackHook();
  11643. }
  11644. window.setTimeout( process );
  11645. }
  11646. };
  11647. }
  11648. return jQuery.Deferred( function( newDefer ) {
  11649. // progress_handlers.add( ... )
  11650. tuples[ 0 ][ 3 ].add(
  11651. resolve(
  11652. 0,
  11653. newDefer,
  11654. isFunction( onProgress ) ?
  11655. onProgress :
  11656. Identity,
  11657. newDefer.notifyWith
  11658. )
  11659. );
  11660. // fulfilled_handlers.add( ... )
  11661. tuples[ 1 ][ 3 ].add(
  11662. resolve(
  11663. 0,
  11664. newDefer,
  11665. isFunction( onFulfilled ) ?
  11666. onFulfilled :
  11667. Identity
  11668. )
  11669. );
  11670. // rejected_handlers.add( ... )
  11671. tuples[ 2 ][ 3 ].add(
  11672. resolve(
  11673. 0,
  11674. newDefer,
  11675. isFunction( onRejected ) ?
  11676. onRejected :
  11677. Thrower
  11678. )
  11679. );
  11680. } ).promise();
  11681. },
  11682. // Get a promise for this deferred
  11683. // If obj is provided, the promise aspect is added to the object
  11684. promise: function( obj ) {
  11685. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11686. }
  11687. },
  11688. deferred = {};
  11689. // Add list-specific methods
  11690. jQuery.each( tuples, function( i, tuple ) {
  11691. var list = tuple[ 2 ],
  11692. stateString = tuple[ 5 ];
  11693. // promise.progress = list.add
  11694. // promise.done = list.add
  11695. // promise.fail = list.add
  11696. promise[ tuple[ 1 ] ] = list.add;
  11697. // Handle state
  11698. if ( stateString ) {
  11699. list.add(
  11700. function() {
  11701. // state = "resolved" (i.e., fulfilled)
  11702. // state = "rejected"
  11703. state = stateString;
  11704. },
  11705. // rejected_callbacks.disable
  11706. // fulfilled_callbacks.disable
  11707. tuples[ 3 - i ][ 2 ].disable,
  11708. // rejected_handlers.disable
  11709. // fulfilled_handlers.disable
  11710. tuples[ 3 - i ][ 3 ].disable,
  11711. // progress_callbacks.lock
  11712. tuples[ 0 ][ 2 ].lock,
  11713. // progress_handlers.lock
  11714. tuples[ 0 ][ 3 ].lock
  11715. );
  11716. }
  11717. // progress_handlers.fire
  11718. // fulfilled_handlers.fire
  11719. // rejected_handlers.fire
  11720. list.add( tuple[ 3 ].fire );
  11721. // deferred.notify = function() { deferred.notifyWith(...) }
  11722. // deferred.resolve = function() { deferred.resolveWith(...) }
  11723. // deferred.reject = function() { deferred.rejectWith(...) }
  11724. deferred[ tuple[ 0 ] ] = function() {
  11725. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11726. return this;
  11727. };
  11728. // deferred.notifyWith = list.fireWith
  11729. // deferred.resolveWith = list.fireWith
  11730. // deferred.rejectWith = list.fireWith
  11731. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11732. } );
  11733. // Make the deferred a promise
  11734. promise.promise( deferred );
  11735. // Call given func if any
  11736. if ( func ) {
  11737. func.call( deferred, deferred );
  11738. }
  11739. // All done!
  11740. return deferred;
  11741. },
  11742. // Deferred helper
  11743. when: function( singleValue ) {
  11744. var
  11745. // count of uncompleted subordinates
  11746. remaining = arguments.length,
  11747. // count of unprocessed arguments
  11748. i = remaining,
  11749. // subordinate fulfillment data
  11750. resolveContexts = Array( i ),
  11751. resolveValues = slice.call( arguments ),
  11752. // the master Deferred
  11753. master = jQuery.Deferred(),
  11754. // subordinate callback factory
  11755. updateFunc = function( i ) {
  11756. return function( value ) {
  11757. resolveContexts[ i ] = this;
  11758. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11759. if ( !( --remaining ) ) {
  11760. master.resolveWith( resolveContexts, resolveValues );
  11761. }
  11762. };
  11763. };
  11764. // Single- and empty arguments are adopted like Promise.resolve
  11765. if ( remaining <= 1 ) {
  11766. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11767. !remaining );
  11768. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11769. if ( master.state() === "pending" ||
  11770. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11771. return master.then();
  11772. }
  11773. }
  11774. // Multiple arguments are aggregated like Promise.all array elements
  11775. while ( i-- ) {
  11776. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11777. }
  11778. return master.promise();
  11779. }
  11780. } );
  11781. // These usually indicate a programmer mistake during development,
  11782. // warn about them ASAP rather than swallowing them by default.
  11783. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11784. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11785. // Support: IE 8 - 9 only
  11786. // Console exists when dev tools are open, which can happen at any time
  11787. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11788. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11789. }
  11790. };
  11791. jQuery.readyException = function( error ) {
  11792. window.setTimeout( function() {
  11793. throw error;
  11794. } );
  11795. };
  11796. // The deferred used on DOM ready
  11797. var readyList = jQuery.Deferred();
  11798. jQuery.fn.ready = function( fn ) {
  11799. readyList
  11800. .then( fn )
  11801. // Wrap jQuery.readyException in a function so that the lookup
  11802. // happens at the time of error handling instead of callback
  11803. // registration.
  11804. .catch( function( error ) {
  11805. jQuery.readyException( error );
  11806. } );
  11807. return this;
  11808. };
  11809. jQuery.extend( {
  11810. // Is the DOM ready to be used? Set to true once it occurs.
  11811. isReady: false,
  11812. // A counter to track how many items to wait for before
  11813. // the ready event fires. See #6781
  11814. readyWait: 1,
  11815. // Handle when the DOM is ready
  11816. ready: function( wait ) {
  11817. // Abort if there are pending holds or we're already ready
  11818. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11819. return;
  11820. }
  11821. // Remember that the DOM is ready
  11822. jQuery.isReady = true;
  11823. // If a normal DOM Ready event fired, decrement, and wait if need be
  11824. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11825. return;
  11826. }
  11827. // If there are functions bound, to execute
  11828. readyList.resolveWith( document, [ jQuery ] );
  11829. }
  11830. } );
  11831. jQuery.ready.then = readyList.then;
  11832. // The ready event handler and self cleanup method
  11833. function completed() {
  11834. document.removeEventListener( "DOMContentLoaded", completed );
  11835. window.removeEventListener( "load", completed );
  11836. jQuery.ready();
  11837. }
  11838. // Catch cases where $(document).ready() is called
  11839. // after the browser event has already occurred.
  11840. // Support: IE <=9 - 10 only
  11841. // Older IE sometimes signals "interactive" too soon
  11842. if ( document.readyState === "complete" ||
  11843. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11844. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11845. window.setTimeout( jQuery.ready );
  11846. } else {
  11847. // Use the handy event callback
  11848. document.addEventListener( "DOMContentLoaded", completed );
  11849. // A fallback to window.onload, that will always work
  11850. window.addEventListener( "load", completed );
  11851. }
  11852. // Multifunctional method to get and set values of a collection
  11853. // The value/s can optionally be executed if it's a function
  11854. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11855. var i = 0,
  11856. len = elems.length,
  11857. bulk = key == null;
  11858. // Sets many values
  11859. if ( toType( key ) === "object" ) {
  11860. chainable = true;
  11861. for ( i in key ) {
  11862. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11863. }
  11864. // Sets one value
  11865. } else if ( value !== undefined ) {
  11866. chainable = true;
  11867. if ( !isFunction( value ) ) {
  11868. raw = true;
  11869. }
  11870. if ( bulk ) {
  11871. // Bulk operations run against the entire set
  11872. if ( raw ) {
  11873. fn.call( elems, value );
  11874. fn = null;
  11875. // ...except when executing function values
  11876. } else {
  11877. bulk = fn;
  11878. fn = function( elem, key, value ) {
  11879. return bulk.call( jQuery( elem ), value );
  11880. };
  11881. }
  11882. }
  11883. if ( fn ) {
  11884. for ( ; i < len; i++ ) {
  11885. fn(
  11886. elems[ i ], key, raw ?
  11887. value :
  11888. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11889. );
  11890. }
  11891. }
  11892. }
  11893. if ( chainable ) {
  11894. return elems;
  11895. }
  11896. // Gets
  11897. if ( bulk ) {
  11898. return fn.call( elems );
  11899. }
  11900. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11901. };
  11902. // Matches dashed string for camelizing
  11903. var rmsPrefix = /^-ms-/,
  11904. rdashAlpha = /-([a-z])/g;
  11905. // Used by camelCase as callback to replace()
  11906. function fcamelCase( all, letter ) {
  11907. return letter.toUpperCase();
  11908. }
  11909. // Convert dashed to camelCase; used by the css and data modules
  11910. // Support: IE <=9 - 11, Edge 12 - 15
  11911. // Microsoft forgot to hump their vendor prefix (#9572)
  11912. function camelCase( string ) {
  11913. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11914. }
  11915. var acceptData = function( owner ) {
  11916. // Accepts only:
  11917. // - Node
  11918. // - Node.ELEMENT_NODE
  11919. // - Node.DOCUMENT_NODE
  11920. // - Object
  11921. // - Any
  11922. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11923. };
  11924. function Data() {
  11925. this.expando = jQuery.expando + Data.uid++;
  11926. }
  11927. Data.uid = 1;
  11928. Data.prototype = {
  11929. cache: function( owner ) {
  11930. // Check if the owner object already has a cache
  11931. var value = owner[ this.expando ];
  11932. // If not, create one
  11933. if ( !value ) {
  11934. value = {};
  11935. // We can accept data for non-element nodes in modern browsers,
  11936. // but we should not, see #8335.
  11937. // Always return an empty object.
  11938. if ( acceptData( owner ) ) {
  11939. // If it is a node unlikely to be stringify-ed or looped over
  11940. // use plain assignment
  11941. if ( owner.nodeType ) {
  11942. owner[ this.expando ] = value;
  11943. // Otherwise secure it in a non-enumerable property
  11944. // configurable must be true to allow the property to be
  11945. // deleted when data is removed
  11946. } else {
  11947. Object.defineProperty( owner, this.expando, {
  11948. value: value,
  11949. configurable: true
  11950. } );
  11951. }
  11952. }
  11953. }
  11954. return value;
  11955. },
  11956. set: function( owner, data, value ) {
  11957. var prop,
  11958. cache = this.cache( owner );
  11959. // Handle: [ owner, key, value ] args
  11960. // Always use camelCase key (gh-2257)
  11961. if ( typeof data === "string" ) {
  11962. cache[ camelCase( data ) ] = value;
  11963. // Handle: [ owner, { properties } ] args
  11964. } else {
  11965. // Copy the properties one-by-one to the cache object
  11966. for ( prop in data ) {
  11967. cache[ camelCase( prop ) ] = data[ prop ];
  11968. }
  11969. }
  11970. return cache;
  11971. },
  11972. get: function( owner, key ) {
  11973. return key === undefined ?
  11974. this.cache( owner ) :
  11975. // Always use camelCase key (gh-2257)
  11976. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11977. },
  11978. access: function( owner, key, value ) {
  11979. // In cases where either:
  11980. //
  11981. // 1. No key was specified
  11982. // 2. A string key was specified, but no value provided
  11983. //
  11984. // Take the "read" path and allow the get method to determine
  11985. // which value to return, respectively either:
  11986. //
  11987. // 1. The entire cache object
  11988. // 2. The data stored at the key
  11989. //
  11990. if ( key === undefined ||
  11991. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11992. return this.get( owner, key );
  11993. }
  11994. // When the key is not a string, or both a key and value
  11995. // are specified, set or extend (existing objects) with either:
  11996. //
  11997. // 1. An object of properties
  11998. // 2. A key and value
  11999. //
  12000. this.set( owner, key, value );
  12001. // Since the "set" path can have two possible entry points
  12002. // return the expected data based on which path was taken[*]
  12003. return value !== undefined ? value : key;
  12004. },
  12005. remove: function( owner, key ) {
  12006. var i,
  12007. cache = owner[ this.expando ];
  12008. if ( cache === undefined ) {
  12009. return;
  12010. }
  12011. if ( key !== undefined ) {
  12012. // Support array or space separated string of keys
  12013. if ( Array.isArray( key ) ) {
  12014. // If key is an array of keys...
  12015. // We always set camelCase keys, so remove that.
  12016. key = key.map( camelCase );
  12017. } else {
  12018. key = camelCase( key );
  12019. // If a key with the spaces exists, use it.
  12020. // Otherwise, create an array by matching non-whitespace
  12021. key = key in cache ?
  12022. [ key ] :
  12023. ( key.match( rnothtmlwhite ) || [] );
  12024. }
  12025. i = key.length;
  12026. while ( i-- ) {
  12027. delete cache[ key[ i ] ];
  12028. }
  12029. }
  12030. // Remove the expando if there's no more data
  12031. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12032. // Support: Chrome <=35 - 45
  12033. // Webkit & Blink performance suffers when deleting properties
  12034. // from DOM nodes, so set to undefined instead
  12035. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12036. if ( owner.nodeType ) {
  12037. owner[ this.expando ] = undefined;
  12038. } else {
  12039. delete owner[ this.expando ];
  12040. }
  12041. }
  12042. },
  12043. hasData: function( owner ) {
  12044. var cache = owner[ this.expando ];
  12045. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12046. }
  12047. };
  12048. var dataPriv = new Data();
  12049. var dataUser = new Data();
  12050. // Implementation Summary
  12051. //
  12052. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12053. // 2. Improve the module's maintainability by reducing the storage
  12054. // paths to a single mechanism.
  12055. // 3. Use the same single mechanism to support "private" and "user" data.
  12056. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12057. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12058. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12059. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12060. rmultiDash = /[A-Z]/g;
  12061. function getData( data ) {
  12062. if ( data === "true" ) {
  12063. return true;
  12064. }
  12065. if ( data === "false" ) {
  12066. return false;
  12067. }
  12068. if ( data === "null" ) {
  12069. return null;
  12070. }
  12071. // Only convert to a number if it doesn't change the string
  12072. if ( data === +data + "" ) {
  12073. return +data;
  12074. }
  12075. if ( rbrace.test( data ) ) {
  12076. return JSON.parse( data );
  12077. }
  12078. return data;
  12079. }
  12080. function dataAttr( elem, key, data ) {
  12081. var name;
  12082. // If nothing was found internally, try to fetch any
  12083. // data from the HTML5 data-* attribute
  12084. if ( data === undefined && elem.nodeType === 1 ) {
  12085. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12086. data = elem.getAttribute( name );
  12087. if ( typeof data === "string" ) {
  12088. try {
  12089. data = getData( data );
  12090. } catch ( e ) {}
  12091. // Make sure we set the data so it isn't changed later
  12092. dataUser.set( elem, key, data );
  12093. } else {
  12094. data = undefined;
  12095. }
  12096. }
  12097. return data;
  12098. }
  12099. jQuery.extend( {
  12100. hasData: function( elem ) {
  12101. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12102. },
  12103. data: function( elem, name, data ) {
  12104. return dataUser.access( elem, name, data );
  12105. },
  12106. removeData: function( elem, name ) {
  12107. dataUser.remove( elem, name );
  12108. },
  12109. // TODO: Now that all calls to _data and _removeData have been replaced
  12110. // with direct calls to dataPriv methods, these can be deprecated.
  12111. _data: function( elem, name, data ) {
  12112. return dataPriv.access( elem, name, data );
  12113. },
  12114. _removeData: function( elem, name ) {
  12115. dataPriv.remove( elem, name );
  12116. }
  12117. } );
  12118. jQuery.fn.extend( {
  12119. data: function( key, value ) {
  12120. var i, name, data,
  12121. elem = this[ 0 ],
  12122. attrs = elem && elem.attributes;
  12123. // Gets all values
  12124. if ( key === undefined ) {
  12125. if ( this.length ) {
  12126. data = dataUser.get( elem );
  12127. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12128. i = attrs.length;
  12129. while ( i-- ) {
  12130. // Support: IE 11 only
  12131. // The attrs elements can be null (#14894)
  12132. if ( attrs[ i ] ) {
  12133. name = attrs[ i ].name;
  12134. if ( name.indexOf( "data-" ) === 0 ) {
  12135. name = camelCase( name.slice( 5 ) );
  12136. dataAttr( elem, name, data[ name ] );
  12137. }
  12138. }
  12139. }
  12140. dataPriv.set( elem, "hasDataAttrs", true );
  12141. }
  12142. }
  12143. return data;
  12144. }
  12145. // Sets multiple values
  12146. if ( typeof key === "object" ) {
  12147. return this.each( function() {
  12148. dataUser.set( this, key );
  12149. } );
  12150. }
  12151. return access( this, function( value ) {
  12152. var data;
  12153. // The calling jQuery object (element matches) is not empty
  12154. // (and therefore has an element appears at this[ 0 ]) and the
  12155. // `value` parameter was not undefined. An empty jQuery object
  12156. // will result in `undefined` for elem = this[ 0 ] which will
  12157. // throw an exception if an attempt to read a data cache is made.
  12158. if ( elem && value === undefined ) {
  12159. // Attempt to get data from the cache
  12160. // The key will always be camelCased in Data
  12161. data = dataUser.get( elem, key );
  12162. if ( data !== undefined ) {
  12163. return data;
  12164. }
  12165. // Attempt to "discover" the data in
  12166. // HTML5 custom data-* attrs
  12167. data = dataAttr( elem, key );
  12168. if ( data !== undefined ) {
  12169. return data;
  12170. }
  12171. // We tried really hard, but the data doesn't exist.
  12172. return;
  12173. }
  12174. // Set the data...
  12175. this.each( function() {
  12176. // We always store the camelCased key
  12177. dataUser.set( this, key, value );
  12178. } );
  12179. }, null, value, arguments.length > 1, null, true );
  12180. },
  12181. removeData: function( key ) {
  12182. return this.each( function() {
  12183. dataUser.remove( this, key );
  12184. } );
  12185. }
  12186. } );
  12187. jQuery.extend( {
  12188. queue: function( elem, type, data ) {
  12189. var queue;
  12190. if ( elem ) {
  12191. type = ( type || "fx" ) + "queue";
  12192. queue = dataPriv.get( elem, type );
  12193. // Speed up dequeue by getting out quickly if this is just a lookup
  12194. if ( data ) {
  12195. if ( !queue || Array.isArray( data ) ) {
  12196. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12197. } else {
  12198. queue.push( data );
  12199. }
  12200. }
  12201. return queue || [];
  12202. }
  12203. },
  12204. dequeue: function( elem, type ) {
  12205. type = type || "fx";
  12206. var queue = jQuery.queue( elem, type ),
  12207. startLength = queue.length,
  12208. fn = queue.shift(),
  12209. hooks = jQuery._queueHooks( elem, type ),
  12210. next = function() {
  12211. jQuery.dequeue( elem, type );
  12212. };
  12213. // If the fx queue is dequeued, always remove the progress sentinel
  12214. if ( fn === "inprogress" ) {
  12215. fn = queue.shift();
  12216. startLength--;
  12217. }
  12218. if ( fn ) {
  12219. // Add a progress sentinel to prevent the fx queue from being
  12220. // automatically dequeued
  12221. if ( type === "fx" ) {
  12222. queue.unshift( "inprogress" );
  12223. }
  12224. // Clear up the last queue stop function
  12225. delete hooks.stop;
  12226. fn.call( elem, next, hooks );
  12227. }
  12228. if ( !startLength && hooks ) {
  12229. hooks.empty.fire();
  12230. }
  12231. },
  12232. // Not public - generate a queueHooks object, or return the current one
  12233. _queueHooks: function( elem, type ) {
  12234. var key = type + "queueHooks";
  12235. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12236. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12237. dataPriv.remove( elem, [ type + "queue", key ] );
  12238. } )
  12239. } );
  12240. }
  12241. } );
  12242. jQuery.fn.extend( {
  12243. queue: function( type, data ) {
  12244. var setter = 2;
  12245. if ( typeof type !== "string" ) {
  12246. data = type;
  12247. type = "fx";
  12248. setter--;
  12249. }
  12250. if ( arguments.length < setter ) {
  12251. return jQuery.queue( this[ 0 ], type );
  12252. }
  12253. return data === undefined ?
  12254. this :
  12255. this.each( function() {
  12256. var queue = jQuery.queue( this, type, data );
  12257. // Ensure a hooks for this queue
  12258. jQuery._queueHooks( this, type );
  12259. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12260. jQuery.dequeue( this, type );
  12261. }
  12262. } );
  12263. },
  12264. dequeue: function( type ) {
  12265. return this.each( function() {
  12266. jQuery.dequeue( this, type );
  12267. } );
  12268. },
  12269. clearQueue: function( type ) {
  12270. return this.queue( type || "fx", [] );
  12271. },
  12272. // Get a promise resolved when queues of a certain type
  12273. // are emptied (fx is the type by default)
  12274. promise: function( type, obj ) {
  12275. var tmp,
  12276. count = 1,
  12277. defer = jQuery.Deferred(),
  12278. elements = this,
  12279. i = this.length,
  12280. resolve = function() {
  12281. if ( !( --count ) ) {
  12282. defer.resolveWith( elements, [ elements ] );
  12283. }
  12284. };
  12285. if ( typeof type !== "string" ) {
  12286. obj = type;
  12287. type = undefined;
  12288. }
  12289. type = type || "fx";
  12290. while ( i-- ) {
  12291. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12292. if ( tmp && tmp.empty ) {
  12293. count++;
  12294. tmp.empty.add( resolve );
  12295. }
  12296. }
  12297. resolve();
  12298. return defer.promise( obj );
  12299. }
  12300. } );
  12301. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12302. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12303. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12304. var documentElement = document.documentElement;
  12305. var isAttached = function( elem ) {
  12306. return jQuery.contains( elem.ownerDocument, elem );
  12307. },
  12308. composed = { composed: true };
  12309. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12310. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12311. // Support: iOS 10.0-10.2 only
  12312. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12313. // leading to errors. We need to check for `getRootNode`.
  12314. if ( documentElement.getRootNode ) {
  12315. isAttached = function( elem ) {
  12316. return jQuery.contains( elem.ownerDocument, elem ) ||
  12317. elem.getRootNode( composed ) === elem.ownerDocument;
  12318. };
  12319. }
  12320. var isHiddenWithinTree = function( elem, el ) {
  12321. // isHiddenWithinTree might be called from jQuery#filter function;
  12322. // in that case, element will be second argument
  12323. elem = el || elem;
  12324. // Inline style trumps all
  12325. return elem.style.display === "none" ||
  12326. elem.style.display === "" &&
  12327. // Otherwise, check computed style
  12328. // Support: Firefox <=43 - 45
  12329. // Disconnected elements can have computed display: none, so first confirm that elem is
  12330. // in the document.
  12331. isAttached( elem ) &&
  12332. jQuery.css( elem, "display" ) === "none";
  12333. };
  12334. var swap = function( elem, options, callback, args ) {
  12335. var ret, name,
  12336. old = {};
  12337. // Remember the old values, and insert the new ones
  12338. for ( name in options ) {
  12339. old[ name ] = elem.style[ name ];
  12340. elem.style[ name ] = options[ name ];
  12341. }
  12342. ret = callback.apply( elem, args || [] );
  12343. // Revert the old values
  12344. for ( name in options ) {
  12345. elem.style[ name ] = old[ name ];
  12346. }
  12347. return ret;
  12348. };
  12349. function adjustCSS( elem, prop, valueParts, tween ) {
  12350. var adjusted, scale,
  12351. maxIterations = 20,
  12352. currentValue = tween ?
  12353. function() {
  12354. return tween.cur();
  12355. } :
  12356. function() {
  12357. return jQuery.css( elem, prop, "" );
  12358. },
  12359. initial = currentValue(),
  12360. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12361. // Starting value computation is required for potential unit mismatches
  12362. initialInUnit = elem.nodeType &&
  12363. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12364. rcssNum.exec( jQuery.css( elem, prop ) );
  12365. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12366. // Support: Firefox <=54
  12367. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12368. initial = initial / 2;
  12369. // Trust units reported by jQuery.css
  12370. unit = unit || initialInUnit[ 3 ];
  12371. // Iteratively approximate from a nonzero starting point
  12372. initialInUnit = +initial || 1;
  12373. while ( maxIterations-- ) {
  12374. // Evaluate and update our best guess (doubling guesses that zero out).
  12375. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12376. jQuery.style( elem, prop, initialInUnit + unit );
  12377. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12378. maxIterations = 0;
  12379. }
  12380. initialInUnit = initialInUnit / scale;
  12381. }
  12382. initialInUnit = initialInUnit * 2;
  12383. jQuery.style( elem, prop, initialInUnit + unit );
  12384. // Make sure we update the tween properties later on
  12385. valueParts = valueParts || [];
  12386. }
  12387. if ( valueParts ) {
  12388. initialInUnit = +initialInUnit || +initial || 0;
  12389. // Apply relative offset (+=/-=) if specified
  12390. adjusted = valueParts[ 1 ] ?
  12391. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12392. +valueParts[ 2 ];
  12393. if ( tween ) {
  12394. tween.unit = unit;
  12395. tween.start = initialInUnit;
  12396. tween.end = adjusted;
  12397. }
  12398. }
  12399. return adjusted;
  12400. }
  12401. var defaultDisplayMap = {};
  12402. function getDefaultDisplay( elem ) {
  12403. var temp,
  12404. doc = elem.ownerDocument,
  12405. nodeName = elem.nodeName,
  12406. display = defaultDisplayMap[ nodeName ];
  12407. if ( display ) {
  12408. return display;
  12409. }
  12410. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12411. display = jQuery.css( temp, "display" );
  12412. temp.parentNode.removeChild( temp );
  12413. if ( display === "none" ) {
  12414. display = "block";
  12415. }
  12416. defaultDisplayMap[ nodeName ] = display;
  12417. return display;
  12418. }
  12419. function showHide( elements, show ) {
  12420. var display, elem,
  12421. values = [],
  12422. index = 0,
  12423. length = elements.length;
  12424. // Determine new display value for elements that need to change
  12425. for ( ; index < length; index++ ) {
  12426. elem = elements[ index ];
  12427. if ( !elem.style ) {
  12428. continue;
  12429. }
  12430. display = elem.style.display;
  12431. if ( show ) {
  12432. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12433. // check is required in this first loop unless we have a nonempty display value (either
  12434. // inline or about-to-be-restored)
  12435. if ( display === "none" ) {
  12436. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12437. if ( !values[ index ] ) {
  12438. elem.style.display = "";
  12439. }
  12440. }
  12441. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12442. values[ index ] = getDefaultDisplay( elem );
  12443. }
  12444. } else {
  12445. if ( display !== "none" ) {
  12446. values[ index ] = "none";
  12447. // Remember what we're overwriting
  12448. dataPriv.set( elem, "display", display );
  12449. }
  12450. }
  12451. }
  12452. // Set the display of the elements in a second loop to avoid constant reflow
  12453. for ( index = 0; index < length; index++ ) {
  12454. if ( values[ index ] != null ) {
  12455. elements[ index ].style.display = values[ index ];
  12456. }
  12457. }
  12458. return elements;
  12459. }
  12460. jQuery.fn.extend( {
  12461. show: function() {
  12462. return showHide( this, true );
  12463. },
  12464. hide: function() {
  12465. return showHide( this );
  12466. },
  12467. toggle: function( state ) {
  12468. if ( typeof state === "boolean" ) {
  12469. return state ? this.show() : this.hide();
  12470. }
  12471. return this.each( function() {
  12472. if ( isHiddenWithinTree( this ) ) {
  12473. jQuery( this ).show();
  12474. } else {
  12475. jQuery( this ).hide();
  12476. }
  12477. } );
  12478. }
  12479. } );
  12480. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12481. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12482. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12483. // We have to close these tags to support XHTML (#13200)
  12484. var wrapMap = {
  12485. // Support: IE <=9 only
  12486. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12487. // XHTML parsers do not magically insert elements in the
  12488. // same way that tag soup parsers do. So we cannot shorten
  12489. // this by omitting <tbody> or other required elements.
  12490. thead: [ 1, "<table>", "</table>" ],
  12491. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12492. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12493. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12494. _default: [ 0, "", "" ]
  12495. };
  12496. // Support: IE <=9 only
  12497. wrapMap.optgroup = wrapMap.option;
  12498. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12499. wrapMap.th = wrapMap.td;
  12500. function getAll( context, tag ) {
  12501. // Support: IE <=9 - 11 only
  12502. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12503. var ret;
  12504. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12505. ret = context.getElementsByTagName( tag || "*" );
  12506. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12507. ret = context.querySelectorAll( tag || "*" );
  12508. } else {
  12509. ret = [];
  12510. }
  12511. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12512. return jQuery.merge( [ context ], ret );
  12513. }
  12514. return ret;
  12515. }
  12516. // Mark scripts as having already been evaluated
  12517. function setGlobalEval( elems, refElements ) {
  12518. var i = 0,
  12519. l = elems.length;
  12520. for ( ; i < l; i++ ) {
  12521. dataPriv.set(
  12522. elems[ i ],
  12523. "globalEval",
  12524. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12525. );
  12526. }
  12527. }
  12528. var rhtml = /<|&#?\w+;/;
  12529. function buildFragment( elems, context, scripts, selection, ignored ) {
  12530. var elem, tmp, tag, wrap, attached, j,
  12531. fragment = context.createDocumentFragment(),
  12532. nodes = [],
  12533. i = 0,
  12534. l = elems.length;
  12535. for ( ; i < l; i++ ) {
  12536. elem = elems[ i ];
  12537. if ( elem || elem === 0 ) {
  12538. // Add nodes directly
  12539. if ( toType( elem ) === "object" ) {
  12540. // Support: Android <=4.0 only, PhantomJS 1 only
  12541. // push.apply(_, arraylike) throws on ancient WebKit
  12542. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12543. // Convert non-html into a text node
  12544. } else if ( !rhtml.test( elem ) ) {
  12545. nodes.push( context.createTextNode( elem ) );
  12546. // Convert html into DOM nodes
  12547. } else {
  12548. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12549. // Deserialize a standard representation
  12550. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12551. wrap = wrapMap[ tag ] || wrapMap._default;
  12552. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12553. // Descend through wrappers to the right content
  12554. j = wrap[ 0 ];
  12555. while ( j-- ) {
  12556. tmp = tmp.lastChild;
  12557. }
  12558. // Support: Android <=4.0 only, PhantomJS 1 only
  12559. // push.apply(_, arraylike) throws on ancient WebKit
  12560. jQuery.merge( nodes, tmp.childNodes );
  12561. // Remember the top-level container
  12562. tmp = fragment.firstChild;
  12563. // Ensure the created nodes are orphaned (#12392)
  12564. tmp.textContent = "";
  12565. }
  12566. }
  12567. }
  12568. // Remove wrapper from fragment
  12569. fragment.textContent = "";
  12570. i = 0;
  12571. while ( ( elem = nodes[ i++ ] ) ) {
  12572. // Skip elements already in the context collection (trac-4087)
  12573. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12574. if ( ignored ) {
  12575. ignored.push( elem );
  12576. }
  12577. continue;
  12578. }
  12579. attached = isAttached( elem );
  12580. // Append to fragment
  12581. tmp = getAll( fragment.appendChild( elem ), "script" );
  12582. // Preserve script evaluation history
  12583. if ( attached ) {
  12584. setGlobalEval( tmp );
  12585. }
  12586. // Capture executables
  12587. if ( scripts ) {
  12588. j = 0;
  12589. while ( ( elem = tmp[ j++ ] ) ) {
  12590. if ( rscriptType.test( elem.type || "" ) ) {
  12591. scripts.push( elem );
  12592. }
  12593. }
  12594. }
  12595. }
  12596. return fragment;
  12597. }
  12598. ( function() {
  12599. var fragment = document.createDocumentFragment(),
  12600. div = fragment.appendChild( document.createElement( "div" ) ),
  12601. input = document.createElement( "input" );
  12602. // Support: Android 4.0 - 4.3 only
  12603. // Check state lost if the name is set (#11217)
  12604. // Support: Windows Web Apps (WWA)
  12605. // `name` and `type` must use .setAttribute for WWA (#14901)
  12606. input.setAttribute( "type", "radio" );
  12607. input.setAttribute( "checked", "checked" );
  12608. input.setAttribute( "name", "t" );
  12609. div.appendChild( input );
  12610. // Support: Android <=4.1 only
  12611. // Older WebKit doesn't clone checked state correctly in fragments
  12612. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12613. // Support: IE <=11 only
  12614. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12615. div.innerHTML = "<textarea>x</textarea>";
  12616. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12617. } )();
  12618. var
  12619. rkeyEvent = /^key/,
  12620. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12621. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12622. function returnTrue() {
  12623. return true;
  12624. }
  12625. function returnFalse() {
  12626. return false;
  12627. }
  12628. // Support: IE <=9 - 11+
  12629. // focus() and blur() are asynchronous, except when they are no-op.
  12630. // So expect focus to be synchronous when the element is already active,
  12631. // and blur to be synchronous when the element is not already active.
  12632. // (focus and blur are always synchronous in other supported browsers,
  12633. // this just defines when we can count on it).
  12634. function expectSync( elem, type ) {
  12635. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12636. }
  12637. // Support: IE <=9 only
  12638. // Accessing document.activeElement can throw unexpectedly
  12639. // https://bugs.jquery.com/ticket/13393
  12640. function safeActiveElement() {
  12641. try {
  12642. return document.activeElement;
  12643. } catch ( err ) { }
  12644. }
  12645. function on( elem, types, selector, data, fn, one ) {
  12646. var origFn, type;
  12647. // Types can be a map of types/handlers
  12648. if ( typeof types === "object" ) {
  12649. // ( types-Object, selector, data )
  12650. if ( typeof selector !== "string" ) {
  12651. // ( types-Object, data )
  12652. data = data || selector;
  12653. selector = undefined;
  12654. }
  12655. for ( type in types ) {
  12656. on( elem, type, selector, data, types[ type ], one );
  12657. }
  12658. return elem;
  12659. }
  12660. if ( data == null && fn == null ) {
  12661. // ( types, fn )
  12662. fn = selector;
  12663. data = selector = undefined;
  12664. } else if ( fn == null ) {
  12665. if ( typeof selector === "string" ) {
  12666. // ( types, selector, fn )
  12667. fn = data;
  12668. data = undefined;
  12669. } else {
  12670. // ( types, data, fn )
  12671. fn = data;
  12672. data = selector;
  12673. selector = undefined;
  12674. }
  12675. }
  12676. if ( fn === false ) {
  12677. fn = returnFalse;
  12678. } else if ( !fn ) {
  12679. return elem;
  12680. }
  12681. if ( one === 1 ) {
  12682. origFn = fn;
  12683. fn = function( event ) {
  12684. // Can use an empty set, since event contains the info
  12685. jQuery().off( event );
  12686. return origFn.apply( this, arguments );
  12687. };
  12688. // Use same guid so caller can remove using origFn
  12689. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12690. }
  12691. return elem.each( function() {
  12692. jQuery.event.add( this, types, fn, data, selector );
  12693. } );
  12694. }
  12695. /*
  12696. * Helper functions for managing events -- not part of the public interface.
  12697. * Props to Dean Edwards' addEvent library for many of the ideas.
  12698. */
  12699. jQuery.event = {
  12700. global: {},
  12701. add: function( elem, types, handler, data, selector ) {
  12702. var handleObjIn, eventHandle, tmp,
  12703. events, t, handleObj,
  12704. special, handlers, type, namespaces, origType,
  12705. elemData = dataPriv.get( elem );
  12706. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12707. if ( !elemData ) {
  12708. return;
  12709. }
  12710. // Caller can pass in an object of custom data in lieu of the handler
  12711. if ( handler.handler ) {
  12712. handleObjIn = handler;
  12713. handler = handleObjIn.handler;
  12714. selector = handleObjIn.selector;
  12715. }
  12716. // Ensure that invalid selectors throw exceptions at attach time
  12717. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12718. if ( selector ) {
  12719. jQuery.find.matchesSelector( documentElement, selector );
  12720. }
  12721. // Make sure that the handler has a unique ID, used to find/remove it later
  12722. if ( !handler.guid ) {
  12723. handler.guid = jQuery.guid++;
  12724. }
  12725. // Init the element's event structure and main handler, if this is the first
  12726. if ( !( events = elemData.events ) ) {
  12727. events = elemData.events = {};
  12728. }
  12729. if ( !( eventHandle = elemData.handle ) ) {
  12730. eventHandle = elemData.handle = function( e ) {
  12731. // Discard the second event of a jQuery.event.trigger() and
  12732. // when an event is called after a page has unloaded
  12733. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12734. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12735. };
  12736. }
  12737. // Handle multiple events separated by a space
  12738. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12739. t = types.length;
  12740. while ( t-- ) {
  12741. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12742. type = origType = tmp[ 1 ];
  12743. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12744. // There *must* be a type, no attaching namespace-only handlers
  12745. if ( !type ) {
  12746. continue;
  12747. }
  12748. // If event changes its type, use the special event handlers for the changed type
  12749. special = jQuery.event.special[ type ] || {};
  12750. // If selector defined, determine special event api type, otherwise given type
  12751. type = ( selector ? special.delegateType : special.bindType ) || type;
  12752. // Update special based on newly reset type
  12753. special = jQuery.event.special[ type ] || {};
  12754. // handleObj is passed to all event handlers
  12755. handleObj = jQuery.extend( {
  12756. type: type,
  12757. origType: origType,
  12758. data: data,
  12759. handler: handler,
  12760. guid: handler.guid,
  12761. selector: selector,
  12762. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12763. namespace: namespaces.join( "." )
  12764. }, handleObjIn );
  12765. // Init the event handler queue if we're the first
  12766. if ( !( handlers = events[ type ] ) ) {
  12767. handlers = events[ type ] = [];
  12768. handlers.delegateCount = 0;
  12769. // Only use addEventListener if the special events handler returns false
  12770. if ( !special.setup ||
  12771. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12772. if ( elem.addEventListener ) {
  12773. elem.addEventListener( type, eventHandle );
  12774. }
  12775. }
  12776. }
  12777. if ( special.add ) {
  12778. special.add.call( elem, handleObj );
  12779. if ( !handleObj.handler.guid ) {
  12780. handleObj.handler.guid = handler.guid;
  12781. }
  12782. }
  12783. // Add to the element's handler list, delegates in front
  12784. if ( selector ) {
  12785. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12786. } else {
  12787. handlers.push( handleObj );
  12788. }
  12789. // Keep track of which events have ever been used, for event optimization
  12790. jQuery.event.global[ type ] = true;
  12791. }
  12792. },
  12793. // Detach an event or set of events from an element
  12794. remove: function( elem, types, handler, selector, mappedTypes ) {
  12795. var j, origCount, tmp,
  12796. events, t, handleObj,
  12797. special, handlers, type, namespaces, origType,
  12798. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12799. if ( !elemData || !( events = elemData.events ) ) {
  12800. return;
  12801. }
  12802. // Once for each type.namespace in types; type may be omitted
  12803. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12804. t = types.length;
  12805. while ( t-- ) {
  12806. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12807. type = origType = tmp[ 1 ];
  12808. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12809. // Unbind all events (on this namespace, if provided) for the element
  12810. if ( !type ) {
  12811. for ( type in events ) {
  12812. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12813. }
  12814. continue;
  12815. }
  12816. special = jQuery.event.special[ type ] || {};
  12817. type = ( selector ? special.delegateType : special.bindType ) || type;
  12818. handlers = events[ type ] || [];
  12819. tmp = tmp[ 2 ] &&
  12820. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12821. // Remove matching events
  12822. origCount = j = handlers.length;
  12823. while ( j-- ) {
  12824. handleObj = handlers[ j ];
  12825. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12826. ( !handler || handler.guid === handleObj.guid ) &&
  12827. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12828. ( !selector || selector === handleObj.selector ||
  12829. selector === "**" && handleObj.selector ) ) {
  12830. handlers.splice( j, 1 );
  12831. if ( handleObj.selector ) {
  12832. handlers.delegateCount--;
  12833. }
  12834. if ( special.remove ) {
  12835. special.remove.call( elem, handleObj );
  12836. }
  12837. }
  12838. }
  12839. // Remove generic event handler if we removed something and no more handlers exist
  12840. // (avoids potential for endless recursion during removal of special event handlers)
  12841. if ( origCount && !handlers.length ) {
  12842. if ( !special.teardown ||
  12843. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12844. jQuery.removeEvent( elem, type, elemData.handle );
  12845. }
  12846. delete events[ type ];
  12847. }
  12848. }
  12849. // Remove data and the expando if it's no longer used
  12850. if ( jQuery.isEmptyObject( events ) ) {
  12851. dataPriv.remove( elem, "handle events" );
  12852. }
  12853. },
  12854. dispatch: function( nativeEvent ) {
  12855. // Make a writable jQuery.Event from the native event object
  12856. var event = jQuery.event.fix( nativeEvent );
  12857. var i, j, ret, matched, handleObj, handlerQueue,
  12858. args = new Array( arguments.length ),
  12859. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12860. special = jQuery.event.special[ event.type ] || {};
  12861. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12862. args[ 0 ] = event;
  12863. for ( i = 1; i < arguments.length; i++ ) {
  12864. args[ i ] = arguments[ i ];
  12865. }
  12866. event.delegateTarget = this;
  12867. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12868. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12869. return;
  12870. }
  12871. // Determine handlers
  12872. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12873. // Run delegates first; they may want to stop propagation beneath us
  12874. i = 0;
  12875. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12876. event.currentTarget = matched.elem;
  12877. j = 0;
  12878. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12879. !event.isImmediatePropagationStopped() ) {
  12880. // If the event is namespaced, then each handler is only invoked if it is
  12881. // specially universal or its namespaces are a superset of the event's.
  12882. if ( !event.rnamespace || handleObj.namespace === false ||
  12883. event.rnamespace.test( handleObj.namespace ) ) {
  12884. event.handleObj = handleObj;
  12885. event.data = handleObj.data;
  12886. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12887. handleObj.handler ).apply( matched.elem, args );
  12888. if ( ret !== undefined ) {
  12889. if ( ( event.result = ret ) === false ) {
  12890. event.preventDefault();
  12891. event.stopPropagation();
  12892. }
  12893. }
  12894. }
  12895. }
  12896. }
  12897. // Call the postDispatch hook for the mapped type
  12898. if ( special.postDispatch ) {
  12899. special.postDispatch.call( this, event );
  12900. }
  12901. return event.result;
  12902. },
  12903. handlers: function( event, handlers ) {
  12904. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12905. handlerQueue = [],
  12906. delegateCount = handlers.delegateCount,
  12907. cur = event.target;
  12908. // Find delegate handlers
  12909. if ( delegateCount &&
  12910. // Support: IE <=9
  12911. // Black-hole SVG <use> instance trees (trac-13180)
  12912. cur.nodeType &&
  12913. // Support: Firefox <=42
  12914. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12915. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12916. // Support: IE 11 only
  12917. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12918. !( event.type === "click" && event.button >= 1 ) ) {
  12919. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12920. // Don't check non-elements (#13208)
  12921. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12922. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12923. matchedHandlers = [];
  12924. matchedSelectors = {};
  12925. for ( i = 0; i < delegateCount; i++ ) {
  12926. handleObj = handlers[ i ];
  12927. // Don't conflict with Object.prototype properties (#13203)
  12928. sel = handleObj.selector + " ";
  12929. if ( matchedSelectors[ sel ] === undefined ) {
  12930. matchedSelectors[ sel ] = handleObj.needsContext ?
  12931. jQuery( sel, this ).index( cur ) > -1 :
  12932. jQuery.find( sel, this, null, [ cur ] ).length;
  12933. }
  12934. if ( matchedSelectors[ sel ] ) {
  12935. matchedHandlers.push( handleObj );
  12936. }
  12937. }
  12938. if ( matchedHandlers.length ) {
  12939. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12940. }
  12941. }
  12942. }
  12943. }
  12944. // Add the remaining (directly-bound) handlers
  12945. cur = this;
  12946. if ( delegateCount < handlers.length ) {
  12947. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12948. }
  12949. return handlerQueue;
  12950. },
  12951. addProp: function( name, hook ) {
  12952. Object.defineProperty( jQuery.Event.prototype, name, {
  12953. enumerable: true,
  12954. configurable: true,
  12955. get: isFunction( hook ) ?
  12956. function() {
  12957. if ( this.originalEvent ) {
  12958. return hook( this.originalEvent );
  12959. }
  12960. } :
  12961. function() {
  12962. if ( this.originalEvent ) {
  12963. return this.originalEvent[ name ];
  12964. }
  12965. },
  12966. set: function( value ) {
  12967. Object.defineProperty( this, name, {
  12968. enumerable: true,
  12969. configurable: true,
  12970. writable: true,
  12971. value: value
  12972. } );
  12973. }
  12974. } );
  12975. },
  12976. fix: function( originalEvent ) {
  12977. return originalEvent[ jQuery.expando ] ?
  12978. originalEvent :
  12979. new jQuery.Event( originalEvent );
  12980. },
  12981. special: {
  12982. load: {
  12983. // Prevent triggered image.load events from bubbling to window.load
  12984. noBubble: true
  12985. },
  12986. click: {
  12987. // Utilize native event to ensure correct state for checkable inputs
  12988. setup: function( data ) {
  12989. // For mutual compressibility with _default, replace `this` access with a local var.
  12990. // `|| data` is dead code meant only to preserve the variable through minification.
  12991. var el = this || data;
  12992. // Claim the first handler
  12993. if ( rcheckableType.test( el.type ) &&
  12994. el.click && nodeName( el, "input" ) ) {
  12995. // dataPriv.set( el, "click", ... )
  12996. leverageNative( el, "click", returnTrue );
  12997. }
  12998. // Return false to allow normal processing in the caller
  12999. return false;
  13000. },
  13001. trigger: function( data ) {
  13002. // For mutual compressibility with _default, replace `this` access with a local var.
  13003. // `|| data` is dead code meant only to preserve the variable through minification.
  13004. var el = this || data;
  13005. // Force setup before triggering a click
  13006. if ( rcheckableType.test( el.type ) &&
  13007. el.click && nodeName( el, "input" ) ) {
  13008. leverageNative( el, "click" );
  13009. }
  13010. // Return non-false to allow normal event-path propagation
  13011. return true;
  13012. },
  13013. // For cross-browser consistency, suppress native .click() on links
  13014. // Also prevent it if we're currently inside a leveraged native-event stack
  13015. _default: function( event ) {
  13016. var target = event.target;
  13017. return rcheckableType.test( target.type ) &&
  13018. target.click && nodeName( target, "input" ) &&
  13019. dataPriv.get( target, "click" ) ||
  13020. nodeName( target, "a" );
  13021. }
  13022. },
  13023. beforeunload: {
  13024. postDispatch: function( event ) {
  13025. // Support: Firefox 20+
  13026. // Firefox doesn't alert if the returnValue field is not set.
  13027. if ( event.result !== undefined && event.originalEvent ) {
  13028. event.originalEvent.returnValue = event.result;
  13029. }
  13030. }
  13031. }
  13032. }
  13033. };
  13034. // Ensure the presence of an event listener that handles manually-triggered
  13035. // synthetic events by interrupting progress until reinvoked in response to
  13036. // *native* events that it fires directly, ensuring that state changes have
  13037. // already occurred before other listeners are invoked.
  13038. function leverageNative( el, type, expectSync ) {
  13039. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13040. if ( !expectSync ) {
  13041. if ( dataPriv.get( el, type ) === undefined ) {
  13042. jQuery.event.add( el, type, returnTrue );
  13043. }
  13044. return;
  13045. }
  13046. // Register the controller as a special universal handler for all event namespaces
  13047. dataPriv.set( el, type, false );
  13048. jQuery.event.add( el, type, {
  13049. namespace: false,
  13050. handler: function( event ) {
  13051. var notAsync, result,
  13052. saved = dataPriv.get( this, type );
  13053. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13054. // Interrupt processing of the outer synthetic .trigger()ed event
  13055. // Saved data should be false in such cases, but might be a leftover capture object
  13056. // from an async native handler (gh-4350)
  13057. if ( !saved.length ) {
  13058. // Store arguments for use when handling the inner native event
  13059. // There will always be at least one argument (an event object), so this array
  13060. // will not be confused with a leftover capture object.
  13061. saved = slice.call( arguments );
  13062. dataPriv.set( this, type, saved );
  13063. // Trigger the native event and capture its result
  13064. // Support: IE <=9 - 11+
  13065. // focus() and blur() are asynchronous
  13066. notAsync = expectSync( this, type );
  13067. this[ type ]();
  13068. result = dataPriv.get( this, type );
  13069. if ( saved !== result || notAsync ) {
  13070. dataPriv.set( this, type, false );
  13071. } else {
  13072. result = {};
  13073. }
  13074. if ( saved !== result ) {
  13075. // Cancel the outer synthetic event
  13076. event.stopImmediatePropagation();
  13077. event.preventDefault();
  13078. return result.value;
  13079. }
  13080. // If this is an inner synthetic event for an event with a bubbling surrogate
  13081. // (focus or blur), assume that the surrogate already propagated from triggering the
  13082. // native event and prevent that from happening again here.
  13083. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13084. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13085. // less bad than duplication.
  13086. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13087. event.stopPropagation();
  13088. }
  13089. // If this is a native event triggered above, everything is now in order
  13090. // Fire an inner synthetic event with the original arguments
  13091. } else if ( saved.length ) {
  13092. // ...and capture the result
  13093. dataPriv.set( this, type, {
  13094. value: jQuery.event.trigger(
  13095. // Support: IE <=9 - 11+
  13096. // Extend with the prototype to reset the above stopImmediatePropagation()
  13097. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13098. saved.slice( 1 ),
  13099. this
  13100. )
  13101. } );
  13102. // Abort handling of the native event
  13103. event.stopImmediatePropagation();
  13104. }
  13105. }
  13106. } );
  13107. }
  13108. jQuery.removeEvent = function( elem, type, handle ) {
  13109. // This "if" is needed for plain objects
  13110. if ( elem.removeEventListener ) {
  13111. elem.removeEventListener( type, handle );
  13112. }
  13113. };
  13114. jQuery.Event = function( src, props ) {
  13115. // Allow instantiation without the 'new' keyword
  13116. if ( !( this instanceof jQuery.Event ) ) {
  13117. return new jQuery.Event( src, props );
  13118. }
  13119. // Event object
  13120. if ( src && src.type ) {
  13121. this.originalEvent = src;
  13122. this.type = src.type;
  13123. // Events bubbling up the document may have been marked as prevented
  13124. // by a handler lower down the tree; reflect the correct value.
  13125. this.isDefaultPrevented = src.defaultPrevented ||
  13126. src.defaultPrevented === undefined &&
  13127. // Support: Android <=2.3 only
  13128. src.returnValue === false ?
  13129. returnTrue :
  13130. returnFalse;
  13131. // Create target properties
  13132. // Support: Safari <=6 - 7 only
  13133. // Target should not be a text node (#504, #13143)
  13134. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13135. src.target.parentNode :
  13136. src.target;
  13137. this.currentTarget = src.currentTarget;
  13138. this.relatedTarget = src.relatedTarget;
  13139. // Event type
  13140. } else {
  13141. this.type = src;
  13142. }
  13143. // Put explicitly provided properties onto the event object
  13144. if ( props ) {
  13145. jQuery.extend( this, props );
  13146. }
  13147. // Create a timestamp if incoming event doesn't have one
  13148. this.timeStamp = src && src.timeStamp || Date.now();
  13149. // Mark it as fixed
  13150. this[ jQuery.expando ] = true;
  13151. };
  13152. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13153. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13154. jQuery.Event.prototype = {
  13155. constructor: jQuery.Event,
  13156. isDefaultPrevented: returnFalse,
  13157. isPropagationStopped: returnFalse,
  13158. isImmediatePropagationStopped: returnFalse,
  13159. isSimulated: false,
  13160. preventDefault: function() {
  13161. var e = this.originalEvent;
  13162. this.isDefaultPrevented = returnTrue;
  13163. if ( e && !this.isSimulated ) {
  13164. e.preventDefault();
  13165. }
  13166. },
  13167. stopPropagation: function() {
  13168. var e = this.originalEvent;
  13169. this.isPropagationStopped = returnTrue;
  13170. if ( e && !this.isSimulated ) {
  13171. e.stopPropagation();
  13172. }
  13173. },
  13174. stopImmediatePropagation: function() {
  13175. var e = this.originalEvent;
  13176. this.isImmediatePropagationStopped = returnTrue;
  13177. if ( e && !this.isSimulated ) {
  13178. e.stopImmediatePropagation();
  13179. }
  13180. this.stopPropagation();
  13181. }
  13182. };
  13183. // Includes all common event props including KeyEvent and MouseEvent specific props
  13184. jQuery.each( {
  13185. altKey: true,
  13186. bubbles: true,
  13187. cancelable: true,
  13188. changedTouches: true,
  13189. ctrlKey: true,
  13190. detail: true,
  13191. eventPhase: true,
  13192. metaKey: true,
  13193. pageX: true,
  13194. pageY: true,
  13195. shiftKey: true,
  13196. view: true,
  13197. "char": true,
  13198. code: true,
  13199. charCode: true,
  13200. key: true,
  13201. keyCode: true,
  13202. button: true,
  13203. buttons: true,
  13204. clientX: true,
  13205. clientY: true,
  13206. offsetX: true,
  13207. offsetY: true,
  13208. pointerId: true,
  13209. pointerType: true,
  13210. screenX: true,
  13211. screenY: true,
  13212. targetTouches: true,
  13213. toElement: true,
  13214. touches: true,
  13215. which: function( event ) {
  13216. var button = event.button;
  13217. // Add which for key events
  13218. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13219. return event.charCode != null ? event.charCode : event.keyCode;
  13220. }
  13221. // Add which for click: 1 === left; 2 === middle; 3 === right
  13222. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13223. if ( button & 1 ) {
  13224. return 1;
  13225. }
  13226. if ( button & 2 ) {
  13227. return 3;
  13228. }
  13229. if ( button & 4 ) {
  13230. return 2;
  13231. }
  13232. return 0;
  13233. }
  13234. return event.which;
  13235. }
  13236. }, jQuery.event.addProp );
  13237. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13238. jQuery.event.special[ type ] = {
  13239. // Utilize native event if possible so blur/focus sequence is correct
  13240. setup: function() {
  13241. // Claim the first handler
  13242. // dataPriv.set( this, "focus", ... )
  13243. // dataPriv.set( this, "blur", ... )
  13244. leverageNative( this, type, expectSync );
  13245. // Return false to allow normal processing in the caller
  13246. return false;
  13247. },
  13248. trigger: function() {
  13249. // Force setup before trigger
  13250. leverageNative( this, type );
  13251. // Return non-false to allow normal event-path propagation
  13252. return true;
  13253. },
  13254. delegateType: delegateType
  13255. };
  13256. } );
  13257. // Create mouseenter/leave events using mouseover/out and event-time checks
  13258. // so that event delegation works in jQuery.
  13259. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13260. //
  13261. // Support: Safari 7 only
  13262. // Safari sends mouseenter too often; see:
  13263. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13264. // for the description of the bug (it existed in older Chrome versions as well).
  13265. jQuery.each( {
  13266. mouseenter: "mouseover",
  13267. mouseleave: "mouseout",
  13268. pointerenter: "pointerover",
  13269. pointerleave: "pointerout"
  13270. }, function( orig, fix ) {
  13271. jQuery.event.special[ orig ] = {
  13272. delegateType: fix,
  13273. bindType: fix,
  13274. handle: function( event ) {
  13275. var ret,
  13276. target = this,
  13277. related = event.relatedTarget,
  13278. handleObj = event.handleObj;
  13279. // For mouseenter/leave call the handler if related is outside the target.
  13280. // NB: No relatedTarget if the mouse left/entered the browser window
  13281. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13282. event.type = handleObj.origType;
  13283. ret = handleObj.handler.apply( this, arguments );
  13284. event.type = fix;
  13285. }
  13286. return ret;
  13287. }
  13288. };
  13289. } );
  13290. jQuery.fn.extend( {
  13291. on: function( types, selector, data, fn ) {
  13292. return on( this, types, selector, data, fn );
  13293. },
  13294. one: function( types, selector, data, fn ) {
  13295. return on( this, types, selector, data, fn, 1 );
  13296. },
  13297. off: function( types, selector, fn ) {
  13298. var handleObj, type;
  13299. if ( types && types.preventDefault && types.handleObj ) {
  13300. // ( event ) dispatched jQuery.Event
  13301. handleObj = types.handleObj;
  13302. jQuery( types.delegateTarget ).off(
  13303. handleObj.namespace ?
  13304. handleObj.origType + "." + handleObj.namespace :
  13305. handleObj.origType,
  13306. handleObj.selector,
  13307. handleObj.handler
  13308. );
  13309. return this;
  13310. }
  13311. if ( typeof types === "object" ) {
  13312. // ( types-object [, selector] )
  13313. for ( type in types ) {
  13314. this.off( type, selector, types[ type ] );
  13315. }
  13316. return this;
  13317. }
  13318. if ( selector === false || typeof selector === "function" ) {
  13319. // ( types [, fn] )
  13320. fn = selector;
  13321. selector = undefined;
  13322. }
  13323. if ( fn === false ) {
  13324. fn = returnFalse;
  13325. }
  13326. return this.each( function() {
  13327. jQuery.event.remove( this, types, fn, selector );
  13328. } );
  13329. }
  13330. } );
  13331. var
  13332. /* eslint-disable max-len */
  13333. // See https://github.com/eslint/eslint/issues/3229
  13334. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13335. /* eslint-enable */
  13336. // Support: IE <=10 - 11, Edge 12 - 13 only
  13337. // In IE/Edge using regex groups here causes severe slowdowns.
  13338. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13339. rnoInnerhtml = /<script|<style|<link/i,
  13340. // checked="checked" or checked
  13341. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13342. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13343. // Prefer a tbody over its parent table for containing new rows
  13344. function manipulationTarget( elem, content ) {
  13345. if ( nodeName( elem, "table" ) &&
  13346. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13347. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13348. }
  13349. return elem;
  13350. }
  13351. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13352. function disableScript( elem ) {
  13353. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13354. return elem;
  13355. }
  13356. function restoreScript( elem ) {
  13357. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13358. elem.type = elem.type.slice( 5 );
  13359. } else {
  13360. elem.removeAttribute( "type" );
  13361. }
  13362. return elem;
  13363. }
  13364. function cloneCopyEvent( src, dest ) {
  13365. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13366. if ( dest.nodeType !== 1 ) {
  13367. return;
  13368. }
  13369. // 1. Copy private data: events, handlers, etc.
  13370. if ( dataPriv.hasData( src ) ) {
  13371. pdataOld = dataPriv.access( src );
  13372. pdataCur = dataPriv.set( dest, pdataOld );
  13373. events = pdataOld.events;
  13374. if ( events ) {
  13375. delete pdataCur.handle;
  13376. pdataCur.events = {};
  13377. for ( type in events ) {
  13378. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13379. jQuery.event.add( dest, type, events[ type ][ i ] );
  13380. }
  13381. }
  13382. }
  13383. }
  13384. // 2. Copy user data
  13385. if ( dataUser.hasData( src ) ) {
  13386. udataOld = dataUser.access( src );
  13387. udataCur = jQuery.extend( {}, udataOld );
  13388. dataUser.set( dest, udataCur );
  13389. }
  13390. }
  13391. // Fix IE bugs, see support tests
  13392. function fixInput( src, dest ) {
  13393. var nodeName = dest.nodeName.toLowerCase();
  13394. // Fails to persist the checked state of a cloned checkbox or radio button.
  13395. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13396. dest.checked = src.checked;
  13397. // Fails to return the selected option to the default selected state when cloning options
  13398. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13399. dest.defaultValue = src.defaultValue;
  13400. }
  13401. }
  13402. function domManip( collection, args, callback, ignored ) {
  13403. // Flatten any nested arrays
  13404. args = concat.apply( [], args );
  13405. var fragment, first, scripts, hasScripts, node, doc,
  13406. i = 0,
  13407. l = collection.length,
  13408. iNoClone = l - 1,
  13409. value = args[ 0 ],
  13410. valueIsFunction = isFunction( value );
  13411. // We can't cloneNode fragments that contain checked, in WebKit
  13412. if ( valueIsFunction ||
  13413. ( l > 1 && typeof value === "string" &&
  13414. !support.checkClone && rchecked.test( value ) ) ) {
  13415. return collection.each( function( index ) {
  13416. var self = collection.eq( index );
  13417. if ( valueIsFunction ) {
  13418. args[ 0 ] = value.call( this, index, self.html() );
  13419. }
  13420. domManip( self, args, callback, ignored );
  13421. } );
  13422. }
  13423. if ( l ) {
  13424. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13425. first = fragment.firstChild;
  13426. if ( fragment.childNodes.length === 1 ) {
  13427. fragment = first;
  13428. }
  13429. // Require either new content or an interest in ignored elements to invoke the callback
  13430. if ( first || ignored ) {
  13431. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13432. hasScripts = scripts.length;
  13433. // Use the original fragment for the last item
  13434. // instead of the first because it can end up
  13435. // being emptied incorrectly in certain situations (#8070).
  13436. for ( ; i < l; i++ ) {
  13437. node = fragment;
  13438. if ( i !== iNoClone ) {
  13439. node = jQuery.clone( node, true, true );
  13440. // Keep references to cloned scripts for later restoration
  13441. if ( hasScripts ) {
  13442. // Support: Android <=4.0 only, PhantomJS 1 only
  13443. // push.apply(_, arraylike) throws on ancient WebKit
  13444. jQuery.merge( scripts, getAll( node, "script" ) );
  13445. }
  13446. }
  13447. callback.call( collection[ i ], node, i );
  13448. }
  13449. if ( hasScripts ) {
  13450. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13451. // Reenable scripts
  13452. jQuery.map( scripts, restoreScript );
  13453. // Evaluate executable scripts on first document insertion
  13454. for ( i = 0; i < hasScripts; i++ ) {
  13455. node = scripts[ i ];
  13456. if ( rscriptType.test( node.type || "" ) &&
  13457. !dataPriv.access( node, "globalEval" ) &&
  13458. jQuery.contains( doc, node ) ) {
  13459. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13460. // Optional AJAX dependency, but won't run scripts if not present
  13461. if ( jQuery._evalUrl && !node.noModule ) {
  13462. jQuery._evalUrl( node.src, {
  13463. nonce: node.nonce || node.getAttribute( "nonce" )
  13464. } );
  13465. }
  13466. } else {
  13467. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13468. }
  13469. }
  13470. }
  13471. }
  13472. }
  13473. }
  13474. return collection;
  13475. }
  13476. function remove( elem, selector, keepData ) {
  13477. var node,
  13478. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13479. i = 0;
  13480. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13481. if ( !keepData && node.nodeType === 1 ) {
  13482. jQuery.cleanData( getAll( node ) );
  13483. }
  13484. if ( node.parentNode ) {
  13485. if ( keepData && isAttached( node ) ) {
  13486. setGlobalEval( getAll( node, "script" ) );
  13487. }
  13488. node.parentNode.removeChild( node );
  13489. }
  13490. }
  13491. return elem;
  13492. }
  13493. jQuery.extend( {
  13494. htmlPrefilter: function( html ) {
  13495. return html.replace( rxhtmlTag, "<$1></$2>" );
  13496. },
  13497. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13498. var i, l, srcElements, destElements,
  13499. clone = elem.cloneNode( true ),
  13500. inPage = isAttached( elem );
  13501. // Fix IE cloning issues
  13502. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13503. !jQuery.isXMLDoc( elem ) ) {
  13504. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13505. destElements = getAll( clone );
  13506. srcElements = getAll( elem );
  13507. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13508. fixInput( srcElements[ i ], destElements[ i ] );
  13509. }
  13510. }
  13511. // Copy the events from the original to the clone
  13512. if ( dataAndEvents ) {
  13513. if ( deepDataAndEvents ) {
  13514. srcElements = srcElements || getAll( elem );
  13515. destElements = destElements || getAll( clone );
  13516. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13517. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13518. }
  13519. } else {
  13520. cloneCopyEvent( elem, clone );
  13521. }
  13522. }
  13523. // Preserve script evaluation history
  13524. destElements = getAll( clone, "script" );
  13525. if ( destElements.length > 0 ) {
  13526. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13527. }
  13528. // Return the cloned set
  13529. return clone;
  13530. },
  13531. cleanData: function( elems ) {
  13532. var data, elem, type,
  13533. special = jQuery.event.special,
  13534. i = 0;
  13535. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13536. if ( acceptData( elem ) ) {
  13537. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13538. if ( data.events ) {
  13539. for ( type in data.events ) {
  13540. if ( special[ type ] ) {
  13541. jQuery.event.remove( elem, type );
  13542. // This is a shortcut to avoid jQuery.event.remove's overhead
  13543. } else {
  13544. jQuery.removeEvent( elem, type, data.handle );
  13545. }
  13546. }
  13547. }
  13548. // Support: Chrome <=35 - 45+
  13549. // Assign undefined instead of using delete, see Data#remove
  13550. elem[ dataPriv.expando ] = undefined;
  13551. }
  13552. if ( elem[ dataUser.expando ] ) {
  13553. // Support: Chrome <=35 - 45+
  13554. // Assign undefined instead of using delete, see Data#remove
  13555. elem[ dataUser.expando ] = undefined;
  13556. }
  13557. }
  13558. }
  13559. }
  13560. } );
  13561. jQuery.fn.extend( {
  13562. detach: function( selector ) {
  13563. return remove( this, selector, true );
  13564. },
  13565. remove: function( selector ) {
  13566. return remove( this, selector );
  13567. },
  13568. text: function( value ) {
  13569. return access( this, function( value ) {
  13570. return value === undefined ?
  13571. jQuery.text( this ) :
  13572. this.empty().each( function() {
  13573. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13574. this.textContent = value;
  13575. }
  13576. } );
  13577. }, null, value, arguments.length );
  13578. },
  13579. append: function() {
  13580. return domManip( this, arguments, function( elem ) {
  13581. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13582. var target = manipulationTarget( this, elem );
  13583. target.appendChild( elem );
  13584. }
  13585. } );
  13586. },
  13587. prepend: function() {
  13588. return domManip( this, arguments, function( elem ) {
  13589. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13590. var target = manipulationTarget( this, elem );
  13591. target.insertBefore( elem, target.firstChild );
  13592. }
  13593. } );
  13594. },
  13595. before: function() {
  13596. return domManip( this, arguments, function( elem ) {
  13597. if ( this.parentNode ) {
  13598. this.parentNode.insertBefore( elem, this );
  13599. }
  13600. } );
  13601. },
  13602. after: function() {
  13603. return domManip( this, arguments, function( elem ) {
  13604. if ( this.parentNode ) {
  13605. this.parentNode.insertBefore( elem, this.nextSibling );
  13606. }
  13607. } );
  13608. },
  13609. empty: function() {
  13610. var elem,
  13611. i = 0;
  13612. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13613. if ( elem.nodeType === 1 ) {
  13614. // Prevent memory leaks
  13615. jQuery.cleanData( getAll( elem, false ) );
  13616. // Remove any remaining nodes
  13617. elem.textContent = "";
  13618. }
  13619. }
  13620. return this;
  13621. },
  13622. clone: function( dataAndEvents, deepDataAndEvents ) {
  13623. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13624. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13625. return this.map( function() {
  13626. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13627. } );
  13628. },
  13629. html: function( value ) {
  13630. return access( this, function( value ) {
  13631. var elem = this[ 0 ] || {},
  13632. i = 0,
  13633. l = this.length;
  13634. if ( value === undefined && elem.nodeType === 1 ) {
  13635. return elem.innerHTML;
  13636. }
  13637. // See if we can take a shortcut and just use innerHTML
  13638. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13639. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13640. value = jQuery.htmlPrefilter( value );
  13641. try {
  13642. for ( ; i < l; i++ ) {
  13643. elem = this[ i ] || {};
  13644. // Remove element nodes and prevent memory leaks
  13645. if ( elem.nodeType === 1 ) {
  13646. jQuery.cleanData( getAll( elem, false ) );
  13647. elem.innerHTML = value;
  13648. }
  13649. }
  13650. elem = 0;
  13651. // If using innerHTML throws an exception, use the fallback method
  13652. } catch ( e ) {}
  13653. }
  13654. if ( elem ) {
  13655. this.empty().append( value );
  13656. }
  13657. }, null, value, arguments.length );
  13658. },
  13659. replaceWith: function() {
  13660. var ignored = [];
  13661. // Make the changes, replacing each non-ignored context element with the new content
  13662. return domManip( this, arguments, function( elem ) {
  13663. var parent = this.parentNode;
  13664. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13665. jQuery.cleanData( getAll( this ) );
  13666. if ( parent ) {
  13667. parent.replaceChild( elem, this );
  13668. }
  13669. }
  13670. // Force callback invocation
  13671. }, ignored );
  13672. }
  13673. } );
  13674. jQuery.each( {
  13675. appendTo: "append",
  13676. prependTo: "prepend",
  13677. insertBefore: "before",
  13678. insertAfter: "after",
  13679. replaceAll: "replaceWith"
  13680. }, function( name, original ) {
  13681. jQuery.fn[ name ] = function( selector ) {
  13682. var elems,
  13683. ret = [],
  13684. insert = jQuery( selector ),
  13685. last = insert.length - 1,
  13686. i = 0;
  13687. for ( ; i <= last; i++ ) {
  13688. elems = i === last ? this : this.clone( true );
  13689. jQuery( insert[ i ] )[ original ]( elems );
  13690. // Support: Android <=4.0 only, PhantomJS 1 only
  13691. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13692. push.apply( ret, elems.get() );
  13693. }
  13694. return this.pushStack( ret );
  13695. };
  13696. } );
  13697. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13698. var getStyles = function( elem ) {
  13699. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13700. // IE throws on elements created in popups
  13701. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13702. var view = elem.ownerDocument.defaultView;
  13703. if ( !view || !view.opener ) {
  13704. view = window;
  13705. }
  13706. return view.getComputedStyle( elem );
  13707. };
  13708. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13709. ( function() {
  13710. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13711. // so they're executed at the same time to save the second computation.
  13712. function computeStyleTests() {
  13713. // This is a singleton, we need to execute it only once
  13714. if ( !div ) {
  13715. return;
  13716. }
  13717. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13718. "margin-top:1px;padding:0;border:0";
  13719. div.style.cssText =
  13720. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13721. "margin:auto;border:1px;padding:1px;" +
  13722. "width:60%;top:1%";
  13723. documentElement.appendChild( container ).appendChild( div );
  13724. var divStyle = window.getComputedStyle( div );
  13725. pixelPositionVal = divStyle.top !== "1%";
  13726. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13727. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13728. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13729. // Some styles come back with percentage values, even though they shouldn't
  13730. div.style.right = "60%";
  13731. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13732. // Support: IE 9 - 11 only
  13733. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13734. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13735. // Support: IE 9 only
  13736. // Detect overflow:scroll screwiness (gh-3699)
  13737. // Support: Chrome <=64
  13738. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13739. div.style.position = "absolute";
  13740. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13741. documentElement.removeChild( container );
  13742. // Nullify the div so it wouldn't be stored in the memory and
  13743. // it will also be a sign that checks already performed
  13744. div = null;
  13745. }
  13746. function roundPixelMeasures( measure ) {
  13747. return Math.round( parseFloat( measure ) );
  13748. }
  13749. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13750. reliableMarginLeftVal,
  13751. container = document.createElement( "div" ),
  13752. div = document.createElement( "div" );
  13753. // Finish early in limited (non-browser) environments
  13754. if ( !div.style ) {
  13755. return;
  13756. }
  13757. // Support: IE <=9 - 11 only
  13758. // Style of cloned element affects source element cloned (#8908)
  13759. div.style.backgroundClip = "content-box";
  13760. div.cloneNode( true ).style.backgroundClip = "";
  13761. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13762. jQuery.extend( support, {
  13763. boxSizingReliable: function() {
  13764. computeStyleTests();
  13765. return boxSizingReliableVal;
  13766. },
  13767. pixelBoxStyles: function() {
  13768. computeStyleTests();
  13769. return pixelBoxStylesVal;
  13770. },
  13771. pixelPosition: function() {
  13772. computeStyleTests();
  13773. return pixelPositionVal;
  13774. },
  13775. reliableMarginLeft: function() {
  13776. computeStyleTests();
  13777. return reliableMarginLeftVal;
  13778. },
  13779. scrollboxSize: function() {
  13780. computeStyleTests();
  13781. return scrollboxSizeVal;
  13782. }
  13783. } );
  13784. } )();
  13785. function curCSS( elem, name, computed ) {
  13786. var width, minWidth, maxWidth, ret,
  13787. // Support: Firefox 51+
  13788. // Retrieving style before computed somehow
  13789. // fixes an issue with getting wrong values
  13790. // on detached elements
  13791. style = elem.style;
  13792. computed = computed || getStyles( elem );
  13793. // getPropertyValue is needed for:
  13794. // .css('filter') (IE 9 only, #12537)
  13795. // .css('--customProperty) (#3144)
  13796. if ( computed ) {
  13797. ret = computed.getPropertyValue( name ) || computed[ name ];
  13798. if ( ret === "" && !isAttached( elem ) ) {
  13799. ret = jQuery.style( elem, name );
  13800. }
  13801. // A tribute to the "awesome hack by Dean Edwards"
  13802. // Android Browser returns percentage for some values,
  13803. // but width seems to be reliably pixels.
  13804. // This is against the CSSOM draft spec:
  13805. // https://drafts.csswg.org/cssom/#resolved-values
  13806. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13807. // Remember the original values
  13808. width = style.width;
  13809. minWidth = style.minWidth;
  13810. maxWidth = style.maxWidth;
  13811. // Put in the new values to get a computed value out
  13812. style.minWidth = style.maxWidth = style.width = ret;
  13813. ret = computed.width;
  13814. // Revert the changed values
  13815. style.width = width;
  13816. style.minWidth = minWidth;
  13817. style.maxWidth = maxWidth;
  13818. }
  13819. }
  13820. return ret !== undefined ?
  13821. // Support: IE <=9 - 11 only
  13822. // IE returns zIndex value as an integer.
  13823. ret + "" :
  13824. ret;
  13825. }
  13826. function addGetHookIf( conditionFn, hookFn ) {
  13827. // Define the hook, we'll check on the first run if it's really needed.
  13828. return {
  13829. get: function() {
  13830. if ( conditionFn() ) {
  13831. // Hook not needed (or it's not possible to use it due
  13832. // to missing dependency), remove it.
  13833. delete this.get;
  13834. return;
  13835. }
  13836. // Hook needed; redefine it so that the support test is not executed again.
  13837. return ( this.get = hookFn ).apply( this, arguments );
  13838. }
  13839. };
  13840. }
  13841. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13842. emptyStyle = document.createElement( "div" ).style,
  13843. vendorProps = {};
  13844. // Return a vendor-prefixed property or undefined
  13845. function vendorPropName( name ) {
  13846. // Check for vendor prefixed names
  13847. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13848. i = cssPrefixes.length;
  13849. while ( i-- ) {
  13850. name = cssPrefixes[ i ] + capName;
  13851. if ( name in emptyStyle ) {
  13852. return name;
  13853. }
  13854. }
  13855. }
  13856. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13857. function finalPropName( name ) {
  13858. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13859. if ( final ) {
  13860. return final;
  13861. }
  13862. if ( name in emptyStyle ) {
  13863. return name;
  13864. }
  13865. return vendorProps[ name ] = vendorPropName( name ) || name;
  13866. }
  13867. var
  13868. // Swappable if display is none or starts with table
  13869. // except "table", "table-cell", or "table-caption"
  13870. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13871. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13872. rcustomProp = /^--/,
  13873. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13874. cssNormalTransform = {
  13875. letterSpacing: "0",
  13876. fontWeight: "400"
  13877. };
  13878. function setPositiveNumber( elem, value, subtract ) {
  13879. // Any relative (+/-) values have already been
  13880. // normalized at this point
  13881. var matches = rcssNum.exec( value );
  13882. return matches ?
  13883. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13884. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13885. value;
  13886. }
  13887. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13888. var i = dimension === "width" ? 1 : 0,
  13889. extra = 0,
  13890. delta = 0;
  13891. // Adjustment may not be necessary
  13892. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13893. return 0;
  13894. }
  13895. for ( ; i < 4; i += 2 ) {
  13896. // Both box models exclude margin
  13897. if ( box === "margin" ) {
  13898. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13899. }
  13900. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13901. if ( !isBorderBox ) {
  13902. // Add padding
  13903. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13904. // For "border" or "margin", add border
  13905. if ( box !== "padding" ) {
  13906. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13907. // But still keep track of it otherwise
  13908. } else {
  13909. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13910. }
  13911. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13912. // "padding" or "margin"
  13913. } else {
  13914. // For "content", subtract padding
  13915. if ( box === "content" ) {
  13916. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13917. }
  13918. // For "content" or "padding", subtract border
  13919. if ( box !== "margin" ) {
  13920. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13921. }
  13922. }
  13923. }
  13924. // Account for positive content-box scroll gutter when requested by providing computedVal
  13925. if ( !isBorderBox && computedVal >= 0 ) {
  13926. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13927. // Assuming integer scroll gutter, subtract the rest and round down
  13928. delta += Math.max( 0, Math.ceil(
  13929. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13930. computedVal -
  13931. delta -
  13932. extra -
  13933. 0.5
  13934. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13935. // Use an explicit zero to avoid NaN (gh-3964)
  13936. ) ) || 0;
  13937. }
  13938. return delta;
  13939. }
  13940. function getWidthOrHeight( elem, dimension, extra ) {
  13941. // Start with computed style
  13942. var styles = getStyles( elem ),
  13943. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13944. // Fake content-box until we know it's needed to know the true value.
  13945. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13946. isBorderBox = boxSizingNeeded &&
  13947. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13948. valueIsBorderBox = isBorderBox,
  13949. val = curCSS( elem, dimension, styles ),
  13950. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13951. // Support: Firefox <=54
  13952. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13953. if ( rnumnonpx.test( val ) ) {
  13954. if ( !extra ) {
  13955. return val;
  13956. }
  13957. val = "auto";
  13958. }
  13959. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13960. // This happens for inline elements with no explicit setting (gh-3571)
  13961. // Support: Android <=4.1 - 4.3 only
  13962. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13963. // Support: IE 9-11 only
  13964. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13965. // We use getClientRects() to check for hidden/disconnected.
  13966. // In those cases, the computed value can be trusted to be border-box
  13967. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13968. val === "auto" ||
  13969. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13970. elem.getClientRects().length ) {
  13971. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13972. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13973. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13974. // retrieved value as a content box dimension.
  13975. valueIsBorderBox = offsetProp in elem;
  13976. if ( valueIsBorderBox ) {
  13977. val = elem[ offsetProp ];
  13978. }
  13979. }
  13980. // Normalize "" and auto
  13981. val = parseFloat( val ) || 0;
  13982. // Adjust for the element's box model
  13983. return ( val +
  13984. boxModelAdjustment(
  13985. elem,
  13986. dimension,
  13987. extra || ( isBorderBox ? "border" : "content" ),
  13988. valueIsBorderBox,
  13989. styles,
  13990. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13991. val
  13992. )
  13993. ) + "px";
  13994. }
  13995. jQuery.extend( {
  13996. // Add in style property hooks for overriding the default
  13997. // behavior of getting and setting a style property
  13998. cssHooks: {
  13999. opacity: {
  14000. get: function( elem, computed ) {
  14001. if ( computed ) {
  14002. // We should always get a number back from opacity
  14003. var ret = curCSS( elem, "opacity" );
  14004. return ret === "" ? "1" : ret;
  14005. }
  14006. }
  14007. }
  14008. },
  14009. // Don't automatically add "px" to these possibly-unitless properties
  14010. cssNumber: {
  14011. "animationIterationCount": true,
  14012. "columnCount": true,
  14013. "fillOpacity": true,
  14014. "flexGrow": true,
  14015. "flexShrink": true,
  14016. "fontWeight": true,
  14017. "gridArea": true,
  14018. "gridColumn": true,
  14019. "gridColumnEnd": true,
  14020. "gridColumnStart": true,
  14021. "gridRow": true,
  14022. "gridRowEnd": true,
  14023. "gridRowStart": true,
  14024. "lineHeight": true,
  14025. "opacity": true,
  14026. "order": true,
  14027. "orphans": true,
  14028. "widows": true,
  14029. "zIndex": true,
  14030. "zoom": true
  14031. },
  14032. // Add in properties whose names you wish to fix before
  14033. // setting or getting the value
  14034. cssProps: {},
  14035. // Get and set the style property on a DOM Node
  14036. style: function( elem, name, value, extra ) {
  14037. // Don't set styles on text and comment nodes
  14038. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14039. return;
  14040. }
  14041. // Make sure that we're working with the right name
  14042. var ret, type, hooks,
  14043. origName = camelCase( name ),
  14044. isCustomProp = rcustomProp.test( name ),
  14045. style = elem.style;
  14046. // Make sure that we're working with the right name. We don't
  14047. // want to query the value if it is a CSS custom property
  14048. // since they are user-defined.
  14049. if ( !isCustomProp ) {
  14050. name = finalPropName( origName );
  14051. }
  14052. // Gets hook for the prefixed version, then unprefixed version
  14053. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14054. // Check if we're setting a value
  14055. if ( value !== undefined ) {
  14056. type = typeof value;
  14057. // Convert "+=" or "-=" to relative numbers (#7345)
  14058. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14059. value = adjustCSS( elem, name, ret );
  14060. // Fixes bug #9237
  14061. type = "number";
  14062. }
  14063. // Make sure that null and NaN values aren't set (#7116)
  14064. if ( value == null || value !== value ) {
  14065. return;
  14066. }
  14067. // If a number was passed in, add the unit (except for certain CSS properties)
  14068. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14069. // "px" to a few hardcoded values.
  14070. if ( type === "number" && !isCustomProp ) {
  14071. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14072. }
  14073. // background-* props affect original clone's values
  14074. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14075. style[ name ] = "inherit";
  14076. }
  14077. // If a hook was provided, use that value, otherwise just set the specified value
  14078. if ( !hooks || !( "set" in hooks ) ||
  14079. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14080. if ( isCustomProp ) {
  14081. style.setProperty( name, value );
  14082. } else {
  14083. style[ name ] = value;
  14084. }
  14085. }
  14086. } else {
  14087. // If a hook was provided get the non-computed value from there
  14088. if ( hooks && "get" in hooks &&
  14089. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14090. return ret;
  14091. }
  14092. // Otherwise just get the value from the style object
  14093. return style[ name ];
  14094. }
  14095. },
  14096. css: function( elem, name, extra, styles ) {
  14097. var val, num, hooks,
  14098. origName = camelCase( name ),
  14099. isCustomProp = rcustomProp.test( name );
  14100. // Make sure that we're working with the right name. We don't
  14101. // want to modify the value if it is a CSS custom property
  14102. // since they are user-defined.
  14103. if ( !isCustomProp ) {
  14104. name = finalPropName( origName );
  14105. }
  14106. // Try prefixed name followed by the unprefixed name
  14107. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14108. // If a hook was provided get the computed value from there
  14109. if ( hooks && "get" in hooks ) {
  14110. val = hooks.get( elem, true, extra );
  14111. }
  14112. // Otherwise, if a way to get the computed value exists, use that
  14113. if ( val === undefined ) {
  14114. val = curCSS( elem, name, styles );
  14115. }
  14116. // Convert "normal" to computed value
  14117. if ( val === "normal" && name in cssNormalTransform ) {
  14118. val = cssNormalTransform[ name ];
  14119. }
  14120. // Make numeric if forced or a qualifier was provided and val looks numeric
  14121. if ( extra === "" || extra ) {
  14122. num = parseFloat( val );
  14123. return extra === true || isFinite( num ) ? num || 0 : val;
  14124. }
  14125. return val;
  14126. }
  14127. } );
  14128. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14129. jQuery.cssHooks[ dimension ] = {
  14130. get: function( elem, computed, extra ) {
  14131. if ( computed ) {
  14132. // Certain elements can have dimension info if we invisibly show them
  14133. // but it must have a current display style that would benefit
  14134. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14135. // Support: Safari 8+
  14136. // Table columns in Safari have non-zero offsetWidth & zero
  14137. // getBoundingClientRect().width unless display is changed.
  14138. // Support: IE <=11 only
  14139. // Running getBoundingClientRect on a disconnected node
  14140. // in IE throws an error.
  14141. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14142. swap( elem, cssShow, function() {
  14143. return getWidthOrHeight( elem, dimension, extra );
  14144. } ) :
  14145. getWidthOrHeight( elem, dimension, extra );
  14146. }
  14147. },
  14148. set: function( elem, value, extra ) {
  14149. var matches,
  14150. styles = getStyles( elem ),
  14151. // Only read styles.position if the test has a chance to fail
  14152. // to avoid forcing a reflow.
  14153. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14154. styles.position === "absolute",
  14155. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14156. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14157. isBorderBox = boxSizingNeeded &&
  14158. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14159. subtract = extra ?
  14160. boxModelAdjustment(
  14161. elem,
  14162. dimension,
  14163. extra,
  14164. isBorderBox,
  14165. styles
  14166. ) :
  14167. 0;
  14168. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14169. // faking a content-box to get border and padding (gh-3699)
  14170. if ( isBorderBox && scrollboxSizeBuggy ) {
  14171. subtract -= Math.ceil(
  14172. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14173. parseFloat( styles[ dimension ] ) -
  14174. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14175. 0.5
  14176. );
  14177. }
  14178. // Convert to pixels if value adjustment is needed
  14179. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14180. ( matches[ 3 ] || "px" ) !== "px" ) {
  14181. elem.style[ dimension ] = value;
  14182. value = jQuery.css( elem, dimension );
  14183. }
  14184. return setPositiveNumber( elem, value, subtract );
  14185. }
  14186. };
  14187. } );
  14188. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14189. function( elem, computed ) {
  14190. if ( computed ) {
  14191. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14192. elem.getBoundingClientRect().left -
  14193. swap( elem, { marginLeft: 0 }, function() {
  14194. return elem.getBoundingClientRect().left;
  14195. } )
  14196. ) + "px";
  14197. }
  14198. }
  14199. );
  14200. // These hooks are used by animate to expand properties
  14201. jQuery.each( {
  14202. margin: "",
  14203. padding: "",
  14204. border: "Width"
  14205. }, function( prefix, suffix ) {
  14206. jQuery.cssHooks[ prefix + suffix ] = {
  14207. expand: function( value ) {
  14208. var i = 0,
  14209. expanded = {},
  14210. // Assumes a single number if not a string
  14211. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14212. for ( ; i < 4; i++ ) {
  14213. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14214. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14215. }
  14216. return expanded;
  14217. }
  14218. };
  14219. if ( prefix !== "margin" ) {
  14220. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14221. }
  14222. } );
  14223. jQuery.fn.extend( {
  14224. css: function( name, value ) {
  14225. return access( this, function( elem, name, value ) {
  14226. var styles, len,
  14227. map = {},
  14228. i = 0;
  14229. if ( Array.isArray( name ) ) {
  14230. styles = getStyles( elem );
  14231. len = name.length;
  14232. for ( ; i < len; i++ ) {
  14233. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14234. }
  14235. return map;
  14236. }
  14237. return value !== undefined ?
  14238. jQuery.style( elem, name, value ) :
  14239. jQuery.css( elem, name );
  14240. }, name, value, arguments.length > 1 );
  14241. }
  14242. } );
  14243. function Tween( elem, options, prop, end, easing ) {
  14244. return new Tween.prototype.init( elem, options, prop, end, easing );
  14245. }
  14246. jQuery.Tween = Tween;
  14247. Tween.prototype = {
  14248. constructor: Tween,
  14249. init: function( elem, options, prop, end, easing, unit ) {
  14250. this.elem = elem;
  14251. this.prop = prop;
  14252. this.easing = easing || jQuery.easing._default;
  14253. this.options = options;
  14254. this.start = this.now = this.cur();
  14255. this.end = end;
  14256. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14257. },
  14258. cur: function() {
  14259. var hooks = Tween.propHooks[ this.prop ];
  14260. return hooks && hooks.get ?
  14261. hooks.get( this ) :
  14262. Tween.propHooks._default.get( this );
  14263. },
  14264. run: function( percent ) {
  14265. var eased,
  14266. hooks = Tween.propHooks[ this.prop ];
  14267. if ( this.options.duration ) {
  14268. this.pos = eased = jQuery.easing[ this.easing ](
  14269. percent, this.options.duration * percent, 0, 1, this.options.duration
  14270. );
  14271. } else {
  14272. this.pos = eased = percent;
  14273. }
  14274. this.now = ( this.end - this.start ) * eased + this.start;
  14275. if ( this.options.step ) {
  14276. this.options.step.call( this.elem, this.now, this );
  14277. }
  14278. if ( hooks && hooks.set ) {
  14279. hooks.set( this );
  14280. } else {
  14281. Tween.propHooks._default.set( this );
  14282. }
  14283. return this;
  14284. }
  14285. };
  14286. Tween.prototype.init.prototype = Tween.prototype;
  14287. Tween.propHooks = {
  14288. _default: {
  14289. get: function( tween ) {
  14290. var result;
  14291. // Use a property on the element directly when it is not a DOM element,
  14292. // or when there is no matching style property that exists.
  14293. if ( tween.elem.nodeType !== 1 ||
  14294. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14295. return tween.elem[ tween.prop ];
  14296. }
  14297. // Passing an empty string as a 3rd parameter to .css will automatically
  14298. // attempt a parseFloat and fallback to a string if the parse fails.
  14299. // Simple values such as "10px" are parsed to Float;
  14300. // complex values such as "rotate(1rad)" are returned as-is.
  14301. result = jQuery.css( tween.elem, tween.prop, "" );
  14302. // Empty strings, null, undefined and "auto" are converted to 0.
  14303. return !result || result === "auto" ? 0 : result;
  14304. },
  14305. set: function( tween ) {
  14306. // Use step hook for back compat.
  14307. // Use cssHook if its there.
  14308. // Use .style if available and use plain properties where available.
  14309. if ( jQuery.fx.step[ tween.prop ] ) {
  14310. jQuery.fx.step[ tween.prop ]( tween );
  14311. } else if ( tween.elem.nodeType === 1 && (
  14312. jQuery.cssHooks[ tween.prop ] ||
  14313. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14314. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14315. } else {
  14316. tween.elem[ tween.prop ] = tween.now;
  14317. }
  14318. }
  14319. }
  14320. };
  14321. // Support: IE <=9 only
  14322. // Panic based approach to setting things on disconnected nodes
  14323. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14324. set: function( tween ) {
  14325. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14326. tween.elem[ tween.prop ] = tween.now;
  14327. }
  14328. }
  14329. };
  14330. jQuery.easing = {
  14331. linear: function( p ) {
  14332. return p;
  14333. },
  14334. swing: function( p ) {
  14335. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14336. },
  14337. _default: "swing"
  14338. };
  14339. jQuery.fx = Tween.prototype.init;
  14340. // Back compat <1.8 extension point
  14341. jQuery.fx.step = {};
  14342. var
  14343. fxNow, inProgress,
  14344. rfxtypes = /^(?:toggle|show|hide)$/,
  14345. rrun = /queueHooks$/;
  14346. function schedule() {
  14347. if ( inProgress ) {
  14348. if ( document.hidden === false && window.requestAnimationFrame ) {
  14349. window.requestAnimationFrame( schedule );
  14350. } else {
  14351. window.setTimeout( schedule, jQuery.fx.interval );
  14352. }
  14353. jQuery.fx.tick();
  14354. }
  14355. }
  14356. // Animations created synchronously will run synchronously
  14357. function createFxNow() {
  14358. window.setTimeout( function() {
  14359. fxNow = undefined;
  14360. } );
  14361. return ( fxNow = Date.now() );
  14362. }
  14363. // Generate parameters to create a standard animation
  14364. function genFx( type, includeWidth ) {
  14365. var which,
  14366. i = 0,
  14367. attrs = { height: type };
  14368. // If we include width, step value is 1 to do all cssExpand values,
  14369. // otherwise step value is 2 to skip over Left and Right
  14370. includeWidth = includeWidth ? 1 : 0;
  14371. for ( ; i < 4; i += 2 - includeWidth ) {
  14372. which = cssExpand[ i ];
  14373. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14374. }
  14375. if ( includeWidth ) {
  14376. attrs.opacity = attrs.width = type;
  14377. }
  14378. return attrs;
  14379. }
  14380. function createTween( value, prop, animation ) {
  14381. var tween,
  14382. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14383. index = 0,
  14384. length = collection.length;
  14385. for ( ; index < length; index++ ) {
  14386. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14387. // We're done with this property
  14388. return tween;
  14389. }
  14390. }
  14391. }
  14392. function defaultPrefilter( elem, props, opts ) {
  14393. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14394. isBox = "width" in props || "height" in props,
  14395. anim = this,
  14396. orig = {},
  14397. style = elem.style,
  14398. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14399. dataShow = dataPriv.get( elem, "fxshow" );
  14400. // Queue-skipping animations hijack the fx hooks
  14401. if ( !opts.queue ) {
  14402. hooks = jQuery._queueHooks( elem, "fx" );
  14403. if ( hooks.unqueued == null ) {
  14404. hooks.unqueued = 0;
  14405. oldfire = hooks.empty.fire;
  14406. hooks.empty.fire = function() {
  14407. if ( !hooks.unqueued ) {
  14408. oldfire();
  14409. }
  14410. };
  14411. }
  14412. hooks.unqueued++;
  14413. anim.always( function() {
  14414. // Ensure the complete handler is called before this completes
  14415. anim.always( function() {
  14416. hooks.unqueued--;
  14417. if ( !jQuery.queue( elem, "fx" ).length ) {
  14418. hooks.empty.fire();
  14419. }
  14420. } );
  14421. } );
  14422. }
  14423. // Detect show/hide animations
  14424. for ( prop in props ) {
  14425. value = props[ prop ];
  14426. if ( rfxtypes.test( value ) ) {
  14427. delete props[ prop ];
  14428. toggle = toggle || value === "toggle";
  14429. if ( value === ( hidden ? "hide" : "show" ) ) {
  14430. // Pretend to be hidden if this is a "show" and
  14431. // there is still data from a stopped show/hide
  14432. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14433. hidden = true;
  14434. // Ignore all other no-op show/hide data
  14435. } else {
  14436. continue;
  14437. }
  14438. }
  14439. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14440. }
  14441. }
  14442. // Bail out if this is a no-op like .hide().hide()
  14443. propTween = !jQuery.isEmptyObject( props );
  14444. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14445. return;
  14446. }
  14447. // Restrict "overflow" and "display" styles during box animations
  14448. if ( isBox && elem.nodeType === 1 ) {
  14449. // Support: IE <=9 - 11, Edge 12 - 15
  14450. // Record all 3 overflow attributes because IE does not infer the shorthand
  14451. // from identically-valued overflowX and overflowY and Edge just mirrors
  14452. // the overflowX value there.
  14453. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14454. // Identify a display type, preferring old show/hide data over the CSS cascade
  14455. restoreDisplay = dataShow && dataShow.display;
  14456. if ( restoreDisplay == null ) {
  14457. restoreDisplay = dataPriv.get( elem, "display" );
  14458. }
  14459. display = jQuery.css( elem, "display" );
  14460. if ( display === "none" ) {
  14461. if ( restoreDisplay ) {
  14462. display = restoreDisplay;
  14463. } else {
  14464. // Get nonempty value(s) by temporarily forcing visibility
  14465. showHide( [ elem ], true );
  14466. restoreDisplay = elem.style.display || restoreDisplay;
  14467. display = jQuery.css( elem, "display" );
  14468. showHide( [ elem ] );
  14469. }
  14470. }
  14471. // Animate inline elements as inline-block
  14472. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14473. if ( jQuery.css( elem, "float" ) === "none" ) {
  14474. // Restore the original display value at the end of pure show/hide animations
  14475. if ( !propTween ) {
  14476. anim.done( function() {
  14477. style.display = restoreDisplay;
  14478. } );
  14479. if ( restoreDisplay == null ) {
  14480. display = style.display;
  14481. restoreDisplay = display === "none" ? "" : display;
  14482. }
  14483. }
  14484. style.display = "inline-block";
  14485. }
  14486. }
  14487. }
  14488. if ( opts.overflow ) {
  14489. style.overflow = "hidden";
  14490. anim.always( function() {
  14491. style.overflow = opts.overflow[ 0 ];
  14492. style.overflowX = opts.overflow[ 1 ];
  14493. style.overflowY = opts.overflow[ 2 ];
  14494. } );
  14495. }
  14496. // Implement show/hide animations
  14497. propTween = false;
  14498. for ( prop in orig ) {
  14499. // General show/hide setup for this element animation
  14500. if ( !propTween ) {
  14501. if ( dataShow ) {
  14502. if ( "hidden" in dataShow ) {
  14503. hidden = dataShow.hidden;
  14504. }
  14505. } else {
  14506. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14507. }
  14508. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14509. if ( toggle ) {
  14510. dataShow.hidden = !hidden;
  14511. }
  14512. // Show elements before animating them
  14513. if ( hidden ) {
  14514. showHide( [ elem ], true );
  14515. }
  14516. /* eslint-disable no-loop-func */
  14517. anim.done( function() {
  14518. /* eslint-enable no-loop-func */
  14519. // The final step of a "hide" animation is actually hiding the element
  14520. if ( !hidden ) {
  14521. showHide( [ elem ] );
  14522. }
  14523. dataPriv.remove( elem, "fxshow" );
  14524. for ( prop in orig ) {
  14525. jQuery.style( elem, prop, orig[ prop ] );
  14526. }
  14527. } );
  14528. }
  14529. // Per-property setup
  14530. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14531. if ( !( prop in dataShow ) ) {
  14532. dataShow[ prop ] = propTween.start;
  14533. if ( hidden ) {
  14534. propTween.end = propTween.start;
  14535. propTween.start = 0;
  14536. }
  14537. }
  14538. }
  14539. }
  14540. function propFilter( props, specialEasing ) {
  14541. var index, name, easing, value, hooks;
  14542. // camelCase, specialEasing and expand cssHook pass
  14543. for ( index in props ) {
  14544. name = camelCase( index );
  14545. easing = specialEasing[ name ];
  14546. value = props[ index ];
  14547. if ( Array.isArray( value ) ) {
  14548. easing = value[ 1 ];
  14549. value = props[ index ] = value[ 0 ];
  14550. }
  14551. if ( index !== name ) {
  14552. props[ name ] = value;
  14553. delete props[ index ];
  14554. }
  14555. hooks = jQuery.cssHooks[ name ];
  14556. if ( hooks && "expand" in hooks ) {
  14557. value = hooks.expand( value );
  14558. delete props[ name ];
  14559. // Not quite $.extend, this won't overwrite existing keys.
  14560. // Reusing 'index' because we have the correct "name"
  14561. for ( index in value ) {
  14562. if ( !( index in props ) ) {
  14563. props[ index ] = value[ index ];
  14564. specialEasing[ index ] = easing;
  14565. }
  14566. }
  14567. } else {
  14568. specialEasing[ name ] = easing;
  14569. }
  14570. }
  14571. }
  14572. function Animation( elem, properties, options ) {
  14573. var result,
  14574. stopped,
  14575. index = 0,
  14576. length = Animation.prefilters.length,
  14577. deferred = jQuery.Deferred().always( function() {
  14578. // Don't match elem in the :animated selector
  14579. delete tick.elem;
  14580. } ),
  14581. tick = function() {
  14582. if ( stopped ) {
  14583. return false;
  14584. }
  14585. var currentTime = fxNow || createFxNow(),
  14586. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14587. // Support: Android 2.3 only
  14588. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14589. temp = remaining / animation.duration || 0,
  14590. percent = 1 - temp,
  14591. index = 0,
  14592. length = animation.tweens.length;
  14593. for ( ; index < length; index++ ) {
  14594. animation.tweens[ index ].run( percent );
  14595. }
  14596. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14597. // If there's more to do, yield
  14598. if ( percent < 1 && length ) {
  14599. return remaining;
  14600. }
  14601. // If this was an empty animation, synthesize a final progress notification
  14602. if ( !length ) {
  14603. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14604. }
  14605. // Resolve the animation and report its conclusion
  14606. deferred.resolveWith( elem, [ animation ] );
  14607. return false;
  14608. },
  14609. animation = deferred.promise( {
  14610. elem: elem,
  14611. props: jQuery.extend( {}, properties ),
  14612. opts: jQuery.extend( true, {
  14613. specialEasing: {},
  14614. easing: jQuery.easing._default
  14615. }, options ),
  14616. originalProperties: properties,
  14617. originalOptions: options,
  14618. startTime: fxNow || createFxNow(),
  14619. duration: options.duration,
  14620. tweens: [],
  14621. createTween: function( prop, end ) {
  14622. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14623. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14624. animation.tweens.push( tween );
  14625. return tween;
  14626. },
  14627. stop: function( gotoEnd ) {
  14628. var index = 0,
  14629. // If we are going to the end, we want to run all the tweens
  14630. // otherwise we skip this part
  14631. length = gotoEnd ? animation.tweens.length : 0;
  14632. if ( stopped ) {
  14633. return this;
  14634. }
  14635. stopped = true;
  14636. for ( ; index < length; index++ ) {
  14637. animation.tweens[ index ].run( 1 );
  14638. }
  14639. // Resolve when we played the last frame; otherwise, reject
  14640. if ( gotoEnd ) {
  14641. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14642. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14643. } else {
  14644. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14645. }
  14646. return this;
  14647. }
  14648. } ),
  14649. props = animation.props;
  14650. propFilter( props, animation.opts.specialEasing );
  14651. for ( ; index < length; index++ ) {
  14652. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14653. if ( result ) {
  14654. if ( isFunction( result.stop ) ) {
  14655. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14656. result.stop.bind( result );
  14657. }
  14658. return result;
  14659. }
  14660. }
  14661. jQuery.map( props, createTween, animation );
  14662. if ( isFunction( animation.opts.start ) ) {
  14663. animation.opts.start.call( elem, animation );
  14664. }
  14665. // Attach callbacks from options
  14666. animation
  14667. .progress( animation.opts.progress )
  14668. .done( animation.opts.done, animation.opts.complete )
  14669. .fail( animation.opts.fail )
  14670. .always( animation.opts.always );
  14671. jQuery.fx.timer(
  14672. jQuery.extend( tick, {
  14673. elem: elem,
  14674. anim: animation,
  14675. queue: animation.opts.queue
  14676. } )
  14677. );
  14678. return animation;
  14679. }
  14680. jQuery.Animation = jQuery.extend( Animation, {
  14681. tweeners: {
  14682. "*": [ function( prop, value ) {
  14683. var tween = this.createTween( prop, value );
  14684. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14685. return tween;
  14686. } ]
  14687. },
  14688. tweener: function( props, callback ) {
  14689. if ( isFunction( props ) ) {
  14690. callback = props;
  14691. props = [ "*" ];
  14692. } else {
  14693. props = props.match( rnothtmlwhite );
  14694. }
  14695. var prop,
  14696. index = 0,
  14697. length = props.length;
  14698. for ( ; index < length; index++ ) {
  14699. prop = props[ index ];
  14700. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14701. Animation.tweeners[ prop ].unshift( callback );
  14702. }
  14703. },
  14704. prefilters: [ defaultPrefilter ],
  14705. prefilter: function( callback, prepend ) {
  14706. if ( prepend ) {
  14707. Animation.prefilters.unshift( callback );
  14708. } else {
  14709. Animation.prefilters.push( callback );
  14710. }
  14711. }
  14712. } );
  14713. jQuery.speed = function( speed, easing, fn ) {
  14714. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14715. complete: fn || !fn && easing ||
  14716. isFunction( speed ) && speed,
  14717. duration: speed,
  14718. easing: fn && easing || easing && !isFunction( easing ) && easing
  14719. };
  14720. // Go to the end state if fx are off
  14721. if ( jQuery.fx.off ) {
  14722. opt.duration = 0;
  14723. } else {
  14724. if ( typeof opt.duration !== "number" ) {
  14725. if ( opt.duration in jQuery.fx.speeds ) {
  14726. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14727. } else {
  14728. opt.duration = jQuery.fx.speeds._default;
  14729. }
  14730. }
  14731. }
  14732. // Normalize opt.queue - true/undefined/null -> "fx"
  14733. if ( opt.queue == null || opt.queue === true ) {
  14734. opt.queue = "fx";
  14735. }
  14736. // Queueing
  14737. opt.old = opt.complete;
  14738. opt.complete = function() {
  14739. if ( isFunction( opt.old ) ) {
  14740. opt.old.call( this );
  14741. }
  14742. if ( opt.queue ) {
  14743. jQuery.dequeue( this, opt.queue );
  14744. }
  14745. };
  14746. return opt;
  14747. };
  14748. jQuery.fn.extend( {
  14749. fadeTo: function( speed, to, easing, callback ) {
  14750. // Show any hidden elements after setting opacity to 0
  14751. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14752. // Animate to the value specified
  14753. .end().animate( { opacity: to }, speed, easing, callback );
  14754. },
  14755. animate: function( prop, speed, easing, callback ) {
  14756. var empty = jQuery.isEmptyObject( prop ),
  14757. optall = jQuery.speed( speed, easing, callback ),
  14758. doAnimation = function() {
  14759. // Operate on a copy of prop so per-property easing won't be lost
  14760. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14761. // Empty animations, or finishing resolves immediately
  14762. if ( empty || dataPriv.get( this, "finish" ) ) {
  14763. anim.stop( true );
  14764. }
  14765. };
  14766. doAnimation.finish = doAnimation;
  14767. return empty || optall.queue === false ?
  14768. this.each( doAnimation ) :
  14769. this.queue( optall.queue, doAnimation );
  14770. },
  14771. stop: function( type, clearQueue, gotoEnd ) {
  14772. var stopQueue = function( hooks ) {
  14773. var stop = hooks.stop;
  14774. delete hooks.stop;
  14775. stop( gotoEnd );
  14776. };
  14777. if ( typeof type !== "string" ) {
  14778. gotoEnd = clearQueue;
  14779. clearQueue = type;
  14780. type = undefined;
  14781. }
  14782. if ( clearQueue && type !== false ) {
  14783. this.queue( type || "fx", [] );
  14784. }
  14785. return this.each( function() {
  14786. var dequeue = true,
  14787. index = type != null && type + "queueHooks",
  14788. timers = jQuery.timers,
  14789. data = dataPriv.get( this );
  14790. if ( index ) {
  14791. if ( data[ index ] && data[ index ].stop ) {
  14792. stopQueue( data[ index ] );
  14793. }
  14794. } else {
  14795. for ( index in data ) {
  14796. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14797. stopQueue( data[ index ] );
  14798. }
  14799. }
  14800. }
  14801. for ( index = timers.length; index--; ) {
  14802. if ( timers[ index ].elem === this &&
  14803. ( type == null || timers[ index ].queue === type ) ) {
  14804. timers[ index ].anim.stop( gotoEnd );
  14805. dequeue = false;
  14806. timers.splice( index, 1 );
  14807. }
  14808. }
  14809. // Start the next in the queue if the last step wasn't forced.
  14810. // Timers currently will call their complete callbacks, which
  14811. // will dequeue but only if they were gotoEnd.
  14812. if ( dequeue || !gotoEnd ) {
  14813. jQuery.dequeue( this, type );
  14814. }
  14815. } );
  14816. },
  14817. finish: function( type ) {
  14818. if ( type !== false ) {
  14819. type = type || "fx";
  14820. }
  14821. return this.each( function() {
  14822. var index,
  14823. data = dataPriv.get( this ),
  14824. queue = data[ type + "queue" ],
  14825. hooks = data[ type + "queueHooks" ],
  14826. timers = jQuery.timers,
  14827. length = queue ? queue.length : 0;
  14828. // Enable finishing flag on private data
  14829. data.finish = true;
  14830. // Empty the queue first
  14831. jQuery.queue( this, type, [] );
  14832. if ( hooks && hooks.stop ) {
  14833. hooks.stop.call( this, true );
  14834. }
  14835. // Look for any active animations, and finish them
  14836. for ( index = timers.length; index--; ) {
  14837. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14838. timers[ index ].anim.stop( true );
  14839. timers.splice( index, 1 );
  14840. }
  14841. }
  14842. // Look for any animations in the old queue and finish them
  14843. for ( index = 0; index < length; index++ ) {
  14844. if ( queue[ index ] && queue[ index ].finish ) {
  14845. queue[ index ].finish.call( this );
  14846. }
  14847. }
  14848. // Turn off finishing flag
  14849. delete data.finish;
  14850. } );
  14851. }
  14852. } );
  14853. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14854. var cssFn = jQuery.fn[ name ];
  14855. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14856. return speed == null || typeof speed === "boolean" ?
  14857. cssFn.apply( this, arguments ) :
  14858. this.animate( genFx( name, true ), speed, easing, callback );
  14859. };
  14860. } );
  14861. // Generate shortcuts for custom animations
  14862. jQuery.each( {
  14863. slideDown: genFx( "show" ),
  14864. slideUp: genFx( "hide" ),
  14865. slideToggle: genFx( "toggle" ),
  14866. fadeIn: { opacity: "show" },
  14867. fadeOut: { opacity: "hide" },
  14868. fadeToggle: { opacity: "toggle" }
  14869. }, function( name, props ) {
  14870. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14871. return this.animate( props, speed, easing, callback );
  14872. };
  14873. } );
  14874. jQuery.timers = [];
  14875. jQuery.fx.tick = function() {
  14876. var timer,
  14877. i = 0,
  14878. timers = jQuery.timers;
  14879. fxNow = Date.now();
  14880. for ( ; i < timers.length; i++ ) {
  14881. timer = timers[ i ];
  14882. // Run the timer and safely remove it when done (allowing for external removal)
  14883. if ( !timer() && timers[ i ] === timer ) {
  14884. timers.splice( i--, 1 );
  14885. }
  14886. }
  14887. if ( !timers.length ) {
  14888. jQuery.fx.stop();
  14889. }
  14890. fxNow = undefined;
  14891. };
  14892. jQuery.fx.timer = function( timer ) {
  14893. jQuery.timers.push( timer );
  14894. jQuery.fx.start();
  14895. };
  14896. jQuery.fx.interval = 13;
  14897. jQuery.fx.start = function() {
  14898. if ( inProgress ) {
  14899. return;
  14900. }
  14901. inProgress = true;
  14902. schedule();
  14903. };
  14904. jQuery.fx.stop = function() {
  14905. inProgress = null;
  14906. };
  14907. jQuery.fx.speeds = {
  14908. slow: 600,
  14909. fast: 200,
  14910. // Default speed
  14911. _default: 400
  14912. };
  14913. // Based off of the plugin by Clint Helfers, with permission.
  14914. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14915. jQuery.fn.delay = function( time, type ) {
  14916. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14917. type = type || "fx";
  14918. return this.queue( type, function( next, hooks ) {
  14919. var timeout = window.setTimeout( next, time );
  14920. hooks.stop = function() {
  14921. window.clearTimeout( timeout );
  14922. };
  14923. } );
  14924. };
  14925. ( function() {
  14926. var input = document.createElement( "input" ),
  14927. select = document.createElement( "select" ),
  14928. opt = select.appendChild( document.createElement( "option" ) );
  14929. input.type = "checkbox";
  14930. // Support: Android <=4.3 only
  14931. // Default value for a checkbox should be "on"
  14932. support.checkOn = input.value !== "";
  14933. // Support: IE <=11 only
  14934. // Must access selectedIndex to make default options select
  14935. support.optSelected = opt.selected;
  14936. // Support: IE <=11 only
  14937. // An input loses its value after becoming a radio
  14938. input = document.createElement( "input" );
  14939. input.value = "t";
  14940. input.type = "radio";
  14941. support.radioValue = input.value === "t";
  14942. } )();
  14943. var boolHook,
  14944. attrHandle = jQuery.expr.attrHandle;
  14945. jQuery.fn.extend( {
  14946. attr: function( name, value ) {
  14947. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14948. },
  14949. removeAttr: function( name ) {
  14950. return this.each( function() {
  14951. jQuery.removeAttr( this, name );
  14952. } );
  14953. }
  14954. } );
  14955. jQuery.extend( {
  14956. attr: function( elem, name, value ) {
  14957. var ret, hooks,
  14958. nType = elem.nodeType;
  14959. // Don't get/set attributes on text, comment and attribute nodes
  14960. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14961. return;
  14962. }
  14963. // Fallback to prop when attributes are not supported
  14964. if ( typeof elem.getAttribute === "undefined" ) {
  14965. return jQuery.prop( elem, name, value );
  14966. }
  14967. // Attribute hooks are determined by the lowercase version
  14968. // Grab necessary hook if one is defined
  14969. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14970. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14971. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14972. }
  14973. if ( value !== undefined ) {
  14974. if ( value === null ) {
  14975. jQuery.removeAttr( elem, name );
  14976. return;
  14977. }
  14978. if ( hooks && "set" in hooks &&
  14979. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14980. return ret;
  14981. }
  14982. elem.setAttribute( name, value + "" );
  14983. return value;
  14984. }
  14985. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14986. return ret;
  14987. }
  14988. ret = jQuery.find.attr( elem, name );
  14989. // Non-existent attributes return null, we normalize to undefined
  14990. return ret == null ? undefined : ret;
  14991. },
  14992. attrHooks: {
  14993. type: {
  14994. set: function( elem, value ) {
  14995. if ( !support.radioValue && value === "radio" &&
  14996. nodeName( elem, "input" ) ) {
  14997. var val = elem.value;
  14998. elem.setAttribute( "type", value );
  14999. if ( val ) {
  15000. elem.value = val;
  15001. }
  15002. return value;
  15003. }
  15004. }
  15005. }
  15006. },
  15007. removeAttr: function( elem, value ) {
  15008. var name,
  15009. i = 0,
  15010. // Attribute names can contain non-HTML whitespace characters
  15011. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15012. attrNames = value && value.match( rnothtmlwhite );
  15013. if ( attrNames && elem.nodeType === 1 ) {
  15014. while ( ( name = attrNames[ i++ ] ) ) {
  15015. elem.removeAttribute( name );
  15016. }
  15017. }
  15018. }
  15019. } );
  15020. // Hooks for boolean attributes
  15021. boolHook = {
  15022. set: function( elem, value, name ) {
  15023. if ( value === false ) {
  15024. // Remove boolean attributes when set to false
  15025. jQuery.removeAttr( elem, name );
  15026. } else {
  15027. elem.setAttribute( name, name );
  15028. }
  15029. return name;
  15030. }
  15031. };
  15032. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15033. var getter = attrHandle[ name ] || jQuery.find.attr;
  15034. attrHandle[ name ] = function( elem, name, isXML ) {
  15035. var ret, handle,
  15036. lowercaseName = name.toLowerCase();
  15037. if ( !isXML ) {
  15038. // Avoid an infinite loop by temporarily removing this function from the getter
  15039. handle = attrHandle[ lowercaseName ];
  15040. attrHandle[ lowercaseName ] = ret;
  15041. ret = getter( elem, name, isXML ) != null ?
  15042. lowercaseName :
  15043. null;
  15044. attrHandle[ lowercaseName ] = handle;
  15045. }
  15046. return ret;
  15047. };
  15048. } );
  15049. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15050. rclickable = /^(?:a|area)$/i;
  15051. jQuery.fn.extend( {
  15052. prop: function( name, value ) {
  15053. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15054. },
  15055. removeProp: function( name ) {
  15056. return this.each( function() {
  15057. delete this[ jQuery.propFix[ name ] || name ];
  15058. } );
  15059. }
  15060. } );
  15061. jQuery.extend( {
  15062. prop: function( elem, name, value ) {
  15063. var ret, hooks,
  15064. nType = elem.nodeType;
  15065. // Don't get/set properties on text, comment and attribute nodes
  15066. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15067. return;
  15068. }
  15069. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15070. // Fix name and attach hooks
  15071. name = jQuery.propFix[ name ] || name;
  15072. hooks = jQuery.propHooks[ name ];
  15073. }
  15074. if ( value !== undefined ) {
  15075. if ( hooks && "set" in hooks &&
  15076. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15077. return ret;
  15078. }
  15079. return ( elem[ name ] = value );
  15080. }
  15081. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15082. return ret;
  15083. }
  15084. return elem[ name ];
  15085. },
  15086. propHooks: {
  15087. tabIndex: {
  15088. get: function( elem ) {
  15089. // Support: IE <=9 - 11 only
  15090. // elem.tabIndex doesn't always return the
  15091. // correct value when it hasn't been explicitly set
  15092. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15093. // Use proper attribute retrieval(#12072)
  15094. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15095. if ( tabindex ) {
  15096. return parseInt( tabindex, 10 );
  15097. }
  15098. if (
  15099. rfocusable.test( elem.nodeName ) ||
  15100. rclickable.test( elem.nodeName ) &&
  15101. elem.href
  15102. ) {
  15103. return 0;
  15104. }
  15105. return -1;
  15106. }
  15107. }
  15108. },
  15109. propFix: {
  15110. "for": "htmlFor",
  15111. "class": "className"
  15112. }
  15113. } );
  15114. // Support: IE <=11 only
  15115. // Accessing the selectedIndex property
  15116. // forces the browser to respect setting selected
  15117. // on the option
  15118. // The getter ensures a default option is selected
  15119. // when in an optgroup
  15120. // eslint rule "no-unused-expressions" is disabled for this code
  15121. // since it considers such accessions noop
  15122. if ( !support.optSelected ) {
  15123. jQuery.propHooks.selected = {
  15124. get: function( elem ) {
  15125. /* eslint no-unused-expressions: "off" */
  15126. var parent = elem.parentNode;
  15127. if ( parent && parent.parentNode ) {
  15128. parent.parentNode.selectedIndex;
  15129. }
  15130. return null;
  15131. },
  15132. set: function( elem ) {
  15133. /* eslint no-unused-expressions: "off" */
  15134. var parent = elem.parentNode;
  15135. if ( parent ) {
  15136. parent.selectedIndex;
  15137. if ( parent.parentNode ) {
  15138. parent.parentNode.selectedIndex;
  15139. }
  15140. }
  15141. }
  15142. };
  15143. }
  15144. jQuery.each( [
  15145. "tabIndex",
  15146. "readOnly",
  15147. "maxLength",
  15148. "cellSpacing",
  15149. "cellPadding",
  15150. "rowSpan",
  15151. "colSpan",
  15152. "useMap",
  15153. "frameBorder",
  15154. "contentEditable"
  15155. ], function() {
  15156. jQuery.propFix[ this.toLowerCase() ] = this;
  15157. } );
  15158. // Strip and collapse whitespace according to HTML spec
  15159. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15160. function stripAndCollapse( value ) {
  15161. var tokens = value.match( rnothtmlwhite ) || [];
  15162. return tokens.join( " " );
  15163. }
  15164. function getClass( elem ) {
  15165. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15166. }
  15167. function classesToArray( value ) {
  15168. if ( Array.isArray( value ) ) {
  15169. return value;
  15170. }
  15171. if ( typeof value === "string" ) {
  15172. return value.match( rnothtmlwhite ) || [];
  15173. }
  15174. return [];
  15175. }
  15176. jQuery.fn.extend( {
  15177. addClass: function( value ) {
  15178. var classes, elem, cur, curValue, clazz, j, finalValue,
  15179. i = 0;
  15180. if ( isFunction( value ) ) {
  15181. return this.each( function( j ) {
  15182. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15183. } );
  15184. }
  15185. classes = classesToArray( value );
  15186. if ( classes.length ) {
  15187. while ( ( elem = this[ i++ ] ) ) {
  15188. curValue = getClass( elem );
  15189. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15190. if ( cur ) {
  15191. j = 0;
  15192. while ( ( clazz = classes[ j++ ] ) ) {
  15193. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15194. cur += clazz + " ";
  15195. }
  15196. }
  15197. // Only assign if different to avoid unneeded rendering.
  15198. finalValue = stripAndCollapse( cur );
  15199. if ( curValue !== finalValue ) {
  15200. elem.setAttribute( "class", finalValue );
  15201. }
  15202. }
  15203. }
  15204. }
  15205. return this;
  15206. },
  15207. removeClass: function( value ) {
  15208. var classes, elem, cur, curValue, clazz, j, finalValue,
  15209. i = 0;
  15210. if ( isFunction( value ) ) {
  15211. return this.each( function( j ) {
  15212. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15213. } );
  15214. }
  15215. if ( !arguments.length ) {
  15216. return this.attr( "class", "" );
  15217. }
  15218. classes = classesToArray( value );
  15219. if ( classes.length ) {
  15220. while ( ( elem = this[ i++ ] ) ) {
  15221. curValue = getClass( elem );
  15222. // This expression is here for better compressibility (see addClass)
  15223. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15224. if ( cur ) {
  15225. j = 0;
  15226. while ( ( clazz = classes[ j++ ] ) ) {
  15227. // Remove *all* instances
  15228. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15229. cur = cur.replace( " " + clazz + " ", " " );
  15230. }
  15231. }
  15232. // Only assign if different to avoid unneeded rendering.
  15233. finalValue = stripAndCollapse( cur );
  15234. if ( curValue !== finalValue ) {
  15235. elem.setAttribute( "class", finalValue );
  15236. }
  15237. }
  15238. }
  15239. }
  15240. return this;
  15241. },
  15242. toggleClass: function( value, stateVal ) {
  15243. var type = typeof value,
  15244. isValidValue = type === "string" || Array.isArray( value );
  15245. if ( typeof stateVal === "boolean" && isValidValue ) {
  15246. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15247. }
  15248. if ( isFunction( value ) ) {
  15249. return this.each( function( i ) {
  15250. jQuery( this ).toggleClass(
  15251. value.call( this, i, getClass( this ), stateVal ),
  15252. stateVal
  15253. );
  15254. } );
  15255. }
  15256. return this.each( function() {
  15257. var className, i, self, classNames;
  15258. if ( isValidValue ) {
  15259. // Toggle individual class names
  15260. i = 0;
  15261. self = jQuery( this );
  15262. classNames = classesToArray( value );
  15263. while ( ( className = classNames[ i++ ] ) ) {
  15264. // Check each className given, space separated list
  15265. if ( self.hasClass( className ) ) {
  15266. self.removeClass( className );
  15267. } else {
  15268. self.addClass( className );
  15269. }
  15270. }
  15271. // Toggle whole class name
  15272. } else if ( value === undefined || type === "boolean" ) {
  15273. className = getClass( this );
  15274. if ( className ) {
  15275. // Store className if set
  15276. dataPriv.set( this, "__className__", className );
  15277. }
  15278. // If the element has a class name or if we're passed `false`,
  15279. // then remove the whole classname (if there was one, the above saved it).
  15280. // Otherwise bring back whatever was previously saved (if anything),
  15281. // falling back to the empty string if nothing was stored.
  15282. if ( this.setAttribute ) {
  15283. this.setAttribute( "class",
  15284. className || value === false ?
  15285. "" :
  15286. dataPriv.get( this, "__className__" ) || ""
  15287. );
  15288. }
  15289. }
  15290. } );
  15291. },
  15292. hasClass: function( selector ) {
  15293. var className, elem,
  15294. i = 0;
  15295. className = " " + selector + " ";
  15296. while ( ( elem = this[ i++ ] ) ) {
  15297. if ( elem.nodeType === 1 &&
  15298. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15299. return true;
  15300. }
  15301. }
  15302. return false;
  15303. }
  15304. } );
  15305. var rreturn = /\r/g;
  15306. jQuery.fn.extend( {
  15307. val: function( value ) {
  15308. var hooks, ret, valueIsFunction,
  15309. elem = this[ 0 ];
  15310. if ( !arguments.length ) {
  15311. if ( elem ) {
  15312. hooks = jQuery.valHooks[ elem.type ] ||
  15313. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15314. if ( hooks &&
  15315. "get" in hooks &&
  15316. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15317. ) {
  15318. return ret;
  15319. }
  15320. ret = elem.value;
  15321. // Handle most common string cases
  15322. if ( typeof ret === "string" ) {
  15323. return ret.replace( rreturn, "" );
  15324. }
  15325. // Handle cases where value is null/undef or number
  15326. return ret == null ? "" : ret;
  15327. }
  15328. return;
  15329. }
  15330. valueIsFunction = isFunction( value );
  15331. return this.each( function( i ) {
  15332. var val;
  15333. if ( this.nodeType !== 1 ) {
  15334. return;
  15335. }
  15336. if ( valueIsFunction ) {
  15337. val = value.call( this, i, jQuery( this ).val() );
  15338. } else {
  15339. val = value;
  15340. }
  15341. // Treat null/undefined as ""; convert numbers to string
  15342. if ( val == null ) {
  15343. val = "";
  15344. } else if ( typeof val === "number" ) {
  15345. val += "";
  15346. } else if ( Array.isArray( val ) ) {
  15347. val = jQuery.map( val, function( value ) {
  15348. return value == null ? "" : value + "";
  15349. } );
  15350. }
  15351. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15352. // If set returns undefined, fall back to normal setting
  15353. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15354. this.value = val;
  15355. }
  15356. } );
  15357. }
  15358. } );
  15359. jQuery.extend( {
  15360. valHooks: {
  15361. option: {
  15362. get: function( elem ) {
  15363. var val = jQuery.find.attr( elem, "value" );
  15364. return val != null ?
  15365. val :
  15366. // Support: IE <=10 - 11 only
  15367. // option.text throws exceptions (#14686, #14858)
  15368. // Strip and collapse whitespace
  15369. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15370. stripAndCollapse( jQuery.text( elem ) );
  15371. }
  15372. },
  15373. select: {
  15374. get: function( elem ) {
  15375. var value, option, i,
  15376. options = elem.options,
  15377. index = elem.selectedIndex,
  15378. one = elem.type === "select-one",
  15379. values = one ? null : [],
  15380. max = one ? index + 1 : options.length;
  15381. if ( index < 0 ) {
  15382. i = max;
  15383. } else {
  15384. i = one ? index : 0;
  15385. }
  15386. // Loop through all the selected options
  15387. for ( ; i < max; i++ ) {
  15388. option = options[ i ];
  15389. // Support: IE <=9 only
  15390. // IE8-9 doesn't update selected after form reset (#2551)
  15391. if ( ( option.selected || i === index ) &&
  15392. // Don't return options that are disabled or in a disabled optgroup
  15393. !option.disabled &&
  15394. ( !option.parentNode.disabled ||
  15395. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15396. // Get the specific value for the option
  15397. value = jQuery( option ).val();
  15398. // We don't need an array for one selects
  15399. if ( one ) {
  15400. return value;
  15401. }
  15402. // Multi-Selects return an array
  15403. values.push( value );
  15404. }
  15405. }
  15406. return values;
  15407. },
  15408. set: function( elem, value ) {
  15409. var optionSet, option,
  15410. options = elem.options,
  15411. values = jQuery.makeArray( value ),
  15412. i = options.length;
  15413. while ( i-- ) {
  15414. option = options[ i ];
  15415. /* eslint-disable no-cond-assign */
  15416. if ( option.selected =
  15417. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15418. ) {
  15419. optionSet = true;
  15420. }
  15421. /* eslint-enable no-cond-assign */
  15422. }
  15423. // Force browsers to behave consistently when non-matching value is set
  15424. if ( !optionSet ) {
  15425. elem.selectedIndex = -1;
  15426. }
  15427. return values;
  15428. }
  15429. }
  15430. }
  15431. } );
  15432. // Radios and checkboxes getter/setter
  15433. jQuery.each( [ "radio", "checkbox" ], function() {
  15434. jQuery.valHooks[ this ] = {
  15435. set: function( elem, value ) {
  15436. if ( Array.isArray( value ) ) {
  15437. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15438. }
  15439. }
  15440. };
  15441. if ( !support.checkOn ) {
  15442. jQuery.valHooks[ this ].get = function( elem ) {
  15443. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15444. };
  15445. }
  15446. } );
  15447. // Return jQuery for attributes-only inclusion
  15448. support.focusin = "onfocusin" in window;
  15449. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15450. stopPropagationCallback = function( e ) {
  15451. e.stopPropagation();
  15452. };
  15453. jQuery.extend( jQuery.event, {
  15454. trigger: function( event, data, elem, onlyHandlers ) {
  15455. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15456. eventPath = [ elem || document ],
  15457. type = hasOwn.call( event, "type" ) ? event.type : event,
  15458. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15459. cur = lastElement = tmp = elem = elem || document;
  15460. // Don't do events on text and comment nodes
  15461. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15462. return;
  15463. }
  15464. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15465. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15466. return;
  15467. }
  15468. if ( type.indexOf( "." ) > -1 ) {
  15469. // Namespaced trigger; create a regexp to match event type in handle()
  15470. namespaces = type.split( "." );
  15471. type = namespaces.shift();
  15472. namespaces.sort();
  15473. }
  15474. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15475. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15476. event = event[ jQuery.expando ] ?
  15477. event :
  15478. new jQuery.Event( type, typeof event === "object" && event );
  15479. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15480. event.isTrigger = onlyHandlers ? 2 : 3;
  15481. event.namespace = namespaces.join( "." );
  15482. event.rnamespace = event.namespace ?
  15483. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15484. null;
  15485. // Clean up the event in case it is being reused
  15486. event.result = undefined;
  15487. if ( !event.target ) {
  15488. event.target = elem;
  15489. }
  15490. // Clone any incoming data and prepend the event, creating the handler arg list
  15491. data = data == null ?
  15492. [ event ] :
  15493. jQuery.makeArray( data, [ event ] );
  15494. // Allow special events to draw outside the lines
  15495. special = jQuery.event.special[ type ] || {};
  15496. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15497. return;
  15498. }
  15499. // Determine event propagation path in advance, per W3C events spec (#9951)
  15500. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15501. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15502. bubbleType = special.delegateType || type;
  15503. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15504. cur = cur.parentNode;
  15505. }
  15506. for ( ; cur; cur = cur.parentNode ) {
  15507. eventPath.push( cur );
  15508. tmp = cur;
  15509. }
  15510. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15511. if ( tmp === ( elem.ownerDocument || document ) ) {
  15512. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15513. }
  15514. }
  15515. // Fire handlers on the event path
  15516. i = 0;
  15517. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15518. lastElement = cur;
  15519. event.type = i > 1 ?
  15520. bubbleType :
  15521. special.bindType || type;
  15522. // jQuery handler
  15523. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15524. dataPriv.get( cur, "handle" );
  15525. if ( handle ) {
  15526. handle.apply( cur, data );
  15527. }
  15528. // Native handler
  15529. handle = ontype && cur[ ontype ];
  15530. if ( handle && handle.apply && acceptData( cur ) ) {
  15531. event.result = handle.apply( cur, data );
  15532. if ( event.result === false ) {
  15533. event.preventDefault();
  15534. }
  15535. }
  15536. }
  15537. event.type = type;
  15538. // If nobody prevented the default action, do it now
  15539. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15540. if ( ( !special._default ||
  15541. special._default.apply( eventPath.pop(), data ) === false ) &&
  15542. acceptData( elem ) ) {
  15543. // Call a native DOM method on the target with the same name as the event.
  15544. // Don't do default actions on window, that's where global variables be (#6170)
  15545. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15546. // Don't re-trigger an onFOO event when we call its FOO() method
  15547. tmp = elem[ ontype ];
  15548. if ( tmp ) {
  15549. elem[ ontype ] = null;
  15550. }
  15551. // Prevent re-triggering of the same event, since we already bubbled it above
  15552. jQuery.event.triggered = type;
  15553. if ( event.isPropagationStopped() ) {
  15554. lastElement.addEventListener( type, stopPropagationCallback );
  15555. }
  15556. elem[ type ]();
  15557. if ( event.isPropagationStopped() ) {
  15558. lastElement.removeEventListener( type, stopPropagationCallback );
  15559. }
  15560. jQuery.event.triggered = undefined;
  15561. if ( tmp ) {
  15562. elem[ ontype ] = tmp;
  15563. }
  15564. }
  15565. }
  15566. }
  15567. return event.result;
  15568. },
  15569. // Piggyback on a donor event to simulate a different one
  15570. // Used only for `focus(in | out)` events
  15571. simulate: function( type, elem, event ) {
  15572. var e = jQuery.extend(
  15573. new jQuery.Event(),
  15574. event,
  15575. {
  15576. type: type,
  15577. isSimulated: true
  15578. }
  15579. );
  15580. jQuery.event.trigger( e, null, elem );
  15581. }
  15582. } );
  15583. jQuery.fn.extend( {
  15584. trigger: function( type, data ) {
  15585. return this.each( function() {
  15586. jQuery.event.trigger( type, data, this );
  15587. } );
  15588. },
  15589. triggerHandler: function( type, data ) {
  15590. var elem = this[ 0 ];
  15591. if ( elem ) {
  15592. return jQuery.event.trigger( type, data, elem, true );
  15593. }
  15594. }
  15595. } );
  15596. // Support: Firefox <=44
  15597. // Firefox doesn't have focus(in | out) events
  15598. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15599. //
  15600. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15601. // focus(in | out) events fire after focus & blur events,
  15602. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15603. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15604. if ( !support.focusin ) {
  15605. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15606. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15607. var handler = function( event ) {
  15608. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15609. };
  15610. jQuery.event.special[ fix ] = {
  15611. setup: function() {
  15612. var doc = this.ownerDocument || this,
  15613. attaches = dataPriv.access( doc, fix );
  15614. if ( !attaches ) {
  15615. doc.addEventListener( orig, handler, true );
  15616. }
  15617. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15618. },
  15619. teardown: function() {
  15620. var doc = this.ownerDocument || this,
  15621. attaches = dataPriv.access( doc, fix ) - 1;
  15622. if ( !attaches ) {
  15623. doc.removeEventListener( orig, handler, true );
  15624. dataPriv.remove( doc, fix );
  15625. } else {
  15626. dataPriv.access( doc, fix, attaches );
  15627. }
  15628. }
  15629. };
  15630. } );
  15631. }
  15632. var location = window.location;
  15633. var nonce = Date.now();
  15634. var rquery = ( /\?/ );
  15635. // Cross-browser xml parsing
  15636. jQuery.parseXML = function( data ) {
  15637. var xml;
  15638. if ( !data || typeof data !== "string" ) {
  15639. return null;
  15640. }
  15641. // Support: IE 9 - 11 only
  15642. // IE throws on parseFromString with invalid input.
  15643. try {
  15644. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15645. } catch ( e ) {
  15646. xml = undefined;
  15647. }
  15648. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15649. jQuery.error( "Invalid XML: " + data );
  15650. }
  15651. return xml;
  15652. };
  15653. var
  15654. rbracket = /\[\]$/,
  15655. rCRLF = /\r?\n/g,
  15656. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15657. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15658. function buildParams( prefix, obj, traditional, add ) {
  15659. var name;
  15660. if ( Array.isArray( obj ) ) {
  15661. // Serialize array item.
  15662. jQuery.each( obj, function( i, v ) {
  15663. if ( traditional || rbracket.test( prefix ) ) {
  15664. // Treat each array item as a scalar.
  15665. add( prefix, v );
  15666. } else {
  15667. // Item is non-scalar (array or object), encode its numeric index.
  15668. buildParams(
  15669. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15670. v,
  15671. traditional,
  15672. add
  15673. );
  15674. }
  15675. } );
  15676. } else if ( !traditional && toType( obj ) === "object" ) {
  15677. // Serialize object item.
  15678. for ( name in obj ) {
  15679. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15680. }
  15681. } else {
  15682. // Serialize scalar item.
  15683. add( prefix, obj );
  15684. }
  15685. }
  15686. // Serialize an array of form elements or a set of
  15687. // key/values into a query string
  15688. jQuery.param = function( a, traditional ) {
  15689. var prefix,
  15690. s = [],
  15691. add = function( key, valueOrFunction ) {
  15692. // If value is a function, invoke it and use its return value
  15693. var value = isFunction( valueOrFunction ) ?
  15694. valueOrFunction() :
  15695. valueOrFunction;
  15696. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15697. encodeURIComponent( value == null ? "" : value );
  15698. };
  15699. if ( a == null ) {
  15700. return "";
  15701. }
  15702. // If an array was passed in, assume that it is an array of form elements.
  15703. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15704. // Serialize the form elements
  15705. jQuery.each( a, function() {
  15706. add( this.name, this.value );
  15707. } );
  15708. } else {
  15709. // If traditional, encode the "old" way (the way 1.3.2 or older
  15710. // did it), otherwise encode params recursively.
  15711. for ( prefix in a ) {
  15712. buildParams( prefix, a[ prefix ], traditional, add );
  15713. }
  15714. }
  15715. // Return the resulting serialization
  15716. return s.join( "&" );
  15717. };
  15718. jQuery.fn.extend( {
  15719. serialize: function() {
  15720. return jQuery.param( this.serializeArray() );
  15721. },
  15722. serializeArray: function() {
  15723. return this.map( function() {
  15724. // Can add propHook for "elements" to filter or add form elements
  15725. var elements = jQuery.prop( this, "elements" );
  15726. return elements ? jQuery.makeArray( elements ) : this;
  15727. } )
  15728. .filter( function() {
  15729. var type = this.type;
  15730. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15731. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15732. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15733. ( this.checked || !rcheckableType.test( type ) );
  15734. } )
  15735. .map( function( i, elem ) {
  15736. var val = jQuery( this ).val();
  15737. if ( val == null ) {
  15738. return null;
  15739. }
  15740. if ( Array.isArray( val ) ) {
  15741. return jQuery.map( val, function( val ) {
  15742. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15743. } );
  15744. }
  15745. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15746. } ).get();
  15747. }
  15748. } );
  15749. var
  15750. r20 = /%20/g,
  15751. rhash = /#.*$/,
  15752. rantiCache = /([?&])_=[^&]*/,
  15753. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15754. // #7653, #8125, #8152: local protocol detection
  15755. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15756. rnoContent = /^(?:GET|HEAD)$/,
  15757. rprotocol = /^\/\//,
  15758. /* Prefilters
  15759. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15760. * 2) These are called:
  15761. * - BEFORE asking for a transport
  15762. * - AFTER param serialization (s.data is a string if s.processData is true)
  15763. * 3) key is the dataType
  15764. * 4) the catchall symbol "*" can be used
  15765. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15766. */
  15767. prefilters = {},
  15768. /* Transports bindings
  15769. * 1) key is the dataType
  15770. * 2) the catchall symbol "*" can be used
  15771. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15772. */
  15773. transports = {},
  15774. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15775. allTypes = "*/".concat( "*" ),
  15776. // Anchor tag for parsing the document origin
  15777. originAnchor = document.createElement( "a" );
  15778. originAnchor.href = location.href;
  15779. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15780. function addToPrefiltersOrTransports( structure ) {
  15781. // dataTypeExpression is optional and defaults to "*"
  15782. return function( dataTypeExpression, func ) {
  15783. if ( typeof dataTypeExpression !== "string" ) {
  15784. func = dataTypeExpression;
  15785. dataTypeExpression = "*";
  15786. }
  15787. var dataType,
  15788. i = 0,
  15789. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15790. if ( isFunction( func ) ) {
  15791. // For each dataType in the dataTypeExpression
  15792. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15793. // Prepend if requested
  15794. if ( dataType[ 0 ] === "+" ) {
  15795. dataType = dataType.slice( 1 ) || "*";
  15796. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15797. // Otherwise append
  15798. } else {
  15799. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15800. }
  15801. }
  15802. }
  15803. };
  15804. }
  15805. // Base inspection function for prefilters and transports
  15806. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15807. var inspected = {},
  15808. seekingTransport = ( structure === transports );
  15809. function inspect( dataType ) {
  15810. var selected;
  15811. inspected[ dataType ] = true;
  15812. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15813. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15814. if ( typeof dataTypeOrTransport === "string" &&
  15815. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15816. options.dataTypes.unshift( dataTypeOrTransport );
  15817. inspect( dataTypeOrTransport );
  15818. return false;
  15819. } else if ( seekingTransport ) {
  15820. return !( selected = dataTypeOrTransport );
  15821. }
  15822. } );
  15823. return selected;
  15824. }
  15825. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15826. }
  15827. // A special extend for ajax options
  15828. // that takes "flat" options (not to be deep extended)
  15829. // Fixes #9887
  15830. function ajaxExtend( target, src ) {
  15831. var key, deep,
  15832. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15833. for ( key in src ) {
  15834. if ( src[ key ] !== undefined ) {
  15835. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15836. }
  15837. }
  15838. if ( deep ) {
  15839. jQuery.extend( true, target, deep );
  15840. }
  15841. return target;
  15842. }
  15843. /* Handles responses to an ajax request:
  15844. * - finds the right dataType (mediates between content-type and expected dataType)
  15845. * - returns the corresponding response
  15846. */
  15847. function ajaxHandleResponses( s, jqXHR, responses ) {
  15848. var ct, type, finalDataType, firstDataType,
  15849. contents = s.contents,
  15850. dataTypes = s.dataTypes;
  15851. // Remove auto dataType and get content-type in the process
  15852. while ( dataTypes[ 0 ] === "*" ) {
  15853. dataTypes.shift();
  15854. if ( ct === undefined ) {
  15855. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15856. }
  15857. }
  15858. // Check if we're dealing with a known content-type
  15859. if ( ct ) {
  15860. for ( type in contents ) {
  15861. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15862. dataTypes.unshift( type );
  15863. break;
  15864. }
  15865. }
  15866. }
  15867. // Check to see if we have a response for the expected dataType
  15868. if ( dataTypes[ 0 ] in responses ) {
  15869. finalDataType = dataTypes[ 0 ];
  15870. } else {
  15871. // Try convertible dataTypes
  15872. for ( type in responses ) {
  15873. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15874. finalDataType = type;
  15875. break;
  15876. }
  15877. if ( !firstDataType ) {
  15878. firstDataType = type;
  15879. }
  15880. }
  15881. // Or just use first one
  15882. finalDataType = finalDataType || firstDataType;
  15883. }
  15884. // If we found a dataType
  15885. // We add the dataType to the list if needed
  15886. // and return the corresponding response
  15887. if ( finalDataType ) {
  15888. if ( finalDataType !== dataTypes[ 0 ] ) {
  15889. dataTypes.unshift( finalDataType );
  15890. }
  15891. return responses[ finalDataType ];
  15892. }
  15893. }
  15894. /* Chain conversions given the request and the original response
  15895. * Also sets the responseXXX fields on the jqXHR instance
  15896. */
  15897. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15898. var conv2, current, conv, tmp, prev,
  15899. converters = {},
  15900. // Work with a copy of dataTypes in case we need to modify it for conversion
  15901. dataTypes = s.dataTypes.slice();
  15902. // Create converters map with lowercased keys
  15903. if ( dataTypes[ 1 ] ) {
  15904. for ( conv in s.converters ) {
  15905. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15906. }
  15907. }
  15908. current = dataTypes.shift();
  15909. // Convert to each sequential dataType
  15910. while ( current ) {
  15911. if ( s.responseFields[ current ] ) {
  15912. jqXHR[ s.responseFields[ current ] ] = response;
  15913. }
  15914. // Apply the dataFilter if provided
  15915. if ( !prev && isSuccess && s.dataFilter ) {
  15916. response = s.dataFilter( response, s.dataType );
  15917. }
  15918. prev = current;
  15919. current = dataTypes.shift();
  15920. if ( current ) {
  15921. // There's only work to do if current dataType is non-auto
  15922. if ( current === "*" ) {
  15923. current = prev;
  15924. // Convert response if prev dataType is non-auto and differs from current
  15925. } else if ( prev !== "*" && prev !== current ) {
  15926. // Seek a direct converter
  15927. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15928. // If none found, seek a pair
  15929. if ( !conv ) {
  15930. for ( conv2 in converters ) {
  15931. // If conv2 outputs current
  15932. tmp = conv2.split( " " );
  15933. if ( tmp[ 1 ] === current ) {
  15934. // If prev can be converted to accepted input
  15935. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15936. converters[ "* " + tmp[ 0 ] ];
  15937. if ( conv ) {
  15938. // Condense equivalence converters
  15939. if ( conv === true ) {
  15940. conv = converters[ conv2 ];
  15941. // Otherwise, insert the intermediate dataType
  15942. } else if ( converters[ conv2 ] !== true ) {
  15943. current = tmp[ 0 ];
  15944. dataTypes.unshift( tmp[ 1 ] );
  15945. }
  15946. break;
  15947. }
  15948. }
  15949. }
  15950. }
  15951. // Apply converter (if not an equivalence)
  15952. if ( conv !== true ) {
  15953. // Unless errors are allowed to bubble, catch and return them
  15954. if ( conv && s.throws ) {
  15955. response = conv( response );
  15956. } else {
  15957. try {
  15958. response = conv( response );
  15959. } catch ( e ) {
  15960. return {
  15961. state: "parsererror",
  15962. error: conv ? e : "No conversion from " + prev + " to " + current
  15963. };
  15964. }
  15965. }
  15966. }
  15967. }
  15968. }
  15969. }
  15970. return { state: "success", data: response };
  15971. }
  15972. jQuery.extend( {
  15973. // Counter for holding the number of active queries
  15974. active: 0,
  15975. // Last-Modified header cache for next request
  15976. lastModified: {},
  15977. etag: {},
  15978. ajaxSettings: {
  15979. url: location.href,
  15980. type: "GET",
  15981. isLocal: rlocalProtocol.test( location.protocol ),
  15982. global: true,
  15983. processData: true,
  15984. async: true,
  15985. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15986. /*
  15987. timeout: 0,
  15988. data: null,
  15989. dataType: null,
  15990. username: null,
  15991. password: null,
  15992. cache: null,
  15993. throws: false,
  15994. traditional: false,
  15995. headers: {},
  15996. */
  15997. accepts: {
  15998. "*": allTypes,
  15999. text: "text/plain",
  16000. html: "text/html",
  16001. xml: "application/xml, text/xml",
  16002. json: "application/json, text/javascript"
  16003. },
  16004. contents: {
  16005. xml: /\bxml\b/,
  16006. html: /\bhtml/,
  16007. json: /\bjson\b/
  16008. },
  16009. responseFields: {
  16010. xml: "responseXML",
  16011. text: "responseText",
  16012. json: "responseJSON"
  16013. },
  16014. // Data converters
  16015. // Keys separate source (or catchall "*") and destination types with a single space
  16016. converters: {
  16017. // Convert anything to text
  16018. "* text": String,
  16019. // Text to html (true = no transformation)
  16020. "text html": true,
  16021. // Evaluate text as a json expression
  16022. "text json": JSON.parse,
  16023. // Parse text as xml
  16024. "text xml": jQuery.parseXML
  16025. },
  16026. // For options that shouldn't be deep extended:
  16027. // you can add your own custom options here if
  16028. // and when you create one that shouldn't be
  16029. // deep extended (see ajaxExtend)
  16030. flatOptions: {
  16031. url: true,
  16032. context: true
  16033. }
  16034. },
  16035. // Creates a full fledged settings object into target
  16036. // with both ajaxSettings and settings fields.
  16037. // If target is omitted, writes into ajaxSettings.
  16038. ajaxSetup: function( target, settings ) {
  16039. return settings ?
  16040. // Building a settings object
  16041. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16042. // Extending ajaxSettings
  16043. ajaxExtend( jQuery.ajaxSettings, target );
  16044. },
  16045. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16046. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16047. // Main method
  16048. ajax: function( url, options ) {
  16049. // If url is an object, simulate pre-1.5 signature
  16050. if ( typeof url === "object" ) {
  16051. options = url;
  16052. url = undefined;
  16053. }
  16054. // Force options to be an object
  16055. options = options || {};
  16056. var transport,
  16057. // URL without anti-cache param
  16058. cacheURL,
  16059. // Response headers
  16060. responseHeadersString,
  16061. responseHeaders,
  16062. // timeout handle
  16063. timeoutTimer,
  16064. // Url cleanup var
  16065. urlAnchor,
  16066. // Request state (becomes false upon send and true upon completion)
  16067. completed,
  16068. // To know if global events are to be dispatched
  16069. fireGlobals,
  16070. // Loop variable
  16071. i,
  16072. // uncached part of the url
  16073. uncached,
  16074. // Create the final options object
  16075. s = jQuery.ajaxSetup( {}, options ),
  16076. // Callbacks context
  16077. callbackContext = s.context || s,
  16078. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16079. globalEventContext = s.context &&
  16080. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16081. jQuery( callbackContext ) :
  16082. jQuery.event,
  16083. // Deferreds
  16084. deferred = jQuery.Deferred(),
  16085. completeDeferred = jQuery.Callbacks( "once memory" ),
  16086. // Status-dependent callbacks
  16087. statusCode = s.statusCode || {},
  16088. // Headers (they are sent all at once)
  16089. requestHeaders = {},
  16090. requestHeadersNames = {},
  16091. // Default abort message
  16092. strAbort = "canceled",
  16093. // Fake xhr
  16094. jqXHR = {
  16095. readyState: 0,
  16096. // Builds headers hashtable if needed
  16097. getResponseHeader: function( key ) {
  16098. var match;
  16099. if ( completed ) {
  16100. if ( !responseHeaders ) {
  16101. responseHeaders = {};
  16102. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16103. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16104. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16105. .concat( match[ 2 ] );
  16106. }
  16107. }
  16108. match = responseHeaders[ key.toLowerCase() + " " ];
  16109. }
  16110. return match == null ? null : match.join( ", " );
  16111. },
  16112. // Raw string
  16113. getAllResponseHeaders: function() {
  16114. return completed ? responseHeadersString : null;
  16115. },
  16116. // Caches the header
  16117. setRequestHeader: function( name, value ) {
  16118. if ( completed == null ) {
  16119. name = requestHeadersNames[ name.toLowerCase() ] =
  16120. requestHeadersNames[ name.toLowerCase() ] || name;
  16121. requestHeaders[ name ] = value;
  16122. }
  16123. return this;
  16124. },
  16125. // Overrides response content-type header
  16126. overrideMimeType: function( type ) {
  16127. if ( completed == null ) {
  16128. s.mimeType = type;
  16129. }
  16130. return this;
  16131. },
  16132. // Status-dependent callbacks
  16133. statusCode: function( map ) {
  16134. var code;
  16135. if ( map ) {
  16136. if ( completed ) {
  16137. // Execute the appropriate callbacks
  16138. jqXHR.always( map[ jqXHR.status ] );
  16139. } else {
  16140. // Lazy-add the new callbacks in a way that preserves old ones
  16141. for ( code in map ) {
  16142. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16143. }
  16144. }
  16145. }
  16146. return this;
  16147. },
  16148. // Cancel the request
  16149. abort: function( statusText ) {
  16150. var finalText = statusText || strAbort;
  16151. if ( transport ) {
  16152. transport.abort( finalText );
  16153. }
  16154. done( 0, finalText );
  16155. return this;
  16156. }
  16157. };
  16158. // Attach deferreds
  16159. deferred.promise( jqXHR );
  16160. // Add protocol if not provided (prefilters might expect it)
  16161. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16162. // We also use the url parameter if available
  16163. s.url = ( ( url || s.url || location.href ) + "" )
  16164. .replace( rprotocol, location.protocol + "//" );
  16165. // Alias method option to type as per ticket #12004
  16166. s.type = options.method || options.type || s.method || s.type;
  16167. // Extract dataTypes list
  16168. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16169. // A cross-domain request is in order when the origin doesn't match the current origin.
  16170. if ( s.crossDomain == null ) {
  16171. urlAnchor = document.createElement( "a" );
  16172. // Support: IE <=8 - 11, Edge 12 - 15
  16173. // IE throws exception on accessing the href property if url is malformed,
  16174. // e.g. http://example.com:80x/
  16175. try {
  16176. urlAnchor.href = s.url;
  16177. // Support: IE <=8 - 11 only
  16178. // Anchor's host property isn't correctly set when s.url is relative
  16179. urlAnchor.href = urlAnchor.href;
  16180. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16181. urlAnchor.protocol + "//" + urlAnchor.host;
  16182. } catch ( e ) {
  16183. // If there is an error parsing the URL, assume it is crossDomain,
  16184. // it can be rejected by the transport if it is invalid
  16185. s.crossDomain = true;
  16186. }
  16187. }
  16188. // Convert data if not already a string
  16189. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16190. s.data = jQuery.param( s.data, s.traditional );
  16191. }
  16192. // Apply prefilters
  16193. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16194. // If request was aborted inside a prefilter, stop there
  16195. if ( completed ) {
  16196. return jqXHR;
  16197. }
  16198. // We can fire global events as of now if asked to
  16199. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16200. fireGlobals = jQuery.event && s.global;
  16201. // Watch for a new set of requests
  16202. if ( fireGlobals && jQuery.active++ === 0 ) {
  16203. jQuery.event.trigger( "ajaxStart" );
  16204. }
  16205. // Uppercase the type
  16206. s.type = s.type.toUpperCase();
  16207. // Determine if request has content
  16208. s.hasContent = !rnoContent.test( s.type );
  16209. // Save the URL in case we're toying with the If-Modified-Since
  16210. // and/or If-None-Match header later on
  16211. // Remove hash to simplify url manipulation
  16212. cacheURL = s.url.replace( rhash, "" );
  16213. // More options handling for requests with no content
  16214. if ( !s.hasContent ) {
  16215. // Remember the hash so we can put it back
  16216. uncached = s.url.slice( cacheURL.length );
  16217. // If data is available and should be processed, append data to url
  16218. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16219. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16220. // #9682: remove data so that it's not used in an eventual retry
  16221. delete s.data;
  16222. }
  16223. // Add or update anti-cache param if needed
  16224. if ( s.cache === false ) {
  16225. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16226. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16227. }
  16228. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16229. s.url = cacheURL + uncached;
  16230. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16231. } else if ( s.data && s.processData &&
  16232. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16233. s.data = s.data.replace( r20, "+" );
  16234. }
  16235. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16236. if ( s.ifModified ) {
  16237. if ( jQuery.lastModified[ cacheURL ] ) {
  16238. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16239. }
  16240. if ( jQuery.etag[ cacheURL ] ) {
  16241. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16242. }
  16243. }
  16244. // Set the correct header, if data is being sent
  16245. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16246. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16247. }
  16248. // Set the Accepts header for the server, depending on the dataType
  16249. jqXHR.setRequestHeader(
  16250. "Accept",
  16251. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16252. s.accepts[ s.dataTypes[ 0 ] ] +
  16253. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16254. s.accepts[ "*" ]
  16255. );
  16256. // Check for headers option
  16257. for ( i in s.headers ) {
  16258. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16259. }
  16260. // Allow custom headers/mimetypes and early abort
  16261. if ( s.beforeSend &&
  16262. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16263. // Abort if not done already and return
  16264. return jqXHR.abort();
  16265. }
  16266. // Aborting is no longer a cancellation
  16267. strAbort = "abort";
  16268. // Install callbacks on deferreds
  16269. completeDeferred.add( s.complete );
  16270. jqXHR.done( s.success );
  16271. jqXHR.fail( s.error );
  16272. // Get transport
  16273. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16274. // If no transport, we auto-abort
  16275. if ( !transport ) {
  16276. done( -1, "No Transport" );
  16277. } else {
  16278. jqXHR.readyState = 1;
  16279. // Send global event
  16280. if ( fireGlobals ) {
  16281. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16282. }
  16283. // If request was aborted inside ajaxSend, stop there
  16284. if ( completed ) {
  16285. return jqXHR;
  16286. }
  16287. // Timeout
  16288. if ( s.async && s.timeout > 0 ) {
  16289. timeoutTimer = window.setTimeout( function() {
  16290. jqXHR.abort( "timeout" );
  16291. }, s.timeout );
  16292. }
  16293. try {
  16294. completed = false;
  16295. transport.send( requestHeaders, done );
  16296. } catch ( e ) {
  16297. // Rethrow post-completion exceptions
  16298. if ( completed ) {
  16299. throw e;
  16300. }
  16301. // Propagate others as results
  16302. done( -1, e );
  16303. }
  16304. }
  16305. // Callback for when everything is done
  16306. function done( status, nativeStatusText, responses, headers ) {
  16307. var isSuccess, success, error, response, modified,
  16308. statusText = nativeStatusText;
  16309. // Ignore repeat invocations
  16310. if ( completed ) {
  16311. return;
  16312. }
  16313. completed = true;
  16314. // Clear timeout if it exists
  16315. if ( timeoutTimer ) {
  16316. window.clearTimeout( timeoutTimer );
  16317. }
  16318. // Dereference transport for early garbage collection
  16319. // (no matter how long the jqXHR object will be used)
  16320. transport = undefined;
  16321. // Cache response headers
  16322. responseHeadersString = headers || "";
  16323. // Set readyState
  16324. jqXHR.readyState = status > 0 ? 4 : 0;
  16325. // Determine if successful
  16326. isSuccess = status >= 200 && status < 300 || status === 304;
  16327. // Get response data
  16328. if ( responses ) {
  16329. response = ajaxHandleResponses( s, jqXHR, responses );
  16330. }
  16331. // Convert no matter what (that way responseXXX fields are always set)
  16332. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16333. // If successful, handle type chaining
  16334. if ( isSuccess ) {
  16335. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16336. if ( s.ifModified ) {
  16337. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16338. if ( modified ) {
  16339. jQuery.lastModified[ cacheURL ] = modified;
  16340. }
  16341. modified = jqXHR.getResponseHeader( "etag" );
  16342. if ( modified ) {
  16343. jQuery.etag[ cacheURL ] = modified;
  16344. }
  16345. }
  16346. // if no content
  16347. if ( status === 204 || s.type === "HEAD" ) {
  16348. statusText = "nocontent";
  16349. // if not modified
  16350. } else if ( status === 304 ) {
  16351. statusText = "notmodified";
  16352. // If we have data, let's convert it
  16353. } else {
  16354. statusText = response.state;
  16355. success = response.data;
  16356. error = response.error;
  16357. isSuccess = !error;
  16358. }
  16359. } else {
  16360. // Extract error from statusText and normalize for non-aborts
  16361. error = statusText;
  16362. if ( status || !statusText ) {
  16363. statusText = "error";
  16364. if ( status < 0 ) {
  16365. status = 0;
  16366. }
  16367. }
  16368. }
  16369. // Set data for the fake xhr object
  16370. jqXHR.status = status;
  16371. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16372. // Success/Error
  16373. if ( isSuccess ) {
  16374. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16375. } else {
  16376. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16377. }
  16378. // Status-dependent callbacks
  16379. jqXHR.statusCode( statusCode );
  16380. statusCode = undefined;
  16381. if ( fireGlobals ) {
  16382. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16383. [ jqXHR, s, isSuccess ? success : error ] );
  16384. }
  16385. // Complete
  16386. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16387. if ( fireGlobals ) {
  16388. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16389. // Handle the global AJAX counter
  16390. if ( !( --jQuery.active ) ) {
  16391. jQuery.event.trigger( "ajaxStop" );
  16392. }
  16393. }
  16394. }
  16395. return jqXHR;
  16396. },
  16397. getJSON: function( url, data, callback ) {
  16398. return jQuery.get( url, data, callback, "json" );
  16399. },
  16400. getScript: function( url, callback ) {
  16401. return jQuery.get( url, undefined, callback, "script" );
  16402. }
  16403. } );
  16404. jQuery.each( [ "get", "post" ], function( i, method ) {
  16405. jQuery[ method ] = function( url, data, callback, type ) {
  16406. // Shift arguments if data argument was omitted
  16407. if ( isFunction( data ) ) {
  16408. type = type || callback;
  16409. callback = data;
  16410. data = undefined;
  16411. }
  16412. // The url can be an options object (which then must have .url)
  16413. return jQuery.ajax( jQuery.extend( {
  16414. url: url,
  16415. type: method,
  16416. dataType: type,
  16417. data: data,
  16418. success: callback
  16419. }, jQuery.isPlainObject( url ) && url ) );
  16420. };
  16421. } );
  16422. jQuery._evalUrl = function( url, options ) {
  16423. return jQuery.ajax( {
  16424. url: url,
  16425. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16426. type: "GET",
  16427. dataType: "script",
  16428. cache: true,
  16429. async: false,
  16430. global: false,
  16431. // Only evaluate the response if it is successful (gh-4126)
  16432. // dataFilter is not invoked for failure responses, so using it instead
  16433. // of the default converter is kludgy but it works.
  16434. converters: {
  16435. "text script": function() {}
  16436. },
  16437. dataFilter: function( response ) {
  16438. jQuery.globalEval( response, options );
  16439. }
  16440. } );
  16441. };
  16442. jQuery.fn.extend( {
  16443. wrapAll: function( html ) {
  16444. var wrap;
  16445. if ( this[ 0 ] ) {
  16446. if ( isFunction( html ) ) {
  16447. html = html.call( this[ 0 ] );
  16448. }
  16449. // The elements to wrap the target around
  16450. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16451. if ( this[ 0 ].parentNode ) {
  16452. wrap.insertBefore( this[ 0 ] );
  16453. }
  16454. wrap.map( function() {
  16455. var elem = this;
  16456. while ( elem.firstElementChild ) {
  16457. elem = elem.firstElementChild;
  16458. }
  16459. return elem;
  16460. } ).append( this );
  16461. }
  16462. return this;
  16463. },
  16464. wrapInner: function( html ) {
  16465. if ( isFunction( html ) ) {
  16466. return this.each( function( i ) {
  16467. jQuery( this ).wrapInner( html.call( this, i ) );
  16468. } );
  16469. }
  16470. return this.each( function() {
  16471. var self = jQuery( this ),
  16472. contents = self.contents();
  16473. if ( contents.length ) {
  16474. contents.wrapAll( html );
  16475. } else {
  16476. self.append( html );
  16477. }
  16478. } );
  16479. },
  16480. wrap: function( html ) {
  16481. var htmlIsFunction = isFunction( html );
  16482. return this.each( function( i ) {
  16483. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16484. } );
  16485. },
  16486. unwrap: function( selector ) {
  16487. this.parent( selector ).not( "body" ).each( function() {
  16488. jQuery( this ).replaceWith( this.childNodes );
  16489. } );
  16490. return this;
  16491. }
  16492. } );
  16493. jQuery.expr.pseudos.hidden = function( elem ) {
  16494. return !jQuery.expr.pseudos.visible( elem );
  16495. };
  16496. jQuery.expr.pseudos.visible = function( elem ) {
  16497. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16498. };
  16499. jQuery.ajaxSettings.xhr = function() {
  16500. try {
  16501. return new window.XMLHttpRequest();
  16502. } catch ( e ) {}
  16503. };
  16504. var xhrSuccessStatus = {
  16505. // File protocol always yields status code 0, assume 200
  16506. 0: 200,
  16507. // Support: IE <=9 only
  16508. // #1450: sometimes IE returns 1223 when it should be 204
  16509. 1223: 204
  16510. },
  16511. xhrSupported = jQuery.ajaxSettings.xhr();
  16512. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16513. support.ajax = xhrSupported = !!xhrSupported;
  16514. jQuery.ajaxTransport( function( options ) {
  16515. var callback, errorCallback;
  16516. // Cross domain only allowed if supported through XMLHttpRequest
  16517. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16518. return {
  16519. send: function( headers, complete ) {
  16520. var i,
  16521. xhr = options.xhr();
  16522. xhr.open(
  16523. options.type,
  16524. options.url,
  16525. options.async,
  16526. options.username,
  16527. options.password
  16528. );
  16529. // Apply custom fields if provided
  16530. if ( options.xhrFields ) {
  16531. for ( i in options.xhrFields ) {
  16532. xhr[ i ] = options.xhrFields[ i ];
  16533. }
  16534. }
  16535. // Override mime type if needed
  16536. if ( options.mimeType && xhr.overrideMimeType ) {
  16537. xhr.overrideMimeType( options.mimeType );
  16538. }
  16539. // X-Requested-With header
  16540. // For cross-domain requests, seeing as conditions for a preflight are
  16541. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16542. // (it can always be set on a per-request basis or even using ajaxSetup)
  16543. // For same-domain requests, won't change header if already provided.
  16544. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16545. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16546. }
  16547. // Set headers
  16548. for ( i in headers ) {
  16549. xhr.setRequestHeader( i, headers[ i ] );
  16550. }
  16551. // Callback
  16552. callback = function( type ) {
  16553. return function() {
  16554. if ( callback ) {
  16555. callback = errorCallback = xhr.onload =
  16556. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16557. xhr.onreadystatechange = null;
  16558. if ( type === "abort" ) {
  16559. xhr.abort();
  16560. } else if ( type === "error" ) {
  16561. // Support: IE <=9 only
  16562. // On a manual native abort, IE9 throws
  16563. // errors on any property access that is not readyState
  16564. if ( typeof xhr.status !== "number" ) {
  16565. complete( 0, "error" );
  16566. } else {
  16567. complete(
  16568. // File: protocol always yields status 0; see #8605, #14207
  16569. xhr.status,
  16570. xhr.statusText
  16571. );
  16572. }
  16573. } else {
  16574. complete(
  16575. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16576. xhr.statusText,
  16577. // Support: IE <=9 only
  16578. // IE9 has no XHR2 but throws on binary (trac-11426)
  16579. // For XHR2 non-text, let the caller handle it (gh-2498)
  16580. ( xhr.responseType || "text" ) !== "text" ||
  16581. typeof xhr.responseText !== "string" ?
  16582. { binary: xhr.response } :
  16583. { text: xhr.responseText },
  16584. xhr.getAllResponseHeaders()
  16585. );
  16586. }
  16587. }
  16588. };
  16589. };
  16590. // Listen to events
  16591. xhr.onload = callback();
  16592. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16593. // Support: IE 9 only
  16594. // Use onreadystatechange to replace onabort
  16595. // to handle uncaught aborts
  16596. if ( xhr.onabort !== undefined ) {
  16597. xhr.onabort = errorCallback;
  16598. } else {
  16599. xhr.onreadystatechange = function() {
  16600. // Check readyState before timeout as it changes
  16601. if ( xhr.readyState === 4 ) {
  16602. // Allow onerror to be called first,
  16603. // but that will not handle a native abort
  16604. // Also, save errorCallback to a variable
  16605. // as xhr.onerror cannot be accessed
  16606. window.setTimeout( function() {
  16607. if ( callback ) {
  16608. errorCallback();
  16609. }
  16610. } );
  16611. }
  16612. };
  16613. }
  16614. // Create the abort callback
  16615. callback = callback( "abort" );
  16616. try {
  16617. // Do send the request (this may raise an exception)
  16618. xhr.send( options.hasContent && options.data || null );
  16619. } catch ( e ) {
  16620. // #14683: Only rethrow if this hasn't been notified as an error yet
  16621. if ( callback ) {
  16622. throw e;
  16623. }
  16624. }
  16625. },
  16626. abort: function() {
  16627. if ( callback ) {
  16628. callback();
  16629. }
  16630. }
  16631. };
  16632. }
  16633. } );
  16634. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16635. jQuery.ajaxPrefilter( function( s ) {
  16636. if ( s.crossDomain ) {
  16637. s.contents.script = false;
  16638. }
  16639. } );
  16640. // Install script dataType
  16641. jQuery.ajaxSetup( {
  16642. accepts: {
  16643. script: "text/javascript, application/javascript, " +
  16644. "application/ecmascript, application/x-ecmascript"
  16645. },
  16646. contents: {
  16647. script: /\b(?:java|ecma)script\b/
  16648. },
  16649. converters: {
  16650. "text script": function( text ) {
  16651. jQuery.globalEval( text );
  16652. return text;
  16653. }
  16654. }
  16655. } );
  16656. // Handle cache's special case and crossDomain
  16657. jQuery.ajaxPrefilter( "script", function( s ) {
  16658. if ( s.cache === undefined ) {
  16659. s.cache = false;
  16660. }
  16661. if ( s.crossDomain ) {
  16662. s.type = "GET";
  16663. }
  16664. } );
  16665. // Bind script tag hack transport
  16666. jQuery.ajaxTransport( "script", function( s ) {
  16667. // This transport only deals with cross domain or forced-by-attrs requests
  16668. if ( s.crossDomain || s.scriptAttrs ) {
  16669. var script, callback;
  16670. return {
  16671. send: function( _, complete ) {
  16672. script = jQuery( "<script>" )
  16673. .attr( s.scriptAttrs || {} )
  16674. .prop( { charset: s.scriptCharset, src: s.url } )
  16675. .on( "load error", callback = function( evt ) {
  16676. script.remove();
  16677. callback = null;
  16678. if ( evt ) {
  16679. complete( evt.type === "error" ? 404 : 200, evt.type );
  16680. }
  16681. } );
  16682. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16683. document.head.appendChild( script[ 0 ] );
  16684. },
  16685. abort: function() {
  16686. if ( callback ) {
  16687. callback();
  16688. }
  16689. }
  16690. };
  16691. }
  16692. } );
  16693. var oldCallbacks = [],
  16694. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16695. // Default jsonp settings
  16696. jQuery.ajaxSetup( {
  16697. jsonp: "callback",
  16698. jsonpCallback: function() {
  16699. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16700. this[ callback ] = true;
  16701. return callback;
  16702. }
  16703. } );
  16704. // Detect, normalize options and install callbacks for jsonp requests
  16705. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16706. var callbackName, overwritten, responseContainer,
  16707. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16708. "url" :
  16709. typeof s.data === "string" &&
  16710. ( s.contentType || "" )
  16711. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16712. rjsonp.test( s.data ) && "data"
  16713. );
  16714. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16715. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16716. // Get callback name, remembering preexisting value associated with it
  16717. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16718. s.jsonpCallback() :
  16719. s.jsonpCallback;
  16720. // Insert callback into url or form data
  16721. if ( jsonProp ) {
  16722. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16723. } else if ( s.jsonp !== false ) {
  16724. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16725. }
  16726. // Use data converter to retrieve json after script execution
  16727. s.converters[ "script json" ] = function() {
  16728. if ( !responseContainer ) {
  16729. jQuery.error( callbackName + " was not called" );
  16730. }
  16731. return responseContainer[ 0 ];
  16732. };
  16733. // Force json dataType
  16734. s.dataTypes[ 0 ] = "json";
  16735. // Install callback
  16736. overwritten = window[ callbackName ];
  16737. window[ callbackName ] = function() {
  16738. responseContainer = arguments;
  16739. };
  16740. // Clean-up function (fires after converters)
  16741. jqXHR.always( function() {
  16742. // If previous value didn't exist - remove it
  16743. if ( overwritten === undefined ) {
  16744. jQuery( window ).removeProp( callbackName );
  16745. // Otherwise restore preexisting value
  16746. } else {
  16747. window[ callbackName ] = overwritten;
  16748. }
  16749. // Save back as free
  16750. if ( s[ callbackName ] ) {
  16751. // Make sure that re-using the options doesn't screw things around
  16752. s.jsonpCallback = originalSettings.jsonpCallback;
  16753. // Save the callback name for future use
  16754. oldCallbacks.push( callbackName );
  16755. }
  16756. // Call if it was a function and we have a response
  16757. if ( responseContainer && isFunction( overwritten ) ) {
  16758. overwritten( responseContainer[ 0 ] );
  16759. }
  16760. responseContainer = overwritten = undefined;
  16761. } );
  16762. // Delegate to script
  16763. return "script";
  16764. }
  16765. } );
  16766. // Support: Safari 8 only
  16767. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16768. // collapse sibling forms: the second one becomes a child of the first one.
  16769. // Because of that, this security measure has to be disabled in Safari 8.
  16770. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16771. support.createHTMLDocument = ( function() {
  16772. var body = document.implementation.createHTMLDocument( "" ).body;
  16773. body.innerHTML = "<form></form><form></form>";
  16774. return body.childNodes.length === 2;
  16775. } )();
  16776. // Argument "data" should be string of html
  16777. // context (optional): If specified, the fragment will be created in this context,
  16778. // defaults to document
  16779. // keepScripts (optional): If true, will include scripts passed in the html string
  16780. jQuery.parseHTML = function( data, context, keepScripts ) {
  16781. if ( typeof data !== "string" ) {
  16782. return [];
  16783. }
  16784. if ( typeof context === "boolean" ) {
  16785. keepScripts = context;
  16786. context = false;
  16787. }
  16788. var base, parsed, scripts;
  16789. if ( !context ) {
  16790. // Stop scripts or inline event handlers from being executed immediately
  16791. // by using document.implementation
  16792. if ( support.createHTMLDocument ) {
  16793. context = document.implementation.createHTMLDocument( "" );
  16794. // Set the base href for the created document
  16795. // so any parsed elements with URLs
  16796. // are based on the document's URL (gh-2965)
  16797. base = context.createElement( "base" );
  16798. base.href = document.location.href;
  16799. context.head.appendChild( base );
  16800. } else {
  16801. context = document;
  16802. }
  16803. }
  16804. parsed = rsingleTag.exec( data );
  16805. scripts = !keepScripts && [];
  16806. // Single tag
  16807. if ( parsed ) {
  16808. return [ context.createElement( parsed[ 1 ] ) ];
  16809. }
  16810. parsed = buildFragment( [ data ], context, scripts );
  16811. if ( scripts && scripts.length ) {
  16812. jQuery( scripts ).remove();
  16813. }
  16814. return jQuery.merge( [], parsed.childNodes );
  16815. };
  16816. /**
  16817. * Load a url into a page
  16818. */
  16819. jQuery.fn.load = function( url, params, callback ) {
  16820. var selector, type, response,
  16821. self = this,
  16822. off = url.indexOf( " " );
  16823. if ( off > -1 ) {
  16824. selector = stripAndCollapse( url.slice( off ) );
  16825. url = url.slice( 0, off );
  16826. }
  16827. // If it's a function
  16828. if ( isFunction( params ) ) {
  16829. // We assume that it's the callback
  16830. callback = params;
  16831. params = undefined;
  16832. // Otherwise, build a param string
  16833. } else if ( params && typeof params === "object" ) {
  16834. type = "POST";
  16835. }
  16836. // If we have elements to modify, make the request
  16837. if ( self.length > 0 ) {
  16838. jQuery.ajax( {
  16839. url: url,
  16840. // If "type" variable is undefined, then "GET" method will be used.
  16841. // Make value of this field explicit since
  16842. // user can override it through ajaxSetup method
  16843. type: type || "GET",
  16844. dataType: "html",
  16845. data: params
  16846. } ).done( function( responseText ) {
  16847. // Save response for use in complete callback
  16848. response = arguments;
  16849. self.html( selector ?
  16850. // If a selector was specified, locate the right elements in a dummy div
  16851. // Exclude scripts to avoid IE 'Permission Denied' errors
  16852. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16853. // Otherwise use the full result
  16854. responseText );
  16855. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16856. // but they are ignored because response was set above.
  16857. // If it fails, this function gets "jqXHR", "status", "error"
  16858. } ).always( callback && function( jqXHR, status ) {
  16859. self.each( function() {
  16860. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16861. } );
  16862. } );
  16863. }
  16864. return this;
  16865. };
  16866. // Attach a bunch of functions for handling common AJAX events
  16867. jQuery.each( [
  16868. "ajaxStart",
  16869. "ajaxStop",
  16870. "ajaxComplete",
  16871. "ajaxError",
  16872. "ajaxSuccess",
  16873. "ajaxSend"
  16874. ], function( i, type ) {
  16875. jQuery.fn[ type ] = function( fn ) {
  16876. return this.on( type, fn );
  16877. };
  16878. } );
  16879. jQuery.expr.pseudos.animated = function( elem ) {
  16880. return jQuery.grep( jQuery.timers, function( fn ) {
  16881. return elem === fn.elem;
  16882. } ).length;
  16883. };
  16884. jQuery.offset = {
  16885. setOffset: function( elem, options, i ) {
  16886. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16887. position = jQuery.css( elem, "position" ),
  16888. curElem = jQuery( elem ),
  16889. props = {};
  16890. // Set position first, in-case top/left are set even on static elem
  16891. if ( position === "static" ) {
  16892. elem.style.position = "relative";
  16893. }
  16894. curOffset = curElem.offset();
  16895. curCSSTop = jQuery.css( elem, "top" );
  16896. curCSSLeft = jQuery.css( elem, "left" );
  16897. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16898. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16899. // Need to be able to calculate position if either
  16900. // top or left is auto and position is either absolute or fixed
  16901. if ( calculatePosition ) {
  16902. curPosition = curElem.position();
  16903. curTop = curPosition.top;
  16904. curLeft = curPosition.left;
  16905. } else {
  16906. curTop = parseFloat( curCSSTop ) || 0;
  16907. curLeft = parseFloat( curCSSLeft ) || 0;
  16908. }
  16909. if ( isFunction( options ) ) {
  16910. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16911. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16912. }
  16913. if ( options.top != null ) {
  16914. props.top = ( options.top - curOffset.top ) + curTop;
  16915. }
  16916. if ( options.left != null ) {
  16917. props.left = ( options.left - curOffset.left ) + curLeft;
  16918. }
  16919. if ( "using" in options ) {
  16920. options.using.call( elem, props );
  16921. } else {
  16922. curElem.css( props );
  16923. }
  16924. }
  16925. };
  16926. jQuery.fn.extend( {
  16927. // offset() relates an element's border box to the document origin
  16928. offset: function( options ) {
  16929. // Preserve chaining for setter
  16930. if ( arguments.length ) {
  16931. return options === undefined ?
  16932. this :
  16933. this.each( function( i ) {
  16934. jQuery.offset.setOffset( this, options, i );
  16935. } );
  16936. }
  16937. var rect, win,
  16938. elem = this[ 0 ];
  16939. if ( !elem ) {
  16940. return;
  16941. }
  16942. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16943. // Support: IE <=11 only
  16944. // Running getBoundingClientRect on a
  16945. // disconnected node in IE throws an error
  16946. if ( !elem.getClientRects().length ) {
  16947. return { top: 0, left: 0 };
  16948. }
  16949. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16950. rect = elem.getBoundingClientRect();
  16951. win = elem.ownerDocument.defaultView;
  16952. return {
  16953. top: rect.top + win.pageYOffset,
  16954. left: rect.left + win.pageXOffset
  16955. };
  16956. },
  16957. // position() relates an element's margin box to its offset parent's padding box
  16958. // This corresponds to the behavior of CSS absolute positioning
  16959. position: function() {
  16960. if ( !this[ 0 ] ) {
  16961. return;
  16962. }
  16963. var offsetParent, offset, doc,
  16964. elem = this[ 0 ],
  16965. parentOffset = { top: 0, left: 0 };
  16966. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16967. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16968. // Assume position:fixed implies availability of getBoundingClientRect
  16969. offset = elem.getBoundingClientRect();
  16970. } else {
  16971. offset = this.offset();
  16972. // Account for the *real* offset parent, which can be the document or its root element
  16973. // when a statically positioned element is identified
  16974. doc = elem.ownerDocument;
  16975. offsetParent = elem.offsetParent || doc.documentElement;
  16976. while ( offsetParent &&
  16977. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16978. jQuery.css( offsetParent, "position" ) === "static" ) {
  16979. offsetParent = offsetParent.parentNode;
  16980. }
  16981. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16982. // Incorporate borders into its offset, since they are outside its content origin
  16983. parentOffset = jQuery( offsetParent ).offset();
  16984. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16985. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16986. }
  16987. }
  16988. // Subtract parent offsets and element margins
  16989. return {
  16990. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16991. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16992. };
  16993. },
  16994. // This method will return documentElement in the following cases:
  16995. // 1) For the element inside the iframe without offsetParent, this method will return
  16996. // documentElement of the parent window
  16997. // 2) For the hidden or detached element
  16998. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16999. //
  17000. // but those exceptions were never presented as a real life use-cases
  17001. // and might be considered as more preferable results.
  17002. //
  17003. // This logic, however, is not guaranteed and can change at any point in the future
  17004. offsetParent: function() {
  17005. return this.map( function() {
  17006. var offsetParent = this.offsetParent;
  17007. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17008. offsetParent = offsetParent.offsetParent;
  17009. }
  17010. return offsetParent || documentElement;
  17011. } );
  17012. }
  17013. } );
  17014. // Create scrollLeft and scrollTop methods
  17015. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17016. var top = "pageYOffset" === prop;
  17017. jQuery.fn[ method ] = function( val ) {
  17018. return access( this, function( elem, method, val ) {
  17019. // Coalesce documents and windows
  17020. var win;
  17021. if ( isWindow( elem ) ) {
  17022. win = elem;
  17023. } else if ( elem.nodeType === 9 ) {
  17024. win = elem.defaultView;
  17025. }
  17026. if ( val === undefined ) {
  17027. return win ? win[ prop ] : elem[ method ];
  17028. }
  17029. if ( win ) {
  17030. win.scrollTo(
  17031. !top ? val : win.pageXOffset,
  17032. top ? val : win.pageYOffset
  17033. );
  17034. } else {
  17035. elem[ method ] = val;
  17036. }
  17037. }, method, val, arguments.length );
  17038. };
  17039. } );
  17040. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17041. // Add the top/left cssHooks using jQuery.fn.position
  17042. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17043. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17044. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17045. // rather than make the css module depend on the offset module, just check for it here
  17046. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17047. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17048. function( elem, computed ) {
  17049. if ( computed ) {
  17050. computed = curCSS( elem, prop );
  17051. // If curCSS returns percentage, fallback to offset
  17052. return rnumnonpx.test( computed ) ?
  17053. jQuery( elem ).position()[ prop ] + "px" :
  17054. computed;
  17055. }
  17056. }
  17057. );
  17058. } );
  17059. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17060. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17061. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17062. function( defaultExtra, funcName ) {
  17063. // Margin is only for outerHeight, outerWidth
  17064. jQuery.fn[ funcName ] = function( margin, value ) {
  17065. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17066. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17067. return access( this, function( elem, type, value ) {
  17068. var doc;
  17069. if ( isWindow( elem ) ) {
  17070. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17071. return funcName.indexOf( "outer" ) === 0 ?
  17072. elem[ "inner" + name ] :
  17073. elem.document.documentElement[ "client" + name ];
  17074. }
  17075. // Get document width or height
  17076. if ( elem.nodeType === 9 ) {
  17077. doc = elem.documentElement;
  17078. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17079. // whichever is greatest
  17080. return Math.max(
  17081. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17082. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17083. doc[ "client" + name ]
  17084. );
  17085. }
  17086. return value === undefined ?
  17087. // Get width or height on the element, requesting but not forcing parseFloat
  17088. jQuery.css( elem, type, extra ) :
  17089. // Set width or height on the element
  17090. jQuery.style( elem, type, value, extra );
  17091. }, type, chainable ? margin : undefined, chainable );
  17092. };
  17093. } );
  17094. } );
  17095. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17096. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17097. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17098. function( i, name ) {
  17099. // Handle event binding
  17100. jQuery.fn[ name ] = function( data, fn ) {
  17101. return arguments.length > 0 ?
  17102. this.on( name, null, data, fn ) :
  17103. this.trigger( name );
  17104. };
  17105. } );
  17106. jQuery.fn.extend( {
  17107. hover: function( fnOver, fnOut ) {
  17108. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17109. }
  17110. } );
  17111. jQuery.fn.extend( {
  17112. bind: function( types, data, fn ) {
  17113. return this.on( types, null, data, fn );
  17114. },
  17115. unbind: function( types, fn ) {
  17116. return this.off( types, null, fn );
  17117. },
  17118. delegate: function( selector, types, data, fn ) {
  17119. return this.on( types, selector, data, fn );
  17120. },
  17121. undelegate: function( selector, types, fn ) {
  17122. // ( namespace ) or ( selector, types [, fn] )
  17123. return arguments.length === 1 ?
  17124. this.off( selector, "**" ) :
  17125. this.off( types, selector || "**", fn );
  17126. }
  17127. } );
  17128. // Bind a function to a context, optionally partially applying any
  17129. // arguments.
  17130. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17131. // However, it is not slated for removal any time soon
  17132. jQuery.proxy = function( fn, context ) {
  17133. var tmp, args, proxy;
  17134. if ( typeof context === "string" ) {
  17135. tmp = fn[ context ];
  17136. context = fn;
  17137. fn = tmp;
  17138. }
  17139. // Quick check to determine if target is callable, in the spec
  17140. // this throws a TypeError, but we will just return undefined.
  17141. if ( !isFunction( fn ) ) {
  17142. return undefined;
  17143. }
  17144. // Simulated bind
  17145. args = slice.call( arguments, 2 );
  17146. proxy = function() {
  17147. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17148. };
  17149. // Set the guid of unique handler to the same of original handler, so it can be removed
  17150. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17151. return proxy;
  17152. };
  17153. jQuery.holdReady = function( hold ) {
  17154. if ( hold ) {
  17155. jQuery.readyWait++;
  17156. } else {
  17157. jQuery.ready( true );
  17158. }
  17159. };
  17160. jQuery.isArray = Array.isArray;
  17161. jQuery.parseJSON = JSON.parse;
  17162. jQuery.nodeName = nodeName;
  17163. jQuery.isFunction = isFunction;
  17164. jQuery.isWindow = isWindow;
  17165. jQuery.camelCase = camelCase;
  17166. jQuery.type = toType;
  17167. jQuery.now = Date.now;
  17168. jQuery.isNumeric = function( obj ) {
  17169. // As of jQuery 3.0, isNumeric is limited to
  17170. // strings and numbers (primitives or objects)
  17171. // that can be coerced to finite numbers (gh-2662)
  17172. var type = jQuery.type( obj );
  17173. return ( type === "number" || type === "string" ) &&
  17174. // parseFloat NaNs numeric-cast false positives ("")
  17175. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17176. // subtraction forces infinities to NaN
  17177. !isNaN( obj - parseFloat( obj ) );
  17178. };
  17179. // Register as a named AMD module, since jQuery can be concatenated with other
  17180. // files that may use define, but not via a proper concatenation script that
  17181. // understands anonymous AMD modules. A named AMD is safest and most robust
  17182. // way to register. Lowercase jquery is used because AMD module names are
  17183. // derived from file names, and jQuery is normally delivered in a lowercase
  17184. // file name. Do this after creating the global so that if an AMD module wants
  17185. // to call noConflict to hide this version of jQuery, it will work.
  17186. // Note that for maximum portability, libraries that are not jQuery should
  17187. // declare themselves as anonymous modules, and avoid setting a global if an
  17188. // AMD loader is present. jQuery is a special case. For more information, see
  17189. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17190. if ( true ) {
  17191. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17192. return jQuery;
  17193. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17194. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17195. }
  17196. var
  17197. // Map over jQuery in case of overwrite
  17198. _jQuery = window.jQuery,
  17199. // Map over the $ in case of overwrite
  17200. _$ = window.$;
  17201. jQuery.noConflict = function( deep ) {
  17202. if ( window.$ === jQuery ) {
  17203. window.$ = _$;
  17204. }
  17205. if ( deep && window.jQuery === jQuery ) {
  17206. window.jQuery = _jQuery;
  17207. }
  17208. return jQuery;
  17209. };
  17210. // Expose jQuery and $ identifiers, even in AMD
  17211. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17212. // and CommonJS for browser emulators (#13566)
  17213. if ( !noGlobal ) {
  17214. window.jQuery = window.$ = jQuery;
  17215. }
  17216. return jQuery;
  17217. } );
  17218. /***/ }),
  17219. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17220. /*!************************************************!*\
  17221. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17222. \************************************************/
  17223. /*! exports provided: default */
  17224. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17225. "use strict";
  17226. __webpack_require__.r(__webpack_exports__);
  17227. var classCallCheck = function (instance, Constructor) {
  17228. if (!(instance instanceof Constructor)) {
  17229. throw new TypeError("Cannot call a class as a function");
  17230. }
  17231. };
  17232. var createClass = function () {
  17233. function defineProperties(target, props) {
  17234. for (var i = 0; i < props.length; i++) {
  17235. var descriptor = props[i];
  17236. descriptor.enumerable = descriptor.enumerable || false;
  17237. descriptor.configurable = true;
  17238. if ("value" in descriptor) descriptor.writable = true;
  17239. Object.defineProperty(target, descriptor.key, descriptor);
  17240. }
  17241. }
  17242. return function (Constructor, protoProps, staticProps) {
  17243. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17244. if (staticProps) defineProperties(Constructor, staticProps);
  17245. return Constructor;
  17246. };
  17247. }();
  17248. var _extends = Object.assign || function (target) {
  17249. for (var i = 1; i < arguments.length; i++) {
  17250. var source = arguments[i];
  17251. for (var key in source) {
  17252. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17253. target[key] = source[key];
  17254. }
  17255. }
  17256. }
  17257. return target;
  17258. };
  17259. var inherits = function (subClass, superClass) {
  17260. if (typeof superClass !== "function" && superClass !== null) {
  17261. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17262. }
  17263. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17264. constructor: {
  17265. value: subClass,
  17266. enumerable: false,
  17267. writable: true,
  17268. configurable: true
  17269. }
  17270. });
  17271. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17272. };
  17273. var possibleConstructorReturn = function (self, call) {
  17274. if (!self) {
  17275. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17276. }
  17277. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17278. };
  17279. var Connector = function () {
  17280. /**
  17281. * Create a new class instance.
  17282. */
  17283. function Connector(options) {
  17284. classCallCheck(this, Connector);
  17285. /**
  17286. * Default connector options.
  17287. */
  17288. this._defaultOptions = {
  17289. auth: {
  17290. headers: {}
  17291. },
  17292. authEndpoint: '/broadcasting/auth',
  17293. broadcaster: 'pusher',
  17294. csrfToken: null,
  17295. host: null,
  17296. key: null,
  17297. namespace: 'App.Events'
  17298. };
  17299. this.setOptions(options);
  17300. this.connect();
  17301. }
  17302. /**
  17303. * Merge the custom options with the defaults.
  17304. */
  17305. createClass(Connector, [{
  17306. key: 'setOptions',
  17307. value: function setOptions(options) {
  17308. this.options = _extends(this._defaultOptions, options);
  17309. if (this.csrfToken()) {
  17310. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17311. }
  17312. return options;
  17313. }
  17314. /**
  17315. * Extract the CSRF token from the page.
  17316. */
  17317. }, {
  17318. key: 'csrfToken',
  17319. value: function csrfToken() {
  17320. var selector = void 0;
  17321. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17322. return window['Laravel'].csrfToken;
  17323. } else if (this.options.csrfToken) {
  17324. return this.options.csrfToken;
  17325. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17326. return selector.getAttribute('content');
  17327. }
  17328. return null;
  17329. }
  17330. }]);
  17331. return Connector;
  17332. }();
  17333. /**
  17334. * This class represents a basic channel.
  17335. */
  17336. var Channel = function () {
  17337. function Channel() {
  17338. classCallCheck(this, Channel);
  17339. }
  17340. createClass(Channel, [{
  17341. key: 'listenForWhisper',
  17342. /**
  17343. * Listen for a whisper event on the channel instance.
  17344. */
  17345. value: function listenForWhisper(event, callback) {
  17346. return this.listen('.client-' + event, callback);
  17347. }
  17348. /**
  17349. * Listen for an event on the channel instance.
  17350. */
  17351. }, {
  17352. key: 'notification',
  17353. value: function notification(callback) {
  17354. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17355. }
  17356. /**
  17357. * Stop listening for a whispser event on the channel instance.
  17358. */
  17359. }, {
  17360. key: 'stopListeningForWhisper',
  17361. value: function stopListeningForWhisper(event) {
  17362. return this.stopListening('.client-' + event);
  17363. }
  17364. }]);
  17365. return Channel;
  17366. }();
  17367. /**
  17368. * Event name formatter
  17369. */
  17370. var EventFormatter = function () {
  17371. /**
  17372. * Create a new class instance.
  17373. */
  17374. function EventFormatter(namespace) {
  17375. classCallCheck(this, EventFormatter);
  17376. this.setNamespace(namespace);
  17377. }
  17378. /**
  17379. * Format the given event name.
  17380. */
  17381. createClass(EventFormatter, [{
  17382. key: 'format',
  17383. value: function format(event) {
  17384. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17385. return event.substr(1);
  17386. } else if (this.namespace) {
  17387. event = this.namespace + '.' + event;
  17388. }
  17389. return event.replace(/\./g, '\\');
  17390. }
  17391. /**
  17392. * Set the event namespace.
  17393. */
  17394. }, {
  17395. key: 'setNamespace',
  17396. value: function setNamespace(value) {
  17397. this.namespace = value;
  17398. }
  17399. }]);
  17400. return EventFormatter;
  17401. }();
  17402. /**
  17403. * This class represents a Pusher channel.
  17404. */
  17405. var PusherChannel = function (_Channel) {
  17406. inherits(PusherChannel, _Channel);
  17407. /**
  17408. * Create a new class instance.
  17409. */
  17410. function PusherChannel(pusher, name, options) {
  17411. classCallCheck(this, PusherChannel);
  17412. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17413. _this.name = name;
  17414. _this.pusher = pusher;
  17415. _this.options = options;
  17416. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17417. _this.subscribe();
  17418. return _this;
  17419. }
  17420. /**
  17421. * Subscribe to a Pusher channel.
  17422. */
  17423. createClass(PusherChannel, [{
  17424. key: 'subscribe',
  17425. value: function subscribe() {
  17426. this.subscription = this.pusher.subscribe(this.name);
  17427. }
  17428. /**
  17429. * Unsubscribe from a Pusher channel.
  17430. */
  17431. }, {
  17432. key: 'unsubscribe',
  17433. value: function unsubscribe() {
  17434. this.pusher.unsubscribe(this.name);
  17435. }
  17436. /**
  17437. * Listen for an event on the channel instance.
  17438. */
  17439. }, {
  17440. key: 'listen',
  17441. value: function listen(event, callback) {
  17442. this.on(this.eventFormatter.format(event), callback);
  17443. return this;
  17444. }
  17445. /**
  17446. * Stop listening for an event on the channel instance.
  17447. */
  17448. }, {
  17449. key: 'stopListening',
  17450. value: function stopListening(event) {
  17451. this.subscription.unbind(this.eventFormatter.format(event));
  17452. return this;
  17453. }
  17454. /**
  17455. * Bind a channel to an event.
  17456. */
  17457. }, {
  17458. key: 'on',
  17459. value: function on(event, callback) {
  17460. this.subscription.bind(event, callback);
  17461. return this;
  17462. }
  17463. }]);
  17464. return PusherChannel;
  17465. }(Channel);
  17466. /**
  17467. * This class represents a Pusher private channel.
  17468. */
  17469. var PusherPrivateChannel = function (_PusherChannel) {
  17470. inherits(PusherPrivateChannel, _PusherChannel);
  17471. function PusherPrivateChannel() {
  17472. classCallCheck(this, PusherPrivateChannel);
  17473. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17474. }
  17475. createClass(PusherPrivateChannel, [{
  17476. key: 'whisper',
  17477. /**
  17478. * Trigger client event on the channel.
  17479. */
  17480. value: function whisper(eventName, data) {
  17481. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17482. return this;
  17483. }
  17484. }]);
  17485. return PusherPrivateChannel;
  17486. }(PusherChannel);
  17487. /**
  17488. * This class represents a Pusher presence channel.
  17489. */
  17490. var PusherPresenceChannel = function (_PusherChannel) {
  17491. inherits(PusherPresenceChannel, _PusherChannel);
  17492. function PusherPresenceChannel() {
  17493. classCallCheck(this, PusherPresenceChannel);
  17494. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17495. }
  17496. createClass(PusherPresenceChannel, [{
  17497. key: 'here',
  17498. /**
  17499. * Register a callback to be called anytime the member list changes.
  17500. */
  17501. value: function here(callback) {
  17502. this.on('pusher:subscription_succeeded', function (data) {
  17503. callback(Object.keys(data.members).map(function (k) {
  17504. return data.members[k];
  17505. }));
  17506. });
  17507. return this;
  17508. }
  17509. /**
  17510. * Listen for someone joining the channel.
  17511. */
  17512. }, {
  17513. key: 'joining',
  17514. value: function joining(callback) {
  17515. this.on('pusher:member_added', function (member) {
  17516. callback(member.info);
  17517. });
  17518. return this;
  17519. }
  17520. /**
  17521. * Listen for someone leaving the channel.
  17522. */
  17523. }, {
  17524. key: 'leaving',
  17525. value: function leaving(callback) {
  17526. this.on('pusher:member_removed', function (member) {
  17527. callback(member.info);
  17528. });
  17529. return this;
  17530. }
  17531. /**
  17532. * Trigger client event on the channel.
  17533. */
  17534. }, {
  17535. key: 'whisper',
  17536. value: function whisper(eventName, data) {
  17537. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17538. return this;
  17539. }
  17540. }]);
  17541. return PusherPresenceChannel;
  17542. }(PusherChannel);
  17543. /**
  17544. * This class represents a Socket.io channel.
  17545. */
  17546. var SocketIoChannel = function (_Channel) {
  17547. inherits(SocketIoChannel, _Channel);
  17548. /**
  17549. * Create a new class instance.
  17550. */
  17551. function SocketIoChannel(socket, name, options) {
  17552. classCallCheck(this, SocketIoChannel);
  17553. /**
  17554. * The event callbacks applied to the channel.
  17555. */
  17556. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17557. _this.events = {};
  17558. _this.name = name;
  17559. _this.socket = socket;
  17560. _this.options = options;
  17561. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17562. _this.subscribe();
  17563. _this.configureReconnector();
  17564. return _this;
  17565. }
  17566. /**
  17567. * Subscribe to a Socket.io channel.
  17568. */
  17569. createClass(SocketIoChannel, [{
  17570. key: 'subscribe',
  17571. value: function subscribe() {
  17572. this.socket.emit('subscribe', {
  17573. channel: this.name,
  17574. auth: this.options.auth || {}
  17575. });
  17576. }
  17577. /**
  17578. * Unsubscribe from channel and ubind event callbacks.
  17579. */
  17580. }, {
  17581. key: 'unsubscribe',
  17582. value: function unsubscribe() {
  17583. this.unbind();
  17584. this.socket.emit('unsubscribe', {
  17585. channel: this.name,
  17586. auth: this.options.auth || {}
  17587. });
  17588. }
  17589. /**
  17590. * Listen for an event on the channel instance.
  17591. */
  17592. }, {
  17593. key: 'listen',
  17594. value: function listen(event, callback) {
  17595. this.on(this.eventFormatter.format(event), callback);
  17596. return this;
  17597. }
  17598. /**
  17599. * Stop listening for an event on the channel instance.
  17600. */
  17601. }, {
  17602. key: 'stopListening',
  17603. value: function stopListening(event) {
  17604. var name = this.eventFormatter.format(event);
  17605. this.socket.removeListener(name);
  17606. delete this.events[name];
  17607. return this;
  17608. }
  17609. /**
  17610. * Bind the channel's socket to an event and store the callback.
  17611. */
  17612. }, {
  17613. key: 'on',
  17614. value: function on(event, callback) {
  17615. var _this2 = this;
  17616. var listener = function listener(channel, data) {
  17617. if (_this2.name == channel) {
  17618. callback(data);
  17619. }
  17620. };
  17621. this.socket.on(event, listener);
  17622. this.bind(event, listener);
  17623. }
  17624. /**
  17625. * Attach a 'reconnect' listener and bind the event.
  17626. */
  17627. }, {
  17628. key: 'configureReconnector',
  17629. value: function configureReconnector() {
  17630. var _this3 = this;
  17631. var listener = function listener() {
  17632. _this3.subscribe();
  17633. };
  17634. this.socket.on('reconnect', listener);
  17635. this.bind('reconnect', listener);
  17636. }
  17637. /**
  17638. * Bind the channel's socket to an event and store the callback.
  17639. */
  17640. }, {
  17641. key: 'bind',
  17642. value: function bind(event, callback) {
  17643. this.events[event] = this.events[event] || [];
  17644. this.events[event].push(callback);
  17645. }
  17646. /**
  17647. * Unbind the channel's socket from all stored event callbacks.
  17648. */
  17649. }, {
  17650. key: 'unbind',
  17651. value: function unbind() {
  17652. var _this4 = this;
  17653. Object.keys(this.events).forEach(function (event) {
  17654. _this4.events[event].forEach(function (callback) {
  17655. _this4.socket.removeListener(event, callback);
  17656. });
  17657. delete _this4.events[event];
  17658. });
  17659. }
  17660. }]);
  17661. return SocketIoChannel;
  17662. }(Channel);
  17663. /**
  17664. * This class represents a Socket.io presence channel.
  17665. */
  17666. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17667. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17668. function SocketIoPrivateChannel() {
  17669. classCallCheck(this, SocketIoPrivateChannel);
  17670. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17671. }
  17672. createClass(SocketIoPrivateChannel, [{
  17673. key: 'whisper',
  17674. /**
  17675. * Trigger client event on the channel.
  17676. */
  17677. value: function whisper(eventName, data) {
  17678. this.socket.emit('client event', {
  17679. channel: this.name,
  17680. event: 'client-' + eventName,
  17681. data: data
  17682. });
  17683. return this;
  17684. }
  17685. }]);
  17686. return SocketIoPrivateChannel;
  17687. }(SocketIoChannel);
  17688. /**
  17689. * This class represents a Socket.io presence channel.
  17690. */
  17691. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17692. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17693. function SocketIoPresenceChannel() {
  17694. classCallCheck(this, SocketIoPresenceChannel);
  17695. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17696. }
  17697. createClass(SocketIoPresenceChannel, [{
  17698. key: 'here',
  17699. /**
  17700. * Register a callback to be called anytime the member list changes.
  17701. */
  17702. value: function here(callback) {
  17703. this.on('presence:subscribed', function (members) {
  17704. callback(members.map(function (m) {
  17705. return m.user_info;
  17706. }));
  17707. });
  17708. return this;
  17709. }
  17710. /**
  17711. * Listen for someone joining the channel.
  17712. */
  17713. }, {
  17714. key: 'joining',
  17715. value: function joining(callback) {
  17716. this.on('presence:joining', function (member) {
  17717. return callback(member.user_info);
  17718. });
  17719. return this;
  17720. }
  17721. /**
  17722. * Listen for someone leaving the channel.
  17723. */
  17724. }, {
  17725. key: 'leaving',
  17726. value: function leaving(callback) {
  17727. this.on('presence:leaving', function (member) {
  17728. return callback(member.user_info);
  17729. });
  17730. return this;
  17731. }
  17732. }]);
  17733. return SocketIoPresenceChannel;
  17734. }(SocketIoPrivateChannel);
  17735. /**
  17736. * This class represents a null channel.
  17737. */
  17738. var NullChannel = function (_Channel) {
  17739. inherits(NullChannel, _Channel);
  17740. function NullChannel() {
  17741. classCallCheck(this, NullChannel);
  17742. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17743. }
  17744. createClass(NullChannel, [{
  17745. key: 'subscribe',
  17746. /**
  17747. * Subscribe to a channel.
  17748. */
  17749. value: function subscribe() {}
  17750. //
  17751. /**
  17752. * Unsubscribe from a channel.
  17753. */
  17754. }, {
  17755. key: 'unsubscribe',
  17756. value: function unsubscribe() {}
  17757. //
  17758. /**
  17759. * Listen for an event on the channel instance.
  17760. */
  17761. }, {
  17762. key: 'listen',
  17763. value: function listen(event, callback) {
  17764. return this;
  17765. }
  17766. /**
  17767. * Stop listening for an event on the channel instance.
  17768. */
  17769. }, {
  17770. key: 'stopListening',
  17771. value: function stopListening(event) {
  17772. return this;
  17773. }
  17774. /**
  17775. * Bind a channel to an event.
  17776. */
  17777. }, {
  17778. key: 'on',
  17779. value: function on(event, callback) {
  17780. return this;
  17781. }
  17782. }]);
  17783. return NullChannel;
  17784. }(Channel);
  17785. /**
  17786. * This class represents a null private channel.
  17787. */
  17788. var NullPrivateChannel = function (_NullChannel) {
  17789. inherits(NullPrivateChannel, _NullChannel);
  17790. function NullPrivateChannel() {
  17791. classCallCheck(this, NullPrivateChannel);
  17792. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17793. }
  17794. createClass(NullPrivateChannel, [{
  17795. key: 'whisper',
  17796. /**
  17797. * Trigger client event on the channel.
  17798. */
  17799. value: function whisper(eventName, data) {
  17800. return this;
  17801. }
  17802. }]);
  17803. return NullPrivateChannel;
  17804. }(NullChannel);
  17805. /**
  17806. * This class represents a null presence channel.
  17807. */
  17808. var NullPresenceChannel = function (_NullChannel) {
  17809. inherits(NullPresenceChannel, _NullChannel);
  17810. function NullPresenceChannel() {
  17811. classCallCheck(this, NullPresenceChannel);
  17812. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17813. }
  17814. createClass(NullPresenceChannel, [{
  17815. key: 'here',
  17816. /**
  17817. * Register a callback to be called anytime the member list changes.
  17818. */
  17819. value: function here(callback) {
  17820. return this;
  17821. }
  17822. /**
  17823. * Listen for someone joining the channel.
  17824. */
  17825. }, {
  17826. key: 'joining',
  17827. value: function joining(callback) {
  17828. return this;
  17829. }
  17830. /**
  17831. * Listen for someone leaving the channel.
  17832. */
  17833. }, {
  17834. key: 'leaving',
  17835. value: function leaving(callback) {
  17836. return this;
  17837. }
  17838. /**
  17839. * Trigger client event on the channel.
  17840. */
  17841. }, {
  17842. key: 'whisper',
  17843. value: function whisper(eventName, data) {
  17844. return this;
  17845. }
  17846. }]);
  17847. return NullPresenceChannel;
  17848. }(NullChannel);
  17849. /**
  17850. * This class creates a connector to Pusher.
  17851. */
  17852. var PusherConnector = function (_Connector) {
  17853. inherits(PusherConnector, _Connector);
  17854. function PusherConnector() {
  17855. classCallCheck(this, PusherConnector);
  17856. /**
  17857. * All of the subscribed channel names.
  17858. */
  17859. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17860. _this.channels = {};
  17861. return _this;
  17862. }
  17863. /**
  17864. * Create a fresh Pusher connection.
  17865. */
  17866. createClass(PusherConnector, [{
  17867. key: 'connect',
  17868. value: function connect() {
  17869. if (typeof this.options.client !== 'undefined') {
  17870. this.pusher = this.options.client;
  17871. } else {
  17872. this.pusher = new Pusher(this.options.key, this.options);
  17873. }
  17874. }
  17875. /**
  17876. * Listen for an event on a channel instance.
  17877. */
  17878. }, {
  17879. key: 'listen',
  17880. value: function listen(name, event, callback) {
  17881. return this.channel(name).listen(event, callback);
  17882. }
  17883. /**
  17884. * Get a channel instance by name.
  17885. */
  17886. }, {
  17887. key: 'channel',
  17888. value: function channel(name) {
  17889. if (!this.channels[name]) {
  17890. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17891. }
  17892. return this.channels[name];
  17893. }
  17894. /**
  17895. * Get a private channel instance by name.
  17896. */
  17897. }, {
  17898. key: 'privateChannel',
  17899. value: function privateChannel(name) {
  17900. if (!this.channels['private-' + name]) {
  17901. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17902. }
  17903. return this.channels['private-' + name];
  17904. }
  17905. /**
  17906. * Get a presence channel instance by name.
  17907. */
  17908. }, {
  17909. key: 'presenceChannel',
  17910. value: function presenceChannel(name) {
  17911. if (!this.channels['presence-' + name]) {
  17912. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17913. }
  17914. return this.channels['presence-' + name];
  17915. }
  17916. /**
  17917. * Leave the given channel, as well as its private and presence variants.
  17918. */
  17919. }, {
  17920. key: 'leave',
  17921. value: function leave(name) {
  17922. var _this2 = this;
  17923. var channels = [name, 'private-' + name, 'presence-' + name];
  17924. channels.forEach(function (name, index) {
  17925. _this2.leaveChannel(name);
  17926. });
  17927. }
  17928. /**
  17929. * Leave the given channel.
  17930. */
  17931. }, {
  17932. key: 'leaveChannel',
  17933. value: function leaveChannel(name) {
  17934. if (this.channels[name]) {
  17935. this.channels[name].unsubscribe();
  17936. delete this.channels[name];
  17937. }
  17938. }
  17939. /**
  17940. * Get the socket ID for the connection.
  17941. */
  17942. }, {
  17943. key: 'socketId',
  17944. value: function socketId() {
  17945. return this.pusher.connection.socket_id;
  17946. }
  17947. /**
  17948. * Disconnect Pusher connection.
  17949. */
  17950. }, {
  17951. key: 'disconnect',
  17952. value: function disconnect() {
  17953. this.pusher.disconnect();
  17954. }
  17955. }]);
  17956. return PusherConnector;
  17957. }(Connector);
  17958. /**
  17959. * This class creates a connnector to a Socket.io server.
  17960. */
  17961. var SocketIoConnector = function (_Connector) {
  17962. inherits(SocketIoConnector, _Connector);
  17963. function SocketIoConnector() {
  17964. classCallCheck(this, SocketIoConnector);
  17965. /**
  17966. * All of the subscribed channel names.
  17967. */
  17968. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17969. _this.channels = {};
  17970. return _this;
  17971. }
  17972. /**
  17973. * Create a fresh Socket.io connection.
  17974. */
  17975. createClass(SocketIoConnector, [{
  17976. key: 'connect',
  17977. value: function connect() {
  17978. var io = this.getSocketIO();
  17979. this.socket = io(this.options.host, this.options);
  17980. return this.socket;
  17981. }
  17982. /**
  17983. * Get socket.io module from global scope or options.
  17984. */
  17985. }, {
  17986. key: 'getSocketIO',
  17987. value: function getSocketIO() {
  17988. if (typeof this.options.client !== 'undefined') {
  17989. return this.options.client;
  17990. }
  17991. if (typeof io !== 'undefined') {
  17992. return io;
  17993. }
  17994. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17995. }
  17996. /**
  17997. * Listen for an event on a channel instance.
  17998. */
  17999. }, {
  18000. key: 'listen',
  18001. value: function listen(name, event, callback) {
  18002. return this.channel(name).listen(event, callback);
  18003. }
  18004. /**
  18005. * Get a channel instance by name.
  18006. */
  18007. }, {
  18008. key: 'channel',
  18009. value: function channel(name) {
  18010. if (!this.channels[name]) {
  18011. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18012. }
  18013. return this.channels[name];
  18014. }
  18015. /**
  18016. * Get a private channel instance by name.
  18017. */
  18018. }, {
  18019. key: 'privateChannel',
  18020. value: function privateChannel(name) {
  18021. if (!this.channels['private-' + name]) {
  18022. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18023. }
  18024. return this.channels['private-' + name];
  18025. }
  18026. /**
  18027. * Get a presence channel instance by name.
  18028. */
  18029. }, {
  18030. key: 'presenceChannel',
  18031. value: function presenceChannel(name) {
  18032. if (!this.channels['presence-' + name]) {
  18033. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18034. }
  18035. return this.channels['presence-' + name];
  18036. }
  18037. /**
  18038. * Leave the given channel, as well as its private and presence variants.
  18039. */
  18040. }, {
  18041. key: 'leave',
  18042. value: function leave(name) {
  18043. var _this2 = this;
  18044. var channels = [name, 'private-' + name, 'presence-' + name];
  18045. channels.forEach(function (name) {
  18046. _this2.leaveChannel(name);
  18047. });
  18048. }
  18049. /**
  18050. * Leave the given channel.
  18051. */
  18052. }, {
  18053. key: 'leaveChannel',
  18054. value: function leaveChannel(name) {
  18055. if (this.channels[name]) {
  18056. this.channels[name].unsubscribe();
  18057. delete this.channels[name];
  18058. }
  18059. }
  18060. /**
  18061. * Get the socket ID for the connection.
  18062. */
  18063. }, {
  18064. key: 'socketId',
  18065. value: function socketId() {
  18066. return this.socket.id;
  18067. }
  18068. /**
  18069. * Disconnect Socketio connection.
  18070. */
  18071. }, {
  18072. key: 'disconnect',
  18073. value: function disconnect() {
  18074. this.socket.disconnect();
  18075. }
  18076. }]);
  18077. return SocketIoConnector;
  18078. }(Connector);
  18079. /**
  18080. * This class creates a null connector.
  18081. */
  18082. var NullConnector = function (_Connector) {
  18083. inherits(NullConnector, _Connector);
  18084. function NullConnector() {
  18085. classCallCheck(this, NullConnector);
  18086. /**
  18087. * All of the subscribed channel names.
  18088. */
  18089. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18090. _this.channels = {};
  18091. return _this;
  18092. }
  18093. /**
  18094. * Create a fresh connection.
  18095. */
  18096. createClass(NullConnector, [{
  18097. key: 'connect',
  18098. value: function connect() {}
  18099. //
  18100. /**
  18101. * Listen for an event on a channel instance.
  18102. */
  18103. }, {
  18104. key: 'listen',
  18105. value: function listen(name, event, callback) {
  18106. return new NullChannel();
  18107. }
  18108. /**
  18109. * Get a channel instance by name.
  18110. */
  18111. }, {
  18112. key: 'channel',
  18113. value: function channel(name) {
  18114. return new NullChannel();
  18115. }
  18116. /**
  18117. * Get a private channel instance by name.
  18118. */
  18119. }, {
  18120. key: 'privateChannel',
  18121. value: function privateChannel(name) {
  18122. return new NullPrivateChannel();
  18123. }
  18124. /**
  18125. * Get a presence channel instance by name.
  18126. */
  18127. }, {
  18128. key: 'presenceChannel',
  18129. value: function presenceChannel(name) {
  18130. return new NullPresenceChannel();
  18131. }
  18132. /**
  18133. * Leave the given channel, as well as its private and presence variants.
  18134. */
  18135. }, {
  18136. key: 'leave',
  18137. value: function leave(name) {}
  18138. //
  18139. /**
  18140. * Leave the given channel.
  18141. */
  18142. }, {
  18143. key: 'leaveChannel',
  18144. value: function leaveChannel(name) {}
  18145. //
  18146. /**
  18147. * Get the socket ID for the connection.
  18148. */
  18149. }, {
  18150. key: 'socketId',
  18151. value: function socketId() {
  18152. return 'fake-socket-id';
  18153. }
  18154. /**
  18155. * Disconnect the connection.
  18156. */
  18157. }, {
  18158. key: 'disconnect',
  18159. value: function disconnect() {
  18160. //
  18161. }
  18162. }]);
  18163. return NullConnector;
  18164. }(Connector);
  18165. /**
  18166. * This class is the primary API for interacting with broadcasting.
  18167. */
  18168. var Echo = function () {
  18169. /**
  18170. * Create a new class instance.
  18171. */
  18172. function Echo(options) {
  18173. classCallCheck(this, Echo);
  18174. this.options = options;
  18175. this.connect();
  18176. if (!this.options.withoutInterceptors) {
  18177. this.registerInterceptors();
  18178. }
  18179. }
  18180. /**
  18181. * Get a channel instance by name.
  18182. */
  18183. createClass(Echo, [{
  18184. key: 'channel',
  18185. value: function channel(_channel) {
  18186. return this.connector.channel(_channel);
  18187. }
  18188. /**
  18189. * Create a new connection.
  18190. */
  18191. }, {
  18192. key: 'connect',
  18193. value: function connect() {
  18194. if (this.options.broadcaster == 'pusher') {
  18195. this.connector = new PusherConnector(this.options);
  18196. } else if (this.options.broadcaster == 'socket.io') {
  18197. this.connector = new SocketIoConnector(this.options);
  18198. } else if (this.options.broadcaster == 'null') {
  18199. this.connector = new NullConnector(this.options);
  18200. } else if (typeof this.options.broadcaster == 'function') {
  18201. this.connector = new this.options.broadcaster(this.options);
  18202. }
  18203. }
  18204. /**
  18205. * Disconnect from the Echo server.
  18206. */
  18207. }, {
  18208. key: 'disconnect',
  18209. value: function disconnect() {
  18210. this.connector.disconnect();
  18211. }
  18212. /**
  18213. * Get a presence channel instance by name.
  18214. */
  18215. }, {
  18216. key: 'join',
  18217. value: function join(channel) {
  18218. return this.connector.presenceChannel(channel);
  18219. }
  18220. /**
  18221. * Leave the given channel, as well as its private and presence variants.
  18222. */
  18223. }, {
  18224. key: 'leave',
  18225. value: function leave(channel) {
  18226. this.connector.leave(channel);
  18227. }
  18228. /**
  18229. * Leave the given channel.
  18230. */
  18231. }, {
  18232. key: 'leaveChannel',
  18233. value: function leaveChannel(channel) {
  18234. this.connector.leaveChannel(channel);
  18235. }
  18236. /**
  18237. * Listen for an event on a channel instance.
  18238. */
  18239. }, {
  18240. key: 'listen',
  18241. value: function listen(channel, event, callback) {
  18242. return this.connector.listen(channel, event, callback);
  18243. }
  18244. /**
  18245. * Get a private channel instance by name.
  18246. */
  18247. }, {
  18248. key: 'private',
  18249. value: function _private(channel) {
  18250. return this.connector.privateChannel(channel);
  18251. }
  18252. /**
  18253. * Get the Socket ID for the connection.
  18254. */
  18255. }, {
  18256. key: 'socketId',
  18257. value: function socketId() {
  18258. return this.connector.socketId();
  18259. }
  18260. /**
  18261. * Register 3rd party request interceptiors. These are used to automatically
  18262. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18263. */
  18264. }, {
  18265. key: 'registerInterceptors',
  18266. value: function registerInterceptors() {
  18267. if (typeof Vue === 'function' && Vue.http) {
  18268. this.registerVueRequestInterceptor();
  18269. }
  18270. if (typeof axios === 'function') {
  18271. this.registerAxiosRequestInterceptor();
  18272. }
  18273. if (typeof jQuery === 'function') {
  18274. this.registerjQueryAjaxSetup();
  18275. }
  18276. }
  18277. /**
  18278. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18279. */
  18280. }, {
  18281. key: 'registerVueRequestInterceptor',
  18282. value: function registerVueRequestInterceptor() {
  18283. var _this = this;
  18284. Vue.http.interceptors.push(function (request, next) {
  18285. if (_this.socketId()) {
  18286. request.headers.set('X-Socket-ID', _this.socketId());
  18287. }
  18288. next();
  18289. });
  18290. }
  18291. /**
  18292. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18293. */
  18294. }, {
  18295. key: 'registerAxiosRequestInterceptor',
  18296. value: function registerAxiosRequestInterceptor() {
  18297. var _this2 = this;
  18298. axios.interceptors.request.use(function (config) {
  18299. if (_this2.socketId()) {
  18300. config.headers['X-Socket-Id'] = _this2.socketId();
  18301. }
  18302. return config;
  18303. });
  18304. }
  18305. /**
  18306. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18307. */
  18308. }, {
  18309. key: 'registerjQueryAjaxSetup',
  18310. value: function registerjQueryAjaxSetup() {
  18311. var _this3 = this;
  18312. if (typeof jQuery.ajax != 'undefined') {
  18313. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18314. if (_this3.socketId()) {
  18315. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18316. }
  18317. });
  18318. }
  18319. }
  18320. }]);
  18321. return Echo;
  18322. }();
  18323. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18324. /***/ }),
  18325. /***/ "./node_modules/lodash/lodash.js":
  18326. /*!***************************************!*\
  18327. !*** ./node_modules/lodash/lodash.js ***!
  18328. \***************************************/
  18329. /*! no static exports found */
  18330. /***/ (function(module, exports, __webpack_require__) {
  18331. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18332. * @license
  18333. * Lodash <https://lodash.com/>
  18334. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18335. * Released under MIT license <https://lodash.com/license>
  18336. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18337. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18338. */
  18339. ;(function() {
  18340. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18341. var undefined;
  18342. /** Used as the semantic version number. */
  18343. var VERSION = '4.17.15';
  18344. /** Used as the size to enable large array optimizations. */
  18345. var LARGE_ARRAY_SIZE = 200;
  18346. /** Error message constants. */
  18347. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18348. FUNC_ERROR_TEXT = 'Expected a function';
  18349. /** Used to stand-in for `undefined` hash values. */
  18350. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18351. /** Used as the maximum memoize cache size. */
  18352. var MAX_MEMOIZE_SIZE = 500;
  18353. /** Used as the internal argument placeholder. */
  18354. var PLACEHOLDER = '__lodash_placeholder__';
  18355. /** Used to compose bitmasks for cloning. */
  18356. var CLONE_DEEP_FLAG = 1,
  18357. CLONE_FLAT_FLAG = 2,
  18358. CLONE_SYMBOLS_FLAG = 4;
  18359. /** Used to compose bitmasks for value comparisons. */
  18360. var COMPARE_PARTIAL_FLAG = 1,
  18361. COMPARE_UNORDERED_FLAG = 2;
  18362. /** Used to compose bitmasks for function metadata. */
  18363. var WRAP_BIND_FLAG = 1,
  18364. WRAP_BIND_KEY_FLAG = 2,
  18365. WRAP_CURRY_BOUND_FLAG = 4,
  18366. WRAP_CURRY_FLAG = 8,
  18367. WRAP_CURRY_RIGHT_FLAG = 16,
  18368. WRAP_PARTIAL_FLAG = 32,
  18369. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18370. WRAP_ARY_FLAG = 128,
  18371. WRAP_REARG_FLAG = 256,
  18372. WRAP_FLIP_FLAG = 512;
  18373. /** Used as default options for `_.truncate`. */
  18374. var DEFAULT_TRUNC_LENGTH = 30,
  18375. DEFAULT_TRUNC_OMISSION = '...';
  18376. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18377. var HOT_COUNT = 800,
  18378. HOT_SPAN = 16;
  18379. /** Used to indicate the type of lazy iteratees. */
  18380. var LAZY_FILTER_FLAG = 1,
  18381. LAZY_MAP_FLAG = 2,
  18382. LAZY_WHILE_FLAG = 3;
  18383. /** Used as references for various `Number` constants. */
  18384. var INFINITY = 1 / 0,
  18385. MAX_SAFE_INTEGER = 9007199254740991,
  18386. MAX_INTEGER = 1.7976931348623157e+308,
  18387. NAN = 0 / 0;
  18388. /** Used as references for the maximum length and index of an array. */
  18389. var MAX_ARRAY_LENGTH = 4294967295,
  18390. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18391. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18392. /** Used to associate wrap methods with their bit flags. */
  18393. var wrapFlags = [
  18394. ['ary', WRAP_ARY_FLAG],
  18395. ['bind', WRAP_BIND_FLAG],
  18396. ['bindKey', WRAP_BIND_KEY_FLAG],
  18397. ['curry', WRAP_CURRY_FLAG],
  18398. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18399. ['flip', WRAP_FLIP_FLAG],
  18400. ['partial', WRAP_PARTIAL_FLAG],
  18401. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18402. ['rearg', WRAP_REARG_FLAG]
  18403. ];
  18404. /** `Object#toString` result references. */
  18405. var argsTag = '[object Arguments]',
  18406. arrayTag = '[object Array]',
  18407. asyncTag = '[object AsyncFunction]',
  18408. boolTag = '[object Boolean]',
  18409. dateTag = '[object Date]',
  18410. domExcTag = '[object DOMException]',
  18411. errorTag = '[object Error]',
  18412. funcTag = '[object Function]',
  18413. genTag = '[object GeneratorFunction]',
  18414. mapTag = '[object Map]',
  18415. numberTag = '[object Number]',
  18416. nullTag = '[object Null]',
  18417. objectTag = '[object Object]',
  18418. promiseTag = '[object Promise]',
  18419. proxyTag = '[object Proxy]',
  18420. regexpTag = '[object RegExp]',
  18421. setTag = '[object Set]',
  18422. stringTag = '[object String]',
  18423. symbolTag = '[object Symbol]',
  18424. undefinedTag = '[object Undefined]',
  18425. weakMapTag = '[object WeakMap]',
  18426. weakSetTag = '[object WeakSet]';
  18427. var arrayBufferTag = '[object ArrayBuffer]',
  18428. dataViewTag = '[object DataView]',
  18429. float32Tag = '[object Float32Array]',
  18430. float64Tag = '[object Float64Array]',
  18431. int8Tag = '[object Int8Array]',
  18432. int16Tag = '[object Int16Array]',
  18433. int32Tag = '[object Int32Array]',
  18434. uint8Tag = '[object Uint8Array]',
  18435. uint8ClampedTag = '[object Uint8ClampedArray]',
  18436. uint16Tag = '[object Uint16Array]',
  18437. uint32Tag = '[object Uint32Array]';
  18438. /** Used to match empty string literals in compiled template source. */
  18439. var reEmptyStringLeading = /\b__p \+= '';/g,
  18440. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18441. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18442. /** Used to match HTML entities and HTML characters. */
  18443. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18444. reUnescapedHtml = /[&<>"']/g,
  18445. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18446. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18447. /** Used to match template delimiters. */
  18448. var reEscape = /<%-([\s\S]+?)%>/g,
  18449. reEvaluate = /<%([\s\S]+?)%>/g,
  18450. reInterpolate = /<%=([\s\S]+?)%>/g;
  18451. /** Used to match property names within property paths. */
  18452. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18453. reIsPlainProp = /^\w*$/,
  18454. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18455. /**
  18456. * Used to match `RegExp`
  18457. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18458. */
  18459. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18460. reHasRegExpChar = RegExp(reRegExpChar.source);
  18461. /** Used to match leading and trailing whitespace. */
  18462. var reTrim = /^\s+|\s+$/g,
  18463. reTrimStart = /^\s+/,
  18464. reTrimEnd = /\s+$/;
  18465. /** Used to match wrap detail comments. */
  18466. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18467. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18468. reSplitDetails = /,? & /;
  18469. /** Used to match words composed of alphanumeric characters. */
  18470. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18471. /** Used to match backslashes in property paths. */
  18472. var reEscapeChar = /\\(\\)?/g;
  18473. /**
  18474. * Used to match
  18475. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18476. */
  18477. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18478. /** Used to match `RegExp` flags from their coerced string values. */
  18479. var reFlags = /\w*$/;
  18480. /** Used to detect bad signed hexadecimal string values. */
  18481. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18482. /** Used to detect binary string values. */
  18483. var reIsBinary = /^0b[01]+$/i;
  18484. /** Used to detect host constructors (Safari). */
  18485. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18486. /** Used to detect octal string values. */
  18487. var reIsOctal = /^0o[0-7]+$/i;
  18488. /** Used to detect unsigned integer values. */
  18489. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18490. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18491. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18492. /** Used to ensure capturing order of template delimiters. */
  18493. var reNoMatch = /($^)/;
  18494. /** Used to match unescaped characters in compiled string literals. */
  18495. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18496. /** Used to compose unicode character classes. */
  18497. var rsAstralRange = '\\ud800-\\udfff',
  18498. rsComboMarksRange = '\\u0300-\\u036f',
  18499. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18500. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18501. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18502. rsDingbatRange = '\\u2700-\\u27bf',
  18503. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18504. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18505. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18506. rsPunctuationRange = '\\u2000-\\u206f',
  18507. 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',
  18508. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18509. rsVarRange = '\\ufe0e\\ufe0f',
  18510. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18511. /** Used to compose unicode capture groups. */
  18512. var rsApos = "['\u2019]",
  18513. rsAstral = '[' + rsAstralRange + ']',
  18514. rsBreak = '[' + rsBreakRange + ']',
  18515. rsCombo = '[' + rsComboRange + ']',
  18516. rsDigits = '\\d+',
  18517. rsDingbat = '[' + rsDingbatRange + ']',
  18518. rsLower = '[' + rsLowerRange + ']',
  18519. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18520. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18521. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18522. rsNonAstral = '[^' + rsAstralRange + ']',
  18523. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18524. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18525. rsUpper = '[' + rsUpperRange + ']',
  18526. rsZWJ = '\\u200d';
  18527. /** Used to compose unicode regexes. */
  18528. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18529. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18530. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18531. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18532. reOptMod = rsModifier + '?',
  18533. rsOptVar = '[' + rsVarRange + ']?',
  18534. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18535. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18536. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18537. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18538. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18539. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18540. /** Used to match apostrophes. */
  18541. var reApos = RegExp(rsApos, 'g');
  18542. /**
  18543. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18544. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18545. */
  18546. var reComboMark = RegExp(rsCombo, 'g');
  18547. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18548. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18549. /** Used to match complex or compound words. */
  18550. var reUnicodeWord = RegExp([
  18551. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18552. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18553. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18554. rsUpper + '+' + rsOptContrUpper,
  18555. rsOrdUpper,
  18556. rsOrdLower,
  18557. rsDigits,
  18558. rsEmoji
  18559. ].join('|'), 'g');
  18560. /** 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/). */
  18561. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18562. /** Used to detect strings that need a more robust regexp to match words. */
  18563. 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 ]/;
  18564. /** Used to assign default `context` object properties. */
  18565. var contextProps = [
  18566. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18567. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18568. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18569. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18570. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18571. ];
  18572. /** Used to make template sourceURLs easier to identify. */
  18573. var templateCounter = -1;
  18574. /** Used to identify `toStringTag` values of typed arrays. */
  18575. var typedArrayTags = {};
  18576. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18577. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18578. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18579. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18580. typedArrayTags[uint32Tag] = true;
  18581. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18582. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18583. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18584. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18585. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18586. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18587. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18588. typedArrayTags[weakMapTag] = false;
  18589. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18590. var cloneableTags = {};
  18591. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18592. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18593. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18594. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18595. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18596. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18597. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18598. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18599. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18600. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18601. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18602. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18603. cloneableTags[weakMapTag] = false;
  18604. /** Used to map Latin Unicode letters to basic Latin letters. */
  18605. var deburredLetters = {
  18606. // Latin-1 Supplement block.
  18607. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18608. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18609. '\xc7': 'C', '\xe7': 'c',
  18610. '\xd0': 'D', '\xf0': 'd',
  18611. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18612. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18613. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18614. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18615. '\xd1': 'N', '\xf1': 'n',
  18616. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18617. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18618. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18619. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18620. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18621. '\xc6': 'Ae', '\xe6': 'ae',
  18622. '\xde': 'Th', '\xfe': 'th',
  18623. '\xdf': 'ss',
  18624. // Latin Extended-A block.
  18625. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18626. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18627. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18628. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18629. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18630. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18631. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18632. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18633. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18634. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18635. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18636. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18637. '\u0134': 'J', '\u0135': 'j',
  18638. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18639. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18640. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18641. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18642. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18643. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18644. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18645. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18646. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18647. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18648. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18649. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18650. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18651. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18652. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18653. '\u0174': 'W', '\u0175': 'w',
  18654. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18655. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18656. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18657. '\u0132': 'IJ', '\u0133': 'ij',
  18658. '\u0152': 'Oe', '\u0153': 'oe',
  18659. '\u0149': "'n", '\u017f': 's'
  18660. };
  18661. /** Used to map characters to HTML entities. */
  18662. var htmlEscapes = {
  18663. '&': '&amp;',
  18664. '<': '&lt;',
  18665. '>': '&gt;',
  18666. '"': '&quot;',
  18667. "'": '&#39;'
  18668. };
  18669. /** Used to map HTML entities to characters. */
  18670. var htmlUnescapes = {
  18671. '&amp;': '&',
  18672. '&lt;': '<',
  18673. '&gt;': '>',
  18674. '&quot;': '"',
  18675. '&#39;': "'"
  18676. };
  18677. /** Used to escape characters for inclusion in compiled string literals. */
  18678. var stringEscapes = {
  18679. '\\': '\\',
  18680. "'": "'",
  18681. '\n': 'n',
  18682. '\r': 'r',
  18683. '\u2028': 'u2028',
  18684. '\u2029': 'u2029'
  18685. };
  18686. /** Built-in method references without a dependency on `root`. */
  18687. var freeParseFloat = parseFloat,
  18688. freeParseInt = parseInt;
  18689. /** Detect free variable `global` from Node.js. */
  18690. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18691. /** Detect free variable `self`. */
  18692. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18693. /** Used as a reference to the global object. */
  18694. var root = freeGlobal || freeSelf || Function('return this')();
  18695. /** Detect free variable `exports`. */
  18696. var freeExports = true && exports && !exports.nodeType && exports;
  18697. /** Detect free variable `module`. */
  18698. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18699. /** Detect the popular CommonJS extension `module.exports`. */
  18700. var moduleExports = freeModule && freeModule.exports === freeExports;
  18701. /** Detect free variable `process` from Node.js. */
  18702. var freeProcess = moduleExports && freeGlobal.process;
  18703. /** Used to access faster Node.js helpers. */
  18704. var nodeUtil = (function() {
  18705. try {
  18706. // Use `util.types` for Node.js 10+.
  18707. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18708. if (types) {
  18709. return types;
  18710. }
  18711. // Legacy `process.binding('util')` for Node.js < 10.
  18712. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18713. } catch (e) {}
  18714. }());
  18715. /* Node.js helper references. */
  18716. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18717. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18718. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18719. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18720. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18721. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18722. /*--------------------------------------------------------------------------*/
  18723. /**
  18724. * A faster alternative to `Function#apply`, this function invokes `func`
  18725. * with the `this` binding of `thisArg` and the arguments of `args`.
  18726. *
  18727. * @private
  18728. * @param {Function} func The function to invoke.
  18729. * @param {*} thisArg The `this` binding of `func`.
  18730. * @param {Array} args The arguments to invoke `func` with.
  18731. * @returns {*} Returns the result of `func`.
  18732. */
  18733. function apply(func, thisArg, args) {
  18734. switch (args.length) {
  18735. case 0: return func.call(thisArg);
  18736. case 1: return func.call(thisArg, args[0]);
  18737. case 2: return func.call(thisArg, args[0], args[1]);
  18738. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18739. }
  18740. return func.apply(thisArg, args);
  18741. }
  18742. /**
  18743. * A specialized version of `baseAggregator` for arrays.
  18744. *
  18745. * @private
  18746. * @param {Array} [array] The array to iterate over.
  18747. * @param {Function} setter The function to set `accumulator` values.
  18748. * @param {Function} iteratee The iteratee to transform keys.
  18749. * @param {Object} accumulator The initial aggregated object.
  18750. * @returns {Function} Returns `accumulator`.
  18751. */
  18752. function arrayAggregator(array, setter, iteratee, accumulator) {
  18753. var index = -1,
  18754. length = array == null ? 0 : array.length;
  18755. while (++index < length) {
  18756. var value = array[index];
  18757. setter(accumulator, value, iteratee(value), array);
  18758. }
  18759. return accumulator;
  18760. }
  18761. /**
  18762. * A specialized version of `_.forEach` for arrays without support for
  18763. * iteratee shorthands.
  18764. *
  18765. * @private
  18766. * @param {Array} [array] The array to iterate over.
  18767. * @param {Function} iteratee The function invoked per iteration.
  18768. * @returns {Array} Returns `array`.
  18769. */
  18770. function arrayEach(array, iteratee) {
  18771. var index = -1,
  18772. length = array == null ? 0 : array.length;
  18773. while (++index < length) {
  18774. if (iteratee(array[index], index, array) === false) {
  18775. break;
  18776. }
  18777. }
  18778. return array;
  18779. }
  18780. /**
  18781. * A specialized version of `_.forEachRight` for arrays without support for
  18782. * iteratee shorthands.
  18783. *
  18784. * @private
  18785. * @param {Array} [array] The array to iterate over.
  18786. * @param {Function} iteratee The function invoked per iteration.
  18787. * @returns {Array} Returns `array`.
  18788. */
  18789. function arrayEachRight(array, iteratee) {
  18790. var length = array == null ? 0 : array.length;
  18791. while (length--) {
  18792. if (iteratee(array[length], length, array) === false) {
  18793. break;
  18794. }
  18795. }
  18796. return array;
  18797. }
  18798. /**
  18799. * A specialized version of `_.every` for arrays without support for
  18800. * iteratee shorthands.
  18801. *
  18802. * @private
  18803. * @param {Array} [array] The array to iterate over.
  18804. * @param {Function} predicate The function invoked per iteration.
  18805. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18806. * else `false`.
  18807. */
  18808. function arrayEvery(array, predicate) {
  18809. var index = -1,
  18810. length = array == null ? 0 : array.length;
  18811. while (++index < length) {
  18812. if (!predicate(array[index], index, array)) {
  18813. return false;
  18814. }
  18815. }
  18816. return true;
  18817. }
  18818. /**
  18819. * A specialized version of `_.filter` for arrays without support for
  18820. * iteratee shorthands.
  18821. *
  18822. * @private
  18823. * @param {Array} [array] The array to iterate over.
  18824. * @param {Function} predicate The function invoked per iteration.
  18825. * @returns {Array} Returns the new filtered array.
  18826. */
  18827. function arrayFilter(array, predicate) {
  18828. var index = -1,
  18829. length = array == null ? 0 : array.length,
  18830. resIndex = 0,
  18831. result = [];
  18832. while (++index < length) {
  18833. var value = array[index];
  18834. if (predicate(value, index, array)) {
  18835. result[resIndex++] = value;
  18836. }
  18837. }
  18838. return result;
  18839. }
  18840. /**
  18841. * A specialized version of `_.includes` for arrays without support for
  18842. * specifying an index to search from.
  18843. *
  18844. * @private
  18845. * @param {Array} [array] The array to inspect.
  18846. * @param {*} target The value to search for.
  18847. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18848. */
  18849. function arrayIncludes(array, value) {
  18850. var length = array == null ? 0 : array.length;
  18851. return !!length && baseIndexOf(array, value, 0) > -1;
  18852. }
  18853. /**
  18854. * This function is like `arrayIncludes` except that it accepts a comparator.
  18855. *
  18856. * @private
  18857. * @param {Array} [array] The array to inspect.
  18858. * @param {*} target The value to search for.
  18859. * @param {Function} comparator The comparator invoked per element.
  18860. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18861. */
  18862. function arrayIncludesWith(array, value, comparator) {
  18863. var index = -1,
  18864. length = array == null ? 0 : array.length;
  18865. while (++index < length) {
  18866. if (comparator(value, array[index])) {
  18867. return true;
  18868. }
  18869. }
  18870. return false;
  18871. }
  18872. /**
  18873. * A specialized version of `_.map` for arrays without support for iteratee
  18874. * shorthands.
  18875. *
  18876. * @private
  18877. * @param {Array} [array] The array to iterate over.
  18878. * @param {Function} iteratee The function invoked per iteration.
  18879. * @returns {Array} Returns the new mapped array.
  18880. */
  18881. function arrayMap(array, iteratee) {
  18882. var index = -1,
  18883. length = array == null ? 0 : array.length,
  18884. result = Array(length);
  18885. while (++index < length) {
  18886. result[index] = iteratee(array[index], index, array);
  18887. }
  18888. return result;
  18889. }
  18890. /**
  18891. * Appends the elements of `values` to `array`.
  18892. *
  18893. * @private
  18894. * @param {Array} array The array to modify.
  18895. * @param {Array} values The values to append.
  18896. * @returns {Array} Returns `array`.
  18897. */
  18898. function arrayPush(array, values) {
  18899. var index = -1,
  18900. length = values.length,
  18901. offset = array.length;
  18902. while (++index < length) {
  18903. array[offset + index] = values[index];
  18904. }
  18905. return array;
  18906. }
  18907. /**
  18908. * A specialized version of `_.reduce` for arrays without support for
  18909. * iteratee shorthands.
  18910. *
  18911. * @private
  18912. * @param {Array} [array] The array to iterate over.
  18913. * @param {Function} iteratee The function invoked per iteration.
  18914. * @param {*} [accumulator] The initial value.
  18915. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18916. * the initial value.
  18917. * @returns {*} Returns the accumulated value.
  18918. */
  18919. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18920. var index = -1,
  18921. length = array == null ? 0 : array.length;
  18922. if (initAccum && length) {
  18923. accumulator = array[++index];
  18924. }
  18925. while (++index < length) {
  18926. accumulator = iteratee(accumulator, array[index], index, array);
  18927. }
  18928. return accumulator;
  18929. }
  18930. /**
  18931. * A specialized version of `_.reduceRight` for arrays without support for
  18932. * iteratee shorthands.
  18933. *
  18934. * @private
  18935. * @param {Array} [array] The array to iterate over.
  18936. * @param {Function} iteratee The function invoked per iteration.
  18937. * @param {*} [accumulator] The initial value.
  18938. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18939. * the initial value.
  18940. * @returns {*} Returns the accumulated value.
  18941. */
  18942. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18943. var length = array == null ? 0 : array.length;
  18944. if (initAccum && length) {
  18945. accumulator = array[--length];
  18946. }
  18947. while (length--) {
  18948. accumulator = iteratee(accumulator, array[length], length, array);
  18949. }
  18950. return accumulator;
  18951. }
  18952. /**
  18953. * A specialized version of `_.some` for arrays without support for iteratee
  18954. * shorthands.
  18955. *
  18956. * @private
  18957. * @param {Array} [array] The array to iterate over.
  18958. * @param {Function} predicate The function invoked per iteration.
  18959. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18960. * else `false`.
  18961. */
  18962. function arraySome(array, predicate) {
  18963. var index = -1,
  18964. length = array == null ? 0 : array.length;
  18965. while (++index < length) {
  18966. if (predicate(array[index], index, array)) {
  18967. return true;
  18968. }
  18969. }
  18970. return false;
  18971. }
  18972. /**
  18973. * Gets the size of an ASCII `string`.
  18974. *
  18975. * @private
  18976. * @param {string} string The string inspect.
  18977. * @returns {number} Returns the string size.
  18978. */
  18979. var asciiSize = baseProperty('length');
  18980. /**
  18981. * Converts an ASCII `string` to an array.
  18982. *
  18983. * @private
  18984. * @param {string} string The string to convert.
  18985. * @returns {Array} Returns the converted array.
  18986. */
  18987. function asciiToArray(string) {
  18988. return string.split('');
  18989. }
  18990. /**
  18991. * Splits an ASCII `string` into an array of its words.
  18992. *
  18993. * @private
  18994. * @param {string} The string to inspect.
  18995. * @returns {Array} Returns the words of `string`.
  18996. */
  18997. function asciiWords(string) {
  18998. return string.match(reAsciiWord) || [];
  18999. }
  19000. /**
  19001. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19002. * without support for iteratee shorthands, which iterates over `collection`
  19003. * using `eachFunc`.
  19004. *
  19005. * @private
  19006. * @param {Array|Object} collection The collection to inspect.
  19007. * @param {Function} predicate The function invoked per iteration.
  19008. * @param {Function} eachFunc The function to iterate over `collection`.
  19009. * @returns {*} Returns the found element or its key, else `undefined`.
  19010. */
  19011. function baseFindKey(collection, predicate, eachFunc) {
  19012. var result;
  19013. eachFunc(collection, function(value, key, collection) {
  19014. if (predicate(value, key, collection)) {
  19015. result = key;
  19016. return false;
  19017. }
  19018. });
  19019. return result;
  19020. }
  19021. /**
  19022. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19023. * support for iteratee shorthands.
  19024. *
  19025. * @private
  19026. * @param {Array} array The array to inspect.
  19027. * @param {Function} predicate The function invoked per iteration.
  19028. * @param {number} fromIndex The index to search from.
  19029. * @param {boolean} [fromRight] Specify iterating from right to left.
  19030. * @returns {number} Returns the index of the matched value, else `-1`.
  19031. */
  19032. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19033. var length = array.length,
  19034. index = fromIndex + (fromRight ? 1 : -1);
  19035. while ((fromRight ? index-- : ++index < length)) {
  19036. if (predicate(array[index], index, array)) {
  19037. return index;
  19038. }
  19039. }
  19040. return -1;
  19041. }
  19042. /**
  19043. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19044. *
  19045. * @private
  19046. * @param {Array} array The array to inspect.
  19047. * @param {*} value The value to search for.
  19048. * @param {number} fromIndex The index to search from.
  19049. * @returns {number} Returns the index of the matched value, else `-1`.
  19050. */
  19051. function baseIndexOf(array, value, fromIndex) {
  19052. return value === value
  19053. ? strictIndexOf(array, value, fromIndex)
  19054. : baseFindIndex(array, baseIsNaN, fromIndex);
  19055. }
  19056. /**
  19057. * This function is like `baseIndexOf` except that it accepts a comparator.
  19058. *
  19059. * @private
  19060. * @param {Array} array The array to inspect.
  19061. * @param {*} value The value to search for.
  19062. * @param {number} fromIndex The index to search from.
  19063. * @param {Function} comparator The comparator invoked per element.
  19064. * @returns {number} Returns the index of the matched value, else `-1`.
  19065. */
  19066. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19067. var index = fromIndex - 1,
  19068. length = array.length;
  19069. while (++index < length) {
  19070. if (comparator(array[index], value)) {
  19071. return index;
  19072. }
  19073. }
  19074. return -1;
  19075. }
  19076. /**
  19077. * The base implementation of `_.isNaN` without support for number objects.
  19078. *
  19079. * @private
  19080. * @param {*} value The value to check.
  19081. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19082. */
  19083. function baseIsNaN(value) {
  19084. return value !== value;
  19085. }
  19086. /**
  19087. * The base implementation of `_.mean` and `_.meanBy` without support for
  19088. * iteratee shorthands.
  19089. *
  19090. * @private
  19091. * @param {Array} array The array to iterate over.
  19092. * @param {Function} iteratee The function invoked per iteration.
  19093. * @returns {number} Returns the mean.
  19094. */
  19095. function baseMean(array, iteratee) {
  19096. var length = array == null ? 0 : array.length;
  19097. return length ? (baseSum(array, iteratee) / length) : NAN;
  19098. }
  19099. /**
  19100. * The base implementation of `_.property` without support for deep paths.
  19101. *
  19102. * @private
  19103. * @param {string} key The key of the property to get.
  19104. * @returns {Function} Returns the new accessor function.
  19105. */
  19106. function baseProperty(key) {
  19107. return function(object) {
  19108. return object == null ? undefined : object[key];
  19109. };
  19110. }
  19111. /**
  19112. * The base implementation of `_.propertyOf` without support for deep paths.
  19113. *
  19114. * @private
  19115. * @param {Object} object The object to query.
  19116. * @returns {Function} Returns the new accessor function.
  19117. */
  19118. function basePropertyOf(object) {
  19119. return function(key) {
  19120. return object == null ? undefined : object[key];
  19121. };
  19122. }
  19123. /**
  19124. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19125. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19126. *
  19127. * @private
  19128. * @param {Array|Object} collection The collection to iterate over.
  19129. * @param {Function} iteratee The function invoked per iteration.
  19130. * @param {*} accumulator The initial value.
  19131. * @param {boolean} initAccum Specify using the first or last element of
  19132. * `collection` as the initial value.
  19133. * @param {Function} eachFunc The function to iterate over `collection`.
  19134. * @returns {*} Returns the accumulated value.
  19135. */
  19136. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19137. eachFunc(collection, function(value, index, collection) {
  19138. accumulator = initAccum
  19139. ? (initAccum = false, value)
  19140. : iteratee(accumulator, value, index, collection);
  19141. });
  19142. return accumulator;
  19143. }
  19144. /**
  19145. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19146. * sort order of `array` and replaces criteria objects with their corresponding
  19147. * values.
  19148. *
  19149. * @private
  19150. * @param {Array} array The array to sort.
  19151. * @param {Function} comparer The function to define sort order.
  19152. * @returns {Array} Returns `array`.
  19153. */
  19154. function baseSortBy(array, comparer) {
  19155. var length = array.length;
  19156. array.sort(comparer);
  19157. while (length--) {
  19158. array[length] = array[length].value;
  19159. }
  19160. return array;
  19161. }
  19162. /**
  19163. * The base implementation of `_.sum` and `_.sumBy` without support for
  19164. * iteratee shorthands.
  19165. *
  19166. * @private
  19167. * @param {Array} array The array to iterate over.
  19168. * @param {Function} iteratee The function invoked per iteration.
  19169. * @returns {number} Returns the sum.
  19170. */
  19171. function baseSum(array, iteratee) {
  19172. var result,
  19173. index = -1,
  19174. length = array.length;
  19175. while (++index < length) {
  19176. var current = iteratee(array[index]);
  19177. if (current !== undefined) {
  19178. result = result === undefined ? current : (result + current);
  19179. }
  19180. }
  19181. return result;
  19182. }
  19183. /**
  19184. * The base implementation of `_.times` without support for iteratee shorthands
  19185. * or max array length checks.
  19186. *
  19187. * @private
  19188. * @param {number} n The number of times to invoke `iteratee`.
  19189. * @param {Function} iteratee The function invoked per iteration.
  19190. * @returns {Array} Returns the array of results.
  19191. */
  19192. function baseTimes(n, iteratee) {
  19193. var index = -1,
  19194. result = Array(n);
  19195. while (++index < n) {
  19196. result[index] = iteratee(index);
  19197. }
  19198. return result;
  19199. }
  19200. /**
  19201. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19202. * of key-value pairs for `object` corresponding to the property names of `props`.
  19203. *
  19204. * @private
  19205. * @param {Object} object The object to query.
  19206. * @param {Array} props The property names to get values for.
  19207. * @returns {Object} Returns the key-value pairs.
  19208. */
  19209. function baseToPairs(object, props) {
  19210. return arrayMap(props, function(key) {
  19211. return [key, object[key]];
  19212. });
  19213. }
  19214. /**
  19215. * The base implementation of `_.unary` without support for storing metadata.
  19216. *
  19217. * @private
  19218. * @param {Function} func The function to cap arguments for.
  19219. * @returns {Function} Returns the new capped function.
  19220. */
  19221. function baseUnary(func) {
  19222. return function(value) {
  19223. return func(value);
  19224. };
  19225. }
  19226. /**
  19227. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19228. * array of `object` property values corresponding to the property names
  19229. * of `props`.
  19230. *
  19231. * @private
  19232. * @param {Object} object The object to query.
  19233. * @param {Array} props The property names to get values for.
  19234. * @returns {Object} Returns the array of property values.
  19235. */
  19236. function baseValues(object, props) {
  19237. return arrayMap(props, function(key) {
  19238. return object[key];
  19239. });
  19240. }
  19241. /**
  19242. * Checks if a `cache` value for `key` exists.
  19243. *
  19244. * @private
  19245. * @param {Object} cache The cache to query.
  19246. * @param {string} key The key of the entry to check.
  19247. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19248. */
  19249. function cacheHas(cache, key) {
  19250. return cache.has(key);
  19251. }
  19252. /**
  19253. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19254. * that is not found in the character symbols.
  19255. *
  19256. * @private
  19257. * @param {Array} strSymbols The string symbols to inspect.
  19258. * @param {Array} chrSymbols The character symbols to find.
  19259. * @returns {number} Returns the index of the first unmatched string symbol.
  19260. */
  19261. function charsStartIndex(strSymbols, chrSymbols) {
  19262. var index = -1,
  19263. length = strSymbols.length;
  19264. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19265. return index;
  19266. }
  19267. /**
  19268. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19269. * that is not found in the character symbols.
  19270. *
  19271. * @private
  19272. * @param {Array} strSymbols The string symbols to inspect.
  19273. * @param {Array} chrSymbols The character symbols to find.
  19274. * @returns {number} Returns the index of the last unmatched string symbol.
  19275. */
  19276. function charsEndIndex(strSymbols, chrSymbols) {
  19277. var index = strSymbols.length;
  19278. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19279. return index;
  19280. }
  19281. /**
  19282. * Gets the number of `placeholder` occurrences in `array`.
  19283. *
  19284. * @private
  19285. * @param {Array} array The array to inspect.
  19286. * @param {*} placeholder The placeholder to search for.
  19287. * @returns {number} Returns the placeholder count.
  19288. */
  19289. function countHolders(array, placeholder) {
  19290. var length = array.length,
  19291. result = 0;
  19292. while (length--) {
  19293. if (array[length] === placeholder) {
  19294. ++result;
  19295. }
  19296. }
  19297. return result;
  19298. }
  19299. /**
  19300. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19301. * letters to basic Latin letters.
  19302. *
  19303. * @private
  19304. * @param {string} letter The matched letter to deburr.
  19305. * @returns {string} Returns the deburred letter.
  19306. */
  19307. var deburrLetter = basePropertyOf(deburredLetters);
  19308. /**
  19309. * Used by `_.escape` to convert characters to HTML entities.
  19310. *
  19311. * @private
  19312. * @param {string} chr The matched character to escape.
  19313. * @returns {string} Returns the escaped character.
  19314. */
  19315. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19316. /**
  19317. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19318. *
  19319. * @private
  19320. * @param {string} chr The matched character to escape.
  19321. * @returns {string} Returns the escaped character.
  19322. */
  19323. function escapeStringChar(chr) {
  19324. return '\\' + stringEscapes[chr];
  19325. }
  19326. /**
  19327. * Gets the value at `key` of `object`.
  19328. *
  19329. * @private
  19330. * @param {Object} [object] The object to query.
  19331. * @param {string} key The key of the property to get.
  19332. * @returns {*} Returns the property value.
  19333. */
  19334. function getValue(object, key) {
  19335. return object == null ? undefined : object[key];
  19336. }
  19337. /**
  19338. * Checks if `string` contains Unicode symbols.
  19339. *
  19340. * @private
  19341. * @param {string} string The string to inspect.
  19342. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19343. */
  19344. function hasUnicode(string) {
  19345. return reHasUnicode.test(string);
  19346. }
  19347. /**
  19348. * Checks if `string` contains a word composed of Unicode symbols.
  19349. *
  19350. * @private
  19351. * @param {string} string The string to inspect.
  19352. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19353. */
  19354. function hasUnicodeWord(string) {
  19355. return reHasUnicodeWord.test(string);
  19356. }
  19357. /**
  19358. * Converts `iterator` to an array.
  19359. *
  19360. * @private
  19361. * @param {Object} iterator The iterator to convert.
  19362. * @returns {Array} Returns the converted array.
  19363. */
  19364. function iteratorToArray(iterator) {
  19365. var data,
  19366. result = [];
  19367. while (!(data = iterator.next()).done) {
  19368. result.push(data.value);
  19369. }
  19370. return result;
  19371. }
  19372. /**
  19373. * Converts `map` to its key-value pairs.
  19374. *
  19375. * @private
  19376. * @param {Object} map The map to convert.
  19377. * @returns {Array} Returns the key-value pairs.
  19378. */
  19379. function mapToArray(map) {
  19380. var index = -1,
  19381. result = Array(map.size);
  19382. map.forEach(function(value, key) {
  19383. result[++index] = [key, value];
  19384. });
  19385. return result;
  19386. }
  19387. /**
  19388. * Creates a unary function that invokes `func` with its argument transformed.
  19389. *
  19390. * @private
  19391. * @param {Function} func The function to wrap.
  19392. * @param {Function} transform The argument transform.
  19393. * @returns {Function} Returns the new function.
  19394. */
  19395. function overArg(func, transform) {
  19396. return function(arg) {
  19397. return func(transform(arg));
  19398. };
  19399. }
  19400. /**
  19401. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19402. * and returns an array of their indexes.
  19403. *
  19404. * @private
  19405. * @param {Array} array The array to modify.
  19406. * @param {*} placeholder The placeholder to replace.
  19407. * @returns {Array} Returns the new array of placeholder indexes.
  19408. */
  19409. function replaceHolders(array, placeholder) {
  19410. var index = -1,
  19411. length = array.length,
  19412. resIndex = 0,
  19413. result = [];
  19414. while (++index < length) {
  19415. var value = array[index];
  19416. if (value === placeholder || value === PLACEHOLDER) {
  19417. array[index] = PLACEHOLDER;
  19418. result[resIndex++] = index;
  19419. }
  19420. }
  19421. return result;
  19422. }
  19423. /**
  19424. * Converts `set` to an array of its values.
  19425. *
  19426. * @private
  19427. * @param {Object} set The set to convert.
  19428. * @returns {Array} Returns the values.
  19429. */
  19430. function setToArray(set) {
  19431. var index = -1,
  19432. result = Array(set.size);
  19433. set.forEach(function(value) {
  19434. result[++index] = value;
  19435. });
  19436. return result;
  19437. }
  19438. /**
  19439. * Converts `set` to its value-value pairs.
  19440. *
  19441. * @private
  19442. * @param {Object} set The set to convert.
  19443. * @returns {Array} Returns the value-value pairs.
  19444. */
  19445. function setToPairs(set) {
  19446. var index = -1,
  19447. result = Array(set.size);
  19448. set.forEach(function(value) {
  19449. result[++index] = [value, value];
  19450. });
  19451. return result;
  19452. }
  19453. /**
  19454. * A specialized version of `_.indexOf` which performs strict equality
  19455. * comparisons of values, i.e. `===`.
  19456. *
  19457. * @private
  19458. * @param {Array} array The array to inspect.
  19459. * @param {*} value The value to search for.
  19460. * @param {number} fromIndex The index to search from.
  19461. * @returns {number} Returns the index of the matched value, else `-1`.
  19462. */
  19463. function strictIndexOf(array, value, fromIndex) {
  19464. var index = fromIndex - 1,
  19465. length = array.length;
  19466. while (++index < length) {
  19467. if (array[index] === value) {
  19468. return index;
  19469. }
  19470. }
  19471. return -1;
  19472. }
  19473. /**
  19474. * A specialized version of `_.lastIndexOf` which performs strict equality
  19475. * comparisons of values, i.e. `===`.
  19476. *
  19477. * @private
  19478. * @param {Array} array The array to inspect.
  19479. * @param {*} value The value to search for.
  19480. * @param {number} fromIndex The index to search from.
  19481. * @returns {number} Returns the index of the matched value, else `-1`.
  19482. */
  19483. function strictLastIndexOf(array, value, fromIndex) {
  19484. var index = fromIndex + 1;
  19485. while (index--) {
  19486. if (array[index] === value) {
  19487. return index;
  19488. }
  19489. }
  19490. return index;
  19491. }
  19492. /**
  19493. * Gets the number of symbols in `string`.
  19494. *
  19495. * @private
  19496. * @param {string} string The string to inspect.
  19497. * @returns {number} Returns the string size.
  19498. */
  19499. function stringSize(string) {
  19500. return hasUnicode(string)
  19501. ? unicodeSize(string)
  19502. : asciiSize(string);
  19503. }
  19504. /**
  19505. * Converts `string` to an array.
  19506. *
  19507. * @private
  19508. * @param {string} string The string to convert.
  19509. * @returns {Array} Returns the converted array.
  19510. */
  19511. function stringToArray(string) {
  19512. return hasUnicode(string)
  19513. ? unicodeToArray(string)
  19514. : asciiToArray(string);
  19515. }
  19516. /**
  19517. * Used by `_.unescape` to convert HTML entities to characters.
  19518. *
  19519. * @private
  19520. * @param {string} chr The matched character to unescape.
  19521. * @returns {string} Returns the unescaped character.
  19522. */
  19523. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19524. /**
  19525. * Gets the size of a Unicode `string`.
  19526. *
  19527. * @private
  19528. * @param {string} string The string inspect.
  19529. * @returns {number} Returns the string size.
  19530. */
  19531. function unicodeSize(string) {
  19532. var result = reUnicode.lastIndex = 0;
  19533. while (reUnicode.test(string)) {
  19534. ++result;
  19535. }
  19536. return result;
  19537. }
  19538. /**
  19539. * Converts a Unicode `string` to an array.
  19540. *
  19541. * @private
  19542. * @param {string} string The string to convert.
  19543. * @returns {Array} Returns the converted array.
  19544. */
  19545. function unicodeToArray(string) {
  19546. return string.match(reUnicode) || [];
  19547. }
  19548. /**
  19549. * Splits a Unicode `string` into an array of its words.
  19550. *
  19551. * @private
  19552. * @param {string} The string to inspect.
  19553. * @returns {Array} Returns the words of `string`.
  19554. */
  19555. function unicodeWords(string) {
  19556. return string.match(reUnicodeWord) || [];
  19557. }
  19558. /*--------------------------------------------------------------------------*/
  19559. /**
  19560. * Create a new pristine `lodash` function using the `context` object.
  19561. *
  19562. * @static
  19563. * @memberOf _
  19564. * @since 1.1.0
  19565. * @category Util
  19566. * @param {Object} [context=root] The context object.
  19567. * @returns {Function} Returns a new `lodash` function.
  19568. * @example
  19569. *
  19570. * _.mixin({ 'foo': _.constant('foo') });
  19571. *
  19572. * var lodash = _.runInContext();
  19573. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19574. *
  19575. * _.isFunction(_.foo);
  19576. * // => true
  19577. * _.isFunction(_.bar);
  19578. * // => false
  19579. *
  19580. * lodash.isFunction(lodash.foo);
  19581. * // => false
  19582. * lodash.isFunction(lodash.bar);
  19583. * // => true
  19584. *
  19585. * // Create a suped-up `defer` in Node.js.
  19586. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19587. */
  19588. var runInContext = (function runInContext(context) {
  19589. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19590. /** Built-in constructor references. */
  19591. var Array = context.Array,
  19592. Date = context.Date,
  19593. Error = context.Error,
  19594. Function = context.Function,
  19595. Math = context.Math,
  19596. Object = context.Object,
  19597. RegExp = context.RegExp,
  19598. String = context.String,
  19599. TypeError = context.TypeError;
  19600. /** Used for built-in method references. */
  19601. var arrayProto = Array.prototype,
  19602. funcProto = Function.prototype,
  19603. objectProto = Object.prototype;
  19604. /** Used to detect overreaching core-js shims. */
  19605. var coreJsData = context['__core-js_shared__'];
  19606. /** Used to resolve the decompiled source of functions. */
  19607. var funcToString = funcProto.toString;
  19608. /** Used to check objects for own properties. */
  19609. var hasOwnProperty = objectProto.hasOwnProperty;
  19610. /** Used to generate unique IDs. */
  19611. var idCounter = 0;
  19612. /** Used to detect methods masquerading as native. */
  19613. var maskSrcKey = (function() {
  19614. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19615. return uid ? ('Symbol(src)_1.' + uid) : '';
  19616. }());
  19617. /**
  19618. * Used to resolve the
  19619. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19620. * of values.
  19621. */
  19622. var nativeObjectToString = objectProto.toString;
  19623. /** Used to infer the `Object` constructor. */
  19624. var objectCtorString = funcToString.call(Object);
  19625. /** Used to restore the original `_` reference in `_.noConflict`. */
  19626. var oldDash = root._;
  19627. /** Used to detect if a method is native. */
  19628. var reIsNative = RegExp('^' +
  19629. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19630. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19631. );
  19632. /** Built-in value references. */
  19633. var Buffer = moduleExports ? context.Buffer : undefined,
  19634. Symbol = context.Symbol,
  19635. Uint8Array = context.Uint8Array,
  19636. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19637. getPrototype = overArg(Object.getPrototypeOf, Object),
  19638. objectCreate = Object.create,
  19639. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19640. splice = arrayProto.splice,
  19641. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19642. symIterator = Symbol ? Symbol.iterator : undefined,
  19643. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19644. var defineProperty = (function() {
  19645. try {
  19646. var func = getNative(Object, 'defineProperty');
  19647. func({}, '', {});
  19648. return func;
  19649. } catch (e) {}
  19650. }());
  19651. /** Mocked built-ins. */
  19652. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19653. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19654. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19655. /* Built-in method references for those with the same name as other `lodash` methods. */
  19656. var nativeCeil = Math.ceil,
  19657. nativeFloor = Math.floor,
  19658. nativeGetSymbols = Object.getOwnPropertySymbols,
  19659. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19660. nativeIsFinite = context.isFinite,
  19661. nativeJoin = arrayProto.join,
  19662. nativeKeys = overArg(Object.keys, Object),
  19663. nativeMax = Math.max,
  19664. nativeMin = Math.min,
  19665. nativeNow = Date.now,
  19666. nativeParseInt = context.parseInt,
  19667. nativeRandom = Math.random,
  19668. nativeReverse = arrayProto.reverse;
  19669. /* Built-in method references that are verified to be native. */
  19670. var DataView = getNative(context, 'DataView'),
  19671. Map = getNative(context, 'Map'),
  19672. Promise = getNative(context, 'Promise'),
  19673. Set = getNative(context, 'Set'),
  19674. WeakMap = getNative(context, 'WeakMap'),
  19675. nativeCreate = getNative(Object, 'create');
  19676. /** Used to store function metadata. */
  19677. var metaMap = WeakMap && new WeakMap;
  19678. /** Used to lookup unminified function names. */
  19679. var realNames = {};
  19680. /** Used to detect maps, sets, and weakmaps. */
  19681. var dataViewCtorString = toSource(DataView),
  19682. mapCtorString = toSource(Map),
  19683. promiseCtorString = toSource(Promise),
  19684. setCtorString = toSource(Set),
  19685. weakMapCtorString = toSource(WeakMap);
  19686. /** Used to convert symbols to primitives and strings. */
  19687. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19688. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19689. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19690. /*------------------------------------------------------------------------*/
  19691. /**
  19692. * Creates a `lodash` object which wraps `value` to enable implicit method
  19693. * chain sequences. Methods that operate on and return arrays, collections,
  19694. * and functions can be chained together. Methods that retrieve a single value
  19695. * or may return a primitive value will automatically end the chain sequence
  19696. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19697. * with `_#value`.
  19698. *
  19699. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19700. * enabled using `_.chain`.
  19701. *
  19702. * The execution of chained methods is lazy, that is, it's deferred until
  19703. * `_#value` is implicitly or explicitly called.
  19704. *
  19705. * Lazy evaluation allows several methods to support shortcut fusion.
  19706. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19707. * the creation of intermediate arrays and can greatly reduce the number of
  19708. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19709. * fusion if the section is applied to an array and iteratees accept only
  19710. * one argument. The heuristic for whether a section qualifies for shortcut
  19711. * fusion is subject to change.
  19712. *
  19713. * Chaining is supported in custom builds as long as the `_#value` method is
  19714. * directly or indirectly included in the build.
  19715. *
  19716. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19717. *
  19718. * The wrapper `Array` methods are:
  19719. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19720. *
  19721. * The wrapper `String` methods are:
  19722. * `replace` and `split`
  19723. *
  19724. * The wrapper methods that support shortcut fusion are:
  19725. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19726. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19727. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19728. *
  19729. * The chainable wrapper methods are:
  19730. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19731. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19732. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19733. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19734. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19735. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19736. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19737. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19738. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19739. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19740. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19741. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19742. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19743. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19744. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19745. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19746. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19747. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19748. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19749. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19750. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19751. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19752. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19753. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19754. *
  19755. * The wrapper methods that are **not** chainable by default are:
  19756. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19757. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19758. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19759. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19760. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19761. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19762. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19763. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19764. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19765. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19766. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19767. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19768. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19769. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19770. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19771. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19772. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19773. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19774. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19775. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19776. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19777. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19778. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19779. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19780. * `upperFirst`, `value`, and `words`
  19781. *
  19782. * @name _
  19783. * @constructor
  19784. * @category Seq
  19785. * @param {*} value The value to wrap in a `lodash` instance.
  19786. * @returns {Object} Returns the new `lodash` wrapper instance.
  19787. * @example
  19788. *
  19789. * function square(n) {
  19790. * return n * n;
  19791. * }
  19792. *
  19793. * var wrapped = _([1, 2, 3]);
  19794. *
  19795. * // Returns an unwrapped value.
  19796. * wrapped.reduce(_.add);
  19797. * // => 6
  19798. *
  19799. * // Returns a wrapped value.
  19800. * var squares = wrapped.map(square);
  19801. *
  19802. * _.isArray(squares);
  19803. * // => false
  19804. *
  19805. * _.isArray(squares.value());
  19806. * // => true
  19807. */
  19808. function lodash(value) {
  19809. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19810. if (value instanceof LodashWrapper) {
  19811. return value;
  19812. }
  19813. if (hasOwnProperty.call(value, '__wrapped__')) {
  19814. return wrapperClone(value);
  19815. }
  19816. }
  19817. return new LodashWrapper(value);
  19818. }
  19819. /**
  19820. * The base implementation of `_.create` without support for assigning
  19821. * properties to the created object.
  19822. *
  19823. * @private
  19824. * @param {Object} proto The object to inherit from.
  19825. * @returns {Object} Returns the new object.
  19826. */
  19827. var baseCreate = (function() {
  19828. function object() {}
  19829. return function(proto) {
  19830. if (!isObject(proto)) {
  19831. return {};
  19832. }
  19833. if (objectCreate) {
  19834. return objectCreate(proto);
  19835. }
  19836. object.prototype = proto;
  19837. var result = new object;
  19838. object.prototype = undefined;
  19839. return result;
  19840. };
  19841. }());
  19842. /**
  19843. * The function whose prototype chain sequence wrappers inherit from.
  19844. *
  19845. * @private
  19846. */
  19847. function baseLodash() {
  19848. // No operation performed.
  19849. }
  19850. /**
  19851. * The base constructor for creating `lodash` wrapper objects.
  19852. *
  19853. * @private
  19854. * @param {*} value The value to wrap.
  19855. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19856. */
  19857. function LodashWrapper(value, chainAll) {
  19858. this.__wrapped__ = value;
  19859. this.__actions__ = [];
  19860. this.__chain__ = !!chainAll;
  19861. this.__index__ = 0;
  19862. this.__values__ = undefined;
  19863. }
  19864. /**
  19865. * By default, the template delimiters used by lodash are like those in
  19866. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19867. * following template settings to use alternative delimiters.
  19868. *
  19869. * @static
  19870. * @memberOf _
  19871. * @type {Object}
  19872. */
  19873. lodash.templateSettings = {
  19874. /**
  19875. * Used to detect `data` property values to be HTML-escaped.
  19876. *
  19877. * @memberOf _.templateSettings
  19878. * @type {RegExp}
  19879. */
  19880. 'escape': reEscape,
  19881. /**
  19882. * Used to detect code to be evaluated.
  19883. *
  19884. * @memberOf _.templateSettings
  19885. * @type {RegExp}
  19886. */
  19887. 'evaluate': reEvaluate,
  19888. /**
  19889. * Used to detect `data` property values to inject.
  19890. *
  19891. * @memberOf _.templateSettings
  19892. * @type {RegExp}
  19893. */
  19894. 'interpolate': reInterpolate,
  19895. /**
  19896. * Used to reference the data object in the template text.
  19897. *
  19898. * @memberOf _.templateSettings
  19899. * @type {string}
  19900. */
  19901. 'variable': '',
  19902. /**
  19903. * Used to import variables into the compiled template.
  19904. *
  19905. * @memberOf _.templateSettings
  19906. * @type {Object}
  19907. */
  19908. 'imports': {
  19909. /**
  19910. * A reference to the `lodash` function.
  19911. *
  19912. * @memberOf _.templateSettings.imports
  19913. * @type {Function}
  19914. */
  19915. '_': lodash
  19916. }
  19917. };
  19918. // Ensure wrappers are instances of `baseLodash`.
  19919. lodash.prototype = baseLodash.prototype;
  19920. lodash.prototype.constructor = lodash;
  19921. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19922. LodashWrapper.prototype.constructor = LodashWrapper;
  19923. /*------------------------------------------------------------------------*/
  19924. /**
  19925. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19926. *
  19927. * @private
  19928. * @constructor
  19929. * @param {*} value The value to wrap.
  19930. */
  19931. function LazyWrapper(value) {
  19932. this.__wrapped__ = value;
  19933. this.__actions__ = [];
  19934. this.__dir__ = 1;
  19935. this.__filtered__ = false;
  19936. this.__iteratees__ = [];
  19937. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19938. this.__views__ = [];
  19939. }
  19940. /**
  19941. * Creates a clone of the lazy wrapper object.
  19942. *
  19943. * @private
  19944. * @name clone
  19945. * @memberOf LazyWrapper
  19946. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19947. */
  19948. function lazyClone() {
  19949. var result = new LazyWrapper(this.__wrapped__);
  19950. result.__actions__ = copyArray(this.__actions__);
  19951. result.__dir__ = this.__dir__;
  19952. result.__filtered__ = this.__filtered__;
  19953. result.__iteratees__ = copyArray(this.__iteratees__);
  19954. result.__takeCount__ = this.__takeCount__;
  19955. result.__views__ = copyArray(this.__views__);
  19956. return result;
  19957. }
  19958. /**
  19959. * Reverses the direction of lazy iteration.
  19960. *
  19961. * @private
  19962. * @name reverse
  19963. * @memberOf LazyWrapper
  19964. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19965. */
  19966. function lazyReverse() {
  19967. if (this.__filtered__) {
  19968. var result = new LazyWrapper(this);
  19969. result.__dir__ = -1;
  19970. result.__filtered__ = true;
  19971. } else {
  19972. result = this.clone();
  19973. result.__dir__ *= -1;
  19974. }
  19975. return result;
  19976. }
  19977. /**
  19978. * Extracts the unwrapped value from its lazy wrapper.
  19979. *
  19980. * @private
  19981. * @name value
  19982. * @memberOf LazyWrapper
  19983. * @returns {*} Returns the unwrapped value.
  19984. */
  19985. function lazyValue() {
  19986. var array = this.__wrapped__.value(),
  19987. dir = this.__dir__,
  19988. isArr = isArray(array),
  19989. isRight = dir < 0,
  19990. arrLength = isArr ? array.length : 0,
  19991. view = getView(0, arrLength, this.__views__),
  19992. start = view.start,
  19993. end = view.end,
  19994. length = end - start,
  19995. index = isRight ? end : (start - 1),
  19996. iteratees = this.__iteratees__,
  19997. iterLength = iteratees.length,
  19998. resIndex = 0,
  19999. takeCount = nativeMin(length, this.__takeCount__);
  20000. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20001. return baseWrapperValue(array, this.__actions__);
  20002. }
  20003. var result = [];
  20004. outer:
  20005. while (length-- && resIndex < takeCount) {
  20006. index += dir;
  20007. var iterIndex = -1,
  20008. value = array[index];
  20009. while (++iterIndex < iterLength) {
  20010. var data = iteratees[iterIndex],
  20011. iteratee = data.iteratee,
  20012. type = data.type,
  20013. computed = iteratee(value);
  20014. if (type == LAZY_MAP_FLAG) {
  20015. value = computed;
  20016. } else if (!computed) {
  20017. if (type == LAZY_FILTER_FLAG) {
  20018. continue outer;
  20019. } else {
  20020. break outer;
  20021. }
  20022. }
  20023. }
  20024. result[resIndex++] = value;
  20025. }
  20026. return result;
  20027. }
  20028. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20029. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20030. LazyWrapper.prototype.constructor = LazyWrapper;
  20031. /*------------------------------------------------------------------------*/
  20032. /**
  20033. * Creates a hash object.
  20034. *
  20035. * @private
  20036. * @constructor
  20037. * @param {Array} [entries] The key-value pairs to cache.
  20038. */
  20039. function Hash(entries) {
  20040. var index = -1,
  20041. length = entries == null ? 0 : entries.length;
  20042. this.clear();
  20043. while (++index < length) {
  20044. var entry = entries[index];
  20045. this.set(entry[0], entry[1]);
  20046. }
  20047. }
  20048. /**
  20049. * Removes all key-value entries from the hash.
  20050. *
  20051. * @private
  20052. * @name clear
  20053. * @memberOf Hash
  20054. */
  20055. function hashClear() {
  20056. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20057. this.size = 0;
  20058. }
  20059. /**
  20060. * Removes `key` and its value from the hash.
  20061. *
  20062. * @private
  20063. * @name delete
  20064. * @memberOf Hash
  20065. * @param {Object} hash The hash to modify.
  20066. * @param {string} key The key of the value to remove.
  20067. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20068. */
  20069. function hashDelete(key) {
  20070. var result = this.has(key) && delete this.__data__[key];
  20071. this.size -= result ? 1 : 0;
  20072. return result;
  20073. }
  20074. /**
  20075. * Gets the hash value for `key`.
  20076. *
  20077. * @private
  20078. * @name get
  20079. * @memberOf Hash
  20080. * @param {string} key The key of the value to get.
  20081. * @returns {*} Returns the entry value.
  20082. */
  20083. function hashGet(key) {
  20084. var data = this.__data__;
  20085. if (nativeCreate) {
  20086. var result = data[key];
  20087. return result === HASH_UNDEFINED ? undefined : result;
  20088. }
  20089. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20090. }
  20091. /**
  20092. * Checks if a hash value for `key` exists.
  20093. *
  20094. * @private
  20095. * @name has
  20096. * @memberOf Hash
  20097. * @param {string} key The key of the entry to check.
  20098. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20099. */
  20100. function hashHas(key) {
  20101. var data = this.__data__;
  20102. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20103. }
  20104. /**
  20105. * Sets the hash `key` to `value`.
  20106. *
  20107. * @private
  20108. * @name set
  20109. * @memberOf Hash
  20110. * @param {string} key The key of the value to set.
  20111. * @param {*} value The value to set.
  20112. * @returns {Object} Returns the hash instance.
  20113. */
  20114. function hashSet(key, value) {
  20115. var data = this.__data__;
  20116. this.size += this.has(key) ? 0 : 1;
  20117. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20118. return this;
  20119. }
  20120. // Add methods to `Hash`.
  20121. Hash.prototype.clear = hashClear;
  20122. Hash.prototype['delete'] = hashDelete;
  20123. Hash.prototype.get = hashGet;
  20124. Hash.prototype.has = hashHas;
  20125. Hash.prototype.set = hashSet;
  20126. /*------------------------------------------------------------------------*/
  20127. /**
  20128. * Creates an list cache object.
  20129. *
  20130. * @private
  20131. * @constructor
  20132. * @param {Array} [entries] The key-value pairs to cache.
  20133. */
  20134. function ListCache(entries) {
  20135. var index = -1,
  20136. length = entries == null ? 0 : entries.length;
  20137. this.clear();
  20138. while (++index < length) {
  20139. var entry = entries[index];
  20140. this.set(entry[0], entry[1]);
  20141. }
  20142. }
  20143. /**
  20144. * Removes all key-value entries from the list cache.
  20145. *
  20146. * @private
  20147. * @name clear
  20148. * @memberOf ListCache
  20149. */
  20150. function listCacheClear() {
  20151. this.__data__ = [];
  20152. this.size = 0;
  20153. }
  20154. /**
  20155. * Removes `key` and its value from the list cache.
  20156. *
  20157. * @private
  20158. * @name delete
  20159. * @memberOf ListCache
  20160. * @param {string} key The key of the value to remove.
  20161. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20162. */
  20163. function listCacheDelete(key) {
  20164. var data = this.__data__,
  20165. index = assocIndexOf(data, key);
  20166. if (index < 0) {
  20167. return false;
  20168. }
  20169. var lastIndex = data.length - 1;
  20170. if (index == lastIndex) {
  20171. data.pop();
  20172. } else {
  20173. splice.call(data, index, 1);
  20174. }
  20175. --this.size;
  20176. return true;
  20177. }
  20178. /**
  20179. * Gets the list cache value for `key`.
  20180. *
  20181. * @private
  20182. * @name get
  20183. * @memberOf ListCache
  20184. * @param {string} key The key of the value to get.
  20185. * @returns {*} Returns the entry value.
  20186. */
  20187. function listCacheGet(key) {
  20188. var data = this.__data__,
  20189. index = assocIndexOf(data, key);
  20190. return index < 0 ? undefined : data[index][1];
  20191. }
  20192. /**
  20193. * Checks if a list cache value for `key` exists.
  20194. *
  20195. * @private
  20196. * @name has
  20197. * @memberOf ListCache
  20198. * @param {string} key The key of the entry to check.
  20199. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20200. */
  20201. function listCacheHas(key) {
  20202. return assocIndexOf(this.__data__, key) > -1;
  20203. }
  20204. /**
  20205. * Sets the list cache `key` to `value`.
  20206. *
  20207. * @private
  20208. * @name set
  20209. * @memberOf ListCache
  20210. * @param {string} key The key of the value to set.
  20211. * @param {*} value The value to set.
  20212. * @returns {Object} Returns the list cache instance.
  20213. */
  20214. function listCacheSet(key, value) {
  20215. var data = this.__data__,
  20216. index = assocIndexOf(data, key);
  20217. if (index < 0) {
  20218. ++this.size;
  20219. data.push([key, value]);
  20220. } else {
  20221. data[index][1] = value;
  20222. }
  20223. return this;
  20224. }
  20225. // Add methods to `ListCache`.
  20226. ListCache.prototype.clear = listCacheClear;
  20227. ListCache.prototype['delete'] = listCacheDelete;
  20228. ListCache.prototype.get = listCacheGet;
  20229. ListCache.prototype.has = listCacheHas;
  20230. ListCache.prototype.set = listCacheSet;
  20231. /*------------------------------------------------------------------------*/
  20232. /**
  20233. * Creates a map cache object to store key-value pairs.
  20234. *
  20235. * @private
  20236. * @constructor
  20237. * @param {Array} [entries] The key-value pairs to cache.
  20238. */
  20239. function MapCache(entries) {
  20240. var index = -1,
  20241. length = entries == null ? 0 : entries.length;
  20242. this.clear();
  20243. while (++index < length) {
  20244. var entry = entries[index];
  20245. this.set(entry[0], entry[1]);
  20246. }
  20247. }
  20248. /**
  20249. * Removes all key-value entries from the map.
  20250. *
  20251. * @private
  20252. * @name clear
  20253. * @memberOf MapCache
  20254. */
  20255. function mapCacheClear() {
  20256. this.size = 0;
  20257. this.__data__ = {
  20258. 'hash': new Hash,
  20259. 'map': new (Map || ListCache),
  20260. 'string': new Hash
  20261. };
  20262. }
  20263. /**
  20264. * Removes `key` and its value from the map.
  20265. *
  20266. * @private
  20267. * @name delete
  20268. * @memberOf MapCache
  20269. * @param {string} key The key of the value to remove.
  20270. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20271. */
  20272. function mapCacheDelete(key) {
  20273. var result = getMapData(this, key)['delete'](key);
  20274. this.size -= result ? 1 : 0;
  20275. return result;
  20276. }
  20277. /**
  20278. * Gets the map value for `key`.
  20279. *
  20280. * @private
  20281. * @name get
  20282. * @memberOf MapCache
  20283. * @param {string} key The key of the value to get.
  20284. * @returns {*} Returns the entry value.
  20285. */
  20286. function mapCacheGet(key) {
  20287. return getMapData(this, key).get(key);
  20288. }
  20289. /**
  20290. * Checks if a map value for `key` exists.
  20291. *
  20292. * @private
  20293. * @name has
  20294. * @memberOf MapCache
  20295. * @param {string} key The key of the entry to check.
  20296. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20297. */
  20298. function mapCacheHas(key) {
  20299. return getMapData(this, key).has(key);
  20300. }
  20301. /**
  20302. * Sets the map `key` to `value`.
  20303. *
  20304. * @private
  20305. * @name set
  20306. * @memberOf MapCache
  20307. * @param {string} key The key of the value to set.
  20308. * @param {*} value The value to set.
  20309. * @returns {Object} Returns the map cache instance.
  20310. */
  20311. function mapCacheSet(key, value) {
  20312. var data = getMapData(this, key),
  20313. size = data.size;
  20314. data.set(key, value);
  20315. this.size += data.size == size ? 0 : 1;
  20316. return this;
  20317. }
  20318. // Add methods to `MapCache`.
  20319. MapCache.prototype.clear = mapCacheClear;
  20320. MapCache.prototype['delete'] = mapCacheDelete;
  20321. MapCache.prototype.get = mapCacheGet;
  20322. MapCache.prototype.has = mapCacheHas;
  20323. MapCache.prototype.set = mapCacheSet;
  20324. /*------------------------------------------------------------------------*/
  20325. /**
  20326. *
  20327. * Creates an array cache object to store unique values.
  20328. *
  20329. * @private
  20330. * @constructor
  20331. * @param {Array} [values] The values to cache.
  20332. */
  20333. function SetCache(values) {
  20334. var index = -1,
  20335. length = values == null ? 0 : values.length;
  20336. this.__data__ = new MapCache;
  20337. while (++index < length) {
  20338. this.add(values[index]);
  20339. }
  20340. }
  20341. /**
  20342. * Adds `value` to the array cache.
  20343. *
  20344. * @private
  20345. * @name add
  20346. * @memberOf SetCache
  20347. * @alias push
  20348. * @param {*} value The value to cache.
  20349. * @returns {Object} Returns the cache instance.
  20350. */
  20351. function setCacheAdd(value) {
  20352. this.__data__.set(value, HASH_UNDEFINED);
  20353. return this;
  20354. }
  20355. /**
  20356. * Checks if `value` is in the array cache.
  20357. *
  20358. * @private
  20359. * @name has
  20360. * @memberOf SetCache
  20361. * @param {*} value The value to search for.
  20362. * @returns {number} Returns `true` if `value` is found, else `false`.
  20363. */
  20364. function setCacheHas(value) {
  20365. return this.__data__.has(value);
  20366. }
  20367. // Add methods to `SetCache`.
  20368. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20369. SetCache.prototype.has = setCacheHas;
  20370. /*------------------------------------------------------------------------*/
  20371. /**
  20372. * Creates a stack cache object to store key-value pairs.
  20373. *
  20374. * @private
  20375. * @constructor
  20376. * @param {Array} [entries] The key-value pairs to cache.
  20377. */
  20378. function Stack(entries) {
  20379. var data = this.__data__ = new ListCache(entries);
  20380. this.size = data.size;
  20381. }
  20382. /**
  20383. * Removes all key-value entries from the stack.
  20384. *
  20385. * @private
  20386. * @name clear
  20387. * @memberOf Stack
  20388. */
  20389. function stackClear() {
  20390. this.__data__ = new ListCache;
  20391. this.size = 0;
  20392. }
  20393. /**
  20394. * Removes `key` and its value from the stack.
  20395. *
  20396. * @private
  20397. * @name delete
  20398. * @memberOf Stack
  20399. * @param {string} key The key of the value to remove.
  20400. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20401. */
  20402. function stackDelete(key) {
  20403. var data = this.__data__,
  20404. result = data['delete'](key);
  20405. this.size = data.size;
  20406. return result;
  20407. }
  20408. /**
  20409. * Gets the stack value for `key`.
  20410. *
  20411. * @private
  20412. * @name get
  20413. * @memberOf Stack
  20414. * @param {string} key The key of the value to get.
  20415. * @returns {*} Returns the entry value.
  20416. */
  20417. function stackGet(key) {
  20418. return this.__data__.get(key);
  20419. }
  20420. /**
  20421. * Checks if a stack value for `key` exists.
  20422. *
  20423. * @private
  20424. * @name has
  20425. * @memberOf Stack
  20426. * @param {string} key The key of the entry to check.
  20427. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20428. */
  20429. function stackHas(key) {
  20430. return this.__data__.has(key);
  20431. }
  20432. /**
  20433. * Sets the stack `key` to `value`.
  20434. *
  20435. * @private
  20436. * @name set
  20437. * @memberOf Stack
  20438. * @param {string} key The key of the value to set.
  20439. * @param {*} value The value to set.
  20440. * @returns {Object} Returns the stack cache instance.
  20441. */
  20442. function stackSet(key, value) {
  20443. var data = this.__data__;
  20444. if (data instanceof ListCache) {
  20445. var pairs = data.__data__;
  20446. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20447. pairs.push([key, value]);
  20448. this.size = ++data.size;
  20449. return this;
  20450. }
  20451. data = this.__data__ = new MapCache(pairs);
  20452. }
  20453. data.set(key, value);
  20454. this.size = data.size;
  20455. return this;
  20456. }
  20457. // Add methods to `Stack`.
  20458. Stack.prototype.clear = stackClear;
  20459. Stack.prototype['delete'] = stackDelete;
  20460. Stack.prototype.get = stackGet;
  20461. Stack.prototype.has = stackHas;
  20462. Stack.prototype.set = stackSet;
  20463. /*------------------------------------------------------------------------*/
  20464. /**
  20465. * Creates an array of the enumerable property names of the array-like `value`.
  20466. *
  20467. * @private
  20468. * @param {*} value The value to query.
  20469. * @param {boolean} inherited Specify returning inherited property names.
  20470. * @returns {Array} Returns the array of property names.
  20471. */
  20472. function arrayLikeKeys(value, inherited) {
  20473. var isArr = isArray(value),
  20474. isArg = !isArr && isArguments(value),
  20475. isBuff = !isArr && !isArg && isBuffer(value),
  20476. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20477. skipIndexes = isArr || isArg || isBuff || isType,
  20478. result = skipIndexes ? baseTimes(value.length, String) : [],
  20479. length = result.length;
  20480. for (var key in value) {
  20481. if ((inherited || hasOwnProperty.call(value, key)) &&
  20482. !(skipIndexes && (
  20483. // Safari 9 has enumerable `arguments.length` in strict mode.
  20484. key == 'length' ||
  20485. // Node.js 0.10 has enumerable non-index properties on buffers.
  20486. (isBuff && (key == 'offset' || key == 'parent')) ||
  20487. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20488. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20489. // Skip index properties.
  20490. isIndex(key, length)
  20491. ))) {
  20492. result.push(key);
  20493. }
  20494. }
  20495. return result;
  20496. }
  20497. /**
  20498. * A specialized version of `_.sample` for arrays.
  20499. *
  20500. * @private
  20501. * @param {Array} array The array to sample.
  20502. * @returns {*} Returns the random element.
  20503. */
  20504. function arraySample(array) {
  20505. var length = array.length;
  20506. return length ? array[baseRandom(0, length - 1)] : undefined;
  20507. }
  20508. /**
  20509. * A specialized version of `_.sampleSize` for arrays.
  20510. *
  20511. * @private
  20512. * @param {Array} array The array to sample.
  20513. * @param {number} n The number of elements to sample.
  20514. * @returns {Array} Returns the random elements.
  20515. */
  20516. function arraySampleSize(array, n) {
  20517. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20518. }
  20519. /**
  20520. * A specialized version of `_.shuffle` for arrays.
  20521. *
  20522. * @private
  20523. * @param {Array} array The array to shuffle.
  20524. * @returns {Array} Returns the new shuffled array.
  20525. */
  20526. function arrayShuffle(array) {
  20527. return shuffleSelf(copyArray(array));
  20528. }
  20529. /**
  20530. * This function is like `assignValue` except that it doesn't assign
  20531. * `undefined` values.
  20532. *
  20533. * @private
  20534. * @param {Object} object The object to modify.
  20535. * @param {string} key The key of the property to assign.
  20536. * @param {*} value The value to assign.
  20537. */
  20538. function assignMergeValue(object, key, value) {
  20539. if ((value !== undefined && !eq(object[key], value)) ||
  20540. (value === undefined && !(key in object))) {
  20541. baseAssignValue(object, key, value);
  20542. }
  20543. }
  20544. /**
  20545. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20546. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20547. * for equality comparisons.
  20548. *
  20549. * @private
  20550. * @param {Object} object The object to modify.
  20551. * @param {string} key The key of the property to assign.
  20552. * @param {*} value The value to assign.
  20553. */
  20554. function assignValue(object, key, value) {
  20555. var objValue = object[key];
  20556. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20557. (value === undefined && !(key in object))) {
  20558. baseAssignValue(object, key, value);
  20559. }
  20560. }
  20561. /**
  20562. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20563. *
  20564. * @private
  20565. * @param {Array} array The array to inspect.
  20566. * @param {*} key The key to search for.
  20567. * @returns {number} Returns the index of the matched value, else `-1`.
  20568. */
  20569. function assocIndexOf(array, key) {
  20570. var length = array.length;
  20571. while (length--) {
  20572. if (eq(array[length][0], key)) {
  20573. return length;
  20574. }
  20575. }
  20576. return -1;
  20577. }
  20578. /**
  20579. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20580. * by `iteratee` and values set by `setter`.
  20581. *
  20582. * @private
  20583. * @param {Array|Object} collection The collection to iterate over.
  20584. * @param {Function} setter The function to set `accumulator` values.
  20585. * @param {Function} iteratee The iteratee to transform keys.
  20586. * @param {Object} accumulator The initial aggregated object.
  20587. * @returns {Function} Returns `accumulator`.
  20588. */
  20589. function baseAggregator(collection, setter, iteratee, accumulator) {
  20590. baseEach(collection, function(value, key, collection) {
  20591. setter(accumulator, value, iteratee(value), collection);
  20592. });
  20593. return accumulator;
  20594. }
  20595. /**
  20596. * The base implementation of `_.assign` without support for multiple sources
  20597. * or `customizer` functions.
  20598. *
  20599. * @private
  20600. * @param {Object} object The destination object.
  20601. * @param {Object} source The source object.
  20602. * @returns {Object} Returns `object`.
  20603. */
  20604. function baseAssign(object, source) {
  20605. return object && copyObject(source, keys(source), object);
  20606. }
  20607. /**
  20608. * The base implementation of `_.assignIn` without support for multiple sources
  20609. * or `customizer` functions.
  20610. *
  20611. * @private
  20612. * @param {Object} object The destination object.
  20613. * @param {Object} source The source object.
  20614. * @returns {Object} Returns `object`.
  20615. */
  20616. function baseAssignIn(object, source) {
  20617. return object && copyObject(source, keysIn(source), object);
  20618. }
  20619. /**
  20620. * The base implementation of `assignValue` and `assignMergeValue` without
  20621. * value checks.
  20622. *
  20623. * @private
  20624. * @param {Object} object The object to modify.
  20625. * @param {string} key The key of the property to assign.
  20626. * @param {*} value The value to assign.
  20627. */
  20628. function baseAssignValue(object, key, value) {
  20629. if (key == '__proto__' && defineProperty) {
  20630. defineProperty(object, key, {
  20631. 'configurable': true,
  20632. 'enumerable': true,
  20633. 'value': value,
  20634. 'writable': true
  20635. });
  20636. } else {
  20637. object[key] = value;
  20638. }
  20639. }
  20640. /**
  20641. * The base implementation of `_.at` without support for individual paths.
  20642. *
  20643. * @private
  20644. * @param {Object} object The object to iterate over.
  20645. * @param {string[]} paths The property paths to pick.
  20646. * @returns {Array} Returns the picked elements.
  20647. */
  20648. function baseAt(object, paths) {
  20649. var index = -1,
  20650. length = paths.length,
  20651. result = Array(length),
  20652. skip = object == null;
  20653. while (++index < length) {
  20654. result[index] = skip ? undefined : get(object, paths[index]);
  20655. }
  20656. return result;
  20657. }
  20658. /**
  20659. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20660. *
  20661. * @private
  20662. * @param {number} number The number to clamp.
  20663. * @param {number} [lower] The lower bound.
  20664. * @param {number} upper The upper bound.
  20665. * @returns {number} Returns the clamped number.
  20666. */
  20667. function baseClamp(number, lower, upper) {
  20668. if (number === number) {
  20669. if (upper !== undefined) {
  20670. number = number <= upper ? number : upper;
  20671. }
  20672. if (lower !== undefined) {
  20673. number = number >= lower ? number : lower;
  20674. }
  20675. }
  20676. return number;
  20677. }
  20678. /**
  20679. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20680. * traversed objects.
  20681. *
  20682. * @private
  20683. * @param {*} value The value to clone.
  20684. * @param {boolean} bitmask The bitmask flags.
  20685. * 1 - Deep clone
  20686. * 2 - Flatten inherited properties
  20687. * 4 - Clone symbols
  20688. * @param {Function} [customizer] The function to customize cloning.
  20689. * @param {string} [key] The key of `value`.
  20690. * @param {Object} [object] The parent object of `value`.
  20691. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20692. * @returns {*} Returns the cloned value.
  20693. */
  20694. function baseClone(value, bitmask, customizer, key, object, stack) {
  20695. var result,
  20696. isDeep = bitmask & CLONE_DEEP_FLAG,
  20697. isFlat = bitmask & CLONE_FLAT_FLAG,
  20698. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20699. if (customizer) {
  20700. result = object ? customizer(value, key, object, stack) : customizer(value);
  20701. }
  20702. if (result !== undefined) {
  20703. return result;
  20704. }
  20705. if (!isObject(value)) {
  20706. return value;
  20707. }
  20708. var isArr = isArray(value);
  20709. if (isArr) {
  20710. result = initCloneArray(value);
  20711. if (!isDeep) {
  20712. return copyArray(value, result);
  20713. }
  20714. } else {
  20715. var tag = getTag(value),
  20716. isFunc = tag == funcTag || tag == genTag;
  20717. if (isBuffer(value)) {
  20718. return cloneBuffer(value, isDeep);
  20719. }
  20720. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20721. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20722. if (!isDeep) {
  20723. return isFlat
  20724. ? copySymbolsIn(value, baseAssignIn(result, value))
  20725. : copySymbols(value, baseAssign(result, value));
  20726. }
  20727. } else {
  20728. if (!cloneableTags[tag]) {
  20729. return object ? value : {};
  20730. }
  20731. result = initCloneByTag(value, tag, isDeep);
  20732. }
  20733. }
  20734. // Check for circular references and return its corresponding clone.
  20735. stack || (stack = new Stack);
  20736. var stacked = stack.get(value);
  20737. if (stacked) {
  20738. return stacked;
  20739. }
  20740. stack.set(value, result);
  20741. if (isSet(value)) {
  20742. value.forEach(function(subValue) {
  20743. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20744. });
  20745. } else if (isMap(value)) {
  20746. value.forEach(function(subValue, key) {
  20747. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20748. });
  20749. }
  20750. var keysFunc = isFull
  20751. ? (isFlat ? getAllKeysIn : getAllKeys)
  20752. : (isFlat ? keysIn : keys);
  20753. var props = isArr ? undefined : keysFunc(value);
  20754. arrayEach(props || value, function(subValue, key) {
  20755. if (props) {
  20756. key = subValue;
  20757. subValue = value[key];
  20758. }
  20759. // Recursively populate clone (susceptible to call stack limits).
  20760. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20761. });
  20762. return result;
  20763. }
  20764. /**
  20765. * The base implementation of `_.conforms` which doesn't clone `source`.
  20766. *
  20767. * @private
  20768. * @param {Object} source The object of property predicates to conform to.
  20769. * @returns {Function} Returns the new spec function.
  20770. */
  20771. function baseConforms(source) {
  20772. var props = keys(source);
  20773. return function(object) {
  20774. return baseConformsTo(object, source, props);
  20775. };
  20776. }
  20777. /**
  20778. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20779. *
  20780. * @private
  20781. * @param {Object} object The object to inspect.
  20782. * @param {Object} source The object of property predicates to conform to.
  20783. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20784. */
  20785. function baseConformsTo(object, source, props) {
  20786. var length = props.length;
  20787. if (object == null) {
  20788. return !length;
  20789. }
  20790. object = Object(object);
  20791. while (length--) {
  20792. var key = props[length],
  20793. predicate = source[key],
  20794. value = object[key];
  20795. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20796. return false;
  20797. }
  20798. }
  20799. return true;
  20800. }
  20801. /**
  20802. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20803. * to provide to `func`.
  20804. *
  20805. * @private
  20806. * @param {Function} func The function to delay.
  20807. * @param {number} wait The number of milliseconds to delay invocation.
  20808. * @param {Array} args The arguments to provide to `func`.
  20809. * @returns {number|Object} Returns the timer id or timeout object.
  20810. */
  20811. function baseDelay(func, wait, args) {
  20812. if (typeof func != 'function') {
  20813. throw new TypeError(FUNC_ERROR_TEXT);
  20814. }
  20815. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20816. }
  20817. /**
  20818. * The base implementation of methods like `_.difference` without support
  20819. * for excluding multiple arrays or iteratee shorthands.
  20820. *
  20821. * @private
  20822. * @param {Array} array The array to inspect.
  20823. * @param {Array} values The values to exclude.
  20824. * @param {Function} [iteratee] The iteratee invoked per element.
  20825. * @param {Function} [comparator] The comparator invoked per element.
  20826. * @returns {Array} Returns the new array of filtered values.
  20827. */
  20828. function baseDifference(array, values, iteratee, comparator) {
  20829. var index = -1,
  20830. includes = arrayIncludes,
  20831. isCommon = true,
  20832. length = array.length,
  20833. result = [],
  20834. valuesLength = values.length;
  20835. if (!length) {
  20836. return result;
  20837. }
  20838. if (iteratee) {
  20839. values = arrayMap(values, baseUnary(iteratee));
  20840. }
  20841. if (comparator) {
  20842. includes = arrayIncludesWith;
  20843. isCommon = false;
  20844. }
  20845. else if (values.length >= LARGE_ARRAY_SIZE) {
  20846. includes = cacheHas;
  20847. isCommon = false;
  20848. values = new SetCache(values);
  20849. }
  20850. outer:
  20851. while (++index < length) {
  20852. var value = array[index],
  20853. computed = iteratee == null ? value : iteratee(value);
  20854. value = (comparator || value !== 0) ? value : 0;
  20855. if (isCommon && computed === computed) {
  20856. var valuesIndex = valuesLength;
  20857. while (valuesIndex--) {
  20858. if (values[valuesIndex] === computed) {
  20859. continue outer;
  20860. }
  20861. }
  20862. result.push(value);
  20863. }
  20864. else if (!includes(values, computed, comparator)) {
  20865. result.push(value);
  20866. }
  20867. }
  20868. return result;
  20869. }
  20870. /**
  20871. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20872. *
  20873. * @private
  20874. * @param {Array|Object} collection The collection to iterate over.
  20875. * @param {Function} iteratee The function invoked per iteration.
  20876. * @returns {Array|Object} Returns `collection`.
  20877. */
  20878. var baseEach = createBaseEach(baseForOwn);
  20879. /**
  20880. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20881. *
  20882. * @private
  20883. * @param {Array|Object} collection The collection to iterate over.
  20884. * @param {Function} iteratee The function invoked per iteration.
  20885. * @returns {Array|Object} Returns `collection`.
  20886. */
  20887. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20888. /**
  20889. * The base implementation of `_.every` without support for iteratee shorthands.
  20890. *
  20891. * @private
  20892. * @param {Array|Object} collection The collection to iterate over.
  20893. * @param {Function} predicate The function invoked per iteration.
  20894. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20895. * else `false`
  20896. */
  20897. function baseEvery(collection, predicate) {
  20898. var result = true;
  20899. baseEach(collection, function(value, index, collection) {
  20900. result = !!predicate(value, index, collection);
  20901. return result;
  20902. });
  20903. return result;
  20904. }
  20905. /**
  20906. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20907. * `comparator` to determine the extremum value.
  20908. *
  20909. * @private
  20910. * @param {Array} array The array to iterate over.
  20911. * @param {Function} iteratee The iteratee invoked per iteration.
  20912. * @param {Function} comparator The comparator used to compare values.
  20913. * @returns {*} Returns the extremum value.
  20914. */
  20915. function baseExtremum(array, iteratee, comparator) {
  20916. var index = -1,
  20917. length = array.length;
  20918. while (++index < length) {
  20919. var value = array[index],
  20920. current = iteratee(value);
  20921. if (current != null && (computed === undefined
  20922. ? (current === current && !isSymbol(current))
  20923. : comparator(current, computed)
  20924. )) {
  20925. var computed = current,
  20926. result = value;
  20927. }
  20928. }
  20929. return result;
  20930. }
  20931. /**
  20932. * The base implementation of `_.fill` without an iteratee call guard.
  20933. *
  20934. * @private
  20935. * @param {Array} array The array to fill.
  20936. * @param {*} value The value to fill `array` with.
  20937. * @param {number} [start=0] The start position.
  20938. * @param {number} [end=array.length] The end position.
  20939. * @returns {Array} Returns `array`.
  20940. */
  20941. function baseFill(array, value, start, end) {
  20942. var length = array.length;
  20943. start = toInteger(start);
  20944. if (start < 0) {
  20945. start = -start > length ? 0 : (length + start);
  20946. }
  20947. end = (end === undefined || end > length) ? length : toInteger(end);
  20948. if (end < 0) {
  20949. end += length;
  20950. }
  20951. end = start > end ? 0 : toLength(end);
  20952. while (start < end) {
  20953. array[start++] = value;
  20954. }
  20955. return array;
  20956. }
  20957. /**
  20958. * The base implementation of `_.filter` without support for iteratee shorthands.
  20959. *
  20960. * @private
  20961. * @param {Array|Object} collection The collection to iterate over.
  20962. * @param {Function} predicate The function invoked per iteration.
  20963. * @returns {Array} Returns the new filtered array.
  20964. */
  20965. function baseFilter(collection, predicate) {
  20966. var result = [];
  20967. baseEach(collection, function(value, index, collection) {
  20968. if (predicate(value, index, collection)) {
  20969. result.push(value);
  20970. }
  20971. });
  20972. return result;
  20973. }
  20974. /**
  20975. * The base implementation of `_.flatten` with support for restricting flattening.
  20976. *
  20977. * @private
  20978. * @param {Array} array The array to flatten.
  20979. * @param {number} depth The maximum recursion depth.
  20980. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20981. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20982. * @param {Array} [result=[]] The initial result value.
  20983. * @returns {Array} Returns the new flattened array.
  20984. */
  20985. function baseFlatten(array, depth, predicate, isStrict, result) {
  20986. var index = -1,
  20987. length = array.length;
  20988. predicate || (predicate = isFlattenable);
  20989. result || (result = []);
  20990. while (++index < length) {
  20991. var value = array[index];
  20992. if (depth > 0 && predicate(value)) {
  20993. if (depth > 1) {
  20994. // Recursively flatten arrays (susceptible to call stack limits).
  20995. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20996. } else {
  20997. arrayPush(result, value);
  20998. }
  20999. } else if (!isStrict) {
  21000. result[result.length] = value;
  21001. }
  21002. }
  21003. return result;
  21004. }
  21005. /**
  21006. * The base implementation of `baseForOwn` which iterates over `object`
  21007. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21008. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21009. *
  21010. * @private
  21011. * @param {Object} object The object to iterate over.
  21012. * @param {Function} iteratee The function invoked per iteration.
  21013. * @param {Function} keysFunc The function to get the keys of `object`.
  21014. * @returns {Object} Returns `object`.
  21015. */
  21016. var baseFor = createBaseFor();
  21017. /**
  21018. * This function is like `baseFor` except that it iterates over properties
  21019. * in the opposite order.
  21020. *
  21021. * @private
  21022. * @param {Object} object The object to iterate over.
  21023. * @param {Function} iteratee The function invoked per iteration.
  21024. * @param {Function} keysFunc The function to get the keys of `object`.
  21025. * @returns {Object} Returns `object`.
  21026. */
  21027. var baseForRight = createBaseFor(true);
  21028. /**
  21029. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21030. *
  21031. * @private
  21032. * @param {Object} object The object to iterate over.
  21033. * @param {Function} iteratee The function invoked per iteration.
  21034. * @returns {Object} Returns `object`.
  21035. */
  21036. function baseForOwn(object, iteratee) {
  21037. return object && baseFor(object, iteratee, keys);
  21038. }
  21039. /**
  21040. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21041. *
  21042. * @private
  21043. * @param {Object} object The object to iterate over.
  21044. * @param {Function} iteratee The function invoked per iteration.
  21045. * @returns {Object} Returns `object`.
  21046. */
  21047. function baseForOwnRight(object, iteratee) {
  21048. return object && baseForRight(object, iteratee, keys);
  21049. }
  21050. /**
  21051. * The base implementation of `_.functions` which creates an array of
  21052. * `object` function property names filtered from `props`.
  21053. *
  21054. * @private
  21055. * @param {Object} object The object to inspect.
  21056. * @param {Array} props The property names to filter.
  21057. * @returns {Array} Returns the function names.
  21058. */
  21059. function baseFunctions(object, props) {
  21060. return arrayFilter(props, function(key) {
  21061. return isFunction(object[key]);
  21062. });
  21063. }
  21064. /**
  21065. * The base implementation of `_.get` without support for default values.
  21066. *
  21067. * @private
  21068. * @param {Object} object The object to query.
  21069. * @param {Array|string} path The path of the property to get.
  21070. * @returns {*} Returns the resolved value.
  21071. */
  21072. function baseGet(object, path) {
  21073. path = castPath(path, object);
  21074. var index = 0,
  21075. length = path.length;
  21076. while (object != null && index < length) {
  21077. object = object[toKey(path[index++])];
  21078. }
  21079. return (index && index == length) ? object : undefined;
  21080. }
  21081. /**
  21082. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21083. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21084. * symbols of `object`.
  21085. *
  21086. * @private
  21087. * @param {Object} object The object to query.
  21088. * @param {Function} keysFunc The function to get the keys of `object`.
  21089. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21090. * @returns {Array} Returns the array of property names and symbols.
  21091. */
  21092. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21093. var result = keysFunc(object);
  21094. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21095. }
  21096. /**
  21097. * The base implementation of `getTag` without fallbacks for buggy environments.
  21098. *
  21099. * @private
  21100. * @param {*} value The value to query.
  21101. * @returns {string} Returns the `toStringTag`.
  21102. */
  21103. function baseGetTag(value) {
  21104. if (value == null) {
  21105. return value === undefined ? undefinedTag : nullTag;
  21106. }
  21107. return (symToStringTag && symToStringTag in Object(value))
  21108. ? getRawTag(value)
  21109. : objectToString(value);
  21110. }
  21111. /**
  21112. * The base implementation of `_.gt` which doesn't coerce arguments.
  21113. *
  21114. * @private
  21115. * @param {*} value The value to compare.
  21116. * @param {*} other The other value to compare.
  21117. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21118. * else `false`.
  21119. */
  21120. function baseGt(value, other) {
  21121. return value > other;
  21122. }
  21123. /**
  21124. * The base implementation of `_.has` without support for deep paths.
  21125. *
  21126. * @private
  21127. * @param {Object} [object] The object to query.
  21128. * @param {Array|string} key The key to check.
  21129. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21130. */
  21131. function baseHas(object, key) {
  21132. return object != null && hasOwnProperty.call(object, key);
  21133. }
  21134. /**
  21135. * The base implementation of `_.hasIn` without support for deep paths.
  21136. *
  21137. * @private
  21138. * @param {Object} [object] The object to query.
  21139. * @param {Array|string} key The key to check.
  21140. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21141. */
  21142. function baseHasIn(object, key) {
  21143. return object != null && key in Object(object);
  21144. }
  21145. /**
  21146. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21147. *
  21148. * @private
  21149. * @param {number} number The number to check.
  21150. * @param {number} start The start of the range.
  21151. * @param {number} end The end of the range.
  21152. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21153. */
  21154. function baseInRange(number, start, end) {
  21155. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21156. }
  21157. /**
  21158. * The base implementation of methods like `_.intersection`, without support
  21159. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21160. *
  21161. * @private
  21162. * @param {Array} arrays The arrays to inspect.
  21163. * @param {Function} [iteratee] The iteratee invoked per element.
  21164. * @param {Function} [comparator] The comparator invoked per element.
  21165. * @returns {Array} Returns the new array of shared values.
  21166. */
  21167. function baseIntersection(arrays, iteratee, comparator) {
  21168. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21169. length = arrays[0].length,
  21170. othLength = arrays.length,
  21171. othIndex = othLength,
  21172. caches = Array(othLength),
  21173. maxLength = Infinity,
  21174. result = [];
  21175. while (othIndex--) {
  21176. var array = arrays[othIndex];
  21177. if (othIndex && iteratee) {
  21178. array = arrayMap(array, baseUnary(iteratee));
  21179. }
  21180. maxLength = nativeMin(array.length, maxLength);
  21181. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21182. ? new SetCache(othIndex && array)
  21183. : undefined;
  21184. }
  21185. array = arrays[0];
  21186. var index = -1,
  21187. seen = caches[0];
  21188. outer:
  21189. while (++index < length && result.length < maxLength) {
  21190. var value = array[index],
  21191. computed = iteratee ? iteratee(value) : value;
  21192. value = (comparator || value !== 0) ? value : 0;
  21193. if (!(seen
  21194. ? cacheHas(seen, computed)
  21195. : includes(result, computed, comparator)
  21196. )) {
  21197. othIndex = othLength;
  21198. while (--othIndex) {
  21199. var cache = caches[othIndex];
  21200. if (!(cache
  21201. ? cacheHas(cache, computed)
  21202. : includes(arrays[othIndex], computed, comparator))
  21203. ) {
  21204. continue outer;
  21205. }
  21206. }
  21207. if (seen) {
  21208. seen.push(computed);
  21209. }
  21210. result.push(value);
  21211. }
  21212. }
  21213. return result;
  21214. }
  21215. /**
  21216. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21217. * `object` with values transformed by `iteratee` and set by `setter`.
  21218. *
  21219. * @private
  21220. * @param {Object} object The object to iterate over.
  21221. * @param {Function} setter The function to set `accumulator` values.
  21222. * @param {Function} iteratee The iteratee to transform values.
  21223. * @param {Object} accumulator The initial inverted object.
  21224. * @returns {Function} Returns `accumulator`.
  21225. */
  21226. function baseInverter(object, setter, iteratee, accumulator) {
  21227. baseForOwn(object, function(value, key, object) {
  21228. setter(accumulator, iteratee(value), key, object);
  21229. });
  21230. return accumulator;
  21231. }
  21232. /**
  21233. * The base implementation of `_.invoke` without support for individual
  21234. * method arguments.
  21235. *
  21236. * @private
  21237. * @param {Object} object The object to query.
  21238. * @param {Array|string} path The path of the method to invoke.
  21239. * @param {Array} args The arguments to invoke the method with.
  21240. * @returns {*} Returns the result of the invoked method.
  21241. */
  21242. function baseInvoke(object, path, args) {
  21243. path = castPath(path, object);
  21244. object = parent(object, path);
  21245. var func = object == null ? object : object[toKey(last(path))];
  21246. return func == null ? undefined : apply(func, object, args);
  21247. }
  21248. /**
  21249. * The base implementation of `_.isArguments`.
  21250. *
  21251. * @private
  21252. * @param {*} value The value to check.
  21253. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21254. */
  21255. function baseIsArguments(value) {
  21256. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21257. }
  21258. /**
  21259. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21260. *
  21261. * @private
  21262. * @param {*} value The value to check.
  21263. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21264. */
  21265. function baseIsArrayBuffer(value) {
  21266. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21267. }
  21268. /**
  21269. * The base implementation of `_.isDate` without Node.js optimizations.
  21270. *
  21271. * @private
  21272. * @param {*} value The value to check.
  21273. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21274. */
  21275. function baseIsDate(value) {
  21276. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21277. }
  21278. /**
  21279. * The base implementation of `_.isEqual` which supports partial comparisons
  21280. * and tracks traversed objects.
  21281. *
  21282. * @private
  21283. * @param {*} value The value to compare.
  21284. * @param {*} other The other value to compare.
  21285. * @param {boolean} bitmask The bitmask flags.
  21286. * 1 - Unordered comparison
  21287. * 2 - Partial comparison
  21288. * @param {Function} [customizer] The function to customize comparisons.
  21289. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21290. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21291. */
  21292. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21293. if (value === other) {
  21294. return true;
  21295. }
  21296. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21297. return value !== value && other !== other;
  21298. }
  21299. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21300. }
  21301. /**
  21302. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21303. * deep comparisons and tracks traversed objects enabling objects with circular
  21304. * references to be compared.
  21305. *
  21306. * @private
  21307. * @param {Object} object The object to compare.
  21308. * @param {Object} other The other object to compare.
  21309. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21310. * @param {Function} customizer The function to customize comparisons.
  21311. * @param {Function} equalFunc The function to determine equivalents of values.
  21312. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21313. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21314. */
  21315. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21316. var objIsArr = isArray(object),
  21317. othIsArr = isArray(other),
  21318. objTag = objIsArr ? arrayTag : getTag(object),
  21319. othTag = othIsArr ? arrayTag : getTag(other);
  21320. objTag = objTag == argsTag ? objectTag : objTag;
  21321. othTag = othTag == argsTag ? objectTag : othTag;
  21322. var objIsObj = objTag == objectTag,
  21323. othIsObj = othTag == objectTag,
  21324. isSameTag = objTag == othTag;
  21325. if (isSameTag && isBuffer(object)) {
  21326. if (!isBuffer(other)) {
  21327. return false;
  21328. }
  21329. objIsArr = true;
  21330. objIsObj = false;
  21331. }
  21332. if (isSameTag && !objIsObj) {
  21333. stack || (stack = new Stack);
  21334. return (objIsArr || isTypedArray(object))
  21335. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21336. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21337. }
  21338. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21339. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21340. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21341. if (objIsWrapped || othIsWrapped) {
  21342. var objUnwrapped = objIsWrapped ? object.value() : object,
  21343. othUnwrapped = othIsWrapped ? other.value() : other;
  21344. stack || (stack = new Stack);
  21345. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21346. }
  21347. }
  21348. if (!isSameTag) {
  21349. return false;
  21350. }
  21351. stack || (stack = new Stack);
  21352. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21353. }
  21354. /**
  21355. * The base implementation of `_.isMap` without Node.js optimizations.
  21356. *
  21357. * @private
  21358. * @param {*} value The value to check.
  21359. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21360. */
  21361. function baseIsMap(value) {
  21362. return isObjectLike(value) && getTag(value) == mapTag;
  21363. }
  21364. /**
  21365. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21366. *
  21367. * @private
  21368. * @param {Object} object The object to inspect.
  21369. * @param {Object} source The object of property values to match.
  21370. * @param {Array} matchData The property names, values, and compare flags to match.
  21371. * @param {Function} [customizer] The function to customize comparisons.
  21372. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21373. */
  21374. function baseIsMatch(object, source, matchData, customizer) {
  21375. var index = matchData.length,
  21376. length = index,
  21377. noCustomizer = !customizer;
  21378. if (object == null) {
  21379. return !length;
  21380. }
  21381. object = Object(object);
  21382. while (index--) {
  21383. var data = matchData[index];
  21384. if ((noCustomizer && data[2])
  21385. ? data[1] !== object[data[0]]
  21386. : !(data[0] in object)
  21387. ) {
  21388. return false;
  21389. }
  21390. }
  21391. while (++index < length) {
  21392. data = matchData[index];
  21393. var key = data[0],
  21394. objValue = object[key],
  21395. srcValue = data[1];
  21396. if (noCustomizer && data[2]) {
  21397. if (objValue === undefined && !(key in object)) {
  21398. return false;
  21399. }
  21400. } else {
  21401. var stack = new Stack;
  21402. if (customizer) {
  21403. var result = customizer(objValue, srcValue, key, object, source, stack);
  21404. }
  21405. if (!(result === undefined
  21406. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21407. : result
  21408. )) {
  21409. return false;
  21410. }
  21411. }
  21412. }
  21413. return true;
  21414. }
  21415. /**
  21416. * The base implementation of `_.isNative` without bad shim checks.
  21417. *
  21418. * @private
  21419. * @param {*} value The value to check.
  21420. * @returns {boolean} Returns `true` if `value` is a native function,
  21421. * else `false`.
  21422. */
  21423. function baseIsNative(value) {
  21424. if (!isObject(value) || isMasked(value)) {
  21425. return false;
  21426. }
  21427. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21428. return pattern.test(toSource(value));
  21429. }
  21430. /**
  21431. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21432. *
  21433. * @private
  21434. * @param {*} value The value to check.
  21435. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21436. */
  21437. function baseIsRegExp(value) {
  21438. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21439. }
  21440. /**
  21441. * The base implementation of `_.isSet` without Node.js optimizations.
  21442. *
  21443. * @private
  21444. * @param {*} value The value to check.
  21445. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21446. */
  21447. function baseIsSet(value) {
  21448. return isObjectLike(value) && getTag(value) == setTag;
  21449. }
  21450. /**
  21451. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21452. *
  21453. * @private
  21454. * @param {*} value The value to check.
  21455. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21456. */
  21457. function baseIsTypedArray(value) {
  21458. return isObjectLike(value) &&
  21459. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21460. }
  21461. /**
  21462. * The base implementation of `_.iteratee`.
  21463. *
  21464. * @private
  21465. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21466. * @returns {Function} Returns the iteratee.
  21467. */
  21468. function baseIteratee(value) {
  21469. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21470. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21471. if (typeof value == 'function') {
  21472. return value;
  21473. }
  21474. if (value == null) {
  21475. return identity;
  21476. }
  21477. if (typeof value == 'object') {
  21478. return isArray(value)
  21479. ? baseMatchesProperty(value[0], value[1])
  21480. : baseMatches(value);
  21481. }
  21482. return property(value);
  21483. }
  21484. /**
  21485. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21486. *
  21487. * @private
  21488. * @param {Object} object The object to query.
  21489. * @returns {Array} Returns the array of property names.
  21490. */
  21491. function baseKeys(object) {
  21492. if (!isPrototype(object)) {
  21493. return nativeKeys(object);
  21494. }
  21495. var result = [];
  21496. for (var key in Object(object)) {
  21497. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21498. result.push(key);
  21499. }
  21500. }
  21501. return result;
  21502. }
  21503. /**
  21504. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21505. *
  21506. * @private
  21507. * @param {Object} object The object to query.
  21508. * @returns {Array} Returns the array of property names.
  21509. */
  21510. function baseKeysIn(object) {
  21511. if (!isObject(object)) {
  21512. return nativeKeysIn(object);
  21513. }
  21514. var isProto = isPrototype(object),
  21515. result = [];
  21516. for (var key in object) {
  21517. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21518. result.push(key);
  21519. }
  21520. }
  21521. return result;
  21522. }
  21523. /**
  21524. * The base implementation of `_.lt` which doesn't coerce arguments.
  21525. *
  21526. * @private
  21527. * @param {*} value The value to compare.
  21528. * @param {*} other The other value to compare.
  21529. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21530. * else `false`.
  21531. */
  21532. function baseLt(value, other) {
  21533. return value < other;
  21534. }
  21535. /**
  21536. * The base implementation of `_.map` without support for iteratee shorthands.
  21537. *
  21538. * @private
  21539. * @param {Array|Object} collection The collection to iterate over.
  21540. * @param {Function} iteratee The function invoked per iteration.
  21541. * @returns {Array} Returns the new mapped array.
  21542. */
  21543. function baseMap(collection, iteratee) {
  21544. var index = -1,
  21545. result = isArrayLike(collection) ? Array(collection.length) : [];
  21546. baseEach(collection, function(value, key, collection) {
  21547. result[++index] = iteratee(value, key, collection);
  21548. });
  21549. return result;
  21550. }
  21551. /**
  21552. * The base implementation of `_.matches` which doesn't clone `source`.
  21553. *
  21554. * @private
  21555. * @param {Object} source The object of property values to match.
  21556. * @returns {Function} Returns the new spec function.
  21557. */
  21558. function baseMatches(source) {
  21559. var matchData = getMatchData(source);
  21560. if (matchData.length == 1 && matchData[0][2]) {
  21561. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21562. }
  21563. return function(object) {
  21564. return object === source || baseIsMatch(object, source, matchData);
  21565. };
  21566. }
  21567. /**
  21568. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21569. *
  21570. * @private
  21571. * @param {string} path The path of the property to get.
  21572. * @param {*} srcValue The value to match.
  21573. * @returns {Function} Returns the new spec function.
  21574. */
  21575. function baseMatchesProperty(path, srcValue) {
  21576. if (isKey(path) && isStrictComparable(srcValue)) {
  21577. return matchesStrictComparable(toKey(path), srcValue);
  21578. }
  21579. return function(object) {
  21580. var objValue = get(object, path);
  21581. return (objValue === undefined && objValue === srcValue)
  21582. ? hasIn(object, path)
  21583. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21584. };
  21585. }
  21586. /**
  21587. * The base implementation of `_.merge` without support for multiple sources.
  21588. *
  21589. * @private
  21590. * @param {Object} object The destination object.
  21591. * @param {Object} source The source object.
  21592. * @param {number} srcIndex The index of `source`.
  21593. * @param {Function} [customizer] The function to customize merged values.
  21594. * @param {Object} [stack] Tracks traversed source values and their merged
  21595. * counterparts.
  21596. */
  21597. function baseMerge(object, source, srcIndex, customizer, stack) {
  21598. if (object === source) {
  21599. return;
  21600. }
  21601. baseFor(source, function(srcValue, key) {
  21602. stack || (stack = new Stack);
  21603. if (isObject(srcValue)) {
  21604. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21605. }
  21606. else {
  21607. var newValue = customizer
  21608. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21609. : undefined;
  21610. if (newValue === undefined) {
  21611. newValue = srcValue;
  21612. }
  21613. assignMergeValue(object, key, newValue);
  21614. }
  21615. }, keysIn);
  21616. }
  21617. /**
  21618. * A specialized version of `baseMerge` for arrays and objects which performs
  21619. * deep merges and tracks traversed objects enabling objects with circular
  21620. * references to be merged.
  21621. *
  21622. * @private
  21623. * @param {Object} object The destination object.
  21624. * @param {Object} source The source object.
  21625. * @param {string} key The key of the value to merge.
  21626. * @param {number} srcIndex The index of `source`.
  21627. * @param {Function} mergeFunc The function to merge values.
  21628. * @param {Function} [customizer] The function to customize assigned values.
  21629. * @param {Object} [stack] Tracks traversed source values and their merged
  21630. * counterparts.
  21631. */
  21632. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21633. var objValue = safeGet(object, key),
  21634. srcValue = safeGet(source, key),
  21635. stacked = stack.get(srcValue);
  21636. if (stacked) {
  21637. assignMergeValue(object, key, stacked);
  21638. return;
  21639. }
  21640. var newValue = customizer
  21641. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21642. : undefined;
  21643. var isCommon = newValue === undefined;
  21644. if (isCommon) {
  21645. var isArr = isArray(srcValue),
  21646. isBuff = !isArr && isBuffer(srcValue),
  21647. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21648. newValue = srcValue;
  21649. if (isArr || isBuff || isTyped) {
  21650. if (isArray(objValue)) {
  21651. newValue = objValue;
  21652. }
  21653. else if (isArrayLikeObject(objValue)) {
  21654. newValue = copyArray(objValue);
  21655. }
  21656. else if (isBuff) {
  21657. isCommon = false;
  21658. newValue = cloneBuffer(srcValue, true);
  21659. }
  21660. else if (isTyped) {
  21661. isCommon = false;
  21662. newValue = cloneTypedArray(srcValue, true);
  21663. }
  21664. else {
  21665. newValue = [];
  21666. }
  21667. }
  21668. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21669. newValue = objValue;
  21670. if (isArguments(objValue)) {
  21671. newValue = toPlainObject(objValue);
  21672. }
  21673. else if (!isObject(objValue) || isFunction(objValue)) {
  21674. newValue = initCloneObject(srcValue);
  21675. }
  21676. }
  21677. else {
  21678. isCommon = false;
  21679. }
  21680. }
  21681. if (isCommon) {
  21682. // Recursively merge objects and arrays (susceptible to call stack limits).
  21683. stack.set(srcValue, newValue);
  21684. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21685. stack['delete'](srcValue);
  21686. }
  21687. assignMergeValue(object, key, newValue);
  21688. }
  21689. /**
  21690. * The base implementation of `_.nth` which doesn't coerce arguments.
  21691. *
  21692. * @private
  21693. * @param {Array} array The array to query.
  21694. * @param {number} n The index of the element to return.
  21695. * @returns {*} Returns the nth element of `array`.
  21696. */
  21697. function baseNth(array, n) {
  21698. var length = array.length;
  21699. if (!length) {
  21700. return;
  21701. }
  21702. n += n < 0 ? length : 0;
  21703. return isIndex(n, length) ? array[n] : undefined;
  21704. }
  21705. /**
  21706. * The base implementation of `_.orderBy` without param guards.
  21707. *
  21708. * @private
  21709. * @param {Array|Object} collection The collection to iterate over.
  21710. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21711. * @param {string[]} orders The sort orders of `iteratees`.
  21712. * @returns {Array} Returns the new sorted array.
  21713. */
  21714. function baseOrderBy(collection, iteratees, orders) {
  21715. var index = -1;
  21716. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21717. var result = baseMap(collection, function(value, key, collection) {
  21718. var criteria = arrayMap(iteratees, function(iteratee) {
  21719. return iteratee(value);
  21720. });
  21721. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21722. });
  21723. return baseSortBy(result, function(object, other) {
  21724. return compareMultiple(object, other, orders);
  21725. });
  21726. }
  21727. /**
  21728. * The base implementation of `_.pick` without support for individual
  21729. * property identifiers.
  21730. *
  21731. * @private
  21732. * @param {Object} object The source object.
  21733. * @param {string[]} paths The property paths to pick.
  21734. * @returns {Object} Returns the new object.
  21735. */
  21736. function basePick(object, paths) {
  21737. return basePickBy(object, paths, function(value, path) {
  21738. return hasIn(object, path);
  21739. });
  21740. }
  21741. /**
  21742. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21743. *
  21744. * @private
  21745. * @param {Object} object The source object.
  21746. * @param {string[]} paths The property paths to pick.
  21747. * @param {Function} predicate The function invoked per property.
  21748. * @returns {Object} Returns the new object.
  21749. */
  21750. function basePickBy(object, paths, predicate) {
  21751. var index = -1,
  21752. length = paths.length,
  21753. result = {};
  21754. while (++index < length) {
  21755. var path = paths[index],
  21756. value = baseGet(object, path);
  21757. if (predicate(value, path)) {
  21758. baseSet(result, castPath(path, object), value);
  21759. }
  21760. }
  21761. return result;
  21762. }
  21763. /**
  21764. * A specialized version of `baseProperty` which supports deep paths.
  21765. *
  21766. * @private
  21767. * @param {Array|string} path The path of the property to get.
  21768. * @returns {Function} Returns the new accessor function.
  21769. */
  21770. function basePropertyDeep(path) {
  21771. return function(object) {
  21772. return baseGet(object, path);
  21773. };
  21774. }
  21775. /**
  21776. * The base implementation of `_.pullAllBy` without support for iteratee
  21777. * shorthands.
  21778. *
  21779. * @private
  21780. * @param {Array} array The array to modify.
  21781. * @param {Array} values The values to remove.
  21782. * @param {Function} [iteratee] The iteratee invoked per element.
  21783. * @param {Function} [comparator] The comparator invoked per element.
  21784. * @returns {Array} Returns `array`.
  21785. */
  21786. function basePullAll(array, values, iteratee, comparator) {
  21787. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21788. index = -1,
  21789. length = values.length,
  21790. seen = array;
  21791. if (array === values) {
  21792. values = copyArray(values);
  21793. }
  21794. if (iteratee) {
  21795. seen = arrayMap(array, baseUnary(iteratee));
  21796. }
  21797. while (++index < length) {
  21798. var fromIndex = 0,
  21799. value = values[index],
  21800. computed = iteratee ? iteratee(value) : value;
  21801. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21802. if (seen !== array) {
  21803. splice.call(seen, fromIndex, 1);
  21804. }
  21805. splice.call(array, fromIndex, 1);
  21806. }
  21807. }
  21808. return array;
  21809. }
  21810. /**
  21811. * The base implementation of `_.pullAt` without support for individual
  21812. * indexes or capturing the removed elements.
  21813. *
  21814. * @private
  21815. * @param {Array} array The array to modify.
  21816. * @param {number[]} indexes The indexes of elements to remove.
  21817. * @returns {Array} Returns `array`.
  21818. */
  21819. function basePullAt(array, indexes) {
  21820. var length = array ? indexes.length : 0,
  21821. lastIndex = length - 1;
  21822. while (length--) {
  21823. var index = indexes[length];
  21824. if (length == lastIndex || index !== previous) {
  21825. var previous = index;
  21826. if (isIndex(index)) {
  21827. splice.call(array, index, 1);
  21828. } else {
  21829. baseUnset(array, index);
  21830. }
  21831. }
  21832. }
  21833. return array;
  21834. }
  21835. /**
  21836. * The base implementation of `_.random` without support for returning
  21837. * floating-point numbers.
  21838. *
  21839. * @private
  21840. * @param {number} lower The lower bound.
  21841. * @param {number} upper The upper bound.
  21842. * @returns {number} Returns the random number.
  21843. */
  21844. function baseRandom(lower, upper) {
  21845. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21846. }
  21847. /**
  21848. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21849. * coerce arguments.
  21850. *
  21851. * @private
  21852. * @param {number} start The start of the range.
  21853. * @param {number} end The end of the range.
  21854. * @param {number} step The value to increment or decrement by.
  21855. * @param {boolean} [fromRight] Specify iterating from right to left.
  21856. * @returns {Array} Returns the range of numbers.
  21857. */
  21858. function baseRange(start, end, step, fromRight) {
  21859. var index = -1,
  21860. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21861. result = Array(length);
  21862. while (length--) {
  21863. result[fromRight ? length : ++index] = start;
  21864. start += step;
  21865. }
  21866. return result;
  21867. }
  21868. /**
  21869. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21870. *
  21871. * @private
  21872. * @param {string} string The string to repeat.
  21873. * @param {number} n The number of times to repeat the string.
  21874. * @returns {string} Returns the repeated string.
  21875. */
  21876. function baseRepeat(string, n) {
  21877. var result = '';
  21878. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21879. return result;
  21880. }
  21881. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21882. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21883. do {
  21884. if (n % 2) {
  21885. result += string;
  21886. }
  21887. n = nativeFloor(n / 2);
  21888. if (n) {
  21889. string += string;
  21890. }
  21891. } while (n);
  21892. return result;
  21893. }
  21894. /**
  21895. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21896. *
  21897. * @private
  21898. * @param {Function} func The function to apply a rest parameter to.
  21899. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21900. * @returns {Function} Returns the new function.
  21901. */
  21902. function baseRest(func, start) {
  21903. return setToString(overRest(func, start, identity), func + '');
  21904. }
  21905. /**
  21906. * The base implementation of `_.sample`.
  21907. *
  21908. * @private
  21909. * @param {Array|Object} collection The collection to sample.
  21910. * @returns {*} Returns the random element.
  21911. */
  21912. function baseSample(collection) {
  21913. return arraySample(values(collection));
  21914. }
  21915. /**
  21916. * The base implementation of `_.sampleSize` without param guards.
  21917. *
  21918. * @private
  21919. * @param {Array|Object} collection The collection to sample.
  21920. * @param {number} n The number of elements to sample.
  21921. * @returns {Array} Returns the random elements.
  21922. */
  21923. function baseSampleSize(collection, n) {
  21924. var array = values(collection);
  21925. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21926. }
  21927. /**
  21928. * The base implementation of `_.set`.
  21929. *
  21930. * @private
  21931. * @param {Object} object The object to modify.
  21932. * @param {Array|string} path The path of the property to set.
  21933. * @param {*} value The value to set.
  21934. * @param {Function} [customizer] The function to customize path creation.
  21935. * @returns {Object} Returns `object`.
  21936. */
  21937. function baseSet(object, path, value, customizer) {
  21938. if (!isObject(object)) {
  21939. return object;
  21940. }
  21941. path = castPath(path, object);
  21942. var index = -1,
  21943. length = path.length,
  21944. lastIndex = length - 1,
  21945. nested = object;
  21946. while (nested != null && ++index < length) {
  21947. var key = toKey(path[index]),
  21948. newValue = value;
  21949. if (index != lastIndex) {
  21950. var objValue = nested[key];
  21951. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21952. if (newValue === undefined) {
  21953. newValue = isObject(objValue)
  21954. ? objValue
  21955. : (isIndex(path[index + 1]) ? [] : {});
  21956. }
  21957. }
  21958. assignValue(nested, key, newValue);
  21959. nested = nested[key];
  21960. }
  21961. return object;
  21962. }
  21963. /**
  21964. * The base implementation of `setData` without support for hot loop shorting.
  21965. *
  21966. * @private
  21967. * @param {Function} func The function to associate metadata with.
  21968. * @param {*} data The metadata.
  21969. * @returns {Function} Returns `func`.
  21970. */
  21971. var baseSetData = !metaMap ? identity : function(func, data) {
  21972. metaMap.set(func, data);
  21973. return func;
  21974. };
  21975. /**
  21976. * The base implementation of `setToString` without support for hot loop shorting.
  21977. *
  21978. * @private
  21979. * @param {Function} func The function to modify.
  21980. * @param {Function} string The `toString` result.
  21981. * @returns {Function} Returns `func`.
  21982. */
  21983. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21984. return defineProperty(func, 'toString', {
  21985. 'configurable': true,
  21986. 'enumerable': false,
  21987. 'value': constant(string),
  21988. 'writable': true
  21989. });
  21990. };
  21991. /**
  21992. * The base implementation of `_.shuffle`.
  21993. *
  21994. * @private
  21995. * @param {Array|Object} collection The collection to shuffle.
  21996. * @returns {Array} Returns the new shuffled array.
  21997. */
  21998. function baseShuffle(collection) {
  21999. return shuffleSelf(values(collection));
  22000. }
  22001. /**
  22002. * The base implementation of `_.slice` without an iteratee call guard.
  22003. *
  22004. * @private
  22005. * @param {Array} array The array to slice.
  22006. * @param {number} [start=0] The start position.
  22007. * @param {number} [end=array.length] The end position.
  22008. * @returns {Array} Returns the slice of `array`.
  22009. */
  22010. function baseSlice(array, start, end) {
  22011. var index = -1,
  22012. length = array.length;
  22013. if (start < 0) {
  22014. start = -start > length ? 0 : (length + start);
  22015. }
  22016. end = end > length ? length : end;
  22017. if (end < 0) {
  22018. end += length;
  22019. }
  22020. length = start > end ? 0 : ((end - start) >>> 0);
  22021. start >>>= 0;
  22022. var result = Array(length);
  22023. while (++index < length) {
  22024. result[index] = array[index + start];
  22025. }
  22026. return result;
  22027. }
  22028. /**
  22029. * The base implementation of `_.some` without support for iteratee shorthands.
  22030. *
  22031. * @private
  22032. * @param {Array|Object} collection The collection to iterate over.
  22033. * @param {Function} predicate The function invoked per iteration.
  22034. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22035. * else `false`.
  22036. */
  22037. function baseSome(collection, predicate) {
  22038. var result;
  22039. baseEach(collection, function(value, index, collection) {
  22040. result = predicate(value, index, collection);
  22041. return !result;
  22042. });
  22043. return !!result;
  22044. }
  22045. /**
  22046. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22047. * performs a binary search of `array` to determine the index at which `value`
  22048. * should be inserted into `array` in order to maintain its sort order.
  22049. *
  22050. * @private
  22051. * @param {Array} array The sorted array to inspect.
  22052. * @param {*} value The value to evaluate.
  22053. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22054. * @returns {number} Returns the index at which `value` should be inserted
  22055. * into `array`.
  22056. */
  22057. function baseSortedIndex(array, value, retHighest) {
  22058. var low = 0,
  22059. high = array == null ? low : array.length;
  22060. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22061. while (low < high) {
  22062. var mid = (low + high) >>> 1,
  22063. computed = array[mid];
  22064. if (computed !== null && !isSymbol(computed) &&
  22065. (retHighest ? (computed <= value) : (computed < value))) {
  22066. low = mid + 1;
  22067. } else {
  22068. high = mid;
  22069. }
  22070. }
  22071. return high;
  22072. }
  22073. return baseSortedIndexBy(array, value, identity, retHighest);
  22074. }
  22075. /**
  22076. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22077. * which invokes `iteratee` for `value` and each element of `array` to compute
  22078. * their sort ranking. The iteratee is invoked with one argument; (value).
  22079. *
  22080. * @private
  22081. * @param {Array} array The sorted array to inspect.
  22082. * @param {*} value The value to evaluate.
  22083. * @param {Function} iteratee The iteratee invoked per element.
  22084. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22085. * @returns {number} Returns the index at which `value` should be inserted
  22086. * into `array`.
  22087. */
  22088. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22089. value = iteratee(value);
  22090. var low = 0,
  22091. high = array == null ? 0 : array.length,
  22092. valIsNaN = value !== value,
  22093. valIsNull = value === null,
  22094. valIsSymbol = isSymbol(value),
  22095. valIsUndefined = value === undefined;
  22096. while (low < high) {
  22097. var mid = nativeFloor((low + high) / 2),
  22098. computed = iteratee(array[mid]),
  22099. othIsDefined = computed !== undefined,
  22100. othIsNull = computed === null,
  22101. othIsReflexive = computed === computed,
  22102. othIsSymbol = isSymbol(computed);
  22103. if (valIsNaN) {
  22104. var setLow = retHighest || othIsReflexive;
  22105. } else if (valIsUndefined) {
  22106. setLow = othIsReflexive && (retHighest || othIsDefined);
  22107. } else if (valIsNull) {
  22108. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22109. } else if (valIsSymbol) {
  22110. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22111. } else if (othIsNull || othIsSymbol) {
  22112. setLow = false;
  22113. } else {
  22114. setLow = retHighest ? (computed <= value) : (computed < value);
  22115. }
  22116. if (setLow) {
  22117. low = mid + 1;
  22118. } else {
  22119. high = mid;
  22120. }
  22121. }
  22122. return nativeMin(high, MAX_ARRAY_INDEX);
  22123. }
  22124. /**
  22125. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22126. * support for iteratee shorthands.
  22127. *
  22128. * @private
  22129. * @param {Array} array The array to inspect.
  22130. * @param {Function} [iteratee] The iteratee invoked per element.
  22131. * @returns {Array} Returns the new duplicate free array.
  22132. */
  22133. function baseSortedUniq(array, iteratee) {
  22134. var index = -1,
  22135. length = array.length,
  22136. resIndex = 0,
  22137. result = [];
  22138. while (++index < length) {
  22139. var value = array[index],
  22140. computed = iteratee ? iteratee(value) : value;
  22141. if (!index || !eq(computed, seen)) {
  22142. var seen = computed;
  22143. result[resIndex++] = value === 0 ? 0 : value;
  22144. }
  22145. }
  22146. return result;
  22147. }
  22148. /**
  22149. * The base implementation of `_.toNumber` which doesn't ensure correct
  22150. * conversions of binary, hexadecimal, or octal string values.
  22151. *
  22152. * @private
  22153. * @param {*} value The value to process.
  22154. * @returns {number} Returns the number.
  22155. */
  22156. function baseToNumber(value) {
  22157. if (typeof value == 'number') {
  22158. return value;
  22159. }
  22160. if (isSymbol(value)) {
  22161. return NAN;
  22162. }
  22163. return +value;
  22164. }
  22165. /**
  22166. * The base implementation of `_.toString` which doesn't convert nullish
  22167. * values to empty strings.
  22168. *
  22169. * @private
  22170. * @param {*} value The value to process.
  22171. * @returns {string} Returns the string.
  22172. */
  22173. function baseToString(value) {
  22174. // Exit early for strings to avoid a performance hit in some environments.
  22175. if (typeof value == 'string') {
  22176. return value;
  22177. }
  22178. if (isArray(value)) {
  22179. // Recursively convert values (susceptible to call stack limits).
  22180. return arrayMap(value, baseToString) + '';
  22181. }
  22182. if (isSymbol(value)) {
  22183. return symbolToString ? symbolToString.call(value) : '';
  22184. }
  22185. var result = (value + '');
  22186. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22187. }
  22188. /**
  22189. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22190. *
  22191. * @private
  22192. * @param {Array} array The array to inspect.
  22193. * @param {Function} [iteratee] The iteratee invoked per element.
  22194. * @param {Function} [comparator] The comparator invoked per element.
  22195. * @returns {Array} Returns the new duplicate free array.
  22196. */
  22197. function baseUniq(array, iteratee, comparator) {
  22198. var index = -1,
  22199. includes = arrayIncludes,
  22200. length = array.length,
  22201. isCommon = true,
  22202. result = [],
  22203. seen = result;
  22204. if (comparator) {
  22205. isCommon = false;
  22206. includes = arrayIncludesWith;
  22207. }
  22208. else if (length >= LARGE_ARRAY_SIZE) {
  22209. var set = iteratee ? null : createSet(array);
  22210. if (set) {
  22211. return setToArray(set);
  22212. }
  22213. isCommon = false;
  22214. includes = cacheHas;
  22215. seen = new SetCache;
  22216. }
  22217. else {
  22218. seen = iteratee ? [] : result;
  22219. }
  22220. outer:
  22221. while (++index < length) {
  22222. var value = array[index],
  22223. computed = iteratee ? iteratee(value) : value;
  22224. value = (comparator || value !== 0) ? value : 0;
  22225. if (isCommon && computed === computed) {
  22226. var seenIndex = seen.length;
  22227. while (seenIndex--) {
  22228. if (seen[seenIndex] === computed) {
  22229. continue outer;
  22230. }
  22231. }
  22232. if (iteratee) {
  22233. seen.push(computed);
  22234. }
  22235. result.push(value);
  22236. }
  22237. else if (!includes(seen, computed, comparator)) {
  22238. if (seen !== result) {
  22239. seen.push(computed);
  22240. }
  22241. result.push(value);
  22242. }
  22243. }
  22244. return result;
  22245. }
  22246. /**
  22247. * The base implementation of `_.unset`.
  22248. *
  22249. * @private
  22250. * @param {Object} object The object to modify.
  22251. * @param {Array|string} path The property path to unset.
  22252. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22253. */
  22254. function baseUnset(object, path) {
  22255. path = castPath(path, object);
  22256. object = parent(object, path);
  22257. return object == null || delete object[toKey(last(path))];
  22258. }
  22259. /**
  22260. * The base implementation of `_.update`.
  22261. *
  22262. * @private
  22263. * @param {Object} object The object to modify.
  22264. * @param {Array|string} path The path of the property to update.
  22265. * @param {Function} updater The function to produce the updated value.
  22266. * @param {Function} [customizer] The function to customize path creation.
  22267. * @returns {Object} Returns `object`.
  22268. */
  22269. function baseUpdate(object, path, updater, customizer) {
  22270. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22271. }
  22272. /**
  22273. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22274. * without support for iteratee shorthands.
  22275. *
  22276. * @private
  22277. * @param {Array} array The array to query.
  22278. * @param {Function} predicate The function invoked per iteration.
  22279. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22280. * @param {boolean} [fromRight] Specify iterating from right to left.
  22281. * @returns {Array} Returns the slice of `array`.
  22282. */
  22283. function baseWhile(array, predicate, isDrop, fromRight) {
  22284. var length = array.length,
  22285. index = fromRight ? length : -1;
  22286. while ((fromRight ? index-- : ++index < length) &&
  22287. predicate(array[index], index, array)) {}
  22288. return isDrop
  22289. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22290. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22291. }
  22292. /**
  22293. * The base implementation of `wrapperValue` which returns the result of
  22294. * performing a sequence of actions on the unwrapped `value`, where each
  22295. * successive action is supplied the return value of the previous.
  22296. *
  22297. * @private
  22298. * @param {*} value The unwrapped value.
  22299. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22300. * @returns {*} Returns the resolved value.
  22301. */
  22302. function baseWrapperValue(value, actions) {
  22303. var result = value;
  22304. if (result instanceof LazyWrapper) {
  22305. result = result.value();
  22306. }
  22307. return arrayReduce(actions, function(result, action) {
  22308. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22309. }, result);
  22310. }
  22311. /**
  22312. * The base implementation of methods like `_.xor`, without support for
  22313. * iteratee shorthands, that accepts an array of arrays to inspect.
  22314. *
  22315. * @private
  22316. * @param {Array} arrays The arrays to inspect.
  22317. * @param {Function} [iteratee] The iteratee invoked per element.
  22318. * @param {Function} [comparator] The comparator invoked per element.
  22319. * @returns {Array} Returns the new array of values.
  22320. */
  22321. function baseXor(arrays, iteratee, comparator) {
  22322. var length = arrays.length;
  22323. if (length < 2) {
  22324. return length ? baseUniq(arrays[0]) : [];
  22325. }
  22326. var index = -1,
  22327. result = Array(length);
  22328. while (++index < length) {
  22329. var array = arrays[index],
  22330. othIndex = -1;
  22331. while (++othIndex < length) {
  22332. if (othIndex != index) {
  22333. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22334. }
  22335. }
  22336. }
  22337. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22338. }
  22339. /**
  22340. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22341. *
  22342. * @private
  22343. * @param {Array} props The property identifiers.
  22344. * @param {Array} values The property values.
  22345. * @param {Function} assignFunc The function to assign values.
  22346. * @returns {Object} Returns the new object.
  22347. */
  22348. function baseZipObject(props, values, assignFunc) {
  22349. var index = -1,
  22350. length = props.length,
  22351. valsLength = values.length,
  22352. result = {};
  22353. while (++index < length) {
  22354. var value = index < valsLength ? values[index] : undefined;
  22355. assignFunc(result, props[index], value);
  22356. }
  22357. return result;
  22358. }
  22359. /**
  22360. * Casts `value` to an empty array if it's not an array like object.
  22361. *
  22362. * @private
  22363. * @param {*} value The value to inspect.
  22364. * @returns {Array|Object} Returns the cast array-like object.
  22365. */
  22366. function castArrayLikeObject(value) {
  22367. return isArrayLikeObject(value) ? value : [];
  22368. }
  22369. /**
  22370. * Casts `value` to `identity` if it's not a function.
  22371. *
  22372. * @private
  22373. * @param {*} value The value to inspect.
  22374. * @returns {Function} Returns cast function.
  22375. */
  22376. function castFunction(value) {
  22377. return typeof value == 'function' ? value : identity;
  22378. }
  22379. /**
  22380. * Casts `value` to a path array if it's not one.
  22381. *
  22382. * @private
  22383. * @param {*} value The value to inspect.
  22384. * @param {Object} [object] The object to query keys on.
  22385. * @returns {Array} Returns the cast property path array.
  22386. */
  22387. function castPath(value, object) {
  22388. if (isArray(value)) {
  22389. return value;
  22390. }
  22391. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22392. }
  22393. /**
  22394. * A `baseRest` alias which can be replaced with `identity` by module
  22395. * replacement plugins.
  22396. *
  22397. * @private
  22398. * @type {Function}
  22399. * @param {Function} func The function to apply a rest parameter to.
  22400. * @returns {Function} Returns the new function.
  22401. */
  22402. var castRest = baseRest;
  22403. /**
  22404. * Casts `array` to a slice if it's needed.
  22405. *
  22406. * @private
  22407. * @param {Array} array The array to inspect.
  22408. * @param {number} start The start position.
  22409. * @param {number} [end=array.length] The end position.
  22410. * @returns {Array} Returns the cast slice.
  22411. */
  22412. function castSlice(array, start, end) {
  22413. var length = array.length;
  22414. end = end === undefined ? length : end;
  22415. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22416. }
  22417. /**
  22418. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22419. *
  22420. * @private
  22421. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22422. */
  22423. var clearTimeout = ctxClearTimeout || function(id) {
  22424. return root.clearTimeout(id);
  22425. };
  22426. /**
  22427. * Creates a clone of `buffer`.
  22428. *
  22429. * @private
  22430. * @param {Buffer} buffer The buffer to clone.
  22431. * @param {boolean} [isDeep] Specify a deep clone.
  22432. * @returns {Buffer} Returns the cloned buffer.
  22433. */
  22434. function cloneBuffer(buffer, isDeep) {
  22435. if (isDeep) {
  22436. return buffer.slice();
  22437. }
  22438. var length = buffer.length,
  22439. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22440. buffer.copy(result);
  22441. return result;
  22442. }
  22443. /**
  22444. * Creates a clone of `arrayBuffer`.
  22445. *
  22446. * @private
  22447. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22448. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22449. */
  22450. function cloneArrayBuffer(arrayBuffer) {
  22451. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22452. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22453. return result;
  22454. }
  22455. /**
  22456. * Creates a clone of `dataView`.
  22457. *
  22458. * @private
  22459. * @param {Object} dataView The data view to clone.
  22460. * @param {boolean} [isDeep] Specify a deep clone.
  22461. * @returns {Object} Returns the cloned data view.
  22462. */
  22463. function cloneDataView(dataView, isDeep) {
  22464. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22465. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22466. }
  22467. /**
  22468. * Creates a clone of `regexp`.
  22469. *
  22470. * @private
  22471. * @param {Object} regexp The regexp to clone.
  22472. * @returns {Object} Returns the cloned regexp.
  22473. */
  22474. function cloneRegExp(regexp) {
  22475. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22476. result.lastIndex = regexp.lastIndex;
  22477. return result;
  22478. }
  22479. /**
  22480. * Creates a clone of the `symbol` object.
  22481. *
  22482. * @private
  22483. * @param {Object} symbol The symbol object to clone.
  22484. * @returns {Object} Returns the cloned symbol object.
  22485. */
  22486. function cloneSymbol(symbol) {
  22487. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22488. }
  22489. /**
  22490. * Creates a clone of `typedArray`.
  22491. *
  22492. * @private
  22493. * @param {Object} typedArray The typed array to clone.
  22494. * @param {boolean} [isDeep] Specify a deep clone.
  22495. * @returns {Object} Returns the cloned typed array.
  22496. */
  22497. function cloneTypedArray(typedArray, isDeep) {
  22498. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22499. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22500. }
  22501. /**
  22502. * Compares values to sort them in ascending order.
  22503. *
  22504. * @private
  22505. * @param {*} value The value to compare.
  22506. * @param {*} other The other value to compare.
  22507. * @returns {number} Returns the sort order indicator for `value`.
  22508. */
  22509. function compareAscending(value, other) {
  22510. if (value !== other) {
  22511. var valIsDefined = value !== undefined,
  22512. valIsNull = value === null,
  22513. valIsReflexive = value === value,
  22514. valIsSymbol = isSymbol(value);
  22515. var othIsDefined = other !== undefined,
  22516. othIsNull = other === null,
  22517. othIsReflexive = other === other,
  22518. othIsSymbol = isSymbol(other);
  22519. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22520. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22521. (valIsNull && othIsDefined && othIsReflexive) ||
  22522. (!valIsDefined && othIsReflexive) ||
  22523. !valIsReflexive) {
  22524. return 1;
  22525. }
  22526. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22527. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22528. (othIsNull && valIsDefined && valIsReflexive) ||
  22529. (!othIsDefined && valIsReflexive) ||
  22530. !othIsReflexive) {
  22531. return -1;
  22532. }
  22533. }
  22534. return 0;
  22535. }
  22536. /**
  22537. * Used by `_.orderBy` to compare multiple properties of a value to another
  22538. * and stable sort them.
  22539. *
  22540. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22541. * specify an order of "desc" for descending or "asc" for ascending sort order
  22542. * of corresponding values.
  22543. *
  22544. * @private
  22545. * @param {Object} object The object to compare.
  22546. * @param {Object} other The other object to compare.
  22547. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22548. * @returns {number} Returns the sort order indicator for `object`.
  22549. */
  22550. function compareMultiple(object, other, orders) {
  22551. var index = -1,
  22552. objCriteria = object.criteria,
  22553. othCriteria = other.criteria,
  22554. length = objCriteria.length,
  22555. ordersLength = orders.length;
  22556. while (++index < length) {
  22557. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22558. if (result) {
  22559. if (index >= ordersLength) {
  22560. return result;
  22561. }
  22562. var order = orders[index];
  22563. return result * (order == 'desc' ? -1 : 1);
  22564. }
  22565. }
  22566. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22567. // that causes it, under certain circumstances, to provide the same value for
  22568. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22569. // for more details.
  22570. //
  22571. // This also ensures a stable sort in V8 and other engines.
  22572. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22573. return object.index - other.index;
  22574. }
  22575. /**
  22576. * Creates an array that is the composition of partially applied arguments,
  22577. * placeholders, and provided arguments into a single array of arguments.
  22578. *
  22579. * @private
  22580. * @param {Array} args The provided arguments.
  22581. * @param {Array} partials The arguments to prepend to those provided.
  22582. * @param {Array} holders The `partials` placeholder indexes.
  22583. * @params {boolean} [isCurried] Specify composing for a curried function.
  22584. * @returns {Array} Returns the new array of composed arguments.
  22585. */
  22586. function composeArgs(args, partials, holders, isCurried) {
  22587. var argsIndex = -1,
  22588. argsLength = args.length,
  22589. holdersLength = holders.length,
  22590. leftIndex = -1,
  22591. leftLength = partials.length,
  22592. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22593. result = Array(leftLength + rangeLength),
  22594. isUncurried = !isCurried;
  22595. while (++leftIndex < leftLength) {
  22596. result[leftIndex] = partials[leftIndex];
  22597. }
  22598. while (++argsIndex < holdersLength) {
  22599. if (isUncurried || argsIndex < argsLength) {
  22600. result[holders[argsIndex]] = args[argsIndex];
  22601. }
  22602. }
  22603. while (rangeLength--) {
  22604. result[leftIndex++] = args[argsIndex++];
  22605. }
  22606. return result;
  22607. }
  22608. /**
  22609. * This function is like `composeArgs` except that the arguments composition
  22610. * is tailored for `_.partialRight`.
  22611. *
  22612. * @private
  22613. * @param {Array} args The provided arguments.
  22614. * @param {Array} partials The arguments to append to those provided.
  22615. * @param {Array} holders The `partials` placeholder indexes.
  22616. * @params {boolean} [isCurried] Specify composing for a curried function.
  22617. * @returns {Array} Returns the new array of composed arguments.
  22618. */
  22619. function composeArgsRight(args, partials, holders, isCurried) {
  22620. var argsIndex = -1,
  22621. argsLength = args.length,
  22622. holdersIndex = -1,
  22623. holdersLength = holders.length,
  22624. rightIndex = -1,
  22625. rightLength = partials.length,
  22626. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22627. result = Array(rangeLength + rightLength),
  22628. isUncurried = !isCurried;
  22629. while (++argsIndex < rangeLength) {
  22630. result[argsIndex] = args[argsIndex];
  22631. }
  22632. var offset = argsIndex;
  22633. while (++rightIndex < rightLength) {
  22634. result[offset + rightIndex] = partials[rightIndex];
  22635. }
  22636. while (++holdersIndex < holdersLength) {
  22637. if (isUncurried || argsIndex < argsLength) {
  22638. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22639. }
  22640. }
  22641. return result;
  22642. }
  22643. /**
  22644. * Copies the values of `source` to `array`.
  22645. *
  22646. * @private
  22647. * @param {Array} source The array to copy values from.
  22648. * @param {Array} [array=[]] The array to copy values to.
  22649. * @returns {Array} Returns `array`.
  22650. */
  22651. function copyArray(source, array) {
  22652. var index = -1,
  22653. length = source.length;
  22654. array || (array = Array(length));
  22655. while (++index < length) {
  22656. array[index] = source[index];
  22657. }
  22658. return array;
  22659. }
  22660. /**
  22661. * Copies properties of `source` to `object`.
  22662. *
  22663. * @private
  22664. * @param {Object} source The object to copy properties from.
  22665. * @param {Array} props The property identifiers to copy.
  22666. * @param {Object} [object={}] The object to copy properties to.
  22667. * @param {Function} [customizer] The function to customize copied values.
  22668. * @returns {Object} Returns `object`.
  22669. */
  22670. function copyObject(source, props, object, customizer) {
  22671. var isNew = !object;
  22672. object || (object = {});
  22673. var index = -1,
  22674. length = props.length;
  22675. while (++index < length) {
  22676. var key = props[index];
  22677. var newValue = customizer
  22678. ? customizer(object[key], source[key], key, object, source)
  22679. : undefined;
  22680. if (newValue === undefined) {
  22681. newValue = source[key];
  22682. }
  22683. if (isNew) {
  22684. baseAssignValue(object, key, newValue);
  22685. } else {
  22686. assignValue(object, key, newValue);
  22687. }
  22688. }
  22689. return object;
  22690. }
  22691. /**
  22692. * Copies own symbols of `source` to `object`.
  22693. *
  22694. * @private
  22695. * @param {Object} source The object to copy symbols from.
  22696. * @param {Object} [object={}] The object to copy symbols to.
  22697. * @returns {Object} Returns `object`.
  22698. */
  22699. function copySymbols(source, object) {
  22700. return copyObject(source, getSymbols(source), object);
  22701. }
  22702. /**
  22703. * Copies own and inherited symbols of `source` to `object`.
  22704. *
  22705. * @private
  22706. * @param {Object} source The object to copy symbols from.
  22707. * @param {Object} [object={}] The object to copy symbols to.
  22708. * @returns {Object} Returns `object`.
  22709. */
  22710. function copySymbolsIn(source, object) {
  22711. return copyObject(source, getSymbolsIn(source), object);
  22712. }
  22713. /**
  22714. * Creates a function like `_.groupBy`.
  22715. *
  22716. * @private
  22717. * @param {Function} setter The function to set accumulator values.
  22718. * @param {Function} [initializer] The accumulator object initializer.
  22719. * @returns {Function} Returns the new aggregator function.
  22720. */
  22721. function createAggregator(setter, initializer) {
  22722. return function(collection, iteratee) {
  22723. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22724. accumulator = initializer ? initializer() : {};
  22725. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22726. };
  22727. }
  22728. /**
  22729. * Creates a function like `_.assign`.
  22730. *
  22731. * @private
  22732. * @param {Function} assigner The function to assign values.
  22733. * @returns {Function} Returns the new assigner function.
  22734. */
  22735. function createAssigner(assigner) {
  22736. return baseRest(function(object, sources) {
  22737. var index = -1,
  22738. length = sources.length,
  22739. customizer = length > 1 ? sources[length - 1] : undefined,
  22740. guard = length > 2 ? sources[2] : undefined;
  22741. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22742. ? (length--, customizer)
  22743. : undefined;
  22744. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22745. customizer = length < 3 ? undefined : customizer;
  22746. length = 1;
  22747. }
  22748. object = Object(object);
  22749. while (++index < length) {
  22750. var source = sources[index];
  22751. if (source) {
  22752. assigner(object, source, index, customizer);
  22753. }
  22754. }
  22755. return object;
  22756. });
  22757. }
  22758. /**
  22759. * Creates a `baseEach` or `baseEachRight` function.
  22760. *
  22761. * @private
  22762. * @param {Function} eachFunc The function to iterate over a collection.
  22763. * @param {boolean} [fromRight] Specify iterating from right to left.
  22764. * @returns {Function} Returns the new base function.
  22765. */
  22766. function createBaseEach(eachFunc, fromRight) {
  22767. return function(collection, iteratee) {
  22768. if (collection == null) {
  22769. return collection;
  22770. }
  22771. if (!isArrayLike(collection)) {
  22772. return eachFunc(collection, iteratee);
  22773. }
  22774. var length = collection.length,
  22775. index = fromRight ? length : -1,
  22776. iterable = Object(collection);
  22777. while ((fromRight ? index-- : ++index < length)) {
  22778. if (iteratee(iterable[index], index, iterable) === false) {
  22779. break;
  22780. }
  22781. }
  22782. return collection;
  22783. };
  22784. }
  22785. /**
  22786. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22787. *
  22788. * @private
  22789. * @param {boolean} [fromRight] Specify iterating from right to left.
  22790. * @returns {Function} Returns the new base function.
  22791. */
  22792. function createBaseFor(fromRight) {
  22793. return function(object, iteratee, keysFunc) {
  22794. var index = -1,
  22795. iterable = Object(object),
  22796. props = keysFunc(object),
  22797. length = props.length;
  22798. while (length--) {
  22799. var key = props[fromRight ? length : ++index];
  22800. if (iteratee(iterable[key], key, iterable) === false) {
  22801. break;
  22802. }
  22803. }
  22804. return object;
  22805. };
  22806. }
  22807. /**
  22808. * Creates a function that wraps `func` to invoke it with the optional `this`
  22809. * binding of `thisArg`.
  22810. *
  22811. * @private
  22812. * @param {Function} func The function to wrap.
  22813. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22814. * @param {*} [thisArg] The `this` binding of `func`.
  22815. * @returns {Function} Returns the new wrapped function.
  22816. */
  22817. function createBind(func, bitmask, thisArg) {
  22818. var isBind = bitmask & WRAP_BIND_FLAG,
  22819. Ctor = createCtor(func);
  22820. function wrapper() {
  22821. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22822. return fn.apply(isBind ? thisArg : this, arguments);
  22823. }
  22824. return wrapper;
  22825. }
  22826. /**
  22827. * Creates a function like `_.lowerFirst`.
  22828. *
  22829. * @private
  22830. * @param {string} methodName The name of the `String` case method to use.
  22831. * @returns {Function} Returns the new case function.
  22832. */
  22833. function createCaseFirst(methodName) {
  22834. return function(string) {
  22835. string = toString(string);
  22836. var strSymbols = hasUnicode(string)
  22837. ? stringToArray(string)
  22838. : undefined;
  22839. var chr = strSymbols
  22840. ? strSymbols[0]
  22841. : string.charAt(0);
  22842. var trailing = strSymbols
  22843. ? castSlice(strSymbols, 1).join('')
  22844. : string.slice(1);
  22845. return chr[methodName]() + trailing;
  22846. };
  22847. }
  22848. /**
  22849. * Creates a function like `_.camelCase`.
  22850. *
  22851. * @private
  22852. * @param {Function} callback The function to combine each word.
  22853. * @returns {Function} Returns the new compounder function.
  22854. */
  22855. function createCompounder(callback) {
  22856. return function(string) {
  22857. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22858. };
  22859. }
  22860. /**
  22861. * Creates a function that produces an instance of `Ctor` regardless of
  22862. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22863. *
  22864. * @private
  22865. * @param {Function} Ctor The constructor to wrap.
  22866. * @returns {Function} Returns the new wrapped function.
  22867. */
  22868. function createCtor(Ctor) {
  22869. return function() {
  22870. // Use a `switch` statement to work with class constructors. See
  22871. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22872. // for more details.
  22873. var args = arguments;
  22874. switch (args.length) {
  22875. case 0: return new Ctor;
  22876. case 1: return new Ctor(args[0]);
  22877. case 2: return new Ctor(args[0], args[1]);
  22878. case 3: return new Ctor(args[0], args[1], args[2]);
  22879. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22880. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22881. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22882. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22883. }
  22884. var thisBinding = baseCreate(Ctor.prototype),
  22885. result = Ctor.apply(thisBinding, args);
  22886. // Mimic the constructor's `return` behavior.
  22887. // See https://es5.github.io/#x13.2.2 for more details.
  22888. return isObject(result) ? result : thisBinding;
  22889. };
  22890. }
  22891. /**
  22892. * Creates a function that wraps `func` to enable currying.
  22893. *
  22894. * @private
  22895. * @param {Function} func The function to wrap.
  22896. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22897. * @param {number} arity The arity of `func`.
  22898. * @returns {Function} Returns the new wrapped function.
  22899. */
  22900. function createCurry(func, bitmask, arity) {
  22901. var Ctor = createCtor(func);
  22902. function wrapper() {
  22903. var length = arguments.length,
  22904. args = Array(length),
  22905. index = length,
  22906. placeholder = getHolder(wrapper);
  22907. while (index--) {
  22908. args[index] = arguments[index];
  22909. }
  22910. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22911. ? []
  22912. : replaceHolders(args, placeholder);
  22913. length -= holders.length;
  22914. if (length < arity) {
  22915. return createRecurry(
  22916. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22917. args, holders, undefined, undefined, arity - length);
  22918. }
  22919. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22920. return apply(fn, this, args);
  22921. }
  22922. return wrapper;
  22923. }
  22924. /**
  22925. * Creates a `_.find` or `_.findLast` function.
  22926. *
  22927. * @private
  22928. * @param {Function} findIndexFunc The function to find the collection index.
  22929. * @returns {Function} Returns the new find function.
  22930. */
  22931. function createFind(findIndexFunc) {
  22932. return function(collection, predicate, fromIndex) {
  22933. var iterable = Object(collection);
  22934. if (!isArrayLike(collection)) {
  22935. var iteratee = getIteratee(predicate, 3);
  22936. collection = keys(collection);
  22937. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22938. }
  22939. var index = findIndexFunc(collection, predicate, fromIndex);
  22940. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22941. };
  22942. }
  22943. /**
  22944. * Creates a `_.flow` or `_.flowRight` function.
  22945. *
  22946. * @private
  22947. * @param {boolean} [fromRight] Specify iterating from right to left.
  22948. * @returns {Function} Returns the new flow function.
  22949. */
  22950. function createFlow(fromRight) {
  22951. return flatRest(function(funcs) {
  22952. var length = funcs.length,
  22953. index = length,
  22954. prereq = LodashWrapper.prototype.thru;
  22955. if (fromRight) {
  22956. funcs.reverse();
  22957. }
  22958. while (index--) {
  22959. var func = funcs[index];
  22960. if (typeof func != 'function') {
  22961. throw new TypeError(FUNC_ERROR_TEXT);
  22962. }
  22963. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22964. var wrapper = new LodashWrapper([], true);
  22965. }
  22966. }
  22967. index = wrapper ? index : length;
  22968. while (++index < length) {
  22969. func = funcs[index];
  22970. var funcName = getFuncName(func),
  22971. data = funcName == 'wrapper' ? getData(func) : undefined;
  22972. if (data && isLaziable(data[0]) &&
  22973. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22974. !data[4].length && data[9] == 1
  22975. ) {
  22976. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22977. } else {
  22978. wrapper = (func.length == 1 && isLaziable(func))
  22979. ? wrapper[funcName]()
  22980. : wrapper.thru(func);
  22981. }
  22982. }
  22983. return function() {
  22984. var args = arguments,
  22985. value = args[0];
  22986. if (wrapper && args.length == 1 && isArray(value)) {
  22987. return wrapper.plant(value).value();
  22988. }
  22989. var index = 0,
  22990. result = length ? funcs[index].apply(this, args) : value;
  22991. while (++index < length) {
  22992. result = funcs[index].call(this, result);
  22993. }
  22994. return result;
  22995. };
  22996. });
  22997. }
  22998. /**
  22999. * Creates a function that wraps `func` to invoke it with optional `this`
  23000. * binding of `thisArg`, partial application, and currying.
  23001. *
  23002. * @private
  23003. * @param {Function|string} func The function or method name to wrap.
  23004. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23005. * @param {*} [thisArg] The `this` binding of `func`.
  23006. * @param {Array} [partials] The arguments to prepend to those provided to
  23007. * the new function.
  23008. * @param {Array} [holders] The `partials` placeholder indexes.
  23009. * @param {Array} [partialsRight] The arguments to append to those provided
  23010. * to the new function.
  23011. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23012. * @param {Array} [argPos] The argument positions of the new function.
  23013. * @param {number} [ary] The arity cap of `func`.
  23014. * @param {number} [arity] The arity of `func`.
  23015. * @returns {Function} Returns the new wrapped function.
  23016. */
  23017. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23018. var isAry = bitmask & WRAP_ARY_FLAG,
  23019. isBind = bitmask & WRAP_BIND_FLAG,
  23020. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23021. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23022. isFlip = bitmask & WRAP_FLIP_FLAG,
  23023. Ctor = isBindKey ? undefined : createCtor(func);
  23024. function wrapper() {
  23025. var length = arguments.length,
  23026. args = Array(length),
  23027. index = length;
  23028. while (index--) {
  23029. args[index] = arguments[index];
  23030. }
  23031. if (isCurried) {
  23032. var placeholder = getHolder(wrapper),
  23033. holdersCount = countHolders(args, placeholder);
  23034. }
  23035. if (partials) {
  23036. args = composeArgs(args, partials, holders, isCurried);
  23037. }
  23038. if (partialsRight) {
  23039. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23040. }
  23041. length -= holdersCount;
  23042. if (isCurried && length < arity) {
  23043. var newHolders = replaceHolders(args, placeholder);
  23044. return createRecurry(
  23045. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23046. args, newHolders, argPos, ary, arity - length
  23047. );
  23048. }
  23049. var thisBinding = isBind ? thisArg : this,
  23050. fn = isBindKey ? thisBinding[func] : func;
  23051. length = args.length;
  23052. if (argPos) {
  23053. args = reorder(args, argPos);
  23054. } else if (isFlip && length > 1) {
  23055. args.reverse();
  23056. }
  23057. if (isAry && ary < length) {
  23058. args.length = ary;
  23059. }
  23060. if (this && this !== root && this instanceof wrapper) {
  23061. fn = Ctor || createCtor(fn);
  23062. }
  23063. return fn.apply(thisBinding, args);
  23064. }
  23065. return wrapper;
  23066. }
  23067. /**
  23068. * Creates a function like `_.invertBy`.
  23069. *
  23070. * @private
  23071. * @param {Function} setter The function to set accumulator values.
  23072. * @param {Function} toIteratee The function to resolve iteratees.
  23073. * @returns {Function} Returns the new inverter function.
  23074. */
  23075. function createInverter(setter, toIteratee) {
  23076. return function(object, iteratee) {
  23077. return baseInverter(object, setter, toIteratee(iteratee), {});
  23078. };
  23079. }
  23080. /**
  23081. * Creates a function that performs a mathematical operation on two values.
  23082. *
  23083. * @private
  23084. * @param {Function} operator The function to perform the operation.
  23085. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23086. * @returns {Function} Returns the new mathematical operation function.
  23087. */
  23088. function createMathOperation(operator, defaultValue) {
  23089. return function(value, other) {
  23090. var result;
  23091. if (value === undefined && other === undefined) {
  23092. return defaultValue;
  23093. }
  23094. if (value !== undefined) {
  23095. result = value;
  23096. }
  23097. if (other !== undefined) {
  23098. if (result === undefined) {
  23099. return other;
  23100. }
  23101. if (typeof value == 'string' || typeof other == 'string') {
  23102. value = baseToString(value);
  23103. other = baseToString(other);
  23104. } else {
  23105. value = baseToNumber(value);
  23106. other = baseToNumber(other);
  23107. }
  23108. result = operator(value, other);
  23109. }
  23110. return result;
  23111. };
  23112. }
  23113. /**
  23114. * Creates a function like `_.over`.
  23115. *
  23116. * @private
  23117. * @param {Function} arrayFunc The function to iterate over iteratees.
  23118. * @returns {Function} Returns the new over function.
  23119. */
  23120. function createOver(arrayFunc) {
  23121. return flatRest(function(iteratees) {
  23122. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23123. return baseRest(function(args) {
  23124. var thisArg = this;
  23125. return arrayFunc(iteratees, function(iteratee) {
  23126. return apply(iteratee, thisArg, args);
  23127. });
  23128. });
  23129. });
  23130. }
  23131. /**
  23132. * Creates the padding for `string` based on `length`. The `chars` string
  23133. * is truncated if the number of characters exceeds `length`.
  23134. *
  23135. * @private
  23136. * @param {number} length The padding length.
  23137. * @param {string} [chars=' '] The string used as padding.
  23138. * @returns {string} Returns the padding for `string`.
  23139. */
  23140. function createPadding(length, chars) {
  23141. chars = chars === undefined ? ' ' : baseToString(chars);
  23142. var charsLength = chars.length;
  23143. if (charsLength < 2) {
  23144. return charsLength ? baseRepeat(chars, length) : chars;
  23145. }
  23146. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23147. return hasUnicode(chars)
  23148. ? castSlice(stringToArray(result), 0, length).join('')
  23149. : result.slice(0, length);
  23150. }
  23151. /**
  23152. * Creates a function that wraps `func` to invoke it with the `this` binding
  23153. * of `thisArg` and `partials` prepended to the arguments it receives.
  23154. *
  23155. * @private
  23156. * @param {Function} func The function to wrap.
  23157. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23158. * @param {*} thisArg The `this` binding of `func`.
  23159. * @param {Array} partials The arguments to prepend to those provided to
  23160. * the new function.
  23161. * @returns {Function} Returns the new wrapped function.
  23162. */
  23163. function createPartial(func, bitmask, thisArg, partials) {
  23164. var isBind = bitmask & WRAP_BIND_FLAG,
  23165. Ctor = createCtor(func);
  23166. function wrapper() {
  23167. var argsIndex = -1,
  23168. argsLength = arguments.length,
  23169. leftIndex = -1,
  23170. leftLength = partials.length,
  23171. args = Array(leftLength + argsLength),
  23172. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23173. while (++leftIndex < leftLength) {
  23174. args[leftIndex] = partials[leftIndex];
  23175. }
  23176. while (argsLength--) {
  23177. args[leftIndex++] = arguments[++argsIndex];
  23178. }
  23179. return apply(fn, isBind ? thisArg : this, args);
  23180. }
  23181. return wrapper;
  23182. }
  23183. /**
  23184. * Creates a `_.range` or `_.rangeRight` function.
  23185. *
  23186. * @private
  23187. * @param {boolean} [fromRight] Specify iterating from right to left.
  23188. * @returns {Function} Returns the new range function.
  23189. */
  23190. function createRange(fromRight) {
  23191. return function(start, end, step) {
  23192. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23193. end = step = undefined;
  23194. }
  23195. // Ensure the sign of `-0` is preserved.
  23196. start = toFinite(start);
  23197. if (end === undefined) {
  23198. end = start;
  23199. start = 0;
  23200. } else {
  23201. end = toFinite(end);
  23202. }
  23203. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23204. return baseRange(start, end, step, fromRight);
  23205. };
  23206. }
  23207. /**
  23208. * Creates a function that performs a relational operation on two values.
  23209. *
  23210. * @private
  23211. * @param {Function} operator The function to perform the operation.
  23212. * @returns {Function} Returns the new relational operation function.
  23213. */
  23214. function createRelationalOperation(operator) {
  23215. return function(value, other) {
  23216. if (!(typeof value == 'string' && typeof other == 'string')) {
  23217. value = toNumber(value);
  23218. other = toNumber(other);
  23219. }
  23220. return operator(value, other);
  23221. };
  23222. }
  23223. /**
  23224. * Creates a function that wraps `func` to continue currying.
  23225. *
  23226. * @private
  23227. * @param {Function} func The function to wrap.
  23228. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23229. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23230. * @param {*} placeholder The placeholder value.
  23231. * @param {*} [thisArg] The `this` binding of `func`.
  23232. * @param {Array} [partials] The arguments to prepend to those provided to
  23233. * the new function.
  23234. * @param {Array} [holders] The `partials` placeholder indexes.
  23235. * @param {Array} [argPos] The argument positions of the new function.
  23236. * @param {number} [ary] The arity cap of `func`.
  23237. * @param {number} [arity] The arity of `func`.
  23238. * @returns {Function} Returns the new wrapped function.
  23239. */
  23240. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23241. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23242. newHolders = isCurry ? holders : undefined,
  23243. newHoldersRight = isCurry ? undefined : holders,
  23244. newPartials = isCurry ? partials : undefined,
  23245. newPartialsRight = isCurry ? undefined : partials;
  23246. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23247. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23248. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23249. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23250. }
  23251. var newData = [
  23252. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23253. newHoldersRight, argPos, ary, arity
  23254. ];
  23255. var result = wrapFunc.apply(undefined, newData);
  23256. if (isLaziable(func)) {
  23257. setData(result, newData);
  23258. }
  23259. result.placeholder = placeholder;
  23260. return setWrapToString(result, func, bitmask);
  23261. }
  23262. /**
  23263. * Creates a function like `_.round`.
  23264. *
  23265. * @private
  23266. * @param {string} methodName The name of the `Math` method to use when rounding.
  23267. * @returns {Function} Returns the new round function.
  23268. */
  23269. function createRound(methodName) {
  23270. var func = Math[methodName];
  23271. return function(number, precision) {
  23272. number = toNumber(number);
  23273. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23274. if (precision && nativeIsFinite(number)) {
  23275. // Shift with exponential notation to avoid floating-point issues.
  23276. // See [MDN](https://mdn.io/round#Examples) for more details.
  23277. var pair = (toString(number) + 'e').split('e'),
  23278. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23279. pair = (toString(value) + 'e').split('e');
  23280. return +(pair[0] + 'e' + (+pair[1] - precision));
  23281. }
  23282. return func(number);
  23283. };
  23284. }
  23285. /**
  23286. * Creates a set object of `values`.
  23287. *
  23288. * @private
  23289. * @param {Array} values The values to add to the set.
  23290. * @returns {Object} Returns the new set.
  23291. */
  23292. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23293. return new Set(values);
  23294. };
  23295. /**
  23296. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23297. *
  23298. * @private
  23299. * @param {Function} keysFunc The function to get the keys of a given object.
  23300. * @returns {Function} Returns the new pairs function.
  23301. */
  23302. function createToPairs(keysFunc) {
  23303. return function(object) {
  23304. var tag = getTag(object);
  23305. if (tag == mapTag) {
  23306. return mapToArray(object);
  23307. }
  23308. if (tag == setTag) {
  23309. return setToPairs(object);
  23310. }
  23311. return baseToPairs(object, keysFunc(object));
  23312. };
  23313. }
  23314. /**
  23315. * Creates a function that either curries or invokes `func` with optional
  23316. * `this` binding and partially applied arguments.
  23317. *
  23318. * @private
  23319. * @param {Function|string} func The function or method name to wrap.
  23320. * @param {number} bitmask The bitmask flags.
  23321. * 1 - `_.bind`
  23322. * 2 - `_.bindKey`
  23323. * 4 - `_.curry` or `_.curryRight` of a bound function
  23324. * 8 - `_.curry`
  23325. * 16 - `_.curryRight`
  23326. * 32 - `_.partial`
  23327. * 64 - `_.partialRight`
  23328. * 128 - `_.rearg`
  23329. * 256 - `_.ary`
  23330. * 512 - `_.flip`
  23331. * @param {*} [thisArg] The `this` binding of `func`.
  23332. * @param {Array} [partials] The arguments to be partially applied.
  23333. * @param {Array} [holders] The `partials` placeholder indexes.
  23334. * @param {Array} [argPos] The argument positions of the new function.
  23335. * @param {number} [ary] The arity cap of `func`.
  23336. * @param {number} [arity] The arity of `func`.
  23337. * @returns {Function} Returns the new wrapped function.
  23338. */
  23339. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23340. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23341. if (!isBindKey && typeof func != 'function') {
  23342. throw new TypeError(FUNC_ERROR_TEXT);
  23343. }
  23344. var length = partials ? partials.length : 0;
  23345. if (!length) {
  23346. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23347. partials = holders = undefined;
  23348. }
  23349. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23350. arity = arity === undefined ? arity : toInteger(arity);
  23351. length -= holders ? holders.length : 0;
  23352. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23353. var partialsRight = partials,
  23354. holdersRight = holders;
  23355. partials = holders = undefined;
  23356. }
  23357. var data = isBindKey ? undefined : getData(func);
  23358. var newData = [
  23359. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23360. argPos, ary, arity
  23361. ];
  23362. if (data) {
  23363. mergeData(newData, data);
  23364. }
  23365. func = newData[0];
  23366. bitmask = newData[1];
  23367. thisArg = newData[2];
  23368. partials = newData[3];
  23369. holders = newData[4];
  23370. arity = newData[9] = newData[9] === undefined
  23371. ? (isBindKey ? 0 : func.length)
  23372. : nativeMax(newData[9] - length, 0);
  23373. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23374. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23375. }
  23376. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23377. var result = createBind(func, bitmask, thisArg);
  23378. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23379. result = createCurry(func, bitmask, arity);
  23380. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23381. result = createPartial(func, bitmask, thisArg, partials);
  23382. } else {
  23383. result = createHybrid.apply(undefined, newData);
  23384. }
  23385. var setter = data ? baseSetData : setData;
  23386. return setWrapToString(setter(result, newData), func, bitmask);
  23387. }
  23388. /**
  23389. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23390. * of source objects to the destination object for all destination properties
  23391. * that resolve to `undefined`.
  23392. *
  23393. * @private
  23394. * @param {*} objValue The destination value.
  23395. * @param {*} srcValue The source value.
  23396. * @param {string} key The key of the property to assign.
  23397. * @param {Object} object The parent object of `objValue`.
  23398. * @returns {*} Returns the value to assign.
  23399. */
  23400. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23401. if (objValue === undefined ||
  23402. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23403. return srcValue;
  23404. }
  23405. return objValue;
  23406. }
  23407. /**
  23408. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23409. * objects into destination objects that are passed thru.
  23410. *
  23411. * @private
  23412. * @param {*} objValue The destination value.
  23413. * @param {*} srcValue The source value.
  23414. * @param {string} key The key of the property to merge.
  23415. * @param {Object} object The parent object of `objValue`.
  23416. * @param {Object} source The parent object of `srcValue`.
  23417. * @param {Object} [stack] Tracks traversed source values and their merged
  23418. * counterparts.
  23419. * @returns {*} Returns the value to assign.
  23420. */
  23421. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23422. if (isObject(objValue) && isObject(srcValue)) {
  23423. // Recursively merge objects and arrays (susceptible to call stack limits).
  23424. stack.set(srcValue, objValue);
  23425. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23426. stack['delete'](srcValue);
  23427. }
  23428. return objValue;
  23429. }
  23430. /**
  23431. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23432. * objects.
  23433. *
  23434. * @private
  23435. * @param {*} value The value to inspect.
  23436. * @param {string} key The key of the property to inspect.
  23437. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23438. */
  23439. function customOmitClone(value) {
  23440. return isPlainObject(value) ? undefined : value;
  23441. }
  23442. /**
  23443. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23444. * partial deep comparisons.
  23445. *
  23446. * @private
  23447. * @param {Array} array The array to compare.
  23448. * @param {Array} other The other array to compare.
  23449. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23450. * @param {Function} customizer The function to customize comparisons.
  23451. * @param {Function} equalFunc The function to determine equivalents of values.
  23452. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23453. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23454. */
  23455. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23456. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23457. arrLength = array.length,
  23458. othLength = other.length;
  23459. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23460. return false;
  23461. }
  23462. // Assume cyclic values are equal.
  23463. var stacked = stack.get(array);
  23464. if (stacked && stack.get(other)) {
  23465. return stacked == other;
  23466. }
  23467. var index = -1,
  23468. result = true,
  23469. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23470. stack.set(array, other);
  23471. stack.set(other, array);
  23472. // Ignore non-index properties.
  23473. while (++index < arrLength) {
  23474. var arrValue = array[index],
  23475. othValue = other[index];
  23476. if (customizer) {
  23477. var compared = isPartial
  23478. ? customizer(othValue, arrValue, index, other, array, stack)
  23479. : customizer(arrValue, othValue, index, array, other, stack);
  23480. }
  23481. if (compared !== undefined) {
  23482. if (compared) {
  23483. continue;
  23484. }
  23485. result = false;
  23486. break;
  23487. }
  23488. // Recursively compare arrays (susceptible to call stack limits).
  23489. if (seen) {
  23490. if (!arraySome(other, function(othValue, othIndex) {
  23491. if (!cacheHas(seen, othIndex) &&
  23492. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23493. return seen.push(othIndex);
  23494. }
  23495. })) {
  23496. result = false;
  23497. break;
  23498. }
  23499. } else if (!(
  23500. arrValue === othValue ||
  23501. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23502. )) {
  23503. result = false;
  23504. break;
  23505. }
  23506. }
  23507. stack['delete'](array);
  23508. stack['delete'](other);
  23509. return result;
  23510. }
  23511. /**
  23512. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23513. * the same `toStringTag`.
  23514. *
  23515. * **Note:** This function only supports comparing values with tags of
  23516. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23517. *
  23518. * @private
  23519. * @param {Object} object The object to compare.
  23520. * @param {Object} other The other object to compare.
  23521. * @param {string} tag The `toStringTag` of the objects to compare.
  23522. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23523. * @param {Function} customizer The function to customize comparisons.
  23524. * @param {Function} equalFunc The function to determine equivalents of values.
  23525. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23526. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23527. */
  23528. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23529. switch (tag) {
  23530. case dataViewTag:
  23531. if ((object.byteLength != other.byteLength) ||
  23532. (object.byteOffset != other.byteOffset)) {
  23533. return false;
  23534. }
  23535. object = object.buffer;
  23536. other = other.buffer;
  23537. case arrayBufferTag:
  23538. if ((object.byteLength != other.byteLength) ||
  23539. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23540. return false;
  23541. }
  23542. return true;
  23543. case boolTag:
  23544. case dateTag:
  23545. case numberTag:
  23546. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23547. // Invalid dates are coerced to `NaN`.
  23548. return eq(+object, +other);
  23549. case errorTag:
  23550. return object.name == other.name && object.message == other.message;
  23551. case regexpTag:
  23552. case stringTag:
  23553. // Coerce regexes to strings and treat strings, primitives and objects,
  23554. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23555. // for more details.
  23556. return object == (other + '');
  23557. case mapTag:
  23558. var convert = mapToArray;
  23559. case setTag:
  23560. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23561. convert || (convert = setToArray);
  23562. if (object.size != other.size && !isPartial) {
  23563. return false;
  23564. }
  23565. // Assume cyclic values are equal.
  23566. var stacked = stack.get(object);
  23567. if (stacked) {
  23568. return stacked == other;
  23569. }
  23570. bitmask |= COMPARE_UNORDERED_FLAG;
  23571. // Recursively compare objects (susceptible to call stack limits).
  23572. stack.set(object, other);
  23573. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23574. stack['delete'](object);
  23575. return result;
  23576. case symbolTag:
  23577. if (symbolValueOf) {
  23578. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23579. }
  23580. }
  23581. return false;
  23582. }
  23583. /**
  23584. * A specialized version of `baseIsEqualDeep` for objects with support for
  23585. * partial deep comparisons.
  23586. *
  23587. * @private
  23588. * @param {Object} object The object to compare.
  23589. * @param {Object} other The other object to compare.
  23590. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23591. * @param {Function} customizer The function to customize comparisons.
  23592. * @param {Function} equalFunc The function to determine equivalents of values.
  23593. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23594. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23595. */
  23596. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23597. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23598. objProps = getAllKeys(object),
  23599. objLength = objProps.length,
  23600. othProps = getAllKeys(other),
  23601. othLength = othProps.length;
  23602. if (objLength != othLength && !isPartial) {
  23603. return false;
  23604. }
  23605. var index = objLength;
  23606. while (index--) {
  23607. var key = objProps[index];
  23608. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23609. return false;
  23610. }
  23611. }
  23612. // Assume cyclic values are equal.
  23613. var stacked = stack.get(object);
  23614. if (stacked && stack.get(other)) {
  23615. return stacked == other;
  23616. }
  23617. var result = true;
  23618. stack.set(object, other);
  23619. stack.set(other, object);
  23620. var skipCtor = isPartial;
  23621. while (++index < objLength) {
  23622. key = objProps[index];
  23623. var objValue = object[key],
  23624. othValue = other[key];
  23625. if (customizer) {
  23626. var compared = isPartial
  23627. ? customizer(othValue, objValue, key, other, object, stack)
  23628. : customizer(objValue, othValue, key, object, other, stack);
  23629. }
  23630. // Recursively compare objects (susceptible to call stack limits).
  23631. if (!(compared === undefined
  23632. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23633. : compared
  23634. )) {
  23635. result = false;
  23636. break;
  23637. }
  23638. skipCtor || (skipCtor = key == 'constructor');
  23639. }
  23640. if (result && !skipCtor) {
  23641. var objCtor = object.constructor,
  23642. othCtor = other.constructor;
  23643. // Non `Object` object instances with different constructors are not equal.
  23644. if (objCtor != othCtor &&
  23645. ('constructor' in object && 'constructor' in other) &&
  23646. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23647. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23648. result = false;
  23649. }
  23650. }
  23651. stack['delete'](object);
  23652. stack['delete'](other);
  23653. return result;
  23654. }
  23655. /**
  23656. * A specialized version of `baseRest` which flattens the rest array.
  23657. *
  23658. * @private
  23659. * @param {Function} func The function to apply a rest parameter to.
  23660. * @returns {Function} Returns the new function.
  23661. */
  23662. function flatRest(func) {
  23663. return setToString(overRest(func, undefined, flatten), func + '');
  23664. }
  23665. /**
  23666. * Creates an array of own enumerable property names and symbols of `object`.
  23667. *
  23668. * @private
  23669. * @param {Object} object The object to query.
  23670. * @returns {Array} Returns the array of property names and symbols.
  23671. */
  23672. function getAllKeys(object) {
  23673. return baseGetAllKeys(object, keys, getSymbols);
  23674. }
  23675. /**
  23676. * Creates an array of own and inherited enumerable property names and
  23677. * symbols of `object`.
  23678. *
  23679. * @private
  23680. * @param {Object} object The object to query.
  23681. * @returns {Array} Returns the array of property names and symbols.
  23682. */
  23683. function getAllKeysIn(object) {
  23684. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23685. }
  23686. /**
  23687. * Gets metadata for `func`.
  23688. *
  23689. * @private
  23690. * @param {Function} func The function to query.
  23691. * @returns {*} Returns the metadata for `func`.
  23692. */
  23693. var getData = !metaMap ? noop : function(func) {
  23694. return metaMap.get(func);
  23695. };
  23696. /**
  23697. * Gets the name of `func`.
  23698. *
  23699. * @private
  23700. * @param {Function} func The function to query.
  23701. * @returns {string} Returns the function name.
  23702. */
  23703. function getFuncName(func) {
  23704. var result = (func.name + ''),
  23705. array = realNames[result],
  23706. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23707. while (length--) {
  23708. var data = array[length],
  23709. otherFunc = data.func;
  23710. if (otherFunc == null || otherFunc == func) {
  23711. return data.name;
  23712. }
  23713. }
  23714. return result;
  23715. }
  23716. /**
  23717. * Gets the argument placeholder value for `func`.
  23718. *
  23719. * @private
  23720. * @param {Function} func The function to inspect.
  23721. * @returns {*} Returns the placeholder value.
  23722. */
  23723. function getHolder(func) {
  23724. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23725. return object.placeholder;
  23726. }
  23727. /**
  23728. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23729. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23730. * If arguments are provided, the chosen function is invoked with them and
  23731. * its result is returned.
  23732. *
  23733. * @private
  23734. * @param {*} [value] The value to convert to an iteratee.
  23735. * @param {number} [arity] The arity of the created iteratee.
  23736. * @returns {Function} Returns the chosen function or its result.
  23737. */
  23738. function getIteratee() {
  23739. var result = lodash.iteratee || iteratee;
  23740. result = result === iteratee ? baseIteratee : result;
  23741. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23742. }
  23743. /**
  23744. * Gets the data for `map`.
  23745. *
  23746. * @private
  23747. * @param {Object} map The map to query.
  23748. * @param {string} key The reference key.
  23749. * @returns {*} Returns the map data.
  23750. */
  23751. function getMapData(map, key) {
  23752. var data = map.__data__;
  23753. return isKeyable(key)
  23754. ? data[typeof key == 'string' ? 'string' : 'hash']
  23755. : data.map;
  23756. }
  23757. /**
  23758. * Gets the property names, values, and compare flags of `object`.
  23759. *
  23760. * @private
  23761. * @param {Object} object The object to query.
  23762. * @returns {Array} Returns the match data of `object`.
  23763. */
  23764. function getMatchData(object) {
  23765. var result = keys(object),
  23766. length = result.length;
  23767. while (length--) {
  23768. var key = result[length],
  23769. value = object[key];
  23770. result[length] = [key, value, isStrictComparable(value)];
  23771. }
  23772. return result;
  23773. }
  23774. /**
  23775. * Gets the native function at `key` of `object`.
  23776. *
  23777. * @private
  23778. * @param {Object} object The object to query.
  23779. * @param {string} key The key of the method to get.
  23780. * @returns {*} Returns the function if it's native, else `undefined`.
  23781. */
  23782. function getNative(object, key) {
  23783. var value = getValue(object, key);
  23784. return baseIsNative(value) ? value : undefined;
  23785. }
  23786. /**
  23787. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23788. *
  23789. * @private
  23790. * @param {*} value The value to query.
  23791. * @returns {string} Returns the raw `toStringTag`.
  23792. */
  23793. function getRawTag(value) {
  23794. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23795. tag = value[symToStringTag];
  23796. try {
  23797. value[symToStringTag] = undefined;
  23798. var unmasked = true;
  23799. } catch (e) {}
  23800. var result = nativeObjectToString.call(value);
  23801. if (unmasked) {
  23802. if (isOwn) {
  23803. value[symToStringTag] = tag;
  23804. } else {
  23805. delete value[symToStringTag];
  23806. }
  23807. }
  23808. return result;
  23809. }
  23810. /**
  23811. * Creates an array of the own enumerable symbols of `object`.
  23812. *
  23813. * @private
  23814. * @param {Object} object The object to query.
  23815. * @returns {Array} Returns the array of symbols.
  23816. */
  23817. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23818. if (object == null) {
  23819. return [];
  23820. }
  23821. object = Object(object);
  23822. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23823. return propertyIsEnumerable.call(object, symbol);
  23824. });
  23825. };
  23826. /**
  23827. * Creates an array of the own and inherited enumerable symbols of `object`.
  23828. *
  23829. * @private
  23830. * @param {Object} object The object to query.
  23831. * @returns {Array} Returns the array of symbols.
  23832. */
  23833. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23834. var result = [];
  23835. while (object) {
  23836. arrayPush(result, getSymbols(object));
  23837. object = getPrototype(object);
  23838. }
  23839. return result;
  23840. };
  23841. /**
  23842. * Gets the `toStringTag` of `value`.
  23843. *
  23844. * @private
  23845. * @param {*} value The value to query.
  23846. * @returns {string} Returns the `toStringTag`.
  23847. */
  23848. var getTag = baseGetTag;
  23849. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23850. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23851. (Map && getTag(new Map) != mapTag) ||
  23852. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23853. (Set && getTag(new Set) != setTag) ||
  23854. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23855. getTag = function(value) {
  23856. var result = baseGetTag(value),
  23857. Ctor = result == objectTag ? value.constructor : undefined,
  23858. ctorString = Ctor ? toSource(Ctor) : '';
  23859. if (ctorString) {
  23860. switch (ctorString) {
  23861. case dataViewCtorString: return dataViewTag;
  23862. case mapCtorString: return mapTag;
  23863. case promiseCtorString: return promiseTag;
  23864. case setCtorString: return setTag;
  23865. case weakMapCtorString: return weakMapTag;
  23866. }
  23867. }
  23868. return result;
  23869. };
  23870. }
  23871. /**
  23872. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23873. *
  23874. * @private
  23875. * @param {number} start The start of the view.
  23876. * @param {number} end The end of the view.
  23877. * @param {Array} transforms The transformations to apply to the view.
  23878. * @returns {Object} Returns an object containing the `start` and `end`
  23879. * positions of the view.
  23880. */
  23881. function getView(start, end, transforms) {
  23882. var index = -1,
  23883. length = transforms.length;
  23884. while (++index < length) {
  23885. var data = transforms[index],
  23886. size = data.size;
  23887. switch (data.type) {
  23888. case 'drop': start += size; break;
  23889. case 'dropRight': end -= size; break;
  23890. case 'take': end = nativeMin(end, start + size); break;
  23891. case 'takeRight': start = nativeMax(start, end - size); break;
  23892. }
  23893. }
  23894. return { 'start': start, 'end': end };
  23895. }
  23896. /**
  23897. * Extracts wrapper details from the `source` body comment.
  23898. *
  23899. * @private
  23900. * @param {string} source The source to inspect.
  23901. * @returns {Array} Returns the wrapper details.
  23902. */
  23903. function getWrapDetails(source) {
  23904. var match = source.match(reWrapDetails);
  23905. return match ? match[1].split(reSplitDetails) : [];
  23906. }
  23907. /**
  23908. * Checks if `path` exists on `object`.
  23909. *
  23910. * @private
  23911. * @param {Object} object The object to query.
  23912. * @param {Array|string} path The path to check.
  23913. * @param {Function} hasFunc The function to check properties.
  23914. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23915. */
  23916. function hasPath(object, path, hasFunc) {
  23917. path = castPath(path, object);
  23918. var index = -1,
  23919. length = path.length,
  23920. result = false;
  23921. while (++index < length) {
  23922. var key = toKey(path[index]);
  23923. if (!(result = object != null && hasFunc(object, key))) {
  23924. break;
  23925. }
  23926. object = object[key];
  23927. }
  23928. if (result || ++index != length) {
  23929. return result;
  23930. }
  23931. length = object == null ? 0 : object.length;
  23932. return !!length && isLength(length) && isIndex(key, length) &&
  23933. (isArray(object) || isArguments(object));
  23934. }
  23935. /**
  23936. * Initializes an array clone.
  23937. *
  23938. * @private
  23939. * @param {Array} array The array to clone.
  23940. * @returns {Array} Returns the initialized clone.
  23941. */
  23942. function initCloneArray(array) {
  23943. var length = array.length,
  23944. result = new array.constructor(length);
  23945. // Add properties assigned by `RegExp#exec`.
  23946. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23947. result.index = array.index;
  23948. result.input = array.input;
  23949. }
  23950. return result;
  23951. }
  23952. /**
  23953. * Initializes an object clone.
  23954. *
  23955. * @private
  23956. * @param {Object} object The object to clone.
  23957. * @returns {Object} Returns the initialized clone.
  23958. */
  23959. function initCloneObject(object) {
  23960. return (typeof object.constructor == 'function' && !isPrototype(object))
  23961. ? baseCreate(getPrototype(object))
  23962. : {};
  23963. }
  23964. /**
  23965. * Initializes an object clone based on its `toStringTag`.
  23966. *
  23967. * **Note:** This function only supports cloning values with tags of
  23968. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23969. *
  23970. * @private
  23971. * @param {Object} object The object to clone.
  23972. * @param {string} tag The `toStringTag` of the object to clone.
  23973. * @param {boolean} [isDeep] Specify a deep clone.
  23974. * @returns {Object} Returns the initialized clone.
  23975. */
  23976. function initCloneByTag(object, tag, isDeep) {
  23977. var Ctor = object.constructor;
  23978. switch (tag) {
  23979. case arrayBufferTag:
  23980. return cloneArrayBuffer(object);
  23981. case boolTag:
  23982. case dateTag:
  23983. return new Ctor(+object);
  23984. case dataViewTag:
  23985. return cloneDataView(object, isDeep);
  23986. case float32Tag: case float64Tag:
  23987. case int8Tag: case int16Tag: case int32Tag:
  23988. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23989. return cloneTypedArray(object, isDeep);
  23990. case mapTag:
  23991. return new Ctor;
  23992. case numberTag:
  23993. case stringTag:
  23994. return new Ctor(object);
  23995. case regexpTag:
  23996. return cloneRegExp(object);
  23997. case setTag:
  23998. return new Ctor;
  23999. case symbolTag:
  24000. return cloneSymbol(object);
  24001. }
  24002. }
  24003. /**
  24004. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24005. *
  24006. * @private
  24007. * @param {string} source The source to modify.
  24008. * @returns {Array} details The details to insert.
  24009. * @returns {string} Returns the modified source.
  24010. */
  24011. function insertWrapDetails(source, details) {
  24012. var length = details.length;
  24013. if (!length) {
  24014. return source;
  24015. }
  24016. var lastIndex = length - 1;
  24017. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24018. details = details.join(length > 2 ? ', ' : ' ');
  24019. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24020. }
  24021. /**
  24022. * Checks if `value` is a flattenable `arguments` object or array.
  24023. *
  24024. * @private
  24025. * @param {*} value The value to check.
  24026. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24027. */
  24028. function isFlattenable(value) {
  24029. return isArray(value) || isArguments(value) ||
  24030. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24031. }
  24032. /**
  24033. * Checks if `value` is a valid array-like index.
  24034. *
  24035. * @private
  24036. * @param {*} value The value to check.
  24037. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24038. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24039. */
  24040. function isIndex(value, length) {
  24041. var type = typeof value;
  24042. length = length == null ? MAX_SAFE_INTEGER : length;
  24043. return !!length &&
  24044. (type == 'number' ||
  24045. (type != 'symbol' && reIsUint.test(value))) &&
  24046. (value > -1 && value % 1 == 0 && value < length);
  24047. }
  24048. /**
  24049. * Checks if the given arguments are from an iteratee call.
  24050. *
  24051. * @private
  24052. * @param {*} value The potential iteratee value argument.
  24053. * @param {*} index The potential iteratee index or key argument.
  24054. * @param {*} object The potential iteratee object argument.
  24055. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24056. * else `false`.
  24057. */
  24058. function isIterateeCall(value, index, object) {
  24059. if (!isObject(object)) {
  24060. return false;
  24061. }
  24062. var type = typeof index;
  24063. if (type == 'number'
  24064. ? (isArrayLike(object) && isIndex(index, object.length))
  24065. : (type == 'string' && index in object)
  24066. ) {
  24067. return eq(object[index], value);
  24068. }
  24069. return false;
  24070. }
  24071. /**
  24072. * Checks if `value` is a property name and not a property path.
  24073. *
  24074. * @private
  24075. * @param {*} value The value to check.
  24076. * @param {Object} [object] The object to query keys on.
  24077. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24078. */
  24079. function isKey(value, object) {
  24080. if (isArray(value)) {
  24081. return false;
  24082. }
  24083. var type = typeof value;
  24084. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24085. value == null || isSymbol(value)) {
  24086. return true;
  24087. }
  24088. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24089. (object != null && value in Object(object));
  24090. }
  24091. /**
  24092. * Checks if `value` is suitable for use as unique object key.
  24093. *
  24094. * @private
  24095. * @param {*} value The value to check.
  24096. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24097. */
  24098. function isKeyable(value) {
  24099. var type = typeof value;
  24100. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24101. ? (value !== '__proto__')
  24102. : (value === null);
  24103. }
  24104. /**
  24105. * Checks if `func` has a lazy counterpart.
  24106. *
  24107. * @private
  24108. * @param {Function} func The function to check.
  24109. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24110. * else `false`.
  24111. */
  24112. function isLaziable(func) {
  24113. var funcName = getFuncName(func),
  24114. other = lodash[funcName];
  24115. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24116. return false;
  24117. }
  24118. if (func === other) {
  24119. return true;
  24120. }
  24121. var data = getData(other);
  24122. return !!data && func === data[0];
  24123. }
  24124. /**
  24125. * Checks if `func` has its source masked.
  24126. *
  24127. * @private
  24128. * @param {Function} func The function to check.
  24129. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24130. */
  24131. function isMasked(func) {
  24132. return !!maskSrcKey && (maskSrcKey in func);
  24133. }
  24134. /**
  24135. * Checks if `func` is capable of being masked.
  24136. *
  24137. * @private
  24138. * @param {*} value The value to check.
  24139. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24140. */
  24141. var isMaskable = coreJsData ? isFunction : stubFalse;
  24142. /**
  24143. * Checks if `value` is likely a prototype object.
  24144. *
  24145. * @private
  24146. * @param {*} value The value to check.
  24147. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24148. */
  24149. function isPrototype(value) {
  24150. var Ctor = value && value.constructor,
  24151. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24152. return value === proto;
  24153. }
  24154. /**
  24155. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24156. *
  24157. * @private
  24158. * @param {*} value The value to check.
  24159. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24160. * equality comparisons, else `false`.
  24161. */
  24162. function isStrictComparable(value) {
  24163. return value === value && !isObject(value);
  24164. }
  24165. /**
  24166. * A specialized version of `matchesProperty` for source values suitable
  24167. * for strict equality comparisons, i.e. `===`.
  24168. *
  24169. * @private
  24170. * @param {string} key The key of the property to get.
  24171. * @param {*} srcValue The value to match.
  24172. * @returns {Function} Returns the new spec function.
  24173. */
  24174. function matchesStrictComparable(key, srcValue) {
  24175. return function(object) {
  24176. if (object == null) {
  24177. return false;
  24178. }
  24179. return object[key] === srcValue &&
  24180. (srcValue !== undefined || (key in Object(object)));
  24181. };
  24182. }
  24183. /**
  24184. * A specialized version of `_.memoize` which clears the memoized function's
  24185. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24186. *
  24187. * @private
  24188. * @param {Function} func The function to have its output memoized.
  24189. * @returns {Function} Returns the new memoized function.
  24190. */
  24191. function memoizeCapped(func) {
  24192. var result = memoize(func, function(key) {
  24193. if (cache.size === MAX_MEMOIZE_SIZE) {
  24194. cache.clear();
  24195. }
  24196. return key;
  24197. });
  24198. var cache = result.cache;
  24199. return result;
  24200. }
  24201. /**
  24202. * Merges the function metadata of `source` into `data`.
  24203. *
  24204. * Merging metadata reduces the number of wrappers used to invoke a function.
  24205. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24206. * may be applied regardless of execution order. Methods like `_.ary` and
  24207. * `_.rearg` modify function arguments, making the order in which they are
  24208. * executed important, preventing the merging of metadata. However, we make
  24209. * an exception for a safe combined case where curried functions have `_.ary`
  24210. * and or `_.rearg` applied.
  24211. *
  24212. * @private
  24213. * @param {Array} data The destination metadata.
  24214. * @param {Array} source The source metadata.
  24215. * @returns {Array} Returns `data`.
  24216. */
  24217. function mergeData(data, source) {
  24218. var bitmask = data[1],
  24219. srcBitmask = source[1],
  24220. newBitmask = bitmask | srcBitmask,
  24221. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24222. var isCombo =
  24223. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24224. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24225. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24226. // Exit early if metadata can't be merged.
  24227. if (!(isCommon || isCombo)) {
  24228. return data;
  24229. }
  24230. // Use source `thisArg` if available.
  24231. if (srcBitmask & WRAP_BIND_FLAG) {
  24232. data[2] = source[2];
  24233. // Set when currying a bound function.
  24234. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24235. }
  24236. // Compose partial arguments.
  24237. var value = source[3];
  24238. if (value) {
  24239. var partials = data[3];
  24240. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24241. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24242. }
  24243. // Compose partial right arguments.
  24244. value = source[5];
  24245. if (value) {
  24246. partials = data[5];
  24247. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24248. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24249. }
  24250. // Use source `argPos` if available.
  24251. value = source[7];
  24252. if (value) {
  24253. data[7] = value;
  24254. }
  24255. // Use source `ary` if it's smaller.
  24256. if (srcBitmask & WRAP_ARY_FLAG) {
  24257. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24258. }
  24259. // Use source `arity` if one is not provided.
  24260. if (data[9] == null) {
  24261. data[9] = source[9];
  24262. }
  24263. // Use source `func` and merge bitmasks.
  24264. data[0] = source[0];
  24265. data[1] = newBitmask;
  24266. return data;
  24267. }
  24268. /**
  24269. * This function is like
  24270. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24271. * except that it includes inherited enumerable properties.
  24272. *
  24273. * @private
  24274. * @param {Object} object The object to query.
  24275. * @returns {Array} Returns the array of property names.
  24276. */
  24277. function nativeKeysIn(object) {
  24278. var result = [];
  24279. if (object != null) {
  24280. for (var key in Object(object)) {
  24281. result.push(key);
  24282. }
  24283. }
  24284. return result;
  24285. }
  24286. /**
  24287. * Converts `value` to a string using `Object.prototype.toString`.
  24288. *
  24289. * @private
  24290. * @param {*} value The value to convert.
  24291. * @returns {string} Returns the converted string.
  24292. */
  24293. function objectToString(value) {
  24294. return nativeObjectToString.call(value);
  24295. }
  24296. /**
  24297. * A specialized version of `baseRest` which transforms the rest array.
  24298. *
  24299. * @private
  24300. * @param {Function} func The function to apply a rest parameter to.
  24301. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24302. * @param {Function} transform The rest array transform.
  24303. * @returns {Function} Returns the new function.
  24304. */
  24305. function overRest(func, start, transform) {
  24306. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24307. return function() {
  24308. var args = arguments,
  24309. index = -1,
  24310. length = nativeMax(args.length - start, 0),
  24311. array = Array(length);
  24312. while (++index < length) {
  24313. array[index] = args[start + index];
  24314. }
  24315. index = -1;
  24316. var otherArgs = Array(start + 1);
  24317. while (++index < start) {
  24318. otherArgs[index] = args[index];
  24319. }
  24320. otherArgs[start] = transform(array);
  24321. return apply(func, this, otherArgs);
  24322. };
  24323. }
  24324. /**
  24325. * Gets the parent value at `path` of `object`.
  24326. *
  24327. * @private
  24328. * @param {Object} object The object to query.
  24329. * @param {Array} path The path to get the parent value of.
  24330. * @returns {*} Returns the parent value.
  24331. */
  24332. function parent(object, path) {
  24333. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24334. }
  24335. /**
  24336. * Reorder `array` according to the specified indexes where the element at
  24337. * the first index is assigned as the first element, the element at
  24338. * the second index is assigned as the second element, and so on.
  24339. *
  24340. * @private
  24341. * @param {Array} array The array to reorder.
  24342. * @param {Array} indexes The arranged array indexes.
  24343. * @returns {Array} Returns `array`.
  24344. */
  24345. function reorder(array, indexes) {
  24346. var arrLength = array.length,
  24347. length = nativeMin(indexes.length, arrLength),
  24348. oldArray = copyArray(array);
  24349. while (length--) {
  24350. var index = indexes[length];
  24351. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24352. }
  24353. return array;
  24354. }
  24355. /**
  24356. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24357. *
  24358. * @private
  24359. * @param {Object} object The object to query.
  24360. * @param {string} key The key of the property to get.
  24361. * @returns {*} Returns the property value.
  24362. */
  24363. function safeGet(object, key) {
  24364. if (key === 'constructor' && typeof object[key] === 'function') {
  24365. return;
  24366. }
  24367. if (key == '__proto__') {
  24368. return;
  24369. }
  24370. return object[key];
  24371. }
  24372. /**
  24373. * Sets metadata for `func`.
  24374. *
  24375. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24376. * period of time, it will trip its breaker and transition to an identity
  24377. * function to avoid garbage collection pauses in V8. See
  24378. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24379. * for more details.
  24380. *
  24381. * @private
  24382. * @param {Function} func The function to associate metadata with.
  24383. * @param {*} data The metadata.
  24384. * @returns {Function} Returns `func`.
  24385. */
  24386. var setData = shortOut(baseSetData);
  24387. /**
  24388. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24389. *
  24390. * @private
  24391. * @param {Function} func The function to delay.
  24392. * @param {number} wait The number of milliseconds to delay invocation.
  24393. * @returns {number|Object} Returns the timer id or timeout object.
  24394. */
  24395. var setTimeout = ctxSetTimeout || function(func, wait) {
  24396. return root.setTimeout(func, wait);
  24397. };
  24398. /**
  24399. * Sets the `toString` method of `func` to return `string`.
  24400. *
  24401. * @private
  24402. * @param {Function} func The function to modify.
  24403. * @param {Function} string The `toString` result.
  24404. * @returns {Function} Returns `func`.
  24405. */
  24406. var setToString = shortOut(baseSetToString);
  24407. /**
  24408. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24409. * with wrapper details in a comment at the top of the source body.
  24410. *
  24411. * @private
  24412. * @param {Function} wrapper The function to modify.
  24413. * @param {Function} reference The reference function.
  24414. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24415. * @returns {Function} Returns `wrapper`.
  24416. */
  24417. function setWrapToString(wrapper, reference, bitmask) {
  24418. var source = (reference + '');
  24419. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24420. }
  24421. /**
  24422. * Creates a function that'll short out and invoke `identity` instead
  24423. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24424. * milliseconds.
  24425. *
  24426. * @private
  24427. * @param {Function} func The function to restrict.
  24428. * @returns {Function} Returns the new shortable function.
  24429. */
  24430. function shortOut(func) {
  24431. var count = 0,
  24432. lastCalled = 0;
  24433. return function() {
  24434. var stamp = nativeNow(),
  24435. remaining = HOT_SPAN - (stamp - lastCalled);
  24436. lastCalled = stamp;
  24437. if (remaining > 0) {
  24438. if (++count >= HOT_COUNT) {
  24439. return arguments[0];
  24440. }
  24441. } else {
  24442. count = 0;
  24443. }
  24444. return func.apply(undefined, arguments);
  24445. };
  24446. }
  24447. /**
  24448. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24449. *
  24450. * @private
  24451. * @param {Array} array The array to shuffle.
  24452. * @param {number} [size=array.length] The size of `array`.
  24453. * @returns {Array} Returns `array`.
  24454. */
  24455. function shuffleSelf(array, size) {
  24456. var index = -1,
  24457. length = array.length,
  24458. lastIndex = length - 1;
  24459. size = size === undefined ? length : size;
  24460. while (++index < size) {
  24461. var rand = baseRandom(index, lastIndex),
  24462. value = array[rand];
  24463. array[rand] = array[index];
  24464. array[index] = value;
  24465. }
  24466. array.length = size;
  24467. return array;
  24468. }
  24469. /**
  24470. * Converts `string` to a property path array.
  24471. *
  24472. * @private
  24473. * @param {string} string The string to convert.
  24474. * @returns {Array} Returns the property path array.
  24475. */
  24476. var stringToPath = memoizeCapped(function(string) {
  24477. var result = [];
  24478. if (string.charCodeAt(0) === 46 /* . */) {
  24479. result.push('');
  24480. }
  24481. string.replace(rePropName, function(match, number, quote, subString) {
  24482. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24483. });
  24484. return result;
  24485. });
  24486. /**
  24487. * Converts `value` to a string key if it's not a string or symbol.
  24488. *
  24489. * @private
  24490. * @param {*} value The value to inspect.
  24491. * @returns {string|symbol} Returns the key.
  24492. */
  24493. function toKey(value) {
  24494. if (typeof value == 'string' || isSymbol(value)) {
  24495. return value;
  24496. }
  24497. var result = (value + '');
  24498. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24499. }
  24500. /**
  24501. * Converts `func` to its source code.
  24502. *
  24503. * @private
  24504. * @param {Function} func The function to convert.
  24505. * @returns {string} Returns the source code.
  24506. */
  24507. function toSource(func) {
  24508. if (func != null) {
  24509. try {
  24510. return funcToString.call(func);
  24511. } catch (e) {}
  24512. try {
  24513. return (func + '');
  24514. } catch (e) {}
  24515. }
  24516. return '';
  24517. }
  24518. /**
  24519. * Updates wrapper `details` based on `bitmask` flags.
  24520. *
  24521. * @private
  24522. * @returns {Array} details The details to modify.
  24523. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24524. * @returns {Array} Returns `details`.
  24525. */
  24526. function updateWrapDetails(details, bitmask) {
  24527. arrayEach(wrapFlags, function(pair) {
  24528. var value = '_.' + pair[0];
  24529. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24530. details.push(value);
  24531. }
  24532. });
  24533. return details.sort();
  24534. }
  24535. /**
  24536. * Creates a clone of `wrapper`.
  24537. *
  24538. * @private
  24539. * @param {Object} wrapper The wrapper to clone.
  24540. * @returns {Object} Returns the cloned wrapper.
  24541. */
  24542. function wrapperClone(wrapper) {
  24543. if (wrapper instanceof LazyWrapper) {
  24544. return wrapper.clone();
  24545. }
  24546. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24547. result.__actions__ = copyArray(wrapper.__actions__);
  24548. result.__index__ = wrapper.__index__;
  24549. result.__values__ = wrapper.__values__;
  24550. return result;
  24551. }
  24552. /*------------------------------------------------------------------------*/
  24553. /**
  24554. * Creates an array of elements split into groups the length of `size`.
  24555. * If `array` can't be split evenly, the final chunk will be the remaining
  24556. * elements.
  24557. *
  24558. * @static
  24559. * @memberOf _
  24560. * @since 3.0.0
  24561. * @category Array
  24562. * @param {Array} array The array to process.
  24563. * @param {number} [size=1] The length of each chunk
  24564. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24565. * @returns {Array} Returns the new array of chunks.
  24566. * @example
  24567. *
  24568. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24569. * // => [['a', 'b'], ['c', 'd']]
  24570. *
  24571. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24572. * // => [['a', 'b', 'c'], ['d']]
  24573. */
  24574. function chunk(array, size, guard) {
  24575. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24576. size = 1;
  24577. } else {
  24578. size = nativeMax(toInteger(size), 0);
  24579. }
  24580. var length = array == null ? 0 : array.length;
  24581. if (!length || size < 1) {
  24582. return [];
  24583. }
  24584. var index = 0,
  24585. resIndex = 0,
  24586. result = Array(nativeCeil(length / size));
  24587. while (index < length) {
  24588. result[resIndex++] = baseSlice(array, index, (index += size));
  24589. }
  24590. return result;
  24591. }
  24592. /**
  24593. * Creates an array with all falsey values removed. The values `false`, `null`,
  24594. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24595. *
  24596. * @static
  24597. * @memberOf _
  24598. * @since 0.1.0
  24599. * @category Array
  24600. * @param {Array} array The array to compact.
  24601. * @returns {Array} Returns the new array of filtered values.
  24602. * @example
  24603. *
  24604. * _.compact([0, 1, false, 2, '', 3]);
  24605. * // => [1, 2, 3]
  24606. */
  24607. function compact(array) {
  24608. var index = -1,
  24609. length = array == null ? 0 : array.length,
  24610. resIndex = 0,
  24611. result = [];
  24612. while (++index < length) {
  24613. var value = array[index];
  24614. if (value) {
  24615. result[resIndex++] = value;
  24616. }
  24617. }
  24618. return result;
  24619. }
  24620. /**
  24621. * Creates a new array concatenating `array` with any additional arrays
  24622. * and/or values.
  24623. *
  24624. * @static
  24625. * @memberOf _
  24626. * @since 4.0.0
  24627. * @category Array
  24628. * @param {Array} array The array to concatenate.
  24629. * @param {...*} [values] The values to concatenate.
  24630. * @returns {Array} Returns the new concatenated array.
  24631. * @example
  24632. *
  24633. * var array = [1];
  24634. * var other = _.concat(array, 2, [3], [[4]]);
  24635. *
  24636. * console.log(other);
  24637. * // => [1, 2, 3, [4]]
  24638. *
  24639. * console.log(array);
  24640. * // => [1]
  24641. */
  24642. function concat() {
  24643. var length = arguments.length;
  24644. if (!length) {
  24645. return [];
  24646. }
  24647. var args = Array(length - 1),
  24648. array = arguments[0],
  24649. index = length;
  24650. while (index--) {
  24651. args[index - 1] = arguments[index];
  24652. }
  24653. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24654. }
  24655. /**
  24656. * Creates an array of `array` values not included in the other given arrays
  24657. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24658. * for equality comparisons. The order and references of result values are
  24659. * determined by the first array.
  24660. *
  24661. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24662. *
  24663. * @static
  24664. * @memberOf _
  24665. * @since 0.1.0
  24666. * @category Array
  24667. * @param {Array} array The array to inspect.
  24668. * @param {...Array} [values] The values to exclude.
  24669. * @returns {Array} Returns the new array of filtered values.
  24670. * @see _.without, _.xor
  24671. * @example
  24672. *
  24673. * _.difference([2, 1], [2, 3]);
  24674. * // => [1]
  24675. */
  24676. var difference = baseRest(function(array, values) {
  24677. return isArrayLikeObject(array)
  24678. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24679. : [];
  24680. });
  24681. /**
  24682. * This method is like `_.difference` except that it accepts `iteratee` which
  24683. * is invoked for each element of `array` and `values` to generate the criterion
  24684. * by which they're compared. The order and references of result values are
  24685. * determined by the first array. The iteratee is invoked with one argument:
  24686. * (value).
  24687. *
  24688. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24689. *
  24690. * @static
  24691. * @memberOf _
  24692. * @since 4.0.0
  24693. * @category Array
  24694. * @param {Array} array The array to inspect.
  24695. * @param {...Array} [values] The values to exclude.
  24696. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24697. * @returns {Array} Returns the new array of filtered values.
  24698. * @example
  24699. *
  24700. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24701. * // => [1.2]
  24702. *
  24703. * // The `_.property` iteratee shorthand.
  24704. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24705. * // => [{ 'x': 2 }]
  24706. */
  24707. var differenceBy = baseRest(function(array, values) {
  24708. var iteratee = last(values);
  24709. if (isArrayLikeObject(iteratee)) {
  24710. iteratee = undefined;
  24711. }
  24712. return isArrayLikeObject(array)
  24713. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24714. : [];
  24715. });
  24716. /**
  24717. * This method is like `_.difference` except that it accepts `comparator`
  24718. * which is invoked to compare elements of `array` to `values`. The order and
  24719. * references of result values are determined by the first array. The comparator
  24720. * is invoked with two arguments: (arrVal, othVal).
  24721. *
  24722. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24723. *
  24724. * @static
  24725. * @memberOf _
  24726. * @since 4.0.0
  24727. * @category Array
  24728. * @param {Array} array The array to inspect.
  24729. * @param {...Array} [values] The values to exclude.
  24730. * @param {Function} [comparator] The comparator invoked per element.
  24731. * @returns {Array} Returns the new array of filtered values.
  24732. * @example
  24733. *
  24734. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24735. *
  24736. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24737. * // => [{ 'x': 2, 'y': 1 }]
  24738. */
  24739. var differenceWith = baseRest(function(array, values) {
  24740. var comparator = last(values);
  24741. if (isArrayLikeObject(comparator)) {
  24742. comparator = undefined;
  24743. }
  24744. return isArrayLikeObject(array)
  24745. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24746. : [];
  24747. });
  24748. /**
  24749. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24750. *
  24751. * @static
  24752. * @memberOf _
  24753. * @since 0.5.0
  24754. * @category Array
  24755. * @param {Array} array The array to query.
  24756. * @param {number} [n=1] The number of elements to drop.
  24757. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24758. * @returns {Array} Returns the slice of `array`.
  24759. * @example
  24760. *
  24761. * _.drop([1, 2, 3]);
  24762. * // => [2, 3]
  24763. *
  24764. * _.drop([1, 2, 3], 2);
  24765. * // => [3]
  24766. *
  24767. * _.drop([1, 2, 3], 5);
  24768. * // => []
  24769. *
  24770. * _.drop([1, 2, 3], 0);
  24771. * // => [1, 2, 3]
  24772. */
  24773. function drop(array, n, guard) {
  24774. var length = array == null ? 0 : array.length;
  24775. if (!length) {
  24776. return [];
  24777. }
  24778. n = (guard || n === undefined) ? 1 : toInteger(n);
  24779. return baseSlice(array, n < 0 ? 0 : n, length);
  24780. }
  24781. /**
  24782. * Creates a slice of `array` with `n` elements dropped from the end.
  24783. *
  24784. * @static
  24785. * @memberOf _
  24786. * @since 3.0.0
  24787. * @category Array
  24788. * @param {Array} array The array to query.
  24789. * @param {number} [n=1] The number of elements to drop.
  24790. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24791. * @returns {Array} Returns the slice of `array`.
  24792. * @example
  24793. *
  24794. * _.dropRight([1, 2, 3]);
  24795. * // => [1, 2]
  24796. *
  24797. * _.dropRight([1, 2, 3], 2);
  24798. * // => [1]
  24799. *
  24800. * _.dropRight([1, 2, 3], 5);
  24801. * // => []
  24802. *
  24803. * _.dropRight([1, 2, 3], 0);
  24804. * // => [1, 2, 3]
  24805. */
  24806. function dropRight(array, n, guard) {
  24807. var length = array == null ? 0 : array.length;
  24808. if (!length) {
  24809. return [];
  24810. }
  24811. n = (guard || n === undefined) ? 1 : toInteger(n);
  24812. n = length - n;
  24813. return baseSlice(array, 0, n < 0 ? 0 : n);
  24814. }
  24815. /**
  24816. * Creates a slice of `array` excluding elements dropped from the end.
  24817. * Elements are dropped until `predicate` returns falsey. The predicate is
  24818. * invoked with three arguments: (value, index, array).
  24819. *
  24820. * @static
  24821. * @memberOf _
  24822. * @since 3.0.0
  24823. * @category Array
  24824. * @param {Array} array The array to query.
  24825. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24826. * @returns {Array} Returns the slice of `array`.
  24827. * @example
  24828. *
  24829. * var users = [
  24830. * { 'user': 'barney', 'active': true },
  24831. * { 'user': 'fred', 'active': false },
  24832. * { 'user': 'pebbles', 'active': false }
  24833. * ];
  24834. *
  24835. * _.dropRightWhile(users, function(o) { return !o.active; });
  24836. * // => objects for ['barney']
  24837. *
  24838. * // The `_.matches` iteratee shorthand.
  24839. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24840. * // => objects for ['barney', 'fred']
  24841. *
  24842. * // The `_.matchesProperty` iteratee shorthand.
  24843. * _.dropRightWhile(users, ['active', false]);
  24844. * // => objects for ['barney']
  24845. *
  24846. * // The `_.property` iteratee shorthand.
  24847. * _.dropRightWhile(users, 'active');
  24848. * // => objects for ['barney', 'fred', 'pebbles']
  24849. */
  24850. function dropRightWhile(array, predicate) {
  24851. return (array && array.length)
  24852. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24853. : [];
  24854. }
  24855. /**
  24856. * Creates a slice of `array` excluding elements dropped from the beginning.
  24857. * Elements are dropped until `predicate` returns falsey. The predicate is
  24858. * invoked with three arguments: (value, index, array).
  24859. *
  24860. * @static
  24861. * @memberOf _
  24862. * @since 3.0.0
  24863. * @category Array
  24864. * @param {Array} array The array to query.
  24865. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24866. * @returns {Array} Returns the slice of `array`.
  24867. * @example
  24868. *
  24869. * var users = [
  24870. * { 'user': 'barney', 'active': false },
  24871. * { 'user': 'fred', 'active': false },
  24872. * { 'user': 'pebbles', 'active': true }
  24873. * ];
  24874. *
  24875. * _.dropWhile(users, function(o) { return !o.active; });
  24876. * // => objects for ['pebbles']
  24877. *
  24878. * // The `_.matches` iteratee shorthand.
  24879. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24880. * // => objects for ['fred', 'pebbles']
  24881. *
  24882. * // The `_.matchesProperty` iteratee shorthand.
  24883. * _.dropWhile(users, ['active', false]);
  24884. * // => objects for ['pebbles']
  24885. *
  24886. * // The `_.property` iteratee shorthand.
  24887. * _.dropWhile(users, 'active');
  24888. * // => objects for ['barney', 'fred', 'pebbles']
  24889. */
  24890. function dropWhile(array, predicate) {
  24891. return (array && array.length)
  24892. ? baseWhile(array, getIteratee(predicate, 3), true)
  24893. : [];
  24894. }
  24895. /**
  24896. * Fills elements of `array` with `value` from `start` up to, but not
  24897. * including, `end`.
  24898. *
  24899. * **Note:** This method mutates `array`.
  24900. *
  24901. * @static
  24902. * @memberOf _
  24903. * @since 3.2.0
  24904. * @category Array
  24905. * @param {Array} array The array to fill.
  24906. * @param {*} value The value to fill `array` with.
  24907. * @param {number} [start=0] The start position.
  24908. * @param {number} [end=array.length] The end position.
  24909. * @returns {Array} Returns `array`.
  24910. * @example
  24911. *
  24912. * var array = [1, 2, 3];
  24913. *
  24914. * _.fill(array, 'a');
  24915. * console.log(array);
  24916. * // => ['a', 'a', 'a']
  24917. *
  24918. * _.fill(Array(3), 2);
  24919. * // => [2, 2, 2]
  24920. *
  24921. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24922. * // => [4, '*', '*', 10]
  24923. */
  24924. function fill(array, value, start, end) {
  24925. var length = array == null ? 0 : array.length;
  24926. if (!length) {
  24927. return [];
  24928. }
  24929. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24930. start = 0;
  24931. end = length;
  24932. }
  24933. return baseFill(array, value, start, end);
  24934. }
  24935. /**
  24936. * This method is like `_.find` except that it returns the index of the first
  24937. * element `predicate` returns truthy for instead of the element itself.
  24938. *
  24939. * @static
  24940. * @memberOf _
  24941. * @since 1.1.0
  24942. * @category Array
  24943. * @param {Array} array The array to inspect.
  24944. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24945. * @param {number} [fromIndex=0] The index to search from.
  24946. * @returns {number} Returns the index of the found element, else `-1`.
  24947. * @example
  24948. *
  24949. * var users = [
  24950. * { 'user': 'barney', 'active': false },
  24951. * { 'user': 'fred', 'active': false },
  24952. * { 'user': 'pebbles', 'active': true }
  24953. * ];
  24954. *
  24955. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24956. * // => 0
  24957. *
  24958. * // The `_.matches` iteratee shorthand.
  24959. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24960. * // => 1
  24961. *
  24962. * // The `_.matchesProperty` iteratee shorthand.
  24963. * _.findIndex(users, ['active', false]);
  24964. * // => 0
  24965. *
  24966. * // The `_.property` iteratee shorthand.
  24967. * _.findIndex(users, 'active');
  24968. * // => 2
  24969. */
  24970. function findIndex(array, predicate, fromIndex) {
  24971. var length = array == null ? 0 : array.length;
  24972. if (!length) {
  24973. return -1;
  24974. }
  24975. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24976. if (index < 0) {
  24977. index = nativeMax(length + index, 0);
  24978. }
  24979. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24980. }
  24981. /**
  24982. * This method is like `_.findIndex` except that it iterates over elements
  24983. * of `collection` from right to left.
  24984. *
  24985. * @static
  24986. * @memberOf _
  24987. * @since 2.0.0
  24988. * @category Array
  24989. * @param {Array} array The array to inspect.
  24990. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24991. * @param {number} [fromIndex=array.length-1] The index to search from.
  24992. * @returns {number} Returns the index of the found element, else `-1`.
  24993. * @example
  24994. *
  24995. * var users = [
  24996. * { 'user': 'barney', 'active': true },
  24997. * { 'user': 'fred', 'active': false },
  24998. * { 'user': 'pebbles', 'active': false }
  24999. * ];
  25000. *
  25001. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25002. * // => 2
  25003. *
  25004. * // The `_.matches` iteratee shorthand.
  25005. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25006. * // => 0
  25007. *
  25008. * // The `_.matchesProperty` iteratee shorthand.
  25009. * _.findLastIndex(users, ['active', false]);
  25010. * // => 2
  25011. *
  25012. * // The `_.property` iteratee shorthand.
  25013. * _.findLastIndex(users, 'active');
  25014. * // => 0
  25015. */
  25016. function findLastIndex(array, predicate, fromIndex) {
  25017. var length = array == null ? 0 : array.length;
  25018. if (!length) {
  25019. return -1;
  25020. }
  25021. var index = length - 1;
  25022. if (fromIndex !== undefined) {
  25023. index = toInteger(fromIndex);
  25024. index = fromIndex < 0
  25025. ? nativeMax(length + index, 0)
  25026. : nativeMin(index, length - 1);
  25027. }
  25028. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25029. }
  25030. /**
  25031. * Flattens `array` a single level deep.
  25032. *
  25033. * @static
  25034. * @memberOf _
  25035. * @since 0.1.0
  25036. * @category Array
  25037. * @param {Array} array The array to flatten.
  25038. * @returns {Array} Returns the new flattened array.
  25039. * @example
  25040. *
  25041. * _.flatten([1, [2, [3, [4]], 5]]);
  25042. * // => [1, 2, [3, [4]], 5]
  25043. */
  25044. function flatten(array) {
  25045. var length = array == null ? 0 : array.length;
  25046. return length ? baseFlatten(array, 1) : [];
  25047. }
  25048. /**
  25049. * Recursively flattens `array`.
  25050. *
  25051. * @static
  25052. * @memberOf _
  25053. * @since 3.0.0
  25054. * @category Array
  25055. * @param {Array} array The array to flatten.
  25056. * @returns {Array} Returns the new flattened array.
  25057. * @example
  25058. *
  25059. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25060. * // => [1, 2, 3, 4, 5]
  25061. */
  25062. function flattenDeep(array) {
  25063. var length = array == null ? 0 : array.length;
  25064. return length ? baseFlatten(array, INFINITY) : [];
  25065. }
  25066. /**
  25067. * Recursively flatten `array` up to `depth` times.
  25068. *
  25069. * @static
  25070. * @memberOf _
  25071. * @since 4.4.0
  25072. * @category Array
  25073. * @param {Array} array The array to flatten.
  25074. * @param {number} [depth=1] The maximum recursion depth.
  25075. * @returns {Array} Returns the new flattened array.
  25076. * @example
  25077. *
  25078. * var array = [1, [2, [3, [4]], 5]];
  25079. *
  25080. * _.flattenDepth(array, 1);
  25081. * // => [1, 2, [3, [4]], 5]
  25082. *
  25083. * _.flattenDepth(array, 2);
  25084. * // => [1, 2, 3, [4], 5]
  25085. */
  25086. function flattenDepth(array, depth) {
  25087. var length = array == null ? 0 : array.length;
  25088. if (!length) {
  25089. return [];
  25090. }
  25091. depth = depth === undefined ? 1 : toInteger(depth);
  25092. return baseFlatten(array, depth);
  25093. }
  25094. /**
  25095. * The inverse of `_.toPairs`; this method returns an object composed
  25096. * from key-value `pairs`.
  25097. *
  25098. * @static
  25099. * @memberOf _
  25100. * @since 4.0.0
  25101. * @category Array
  25102. * @param {Array} pairs The key-value pairs.
  25103. * @returns {Object} Returns the new object.
  25104. * @example
  25105. *
  25106. * _.fromPairs([['a', 1], ['b', 2]]);
  25107. * // => { 'a': 1, 'b': 2 }
  25108. */
  25109. function fromPairs(pairs) {
  25110. var index = -1,
  25111. length = pairs == null ? 0 : pairs.length,
  25112. result = {};
  25113. while (++index < length) {
  25114. var pair = pairs[index];
  25115. result[pair[0]] = pair[1];
  25116. }
  25117. return result;
  25118. }
  25119. /**
  25120. * Gets the first element of `array`.
  25121. *
  25122. * @static
  25123. * @memberOf _
  25124. * @since 0.1.0
  25125. * @alias first
  25126. * @category Array
  25127. * @param {Array} array The array to query.
  25128. * @returns {*} Returns the first element of `array`.
  25129. * @example
  25130. *
  25131. * _.head([1, 2, 3]);
  25132. * // => 1
  25133. *
  25134. * _.head([]);
  25135. * // => undefined
  25136. */
  25137. function head(array) {
  25138. return (array && array.length) ? array[0] : undefined;
  25139. }
  25140. /**
  25141. * Gets the index at which the first occurrence of `value` is found in `array`
  25142. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25143. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25144. * offset from the end of `array`.
  25145. *
  25146. * @static
  25147. * @memberOf _
  25148. * @since 0.1.0
  25149. * @category Array
  25150. * @param {Array} array The array to inspect.
  25151. * @param {*} value The value to search for.
  25152. * @param {number} [fromIndex=0] The index to search from.
  25153. * @returns {number} Returns the index of the matched value, else `-1`.
  25154. * @example
  25155. *
  25156. * _.indexOf([1, 2, 1, 2], 2);
  25157. * // => 1
  25158. *
  25159. * // Search from the `fromIndex`.
  25160. * _.indexOf([1, 2, 1, 2], 2, 2);
  25161. * // => 3
  25162. */
  25163. function indexOf(array, value, fromIndex) {
  25164. var length = array == null ? 0 : array.length;
  25165. if (!length) {
  25166. return -1;
  25167. }
  25168. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25169. if (index < 0) {
  25170. index = nativeMax(length + index, 0);
  25171. }
  25172. return baseIndexOf(array, value, index);
  25173. }
  25174. /**
  25175. * Gets all but the last element of `array`.
  25176. *
  25177. * @static
  25178. * @memberOf _
  25179. * @since 0.1.0
  25180. * @category Array
  25181. * @param {Array} array The array to query.
  25182. * @returns {Array} Returns the slice of `array`.
  25183. * @example
  25184. *
  25185. * _.initial([1, 2, 3]);
  25186. * // => [1, 2]
  25187. */
  25188. function initial(array) {
  25189. var length = array == null ? 0 : array.length;
  25190. return length ? baseSlice(array, 0, -1) : [];
  25191. }
  25192. /**
  25193. * Creates an array of unique values that are included in all given arrays
  25194. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25195. * for equality comparisons. The order and references of result values are
  25196. * determined by the first array.
  25197. *
  25198. * @static
  25199. * @memberOf _
  25200. * @since 0.1.0
  25201. * @category Array
  25202. * @param {...Array} [arrays] The arrays to inspect.
  25203. * @returns {Array} Returns the new array of intersecting values.
  25204. * @example
  25205. *
  25206. * _.intersection([2, 1], [2, 3]);
  25207. * // => [2]
  25208. */
  25209. var intersection = baseRest(function(arrays) {
  25210. var mapped = arrayMap(arrays, castArrayLikeObject);
  25211. return (mapped.length && mapped[0] === arrays[0])
  25212. ? baseIntersection(mapped)
  25213. : [];
  25214. });
  25215. /**
  25216. * This method is like `_.intersection` except that it accepts `iteratee`
  25217. * which is invoked for each element of each `arrays` to generate the criterion
  25218. * by which they're compared. The order and references of result values are
  25219. * determined by the first array. The iteratee is invoked with one argument:
  25220. * (value).
  25221. *
  25222. * @static
  25223. * @memberOf _
  25224. * @since 4.0.0
  25225. * @category Array
  25226. * @param {...Array} [arrays] The arrays to inspect.
  25227. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25228. * @returns {Array} Returns the new array of intersecting values.
  25229. * @example
  25230. *
  25231. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25232. * // => [2.1]
  25233. *
  25234. * // The `_.property` iteratee shorthand.
  25235. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25236. * // => [{ 'x': 1 }]
  25237. */
  25238. var intersectionBy = baseRest(function(arrays) {
  25239. var iteratee = last(arrays),
  25240. mapped = arrayMap(arrays, castArrayLikeObject);
  25241. if (iteratee === last(mapped)) {
  25242. iteratee = undefined;
  25243. } else {
  25244. mapped.pop();
  25245. }
  25246. return (mapped.length && mapped[0] === arrays[0])
  25247. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25248. : [];
  25249. });
  25250. /**
  25251. * This method is like `_.intersection` except that it accepts `comparator`
  25252. * which is invoked to compare elements of `arrays`. The order and references
  25253. * of result values are determined by the first array. The comparator is
  25254. * invoked with two arguments: (arrVal, othVal).
  25255. *
  25256. * @static
  25257. * @memberOf _
  25258. * @since 4.0.0
  25259. * @category Array
  25260. * @param {...Array} [arrays] The arrays to inspect.
  25261. * @param {Function} [comparator] The comparator invoked per element.
  25262. * @returns {Array} Returns the new array of intersecting values.
  25263. * @example
  25264. *
  25265. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25266. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25267. *
  25268. * _.intersectionWith(objects, others, _.isEqual);
  25269. * // => [{ 'x': 1, 'y': 2 }]
  25270. */
  25271. var intersectionWith = baseRest(function(arrays) {
  25272. var comparator = last(arrays),
  25273. mapped = arrayMap(arrays, castArrayLikeObject);
  25274. comparator = typeof comparator == 'function' ? comparator : undefined;
  25275. if (comparator) {
  25276. mapped.pop();
  25277. }
  25278. return (mapped.length && mapped[0] === arrays[0])
  25279. ? baseIntersection(mapped, undefined, comparator)
  25280. : [];
  25281. });
  25282. /**
  25283. * Converts all elements in `array` into a string separated by `separator`.
  25284. *
  25285. * @static
  25286. * @memberOf _
  25287. * @since 4.0.0
  25288. * @category Array
  25289. * @param {Array} array The array to convert.
  25290. * @param {string} [separator=','] The element separator.
  25291. * @returns {string} Returns the joined string.
  25292. * @example
  25293. *
  25294. * _.join(['a', 'b', 'c'], '~');
  25295. * // => 'a~b~c'
  25296. */
  25297. function join(array, separator) {
  25298. return array == null ? '' : nativeJoin.call(array, separator);
  25299. }
  25300. /**
  25301. * Gets the last element of `array`.
  25302. *
  25303. * @static
  25304. * @memberOf _
  25305. * @since 0.1.0
  25306. * @category Array
  25307. * @param {Array} array The array to query.
  25308. * @returns {*} Returns the last element of `array`.
  25309. * @example
  25310. *
  25311. * _.last([1, 2, 3]);
  25312. * // => 3
  25313. */
  25314. function last(array) {
  25315. var length = array == null ? 0 : array.length;
  25316. return length ? array[length - 1] : undefined;
  25317. }
  25318. /**
  25319. * This method is like `_.indexOf` except that it iterates over elements of
  25320. * `array` from right to left.
  25321. *
  25322. * @static
  25323. * @memberOf _
  25324. * @since 0.1.0
  25325. * @category Array
  25326. * @param {Array} array The array to inspect.
  25327. * @param {*} value The value to search for.
  25328. * @param {number} [fromIndex=array.length-1] The index to search from.
  25329. * @returns {number} Returns the index of the matched value, else `-1`.
  25330. * @example
  25331. *
  25332. * _.lastIndexOf([1, 2, 1, 2], 2);
  25333. * // => 3
  25334. *
  25335. * // Search from the `fromIndex`.
  25336. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25337. * // => 1
  25338. */
  25339. function lastIndexOf(array, value, fromIndex) {
  25340. var length = array == null ? 0 : array.length;
  25341. if (!length) {
  25342. return -1;
  25343. }
  25344. var index = length;
  25345. if (fromIndex !== undefined) {
  25346. index = toInteger(fromIndex);
  25347. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25348. }
  25349. return value === value
  25350. ? strictLastIndexOf(array, value, index)
  25351. : baseFindIndex(array, baseIsNaN, index, true);
  25352. }
  25353. /**
  25354. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25355. * element from the end is returned.
  25356. *
  25357. * @static
  25358. * @memberOf _
  25359. * @since 4.11.0
  25360. * @category Array
  25361. * @param {Array} array The array to query.
  25362. * @param {number} [n=0] The index of the element to return.
  25363. * @returns {*} Returns the nth element of `array`.
  25364. * @example
  25365. *
  25366. * var array = ['a', 'b', 'c', 'd'];
  25367. *
  25368. * _.nth(array, 1);
  25369. * // => 'b'
  25370. *
  25371. * _.nth(array, -2);
  25372. * // => 'c';
  25373. */
  25374. function nth(array, n) {
  25375. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25376. }
  25377. /**
  25378. * Removes all given values from `array` using
  25379. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25380. * for equality comparisons.
  25381. *
  25382. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25383. * to remove elements from an array by predicate.
  25384. *
  25385. * @static
  25386. * @memberOf _
  25387. * @since 2.0.0
  25388. * @category Array
  25389. * @param {Array} array The array to modify.
  25390. * @param {...*} [values] The values to remove.
  25391. * @returns {Array} Returns `array`.
  25392. * @example
  25393. *
  25394. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25395. *
  25396. * _.pull(array, 'a', 'c');
  25397. * console.log(array);
  25398. * // => ['b', 'b']
  25399. */
  25400. var pull = baseRest(pullAll);
  25401. /**
  25402. * This method is like `_.pull` except that it accepts an array of values to remove.
  25403. *
  25404. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25405. *
  25406. * @static
  25407. * @memberOf _
  25408. * @since 4.0.0
  25409. * @category Array
  25410. * @param {Array} array The array to modify.
  25411. * @param {Array} values The values to remove.
  25412. * @returns {Array} Returns `array`.
  25413. * @example
  25414. *
  25415. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25416. *
  25417. * _.pullAll(array, ['a', 'c']);
  25418. * console.log(array);
  25419. * // => ['b', 'b']
  25420. */
  25421. function pullAll(array, values) {
  25422. return (array && array.length && values && values.length)
  25423. ? basePullAll(array, values)
  25424. : array;
  25425. }
  25426. /**
  25427. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25428. * invoked for each element of `array` and `values` to generate the criterion
  25429. * by which they're compared. The iteratee is invoked with one argument: (value).
  25430. *
  25431. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25432. *
  25433. * @static
  25434. * @memberOf _
  25435. * @since 4.0.0
  25436. * @category Array
  25437. * @param {Array} array The array to modify.
  25438. * @param {Array} values The values to remove.
  25439. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25440. * @returns {Array} Returns `array`.
  25441. * @example
  25442. *
  25443. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25444. *
  25445. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25446. * console.log(array);
  25447. * // => [{ 'x': 2 }]
  25448. */
  25449. function pullAllBy(array, values, iteratee) {
  25450. return (array && array.length && values && values.length)
  25451. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25452. : array;
  25453. }
  25454. /**
  25455. * This method is like `_.pullAll` except that it accepts `comparator` which
  25456. * is invoked to compare elements of `array` to `values`. The comparator is
  25457. * invoked with two arguments: (arrVal, othVal).
  25458. *
  25459. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25460. *
  25461. * @static
  25462. * @memberOf _
  25463. * @since 4.6.0
  25464. * @category Array
  25465. * @param {Array} array The array to modify.
  25466. * @param {Array} values The values to remove.
  25467. * @param {Function} [comparator] The comparator invoked per element.
  25468. * @returns {Array} Returns `array`.
  25469. * @example
  25470. *
  25471. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25472. *
  25473. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25474. * console.log(array);
  25475. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25476. */
  25477. function pullAllWith(array, values, comparator) {
  25478. return (array && array.length && values && values.length)
  25479. ? basePullAll(array, values, undefined, comparator)
  25480. : array;
  25481. }
  25482. /**
  25483. * Removes elements from `array` corresponding to `indexes` and returns an
  25484. * array of removed elements.
  25485. *
  25486. * **Note:** Unlike `_.at`, this method mutates `array`.
  25487. *
  25488. * @static
  25489. * @memberOf _
  25490. * @since 3.0.0
  25491. * @category Array
  25492. * @param {Array} array The array to modify.
  25493. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25494. * @returns {Array} Returns the new array of removed elements.
  25495. * @example
  25496. *
  25497. * var array = ['a', 'b', 'c', 'd'];
  25498. * var pulled = _.pullAt(array, [1, 3]);
  25499. *
  25500. * console.log(array);
  25501. * // => ['a', 'c']
  25502. *
  25503. * console.log(pulled);
  25504. * // => ['b', 'd']
  25505. */
  25506. var pullAt = flatRest(function(array, indexes) {
  25507. var length = array == null ? 0 : array.length,
  25508. result = baseAt(array, indexes);
  25509. basePullAt(array, arrayMap(indexes, function(index) {
  25510. return isIndex(index, length) ? +index : index;
  25511. }).sort(compareAscending));
  25512. return result;
  25513. });
  25514. /**
  25515. * Removes all elements from `array` that `predicate` returns truthy for
  25516. * and returns an array of the removed elements. The predicate is invoked
  25517. * with three arguments: (value, index, array).
  25518. *
  25519. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25520. * to pull elements from an array by value.
  25521. *
  25522. * @static
  25523. * @memberOf _
  25524. * @since 2.0.0
  25525. * @category Array
  25526. * @param {Array} array The array to modify.
  25527. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25528. * @returns {Array} Returns the new array of removed elements.
  25529. * @example
  25530. *
  25531. * var array = [1, 2, 3, 4];
  25532. * var evens = _.remove(array, function(n) {
  25533. * return n % 2 == 0;
  25534. * });
  25535. *
  25536. * console.log(array);
  25537. * // => [1, 3]
  25538. *
  25539. * console.log(evens);
  25540. * // => [2, 4]
  25541. */
  25542. function remove(array, predicate) {
  25543. var result = [];
  25544. if (!(array && array.length)) {
  25545. return result;
  25546. }
  25547. var index = -1,
  25548. indexes = [],
  25549. length = array.length;
  25550. predicate = getIteratee(predicate, 3);
  25551. while (++index < length) {
  25552. var value = array[index];
  25553. if (predicate(value, index, array)) {
  25554. result.push(value);
  25555. indexes.push(index);
  25556. }
  25557. }
  25558. basePullAt(array, indexes);
  25559. return result;
  25560. }
  25561. /**
  25562. * Reverses `array` so that the first element becomes the last, the second
  25563. * element becomes the second to last, and so on.
  25564. *
  25565. * **Note:** This method mutates `array` and is based on
  25566. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25567. *
  25568. * @static
  25569. * @memberOf _
  25570. * @since 4.0.0
  25571. * @category Array
  25572. * @param {Array} array The array to modify.
  25573. * @returns {Array} Returns `array`.
  25574. * @example
  25575. *
  25576. * var array = [1, 2, 3];
  25577. *
  25578. * _.reverse(array);
  25579. * // => [3, 2, 1]
  25580. *
  25581. * console.log(array);
  25582. * // => [3, 2, 1]
  25583. */
  25584. function reverse(array) {
  25585. return array == null ? array : nativeReverse.call(array);
  25586. }
  25587. /**
  25588. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25589. *
  25590. * **Note:** This method is used instead of
  25591. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25592. * returned.
  25593. *
  25594. * @static
  25595. * @memberOf _
  25596. * @since 3.0.0
  25597. * @category Array
  25598. * @param {Array} array The array to slice.
  25599. * @param {number} [start=0] The start position.
  25600. * @param {number} [end=array.length] The end position.
  25601. * @returns {Array} Returns the slice of `array`.
  25602. */
  25603. function slice(array, start, end) {
  25604. var length = array == null ? 0 : array.length;
  25605. if (!length) {
  25606. return [];
  25607. }
  25608. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25609. start = 0;
  25610. end = length;
  25611. }
  25612. else {
  25613. start = start == null ? 0 : toInteger(start);
  25614. end = end === undefined ? length : toInteger(end);
  25615. }
  25616. return baseSlice(array, start, end);
  25617. }
  25618. /**
  25619. * Uses a binary search to determine the lowest index at which `value`
  25620. * should be inserted into `array` in order to maintain its sort order.
  25621. *
  25622. * @static
  25623. * @memberOf _
  25624. * @since 0.1.0
  25625. * @category Array
  25626. * @param {Array} array The sorted array to inspect.
  25627. * @param {*} value The value to evaluate.
  25628. * @returns {number} Returns the index at which `value` should be inserted
  25629. * into `array`.
  25630. * @example
  25631. *
  25632. * _.sortedIndex([30, 50], 40);
  25633. * // => 1
  25634. */
  25635. function sortedIndex(array, value) {
  25636. return baseSortedIndex(array, value);
  25637. }
  25638. /**
  25639. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25640. * which is invoked for `value` and each element of `array` to compute their
  25641. * sort ranking. The iteratee is invoked with one argument: (value).
  25642. *
  25643. * @static
  25644. * @memberOf _
  25645. * @since 4.0.0
  25646. * @category Array
  25647. * @param {Array} array The sorted array to inspect.
  25648. * @param {*} value The value to evaluate.
  25649. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25650. * @returns {number} Returns the index at which `value` should be inserted
  25651. * into `array`.
  25652. * @example
  25653. *
  25654. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25655. *
  25656. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25657. * // => 0
  25658. *
  25659. * // The `_.property` iteratee shorthand.
  25660. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25661. * // => 0
  25662. */
  25663. function sortedIndexBy(array, value, iteratee) {
  25664. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25665. }
  25666. /**
  25667. * This method is like `_.indexOf` except that it performs a binary
  25668. * search on a sorted `array`.
  25669. *
  25670. * @static
  25671. * @memberOf _
  25672. * @since 4.0.0
  25673. * @category Array
  25674. * @param {Array} array The array to inspect.
  25675. * @param {*} value The value to search for.
  25676. * @returns {number} Returns the index of the matched value, else `-1`.
  25677. * @example
  25678. *
  25679. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25680. * // => 1
  25681. */
  25682. function sortedIndexOf(array, value) {
  25683. var length = array == null ? 0 : array.length;
  25684. if (length) {
  25685. var index = baseSortedIndex(array, value);
  25686. if (index < length && eq(array[index], value)) {
  25687. return index;
  25688. }
  25689. }
  25690. return -1;
  25691. }
  25692. /**
  25693. * This method is like `_.sortedIndex` except that it returns the highest
  25694. * index at which `value` should be inserted into `array` in order to
  25695. * maintain its sort order.
  25696. *
  25697. * @static
  25698. * @memberOf _
  25699. * @since 3.0.0
  25700. * @category Array
  25701. * @param {Array} array The sorted array to inspect.
  25702. * @param {*} value The value to evaluate.
  25703. * @returns {number} Returns the index at which `value` should be inserted
  25704. * into `array`.
  25705. * @example
  25706. *
  25707. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25708. * // => 4
  25709. */
  25710. function sortedLastIndex(array, value) {
  25711. return baseSortedIndex(array, value, true);
  25712. }
  25713. /**
  25714. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25715. * which is invoked for `value` and each element of `array` to compute their
  25716. * sort ranking. The iteratee is invoked with one argument: (value).
  25717. *
  25718. * @static
  25719. * @memberOf _
  25720. * @since 4.0.0
  25721. * @category Array
  25722. * @param {Array} array The sorted array to inspect.
  25723. * @param {*} value The value to evaluate.
  25724. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25725. * @returns {number} Returns the index at which `value` should be inserted
  25726. * into `array`.
  25727. * @example
  25728. *
  25729. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25730. *
  25731. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25732. * // => 1
  25733. *
  25734. * // The `_.property` iteratee shorthand.
  25735. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25736. * // => 1
  25737. */
  25738. function sortedLastIndexBy(array, value, iteratee) {
  25739. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25740. }
  25741. /**
  25742. * This method is like `_.lastIndexOf` except that it performs a binary
  25743. * search on a sorted `array`.
  25744. *
  25745. * @static
  25746. * @memberOf _
  25747. * @since 4.0.0
  25748. * @category Array
  25749. * @param {Array} array The array to inspect.
  25750. * @param {*} value The value to search for.
  25751. * @returns {number} Returns the index of the matched value, else `-1`.
  25752. * @example
  25753. *
  25754. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25755. * // => 3
  25756. */
  25757. function sortedLastIndexOf(array, value) {
  25758. var length = array == null ? 0 : array.length;
  25759. if (length) {
  25760. var index = baseSortedIndex(array, value, true) - 1;
  25761. if (eq(array[index], value)) {
  25762. return index;
  25763. }
  25764. }
  25765. return -1;
  25766. }
  25767. /**
  25768. * This method is like `_.uniq` except that it's designed and optimized
  25769. * for sorted arrays.
  25770. *
  25771. * @static
  25772. * @memberOf _
  25773. * @since 4.0.0
  25774. * @category Array
  25775. * @param {Array} array The array to inspect.
  25776. * @returns {Array} Returns the new duplicate free array.
  25777. * @example
  25778. *
  25779. * _.sortedUniq([1, 1, 2]);
  25780. * // => [1, 2]
  25781. */
  25782. function sortedUniq(array) {
  25783. return (array && array.length)
  25784. ? baseSortedUniq(array)
  25785. : [];
  25786. }
  25787. /**
  25788. * This method is like `_.uniqBy` except that it's designed and optimized
  25789. * for sorted arrays.
  25790. *
  25791. * @static
  25792. * @memberOf _
  25793. * @since 4.0.0
  25794. * @category Array
  25795. * @param {Array} array The array to inspect.
  25796. * @param {Function} [iteratee] The iteratee invoked per element.
  25797. * @returns {Array} Returns the new duplicate free array.
  25798. * @example
  25799. *
  25800. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25801. * // => [1.1, 2.3]
  25802. */
  25803. function sortedUniqBy(array, iteratee) {
  25804. return (array && array.length)
  25805. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25806. : [];
  25807. }
  25808. /**
  25809. * Gets all but the first element of `array`.
  25810. *
  25811. * @static
  25812. * @memberOf _
  25813. * @since 4.0.0
  25814. * @category Array
  25815. * @param {Array} array The array to query.
  25816. * @returns {Array} Returns the slice of `array`.
  25817. * @example
  25818. *
  25819. * _.tail([1, 2, 3]);
  25820. * // => [2, 3]
  25821. */
  25822. function tail(array) {
  25823. var length = array == null ? 0 : array.length;
  25824. return length ? baseSlice(array, 1, length) : [];
  25825. }
  25826. /**
  25827. * Creates a slice of `array` with `n` elements taken from the beginning.
  25828. *
  25829. * @static
  25830. * @memberOf _
  25831. * @since 0.1.0
  25832. * @category Array
  25833. * @param {Array} array The array to query.
  25834. * @param {number} [n=1] The number of elements to take.
  25835. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25836. * @returns {Array} Returns the slice of `array`.
  25837. * @example
  25838. *
  25839. * _.take([1, 2, 3]);
  25840. * // => [1]
  25841. *
  25842. * _.take([1, 2, 3], 2);
  25843. * // => [1, 2]
  25844. *
  25845. * _.take([1, 2, 3], 5);
  25846. * // => [1, 2, 3]
  25847. *
  25848. * _.take([1, 2, 3], 0);
  25849. * // => []
  25850. */
  25851. function take(array, n, guard) {
  25852. if (!(array && array.length)) {
  25853. return [];
  25854. }
  25855. n = (guard || n === undefined) ? 1 : toInteger(n);
  25856. return baseSlice(array, 0, n < 0 ? 0 : n);
  25857. }
  25858. /**
  25859. * Creates a slice of `array` with `n` elements taken from the end.
  25860. *
  25861. * @static
  25862. * @memberOf _
  25863. * @since 3.0.0
  25864. * @category Array
  25865. * @param {Array} array The array to query.
  25866. * @param {number} [n=1] The number of elements to take.
  25867. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25868. * @returns {Array} Returns the slice of `array`.
  25869. * @example
  25870. *
  25871. * _.takeRight([1, 2, 3]);
  25872. * // => [3]
  25873. *
  25874. * _.takeRight([1, 2, 3], 2);
  25875. * // => [2, 3]
  25876. *
  25877. * _.takeRight([1, 2, 3], 5);
  25878. * // => [1, 2, 3]
  25879. *
  25880. * _.takeRight([1, 2, 3], 0);
  25881. * // => []
  25882. */
  25883. function takeRight(array, n, guard) {
  25884. var length = array == null ? 0 : array.length;
  25885. if (!length) {
  25886. return [];
  25887. }
  25888. n = (guard || n === undefined) ? 1 : toInteger(n);
  25889. n = length - n;
  25890. return baseSlice(array, n < 0 ? 0 : n, length);
  25891. }
  25892. /**
  25893. * Creates a slice of `array` with elements taken from the end. Elements are
  25894. * taken until `predicate` returns falsey. The predicate is invoked with
  25895. * three arguments: (value, index, array).
  25896. *
  25897. * @static
  25898. * @memberOf _
  25899. * @since 3.0.0
  25900. * @category Array
  25901. * @param {Array} array The array to query.
  25902. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25903. * @returns {Array} Returns the slice of `array`.
  25904. * @example
  25905. *
  25906. * var users = [
  25907. * { 'user': 'barney', 'active': true },
  25908. * { 'user': 'fred', 'active': false },
  25909. * { 'user': 'pebbles', 'active': false }
  25910. * ];
  25911. *
  25912. * _.takeRightWhile(users, function(o) { return !o.active; });
  25913. * // => objects for ['fred', 'pebbles']
  25914. *
  25915. * // The `_.matches` iteratee shorthand.
  25916. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25917. * // => objects for ['pebbles']
  25918. *
  25919. * // The `_.matchesProperty` iteratee shorthand.
  25920. * _.takeRightWhile(users, ['active', false]);
  25921. * // => objects for ['fred', 'pebbles']
  25922. *
  25923. * // The `_.property` iteratee shorthand.
  25924. * _.takeRightWhile(users, 'active');
  25925. * // => []
  25926. */
  25927. function takeRightWhile(array, predicate) {
  25928. return (array && array.length)
  25929. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25930. : [];
  25931. }
  25932. /**
  25933. * Creates a slice of `array` with elements taken from the beginning. Elements
  25934. * are taken until `predicate` returns falsey. The predicate is invoked with
  25935. * three arguments: (value, index, array).
  25936. *
  25937. * @static
  25938. * @memberOf _
  25939. * @since 3.0.0
  25940. * @category Array
  25941. * @param {Array} array The array to query.
  25942. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25943. * @returns {Array} Returns the slice of `array`.
  25944. * @example
  25945. *
  25946. * var users = [
  25947. * { 'user': 'barney', 'active': false },
  25948. * { 'user': 'fred', 'active': false },
  25949. * { 'user': 'pebbles', 'active': true }
  25950. * ];
  25951. *
  25952. * _.takeWhile(users, function(o) { return !o.active; });
  25953. * // => objects for ['barney', 'fred']
  25954. *
  25955. * // The `_.matches` iteratee shorthand.
  25956. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25957. * // => objects for ['barney']
  25958. *
  25959. * // The `_.matchesProperty` iteratee shorthand.
  25960. * _.takeWhile(users, ['active', false]);
  25961. * // => objects for ['barney', 'fred']
  25962. *
  25963. * // The `_.property` iteratee shorthand.
  25964. * _.takeWhile(users, 'active');
  25965. * // => []
  25966. */
  25967. function takeWhile(array, predicate) {
  25968. return (array && array.length)
  25969. ? baseWhile(array, getIteratee(predicate, 3))
  25970. : [];
  25971. }
  25972. /**
  25973. * Creates an array of unique values, in order, from all given arrays using
  25974. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25975. * for equality comparisons.
  25976. *
  25977. * @static
  25978. * @memberOf _
  25979. * @since 0.1.0
  25980. * @category Array
  25981. * @param {...Array} [arrays] The arrays to inspect.
  25982. * @returns {Array} Returns the new array of combined values.
  25983. * @example
  25984. *
  25985. * _.union([2], [1, 2]);
  25986. * // => [2, 1]
  25987. */
  25988. var union = baseRest(function(arrays) {
  25989. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25990. });
  25991. /**
  25992. * This method is like `_.union` except that it accepts `iteratee` which is
  25993. * invoked for each element of each `arrays` to generate the criterion by
  25994. * which uniqueness is computed. Result values are chosen from the first
  25995. * array in which the value occurs. The iteratee is invoked with one argument:
  25996. * (value).
  25997. *
  25998. * @static
  25999. * @memberOf _
  26000. * @since 4.0.0
  26001. * @category Array
  26002. * @param {...Array} [arrays] The arrays to inspect.
  26003. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26004. * @returns {Array} Returns the new array of combined values.
  26005. * @example
  26006. *
  26007. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26008. * // => [2.1, 1.2]
  26009. *
  26010. * // The `_.property` iteratee shorthand.
  26011. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26012. * // => [{ 'x': 1 }, { 'x': 2 }]
  26013. */
  26014. var unionBy = baseRest(function(arrays) {
  26015. var iteratee = last(arrays);
  26016. if (isArrayLikeObject(iteratee)) {
  26017. iteratee = undefined;
  26018. }
  26019. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26020. });
  26021. /**
  26022. * This method is like `_.union` except that it accepts `comparator` which
  26023. * is invoked to compare elements of `arrays`. Result values are chosen from
  26024. * the first array in which the value occurs. The comparator is invoked
  26025. * with two arguments: (arrVal, othVal).
  26026. *
  26027. * @static
  26028. * @memberOf _
  26029. * @since 4.0.0
  26030. * @category Array
  26031. * @param {...Array} [arrays] The arrays to inspect.
  26032. * @param {Function} [comparator] The comparator invoked per element.
  26033. * @returns {Array} Returns the new array of combined values.
  26034. * @example
  26035. *
  26036. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26037. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26038. *
  26039. * _.unionWith(objects, others, _.isEqual);
  26040. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26041. */
  26042. var unionWith = baseRest(function(arrays) {
  26043. var comparator = last(arrays);
  26044. comparator = typeof comparator == 'function' ? comparator : undefined;
  26045. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26046. });
  26047. /**
  26048. * Creates a duplicate-free version of an array, using
  26049. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26050. * for equality comparisons, in which only the first occurrence of each element
  26051. * is kept. The order of result values is determined by the order they occur
  26052. * in the array.
  26053. *
  26054. * @static
  26055. * @memberOf _
  26056. * @since 0.1.0
  26057. * @category Array
  26058. * @param {Array} array The array to inspect.
  26059. * @returns {Array} Returns the new duplicate free array.
  26060. * @example
  26061. *
  26062. * _.uniq([2, 1, 2]);
  26063. * // => [2, 1]
  26064. */
  26065. function uniq(array) {
  26066. return (array && array.length) ? baseUniq(array) : [];
  26067. }
  26068. /**
  26069. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26070. * invoked for each element in `array` to generate the criterion by which
  26071. * uniqueness is computed. The order of result values is determined by the
  26072. * order they occur in the array. The iteratee is invoked with one argument:
  26073. * (value).
  26074. *
  26075. * @static
  26076. * @memberOf _
  26077. * @since 4.0.0
  26078. * @category Array
  26079. * @param {Array} array The array to inspect.
  26080. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26081. * @returns {Array} Returns the new duplicate free array.
  26082. * @example
  26083. *
  26084. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26085. * // => [2.1, 1.2]
  26086. *
  26087. * // The `_.property` iteratee shorthand.
  26088. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26089. * // => [{ 'x': 1 }, { 'x': 2 }]
  26090. */
  26091. function uniqBy(array, iteratee) {
  26092. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26093. }
  26094. /**
  26095. * This method is like `_.uniq` except that it accepts `comparator` which
  26096. * is invoked to compare elements of `array`. The order of result values is
  26097. * determined by the order they occur in the array.The comparator is invoked
  26098. * with two arguments: (arrVal, othVal).
  26099. *
  26100. * @static
  26101. * @memberOf _
  26102. * @since 4.0.0
  26103. * @category Array
  26104. * @param {Array} array The array to inspect.
  26105. * @param {Function} [comparator] The comparator invoked per element.
  26106. * @returns {Array} Returns the new duplicate free array.
  26107. * @example
  26108. *
  26109. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26110. *
  26111. * _.uniqWith(objects, _.isEqual);
  26112. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26113. */
  26114. function uniqWith(array, comparator) {
  26115. comparator = typeof comparator == 'function' ? comparator : undefined;
  26116. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26117. }
  26118. /**
  26119. * This method is like `_.zip` except that it accepts an array of grouped
  26120. * elements and creates an array regrouping the elements to their pre-zip
  26121. * configuration.
  26122. *
  26123. * @static
  26124. * @memberOf _
  26125. * @since 1.2.0
  26126. * @category Array
  26127. * @param {Array} array The array of grouped elements to process.
  26128. * @returns {Array} Returns the new array of regrouped elements.
  26129. * @example
  26130. *
  26131. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26132. * // => [['a', 1, true], ['b', 2, false]]
  26133. *
  26134. * _.unzip(zipped);
  26135. * // => [['a', 'b'], [1, 2], [true, false]]
  26136. */
  26137. function unzip(array) {
  26138. if (!(array && array.length)) {
  26139. return [];
  26140. }
  26141. var length = 0;
  26142. array = arrayFilter(array, function(group) {
  26143. if (isArrayLikeObject(group)) {
  26144. length = nativeMax(group.length, length);
  26145. return true;
  26146. }
  26147. });
  26148. return baseTimes(length, function(index) {
  26149. return arrayMap(array, baseProperty(index));
  26150. });
  26151. }
  26152. /**
  26153. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26154. * how regrouped values should be combined. The iteratee is invoked with the
  26155. * elements of each group: (...group).
  26156. *
  26157. * @static
  26158. * @memberOf _
  26159. * @since 3.8.0
  26160. * @category Array
  26161. * @param {Array} array The array of grouped elements to process.
  26162. * @param {Function} [iteratee=_.identity] The function to combine
  26163. * regrouped values.
  26164. * @returns {Array} Returns the new array of regrouped elements.
  26165. * @example
  26166. *
  26167. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26168. * // => [[1, 10, 100], [2, 20, 200]]
  26169. *
  26170. * _.unzipWith(zipped, _.add);
  26171. * // => [3, 30, 300]
  26172. */
  26173. function unzipWith(array, iteratee) {
  26174. if (!(array && array.length)) {
  26175. return [];
  26176. }
  26177. var result = unzip(array);
  26178. if (iteratee == null) {
  26179. return result;
  26180. }
  26181. return arrayMap(result, function(group) {
  26182. return apply(iteratee, undefined, group);
  26183. });
  26184. }
  26185. /**
  26186. * Creates an array excluding all given values using
  26187. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26188. * for equality comparisons.
  26189. *
  26190. * **Note:** Unlike `_.pull`, this method returns a new array.
  26191. *
  26192. * @static
  26193. * @memberOf _
  26194. * @since 0.1.0
  26195. * @category Array
  26196. * @param {Array} array The array to inspect.
  26197. * @param {...*} [values] The values to exclude.
  26198. * @returns {Array} Returns the new array of filtered values.
  26199. * @see _.difference, _.xor
  26200. * @example
  26201. *
  26202. * _.without([2, 1, 2, 3], 1, 2);
  26203. * // => [3]
  26204. */
  26205. var without = baseRest(function(array, values) {
  26206. return isArrayLikeObject(array)
  26207. ? baseDifference(array, values)
  26208. : [];
  26209. });
  26210. /**
  26211. * Creates an array of unique values that is the
  26212. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26213. * of the given arrays. The order of result values is determined by the order
  26214. * they occur in the arrays.
  26215. *
  26216. * @static
  26217. * @memberOf _
  26218. * @since 2.4.0
  26219. * @category Array
  26220. * @param {...Array} [arrays] The arrays to inspect.
  26221. * @returns {Array} Returns the new array of filtered values.
  26222. * @see _.difference, _.without
  26223. * @example
  26224. *
  26225. * _.xor([2, 1], [2, 3]);
  26226. * // => [1, 3]
  26227. */
  26228. var xor = baseRest(function(arrays) {
  26229. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26230. });
  26231. /**
  26232. * This method is like `_.xor` except that it accepts `iteratee` which is
  26233. * invoked for each element of each `arrays` to generate the criterion by
  26234. * which by which they're compared. The order of result values is determined
  26235. * by the order they occur in the arrays. The iteratee is invoked with one
  26236. * argument: (value).
  26237. *
  26238. * @static
  26239. * @memberOf _
  26240. * @since 4.0.0
  26241. * @category Array
  26242. * @param {...Array} [arrays] The arrays to inspect.
  26243. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26244. * @returns {Array} Returns the new array of filtered values.
  26245. * @example
  26246. *
  26247. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26248. * // => [1.2, 3.4]
  26249. *
  26250. * // The `_.property` iteratee shorthand.
  26251. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26252. * // => [{ 'x': 2 }]
  26253. */
  26254. var xorBy = baseRest(function(arrays) {
  26255. var iteratee = last(arrays);
  26256. if (isArrayLikeObject(iteratee)) {
  26257. iteratee = undefined;
  26258. }
  26259. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26260. });
  26261. /**
  26262. * This method is like `_.xor` except that it accepts `comparator` which is
  26263. * invoked to compare elements of `arrays`. The order of result values is
  26264. * determined by the order they occur in the arrays. The comparator is invoked
  26265. * with two arguments: (arrVal, othVal).
  26266. *
  26267. * @static
  26268. * @memberOf _
  26269. * @since 4.0.0
  26270. * @category Array
  26271. * @param {...Array} [arrays] The arrays to inspect.
  26272. * @param {Function} [comparator] The comparator invoked per element.
  26273. * @returns {Array} Returns the new array of filtered values.
  26274. * @example
  26275. *
  26276. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26277. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26278. *
  26279. * _.xorWith(objects, others, _.isEqual);
  26280. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26281. */
  26282. var xorWith = baseRest(function(arrays) {
  26283. var comparator = last(arrays);
  26284. comparator = typeof comparator == 'function' ? comparator : undefined;
  26285. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26286. });
  26287. /**
  26288. * Creates an array of grouped elements, the first of which contains the
  26289. * first elements of the given arrays, the second of which contains the
  26290. * second elements of the given arrays, and so on.
  26291. *
  26292. * @static
  26293. * @memberOf _
  26294. * @since 0.1.0
  26295. * @category Array
  26296. * @param {...Array} [arrays] The arrays to process.
  26297. * @returns {Array} Returns the new array of grouped elements.
  26298. * @example
  26299. *
  26300. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26301. * // => [['a', 1, true], ['b', 2, false]]
  26302. */
  26303. var zip = baseRest(unzip);
  26304. /**
  26305. * This method is like `_.fromPairs` except that it accepts two arrays,
  26306. * one of property identifiers and one of corresponding values.
  26307. *
  26308. * @static
  26309. * @memberOf _
  26310. * @since 0.4.0
  26311. * @category Array
  26312. * @param {Array} [props=[]] The property identifiers.
  26313. * @param {Array} [values=[]] The property values.
  26314. * @returns {Object} Returns the new object.
  26315. * @example
  26316. *
  26317. * _.zipObject(['a', 'b'], [1, 2]);
  26318. * // => { 'a': 1, 'b': 2 }
  26319. */
  26320. function zipObject(props, values) {
  26321. return baseZipObject(props || [], values || [], assignValue);
  26322. }
  26323. /**
  26324. * This method is like `_.zipObject` except that it supports property paths.
  26325. *
  26326. * @static
  26327. * @memberOf _
  26328. * @since 4.1.0
  26329. * @category Array
  26330. * @param {Array} [props=[]] The property identifiers.
  26331. * @param {Array} [values=[]] The property values.
  26332. * @returns {Object} Returns the new object.
  26333. * @example
  26334. *
  26335. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26336. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26337. */
  26338. function zipObjectDeep(props, values) {
  26339. return baseZipObject(props || [], values || [], baseSet);
  26340. }
  26341. /**
  26342. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26343. * how grouped values should be combined. The iteratee is invoked with the
  26344. * elements of each group: (...group).
  26345. *
  26346. * @static
  26347. * @memberOf _
  26348. * @since 3.8.0
  26349. * @category Array
  26350. * @param {...Array} [arrays] The arrays to process.
  26351. * @param {Function} [iteratee=_.identity] The function to combine
  26352. * grouped values.
  26353. * @returns {Array} Returns the new array of grouped elements.
  26354. * @example
  26355. *
  26356. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26357. * return a + b + c;
  26358. * });
  26359. * // => [111, 222]
  26360. */
  26361. var zipWith = baseRest(function(arrays) {
  26362. var length = arrays.length,
  26363. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26364. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26365. return unzipWith(arrays, iteratee);
  26366. });
  26367. /*------------------------------------------------------------------------*/
  26368. /**
  26369. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26370. * chain sequences enabled. The result of such sequences must be unwrapped
  26371. * with `_#value`.
  26372. *
  26373. * @static
  26374. * @memberOf _
  26375. * @since 1.3.0
  26376. * @category Seq
  26377. * @param {*} value The value to wrap.
  26378. * @returns {Object} Returns the new `lodash` wrapper instance.
  26379. * @example
  26380. *
  26381. * var users = [
  26382. * { 'user': 'barney', 'age': 36 },
  26383. * { 'user': 'fred', 'age': 40 },
  26384. * { 'user': 'pebbles', 'age': 1 }
  26385. * ];
  26386. *
  26387. * var youngest = _
  26388. * .chain(users)
  26389. * .sortBy('age')
  26390. * .map(function(o) {
  26391. * return o.user + ' is ' + o.age;
  26392. * })
  26393. * .head()
  26394. * .value();
  26395. * // => 'pebbles is 1'
  26396. */
  26397. function chain(value) {
  26398. var result = lodash(value);
  26399. result.__chain__ = true;
  26400. return result;
  26401. }
  26402. /**
  26403. * This method invokes `interceptor` and returns `value`. The interceptor
  26404. * is invoked with one argument; (value). The purpose of this method is to
  26405. * "tap into" a method chain sequence in order to modify intermediate results.
  26406. *
  26407. * @static
  26408. * @memberOf _
  26409. * @since 0.1.0
  26410. * @category Seq
  26411. * @param {*} value The value to provide to `interceptor`.
  26412. * @param {Function} interceptor The function to invoke.
  26413. * @returns {*} Returns `value`.
  26414. * @example
  26415. *
  26416. * _([1, 2, 3])
  26417. * .tap(function(array) {
  26418. * // Mutate input array.
  26419. * array.pop();
  26420. * })
  26421. * .reverse()
  26422. * .value();
  26423. * // => [2, 1]
  26424. */
  26425. function tap(value, interceptor) {
  26426. interceptor(value);
  26427. return value;
  26428. }
  26429. /**
  26430. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26431. * The purpose of this method is to "pass thru" values replacing intermediate
  26432. * results in a method chain sequence.
  26433. *
  26434. * @static
  26435. * @memberOf _
  26436. * @since 3.0.0
  26437. * @category Seq
  26438. * @param {*} value The value to provide to `interceptor`.
  26439. * @param {Function} interceptor The function to invoke.
  26440. * @returns {*} Returns the result of `interceptor`.
  26441. * @example
  26442. *
  26443. * _(' abc ')
  26444. * .chain()
  26445. * .trim()
  26446. * .thru(function(value) {
  26447. * return [value];
  26448. * })
  26449. * .value();
  26450. * // => ['abc']
  26451. */
  26452. function thru(value, interceptor) {
  26453. return interceptor(value);
  26454. }
  26455. /**
  26456. * This method is the wrapper version of `_.at`.
  26457. *
  26458. * @name at
  26459. * @memberOf _
  26460. * @since 1.0.0
  26461. * @category Seq
  26462. * @param {...(string|string[])} [paths] The property paths to pick.
  26463. * @returns {Object} Returns the new `lodash` wrapper instance.
  26464. * @example
  26465. *
  26466. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26467. *
  26468. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26469. * // => [3, 4]
  26470. */
  26471. var wrapperAt = flatRest(function(paths) {
  26472. var length = paths.length,
  26473. start = length ? paths[0] : 0,
  26474. value = this.__wrapped__,
  26475. interceptor = function(object) { return baseAt(object, paths); };
  26476. if (length > 1 || this.__actions__.length ||
  26477. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26478. return this.thru(interceptor);
  26479. }
  26480. value = value.slice(start, +start + (length ? 1 : 0));
  26481. value.__actions__.push({
  26482. 'func': thru,
  26483. 'args': [interceptor],
  26484. 'thisArg': undefined
  26485. });
  26486. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26487. if (length && !array.length) {
  26488. array.push(undefined);
  26489. }
  26490. return array;
  26491. });
  26492. });
  26493. /**
  26494. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26495. *
  26496. * @name chain
  26497. * @memberOf _
  26498. * @since 0.1.0
  26499. * @category Seq
  26500. * @returns {Object} Returns the new `lodash` wrapper instance.
  26501. * @example
  26502. *
  26503. * var users = [
  26504. * { 'user': 'barney', 'age': 36 },
  26505. * { 'user': 'fred', 'age': 40 }
  26506. * ];
  26507. *
  26508. * // A sequence without explicit chaining.
  26509. * _(users).head();
  26510. * // => { 'user': 'barney', 'age': 36 }
  26511. *
  26512. * // A sequence with explicit chaining.
  26513. * _(users)
  26514. * .chain()
  26515. * .head()
  26516. * .pick('user')
  26517. * .value();
  26518. * // => { 'user': 'barney' }
  26519. */
  26520. function wrapperChain() {
  26521. return chain(this);
  26522. }
  26523. /**
  26524. * Executes the chain sequence and returns the wrapped result.
  26525. *
  26526. * @name commit
  26527. * @memberOf _
  26528. * @since 3.2.0
  26529. * @category Seq
  26530. * @returns {Object} Returns the new `lodash` wrapper instance.
  26531. * @example
  26532. *
  26533. * var array = [1, 2];
  26534. * var wrapped = _(array).push(3);
  26535. *
  26536. * console.log(array);
  26537. * // => [1, 2]
  26538. *
  26539. * wrapped = wrapped.commit();
  26540. * console.log(array);
  26541. * // => [1, 2, 3]
  26542. *
  26543. * wrapped.last();
  26544. * // => 3
  26545. *
  26546. * console.log(array);
  26547. * // => [1, 2, 3]
  26548. */
  26549. function wrapperCommit() {
  26550. return new LodashWrapper(this.value(), this.__chain__);
  26551. }
  26552. /**
  26553. * Gets the next value on a wrapped object following the
  26554. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26555. *
  26556. * @name next
  26557. * @memberOf _
  26558. * @since 4.0.0
  26559. * @category Seq
  26560. * @returns {Object} Returns the next iterator value.
  26561. * @example
  26562. *
  26563. * var wrapped = _([1, 2]);
  26564. *
  26565. * wrapped.next();
  26566. * // => { 'done': false, 'value': 1 }
  26567. *
  26568. * wrapped.next();
  26569. * // => { 'done': false, 'value': 2 }
  26570. *
  26571. * wrapped.next();
  26572. * // => { 'done': true, 'value': undefined }
  26573. */
  26574. function wrapperNext() {
  26575. if (this.__values__ === undefined) {
  26576. this.__values__ = toArray(this.value());
  26577. }
  26578. var done = this.__index__ >= this.__values__.length,
  26579. value = done ? undefined : this.__values__[this.__index__++];
  26580. return { 'done': done, 'value': value };
  26581. }
  26582. /**
  26583. * Enables the wrapper to be iterable.
  26584. *
  26585. * @name Symbol.iterator
  26586. * @memberOf _
  26587. * @since 4.0.0
  26588. * @category Seq
  26589. * @returns {Object} Returns the wrapper object.
  26590. * @example
  26591. *
  26592. * var wrapped = _([1, 2]);
  26593. *
  26594. * wrapped[Symbol.iterator]() === wrapped;
  26595. * // => true
  26596. *
  26597. * Array.from(wrapped);
  26598. * // => [1, 2]
  26599. */
  26600. function wrapperToIterator() {
  26601. return this;
  26602. }
  26603. /**
  26604. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26605. *
  26606. * @name plant
  26607. * @memberOf _
  26608. * @since 3.2.0
  26609. * @category Seq
  26610. * @param {*} value The value to plant.
  26611. * @returns {Object} Returns the new `lodash` wrapper instance.
  26612. * @example
  26613. *
  26614. * function square(n) {
  26615. * return n * n;
  26616. * }
  26617. *
  26618. * var wrapped = _([1, 2]).map(square);
  26619. * var other = wrapped.plant([3, 4]);
  26620. *
  26621. * other.value();
  26622. * // => [9, 16]
  26623. *
  26624. * wrapped.value();
  26625. * // => [1, 4]
  26626. */
  26627. function wrapperPlant(value) {
  26628. var result,
  26629. parent = this;
  26630. while (parent instanceof baseLodash) {
  26631. var clone = wrapperClone(parent);
  26632. clone.__index__ = 0;
  26633. clone.__values__ = undefined;
  26634. if (result) {
  26635. previous.__wrapped__ = clone;
  26636. } else {
  26637. result = clone;
  26638. }
  26639. var previous = clone;
  26640. parent = parent.__wrapped__;
  26641. }
  26642. previous.__wrapped__ = value;
  26643. return result;
  26644. }
  26645. /**
  26646. * This method is the wrapper version of `_.reverse`.
  26647. *
  26648. * **Note:** This method mutates the wrapped array.
  26649. *
  26650. * @name reverse
  26651. * @memberOf _
  26652. * @since 0.1.0
  26653. * @category Seq
  26654. * @returns {Object} Returns the new `lodash` wrapper instance.
  26655. * @example
  26656. *
  26657. * var array = [1, 2, 3];
  26658. *
  26659. * _(array).reverse().value()
  26660. * // => [3, 2, 1]
  26661. *
  26662. * console.log(array);
  26663. * // => [3, 2, 1]
  26664. */
  26665. function wrapperReverse() {
  26666. var value = this.__wrapped__;
  26667. if (value instanceof LazyWrapper) {
  26668. var wrapped = value;
  26669. if (this.__actions__.length) {
  26670. wrapped = new LazyWrapper(this);
  26671. }
  26672. wrapped = wrapped.reverse();
  26673. wrapped.__actions__.push({
  26674. 'func': thru,
  26675. 'args': [reverse],
  26676. 'thisArg': undefined
  26677. });
  26678. return new LodashWrapper(wrapped, this.__chain__);
  26679. }
  26680. return this.thru(reverse);
  26681. }
  26682. /**
  26683. * Executes the chain sequence to resolve the unwrapped value.
  26684. *
  26685. * @name value
  26686. * @memberOf _
  26687. * @since 0.1.0
  26688. * @alias toJSON, valueOf
  26689. * @category Seq
  26690. * @returns {*} Returns the resolved unwrapped value.
  26691. * @example
  26692. *
  26693. * _([1, 2, 3]).value();
  26694. * // => [1, 2, 3]
  26695. */
  26696. function wrapperValue() {
  26697. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26698. }
  26699. /*------------------------------------------------------------------------*/
  26700. /**
  26701. * Creates an object composed of keys generated from the results of running
  26702. * each element of `collection` thru `iteratee`. The corresponding value of
  26703. * each key is the number of times the key was returned by `iteratee`. The
  26704. * iteratee is invoked with one argument: (value).
  26705. *
  26706. * @static
  26707. * @memberOf _
  26708. * @since 0.5.0
  26709. * @category Collection
  26710. * @param {Array|Object} collection The collection to iterate over.
  26711. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26712. * @returns {Object} Returns the composed aggregate object.
  26713. * @example
  26714. *
  26715. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26716. * // => { '4': 1, '6': 2 }
  26717. *
  26718. * // The `_.property` iteratee shorthand.
  26719. * _.countBy(['one', 'two', 'three'], 'length');
  26720. * // => { '3': 2, '5': 1 }
  26721. */
  26722. var countBy = createAggregator(function(result, value, key) {
  26723. if (hasOwnProperty.call(result, key)) {
  26724. ++result[key];
  26725. } else {
  26726. baseAssignValue(result, key, 1);
  26727. }
  26728. });
  26729. /**
  26730. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26731. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26732. * invoked with three arguments: (value, index|key, collection).
  26733. *
  26734. * **Note:** This method returns `true` for
  26735. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26736. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26737. * elements of empty collections.
  26738. *
  26739. * @static
  26740. * @memberOf _
  26741. * @since 0.1.0
  26742. * @category Collection
  26743. * @param {Array|Object} collection The collection to iterate over.
  26744. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26745. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26746. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26747. * else `false`.
  26748. * @example
  26749. *
  26750. * _.every([true, 1, null, 'yes'], Boolean);
  26751. * // => false
  26752. *
  26753. * var users = [
  26754. * { 'user': 'barney', 'age': 36, 'active': false },
  26755. * { 'user': 'fred', 'age': 40, 'active': false }
  26756. * ];
  26757. *
  26758. * // The `_.matches` iteratee shorthand.
  26759. * _.every(users, { 'user': 'barney', 'active': false });
  26760. * // => false
  26761. *
  26762. * // The `_.matchesProperty` iteratee shorthand.
  26763. * _.every(users, ['active', false]);
  26764. * // => true
  26765. *
  26766. * // The `_.property` iteratee shorthand.
  26767. * _.every(users, 'active');
  26768. * // => false
  26769. */
  26770. function every(collection, predicate, guard) {
  26771. var func = isArray(collection) ? arrayEvery : baseEvery;
  26772. if (guard && isIterateeCall(collection, predicate, guard)) {
  26773. predicate = undefined;
  26774. }
  26775. return func(collection, getIteratee(predicate, 3));
  26776. }
  26777. /**
  26778. * Iterates over elements of `collection`, returning an array of all elements
  26779. * `predicate` returns truthy for. The predicate is invoked with three
  26780. * arguments: (value, index|key, collection).
  26781. *
  26782. * **Note:** Unlike `_.remove`, this method returns a new array.
  26783. *
  26784. * @static
  26785. * @memberOf _
  26786. * @since 0.1.0
  26787. * @category Collection
  26788. * @param {Array|Object} collection The collection to iterate over.
  26789. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26790. * @returns {Array} Returns the new filtered array.
  26791. * @see _.reject
  26792. * @example
  26793. *
  26794. * var users = [
  26795. * { 'user': 'barney', 'age': 36, 'active': true },
  26796. * { 'user': 'fred', 'age': 40, 'active': false }
  26797. * ];
  26798. *
  26799. * _.filter(users, function(o) { return !o.active; });
  26800. * // => objects for ['fred']
  26801. *
  26802. * // The `_.matches` iteratee shorthand.
  26803. * _.filter(users, { 'age': 36, 'active': true });
  26804. * // => objects for ['barney']
  26805. *
  26806. * // The `_.matchesProperty` iteratee shorthand.
  26807. * _.filter(users, ['active', false]);
  26808. * // => objects for ['fred']
  26809. *
  26810. * // The `_.property` iteratee shorthand.
  26811. * _.filter(users, 'active');
  26812. * // => objects for ['barney']
  26813. */
  26814. function filter(collection, predicate) {
  26815. var func = isArray(collection) ? arrayFilter : baseFilter;
  26816. return func(collection, getIteratee(predicate, 3));
  26817. }
  26818. /**
  26819. * Iterates over elements of `collection`, returning the first element
  26820. * `predicate` returns truthy for. The predicate is invoked with three
  26821. * arguments: (value, index|key, collection).
  26822. *
  26823. * @static
  26824. * @memberOf _
  26825. * @since 0.1.0
  26826. * @category Collection
  26827. * @param {Array|Object} collection The collection to inspect.
  26828. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26829. * @param {number} [fromIndex=0] The index to search from.
  26830. * @returns {*} Returns the matched element, else `undefined`.
  26831. * @example
  26832. *
  26833. * var users = [
  26834. * { 'user': 'barney', 'age': 36, 'active': true },
  26835. * { 'user': 'fred', 'age': 40, 'active': false },
  26836. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26837. * ];
  26838. *
  26839. * _.find(users, function(o) { return o.age < 40; });
  26840. * // => object for 'barney'
  26841. *
  26842. * // The `_.matches` iteratee shorthand.
  26843. * _.find(users, { 'age': 1, 'active': true });
  26844. * // => object for 'pebbles'
  26845. *
  26846. * // The `_.matchesProperty` iteratee shorthand.
  26847. * _.find(users, ['active', false]);
  26848. * // => object for 'fred'
  26849. *
  26850. * // The `_.property` iteratee shorthand.
  26851. * _.find(users, 'active');
  26852. * // => object for 'barney'
  26853. */
  26854. var find = createFind(findIndex);
  26855. /**
  26856. * This method is like `_.find` except that it iterates over elements of
  26857. * `collection` from right to left.
  26858. *
  26859. * @static
  26860. * @memberOf _
  26861. * @since 2.0.0
  26862. * @category Collection
  26863. * @param {Array|Object} collection The collection to inspect.
  26864. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26865. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26866. * @returns {*} Returns the matched element, else `undefined`.
  26867. * @example
  26868. *
  26869. * _.findLast([1, 2, 3, 4], function(n) {
  26870. * return n % 2 == 1;
  26871. * });
  26872. * // => 3
  26873. */
  26874. var findLast = createFind(findLastIndex);
  26875. /**
  26876. * Creates a flattened array of values by running each element in `collection`
  26877. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26878. * with three arguments: (value, index|key, collection).
  26879. *
  26880. * @static
  26881. * @memberOf _
  26882. * @since 4.0.0
  26883. * @category Collection
  26884. * @param {Array|Object} collection The collection to iterate over.
  26885. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26886. * @returns {Array} Returns the new flattened array.
  26887. * @example
  26888. *
  26889. * function duplicate(n) {
  26890. * return [n, n];
  26891. * }
  26892. *
  26893. * _.flatMap([1, 2], duplicate);
  26894. * // => [1, 1, 2, 2]
  26895. */
  26896. function flatMap(collection, iteratee) {
  26897. return baseFlatten(map(collection, iteratee), 1);
  26898. }
  26899. /**
  26900. * This method is like `_.flatMap` except that it recursively flattens the
  26901. * mapped results.
  26902. *
  26903. * @static
  26904. * @memberOf _
  26905. * @since 4.7.0
  26906. * @category Collection
  26907. * @param {Array|Object} collection The collection to iterate over.
  26908. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26909. * @returns {Array} Returns the new flattened array.
  26910. * @example
  26911. *
  26912. * function duplicate(n) {
  26913. * return [[[n, n]]];
  26914. * }
  26915. *
  26916. * _.flatMapDeep([1, 2], duplicate);
  26917. * // => [1, 1, 2, 2]
  26918. */
  26919. function flatMapDeep(collection, iteratee) {
  26920. return baseFlatten(map(collection, iteratee), INFINITY);
  26921. }
  26922. /**
  26923. * This method is like `_.flatMap` except that it recursively flattens the
  26924. * mapped results up to `depth` times.
  26925. *
  26926. * @static
  26927. * @memberOf _
  26928. * @since 4.7.0
  26929. * @category Collection
  26930. * @param {Array|Object} collection The collection to iterate over.
  26931. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26932. * @param {number} [depth=1] The maximum recursion depth.
  26933. * @returns {Array} Returns the new flattened array.
  26934. * @example
  26935. *
  26936. * function duplicate(n) {
  26937. * return [[[n, n]]];
  26938. * }
  26939. *
  26940. * _.flatMapDepth([1, 2], duplicate, 2);
  26941. * // => [[1, 1], [2, 2]]
  26942. */
  26943. function flatMapDepth(collection, iteratee, depth) {
  26944. depth = depth === undefined ? 1 : toInteger(depth);
  26945. return baseFlatten(map(collection, iteratee), depth);
  26946. }
  26947. /**
  26948. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26949. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26950. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26951. *
  26952. * **Note:** As with other "Collections" methods, objects with a "length"
  26953. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26954. * or `_.forOwn` for object iteration.
  26955. *
  26956. * @static
  26957. * @memberOf _
  26958. * @since 0.1.0
  26959. * @alias each
  26960. * @category Collection
  26961. * @param {Array|Object} collection The collection to iterate over.
  26962. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26963. * @returns {Array|Object} Returns `collection`.
  26964. * @see _.forEachRight
  26965. * @example
  26966. *
  26967. * _.forEach([1, 2], function(value) {
  26968. * console.log(value);
  26969. * });
  26970. * // => Logs `1` then `2`.
  26971. *
  26972. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26973. * console.log(key);
  26974. * });
  26975. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26976. */
  26977. function forEach(collection, iteratee) {
  26978. var func = isArray(collection) ? arrayEach : baseEach;
  26979. return func(collection, getIteratee(iteratee, 3));
  26980. }
  26981. /**
  26982. * This method is like `_.forEach` except that it iterates over elements of
  26983. * `collection` from right to left.
  26984. *
  26985. * @static
  26986. * @memberOf _
  26987. * @since 2.0.0
  26988. * @alias eachRight
  26989. * @category Collection
  26990. * @param {Array|Object} collection The collection to iterate over.
  26991. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26992. * @returns {Array|Object} Returns `collection`.
  26993. * @see _.forEach
  26994. * @example
  26995. *
  26996. * _.forEachRight([1, 2], function(value) {
  26997. * console.log(value);
  26998. * });
  26999. * // => Logs `2` then `1`.
  27000. */
  27001. function forEachRight(collection, iteratee) {
  27002. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27003. return func(collection, getIteratee(iteratee, 3));
  27004. }
  27005. /**
  27006. * Creates an object composed of keys generated from the results of running
  27007. * each element of `collection` thru `iteratee`. The order of grouped values
  27008. * is determined by the order they occur in `collection`. The corresponding
  27009. * value of each key is an array of elements responsible for generating the
  27010. * key. The iteratee is invoked with one argument: (value).
  27011. *
  27012. * @static
  27013. * @memberOf _
  27014. * @since 0.1.0
  27015. * @category Collection
  27016. * @param {Array|Object} collection The collection to iterate over.
  27017. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27018. * @returns {Object} Returns the composed aggregate object.
  27019. * @example
  27020. *
  27021. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27022. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27023. *
  27024. * // The `_.property` iteratee shorthand.
  27025. * _.groupBy(['one', 'two', 'three'], 'length');
  27026. * // => { '3': ['one', 'two'], '5': ['three'] }
  27027. */
  27028. var groupBy = createAggregator(function(result, value, key) {
  27029. if (hasOwnProperty.call(result, key)) {
  27030. result[key].push(value);
  27031. } else {
  27032. baseAssignValue(result, key, [value]);
  27033. }
  27034. });
  27035. /**
  27036. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27037. * checked for a substring of `value`, otherwise
  27038. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27039. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27040. * the offset from the end of `collection`.
  27041. *
  27042. * @static
  27043. * @memberOf _
  27044. * @since 0.1.0
  27045. * @category Collection
  27046. * @param {Array|Object|string} collection The collection to inspect.
  27047. * @param {*} value The value to search for.
  27048. * @param {number} [fromIndex=0] The index to search from.
  27049. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27050. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27051. * @example
  27052. *
  27053. * _.includes([1, 2, 3], 1);
  27054. * // => true
  27055. *
  27056. * _.includes([1, 2, 3], 1, 2);
  27057. * // => false
  27058. *
  27059. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27060. * // => true
  27061. *
  27062. * _.includes('abcd', 'bc');
  27063. * // => true
  27064. */
  27065. function includes(collection, value, fromIndex, guard) {
  27066. collection = isArrayLike(collection) ? collection : values(collection);
  27067. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27068. var length = collection.length;
  27069. if (fromIndex < 0) {
  27070. fromIndex = nativeMax(length + fromIndex, 0);
  27071. }
  27072. return isString(collection)
  27073. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27074. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27075. }
  27076. /**
  27077. * Invokes the method at `path` of each element in `collection`, returning
  27078. * an array of the results of each invoked method. Any additional arguments
  27079. * are provided to each invoked method. If `path` is a function, it's invoked
  27080. * for, and `this` bound to, each element in `collection`.
  27081. *
  27082. * @static
  27083. * @memberOf _
  27084. * @since 4.0.0
  27085. * @category Collection
  27086. * @param {Array|Object} collection The collection to iterate over.
  27087. * @param {Array|Function|string} path The path of the method to invoke or
  27088. * the function invoked per iteration.
  27089. * @param {...*} [args] The arguments to invoke each method with.
  27090. * @returns {Array} Returns the array of results.
  27091. * @example
  27092. *
  27093. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27094. * // => [[1, 5, 7], [1, 2, 3]]
  27095. *
  27096. * _.invokeMap([123, 456], String.prototype.split, '');
  27097. * // => [['1', '2', '3'], ['4', '5', '6']]
  27098. */
  27099. var invokeMap = baseRest(function(collection, path, args) {
  27100. var index = -1,
  27101. isFunc = typeof path == 'function',
  27102. result = isArrayLike(collection) ? Array(collection.length) : [];
  27103. baseEach(collection, function(value) {
  27104. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27105. });
  27106. return result;
  27107. });
  27108. /**
  27109. * Creates an object composed of keys generated from the results of running
  27110. * each element of `collection` thru `iteratee`. The corresponding value of
  27111. * each key is the last element responsible for generating the key. The
  27112. * iteratee is invoked with one argument: (value).
  27113. *
  27114. * @static
  27115. * @memberOf _
  27116. * @since 4.0.0
  27117. * @category Collection
  27118. * @param {Array|Object} collection The collection to iterate over.
  27119. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27120. * @returns {Object} Returns the composed aggregate object.
  27121. * @example
  27122. *
  27123. * var array = [
  27124. * { 'dir': 'left', 'code': 97 },
  27125. * { 'dir': 'right', 'code': 100 }
  27126. * ];
  27127. *
  27128. * _.keyBy(array, function(o) {
  27129. * return String.fromCharCode(o.code);
  27130. * });
  27131. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27132. *
  27133. * _.keyBy(array, 'dir');
  27134. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27135. */
  27136. var keyBy = createAggregator(function(result, value, key) {
  27137. baseAssignValue(result, key, value);
  27138. });
  27139. /**
  27140. * Creates an array of values by running each element in `collection` thru
  27141. * `iteratee`. The iteratee is invoked with three arguments:
  27142. * (value, index|key, collection).
  27143. *
  27144. * Many lodash methods are guarded to work as iteratees for methods like
  27145. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27146. *
  27147. * The guarded methods are:
  27148. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27149. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27150. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27151. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27152. *
  27153. * @static
  27154. * @memberOf _
  27155. * @since 0.1.0
  27156. * @category Collection
  27157. * @param {Array|Object} collection The collection to iterate over.
  27158. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27159. * @returns {Array} Returns the new mapped array.
  27160. * @example
  27161. *
  27162. * function square(n) {
  27163. * return n * n;
  27164. * }
  27165. *
  27166. * _.map([4, 8], square);
  27167. * // => [16, 64]
  27168. *
  27169. * _.map({ 'a': 4, 'b': 8 }, square);
  27170. * // => [16, 64] (iteration order is not guaranteed)
  27171. *
  27172. * var users = [
  27173. * { 'user': 'barney' },
  27174. * { 'user': 'fred' }
  27175. * ];
  27176. *
  27177. * // The `_.property` iteratee shorthand.
  27178. * _.map(users, 'user');
  27179. * // => ['barney', 'fred']
  27180. */
  27181. function map(collection, iteratee) {
  27182. var func = isArray(collection) ? arrayMap : baseMap;
  27183. return func(collection, getIteratee(iteratee, 3));
  27184. }
  27185. /**
  27186. * This method is like `_.sortBy` except that it allows specifying the sort
  27187. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27188. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27189. * descending or "asc" for ascending sort order of corresponding values.
  27190. *
  27191. * @static
  27192. * @memberOf _
  27193. * @since 4.0.0
  27194. * @category Collection
  27195. * @param {Array|Object} collection The collection to iterate over.
  27196. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27197. * The iteratees to sort by.
  27198. * @param {string[]} [orders] The sort orders of `iteratees`.
  27199. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27200. * @returns {Array} Returns the new sorted array.
  27201. * @example
  27202. *
  27203. * var users = [
  27204. * { 'user': 'fred', 'age': 48 },
  27205. * { 'user': 'barney', 'age': 34 },
  27206. * { 'user': 'fred', 'age': 40 },
  27207. * { 'user': 'barney', 'age': 36 }
  27208. * ];
  27209. *
  27210. * // Sort by `user` in ascending order and by `age` in descending order.
  27211. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27212. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27213. */
  27214. function orderBy(collection, iteratees, orders, guard) {
  27215. if (collection == null) {
  27216. return [];
  27217. }
  27218. if (!isArray(iteratees)) {
  27219. iteratees = iteratees == null ? [] : [iteratees];
  27220. }
  27221. orders = guard ? undefined : orders;
  27222. if (!isArray(orders)) {
  27223. orders = orders == null ? [] : [orders];
  27224. }
  27225. return baseOrderBy(collection, iteratees, orders);
  27226. }
  27227. /**
  27228. * Creates an array of elements split into two groups, the first of which
  27229. * contains elements `predicate` returns truthy for, the second of which
  27230. * contains elements `predicate` returns falsey for. The predicate is
  27231. * invoked with one argument: (value).
  27232. *
  27233. * @static
  27234. * @memberOf _
  27235. * @since 3.0.0
  27236. * @category Collection
  27237. * @param {Array|Object} collection The collection to iterate over.
  27238. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27239. * @returns {Array} Returns the array of grouped elements.
  27240. * @example
  27241. *
  27242. * var users = [
  27243. * { 'user': 'barney', 'age': 36, 'active': false },
  27244. * { 'user': 'fred', 'age': 40, 'active': true },
  27245. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27246. * ];
  27247. *
  27248. * _.partition(users, function(o) { return o.active; });
  27249. * // => objects for [['fred'], ['barney', 'pebbles']]
  27250. *
  27251. * // The `_.matches` iteratee shorthand.
  27252. * _.partition(users, { 'age': 1, 'active': false });
  27253. * // => objects for [['pebbles'], ['barney', 'fred']]
  27254. *
  27255. * // The `_.matchesProperty` iteratee shorthand.
  27256. * _.partition(users, ['active', false]);
  27257. * // => objects for [['barney', 'pebbles'], ['fred']]
  27258. *
  27259. * // The `_.property` iteratee shorthand.
  27260. * _.partition(users, 'active');
  27261. * // => objects for [['fred'], ['barney', 'pebbles']]
  27262. */
  27263. var partition = createAggregator(function(result, value, key) {
  27264. result[key ? 0 : 1].push(value);
  27265. }, function() { return [[], []]; });
  27266. /**
  27267. * Reduces `collection` to a value which is the accumulated result of running
  27268. * each element in `collection` thru `iteratee`, where each successive
  27269. * invocation is supplied the return value of the previous. If `accumulator`
  27270. * is not given, the first element of `collection` is used as the initial
  27271. * value. The iteratee is invoked with four arguments:
  27272. * (accumulator, value, index|key, collection).
  27273. *
  27274. * Many lodash methods are guarded to work as iteratees for methods like
  27275. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27276. *
  27277. * The guarded methods are:
  27278. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27279. * and `sortBy`
  27280. *
  27281. * @static
  27282. * @memberOf _
  27283. * @since 0.1.0
  27284. * @category Collection
  27285. * @param {Array|Object} collection The collection to iterate over.
  27286. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27287. * @param {*} [accumulator] The initial value.
  27288. * @returns {*} Returns the accumulated value.
  27289. * @see _.reduceRight
  27290. * @example
  27291. *
  27292. * _.reduce([1, 2], function(sum, n) {
  27293. * return sum + n;
  27294. * }, 0);
  27295. * // => 3
  27296. *
  27297. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27298. * (result[value] || (result[value] = [])).push(key);
  27299. * return result;
  27300. * }, {});
  27301. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27302. */
  27303. function reduce(collection, iteratee, accumulator) {
  27304. var func = isArray(collection) ? arrayReduce : baseReduce,
  27305. initAccum = arguments.length < 3;
  27306. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27307. }
  27308. /**
  27309. * This method is like `_.reduce` except that it iterates over elements of
  27310. * `collection` from right to left.
  27311. *
  27312. * @static
  27313. * @memberOf _
  27314. * @since 0.1.0
  27315. * @category Collection
  27316. * @param {Array|Object} collection The collection to iterate over.
  27317. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27318. * @param {*} [accumulator] The initial value.
  27319. * @returns {*} Returns the accumulated value.
  27320. * @see _.reduce
  27321. * @example
  27322. *
  27323. * var array = [[0, 1], [2, 3], [4, 5]];
  27324. *
  27325. * _.reduceRight(array, function(flattened, other) {
  27326. * return flattened.concat(other);
  27327. * }, []);
  27328. * // => [4, 5, 2, 3, 0, 1]
  27329. */
  27330. function reduceRight(collection, iteratee, accumulator) {
  27331. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27332. initAccum = arguments.length < 3;
  27333. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27334. }
  27335. /**
  27336. * The opposite of `_.filter`; this method returns the elements of `collection`
  27337. * that `predicate` does **not** return truthy for.
  27338. *
  27339. * @static
  27340. * @memberOf _
  27341. * @since 0.1.0
  27342. * @category Collection
  27343. * @param {Array|Object} collection The collection to iterate over.
  27344. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27345. * @returns {Array} Returns the new filtered array.
  27346. * @see _.filter
  27347. * @example
  27348. *
  27349. * var users = [
  27350. * { 'user': 'barney', 'age': 36, 'active': false },
  27351. * { 'user': 'fred', 'age': 40, 'active': true }
  27352. * ];
  27353. *
  27354. * _.reject(users, function(o) { return !o.active; });
  27355. * // => objects for ['fred']
  27356. *
  27357. * // The `_.matches` iteratee shorthand.
  27358. * _.reject(users, { 'age': 40, 'active': true });
  27359. * // => objects for ['barney']
  27360. *
  27361. * // The `_.matchesProperty` iteratee shorthand.
  27362. * _.reject(users, ['active', false]);
  27363. * // => objects for ['fred']
  27364. *
  27365. * // The `_.property` iteratee shorthand.
  27366. * _.reject(users, 'active');
  27367. * // => objects for ['barney']
  27368. */
  27369. function reject(collection, predicate) {
  27370. var func = isArray(collection) ? arrayFilter : baseFilter;
  27371. return func(collection, negate(getIteratee(predicate, 3)));
  27372. }
  27373. /**
  27374. * Gets a random element from `collection`.
  27375. *
  27376. * @static
  27377. * @memberOf _
  27378. * @since 2.0.0
  27379. * @category Collection
  27380. * @param {Array|Object} collection The collection to sample.
  27381. * @returns {*} Returns the random element.
  27382. * @example
  27383. *
  27384. * _.sample([1, 2, 3, 4]);
  27385. * // => 2
  27386. */
  27387. function sample(collection) {
  27388. var func = isArray(collection) ? arraySample : baseSample;
  27389. return func(collection);
  27390. }
  27391. /**
  27392. * Gets `n` random elements at unique keys from `collection` up to the
  27393. * size of `collection`.
  27394. *
  27395. * @static
  27396. * @memberOf _
  27397. * @since 4.0.0
  27398. * @category Collection
  27399. * @param {Array|Object} collection The collection to sample.
  27400. * @param {number} [n=1] The number of elements to sample.
  27401. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27402. * @returns {Array} Returns the random elements.
  27403. * @example
  27404. *
  27405. * _.sampleSize([1, 2, 3], 2);
  27406. * // => [3, 1]
  27407. *
  27408. * _.sampleSize([1, 2, 3], 4);
  27409. * // => [2, 3, 1]
  27410. */
  27411. function sampleSize(collection, n, guard) {
  27412. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27413. n = 1;
  27414. } else {
  27415. n = toInteger(n);
  27416. }
  27417. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27418. return func(collection, n);
  27419. }
  27420. /**
  27421. * Creates an array of shuffled values, using a version of the
  27422. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27423. *
  27424. * @static
  27425. * @memberOf _
  27426. * @since 0.1.0
  27427. * @category Collection
  27428. * @param {Array|Object} collection The collection to shuffle.
  27429. * @returns {Array} Returns the new shuffled array.
  27430. * @example
  27431. *
  27432. * _.shuffle([1, 2, 3, 4]);
  27433. * // => [4, 1, 3, 2]
  27434. */
  27435. function shuffle(collection) {
  27436. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27437. return func(collection);
  27438. }
  27439. /**
  27440. * Gets the size of `collection` by returning its length for array-like
  27441. * values or the number of own enumerable string keyed properties for objects.
  27442. *
  27443. * @static
  27444. * @memberOf _
  27445. * @since 0.1.0
  27446. * @category Collection
  27447. * @param {Array|Object|string} collection The collection to inspect.
  27448. * @returns {number} Returns the collection size.
  27449. * @example
  27450. *
  27451. * _.size([1, 2, 3]);
  27452. * // => 3
  27453. *
  27454. * _.size({ 'a': 1, 'b': 2 });
  27455. * // => 2
  27456. *
  27457. * _.size('pebbles');
  27458. * // => 7
  27459. */
  27460. function size(collection) {
  27461. if (collection == null) {
  27462. return 0;
  27463. }
  27464. if (isArrayLike(collection)) {
  27465. return isString(collection) ? stringSize(collection) : collection.length;
  27466. }
  27467. var tag = getTag(collection);
  27468. if (tag == mapTag || tag == setTag) {
  27469. return collection.size;
  27470. }
  27471. return baseKeys(collection).length;
  27472. }
  27473. /**
  27474. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27475. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27476. * invoked with three arguments: (value, index|key, collection).
  27477. *
  27478. * @static
  27479. * @memberOf _
  27480. * @since 0.1.0
  27481. * @category Collection
  27482. * @param {Array|Object} collection The collection to iterate over.
  27483. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27484. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27485. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27486. * else `false`.
  27487. * @example
  27488. *
  27489. * _.some([null, 0, 'yes', false], Boolean);
  27490. * // => true
  27491. *
  27492. * var users = [
  27493. * { 'user': 'barney', 'active': true },
  27494. * { 'user': 'fred', 'active': false }
  27495. * ];
  27496. *
  27497. * // The `_.matches` iteratee shorthand.
  27498. * _.some(users, { 'user': 'barney', 'active': false });
  27499. * // => false
  27500. *
  27501. * // The `_.matchesProperty` iteratee shorthand.
  27502. * _.some(users, ['active', false]);
  27503. * // => true
  27504. *
  27505. * // The `_.property` iteratee shorthand.
  27506. * _.some(users, 'active');
  27507. * // => true
  27508. */
  27509. function some(collection, predicate, guard) {
  27510. var func = isArray(collection) ? arraySome : baseSome;
  27511. if (guard && isIterateeCall(collection, predicate, guard)) {
  27512. predicate = undefined;
  27513. }
  27514. return func(collection, getIteratee(predicate, 3));
  27515. }
  27516. /**
  27517. * Creates an array of elements, sorted in ascending order by the results of
  27518. * running each element in a collection thru each iteratee. This method
  27519. * performs a stable sort, that is, it preserves the original sort order of
  27520. * equal elements. The iteratees are invoked with one argument: (value).
  27521. *
  27522. * @static
  27523. * @memberOf _
  27524. * @since 0.1.0
  27525. * @category Collection
  27526. * @param {Array|Object} collection The collection to iterate over.
  27527. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27528. * The iteratees to sort by.
  27529. * @returns {Array} Returns the new sorted array.
  27530. * @example
  27531. *
  27532. * var users = [
  27533. * { 'user': 'fred', 'age': 48 },
  27534. * { 'user': 'barney', 'age': 36 },
  27535. * { 'user': 'fred', 'age': 40 },
  27536. * { 'user': 'barney', 'age': 34 }
  27537. * ];
  27538. *
  27539. * _.sortBy(users, [function(o) { return o.user; }]);
  27540. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27541. *
  27542. * _.sortBy(users, ['user', 'age']);
  27543. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27544. */
  27545. var sortBy = baseRest(function(collection, iteratees) {
  27546. if (collection == null) {
  27547. return [];
  27548. }
  27549. var length = iteratees.length;
  27550. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27551. iteratees = [];
  27552. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27553. iteratees = [iteratees[0]];
  27554. }
  27555. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27556. });
  27557. /*------------------------------------------------------------------------*/
  27558. /**
  27559. * Gets the timestamp of the number of milliseconds that have elapsed since
  27560. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27561. *
  27562. * @static
  27563. * @memberOf _
  27564. * @since 2.4.0
  27565. * @category Date
  27566. * @returns {number} Returns the timestamp.
  27567. * @example
  27568. *
  27569. * _.defer(function(stamp) {
  27570. * console.log(_.now() - stamp);
  27571. * }, _.now());
  27572. * // => Logs the number of milliseconds it took for the deferred invocation.
  27573. */
  27574. var now = ctxNow || function() {
  27575. return root.Date.now();
  27576. };
  27577. /*------------------------------------------------------------------------*/
  27578. /**
  27579. * The opposite of `_.before`; this method creates a function that invokes
  27580. * `func` once it's called `n` or more times.
  27581. *
  27582. * @static
  27583. * @memberOf _
  27584. * @since 0.1.0
  27585. * @category Function
  27586. * @param {number} n The number of calls before `func` is invoked.
  27587. * @param {Function} func The function to restrict.
  27588. * @returns {Function} Returns the new restricted function.
  27589. * @example
  27590. *
  27591. * var saves = ['profile', 'settings'];
  27592. *
  27593. * var done = _.after(saves.length, function() {
  27594. * console.log('done saving!');
  27595. * });
  27596. *
  27597. * _.forEach(saves, function(type) {
  27598. * asyncSave({ 'type': type, 'complete': done });
  27599. * });
  27600. * // => Logs 'done saving!' after the two async saves have completed.
  27601. */
  27602. function after(n, func) {
  27603. if (typeof func != 'function') {
  27604. throw new TypeError(FUNC_ERROR_TEXT);
  27605. }
  27606. n = toInteger(n);
  27607. return function() {
  27608. if (--n < 1) {
  27609. return func.apply(this, arguments);
  27610. }
  27611. };
  27612. }
  27613. /**
  27614. * Creates a function that invokes `func`, with up to `n` arguments,
  27615. * ignoring any additional arguments.
  27616. *
  27617. * @static
  27618. * @memberOf _
  27619. * @since 3.0.0
  27620. * @category Function
  27621. * @param {Function} func The function to cap arguments for.
  27622. * @param {number} [n=func.length] The arity cap.
  27623. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27624. * @returns {Function} Returns the new capped function.
  27625. * @example
  27626. *
  27627. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27628. * // => [6, 8, 10]
  27629. */
  27630. function ary(func, n, guard) {
  27631. n = guard ? undefined : n;
  27632. n = (func && n == null) ? func.length : n;
  27633. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27634. }
  27635. /**
  27636. * Creates a function that invokes `func`, with the `this` binding and arguments
  27637. * of the created function, while it's called less than `n` times. Subsequent
  27638. * calls to the created function return the result of the last `func` invocation.
  27639. *
  27640. * @static
  27641. * @memberOf _
  27642. * @since 3.0.0
  27643. * @category Function
  27644. * @param {number} n The number of calls at which `func` is no longer invoked.
  27645. * @param {Function} func The function to restrict.
  27646. * @returns {Function} Returns the new restricted function.
  27647. * @example
  27648. *
  27649. * jQuery(element).on('click', _.before(5, addContactToList));
  27650. * // => Allows adding up to 4 contacts to the list.
  27651. */
  27652. function before(n, func) {
  27653. var result;
  27654. if (typeof func != 'function') {
  27655. throw new TypeError(FUNC_ERROR_TEXT);
  27656. }
  27657. n = toInteger(n);
  27658. return function() {
  27659. if (--n > 0) {
  27660. result = func.apply(this, arguments);
  27661. }
  27662. if (n <= 1) {
  27663. func = undefined;
  27664. }
  27665. return result;
  27666. };
  27667. }
  27668. /**
  27669. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27670. * and `partials` prepended to the arguments it receives.
  27671. *
  27672. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27673. * may be used as a placeholder for partially applied arguments.
  27674. *
  27675. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27676. * property of bound functions.
  27677. *
  27678. * @static
  27679. * @memberOf _
  27680. * @since 0.1.0
  27681. * @category Function
  27682. * @param {Function} func The function to bind.
  27683. * @param {*} thisArg The `this` binding of `func`.
  27684. * @param {...*} [partials] The arguments to be partially applied.
  27685. * @returns {Function} Returns the new bound function.
  27686. * @example
  27687. *
  27688. * function greet(greeting, punctuation) {
  27689. * return greeting + ' ' + this.user + punctuation;
  27690. * }
  27691. *
  27692. * var object = { 'user': 'fred' };
  27693. *
  27694. * var bound = _.bind(greet, object, 'hi');
  27695. * bound('!');
  27696. * // => 'hi fred!'
  27697. *
  27698. * // Bound with placeholders.
  27699. * var bound = _.bind(greet, object, _, '!');
  27700. * bound('hi');
  27701. * // => 'hi fred!'
  27702. */
  27703. var bind = baseRest(function(func, thisArg, partials) {
  27704. var bitmask = WRAP_BIND_FLAG;
  27705. if (partials.length) {
  27706. var holders = replaceHolders(partials, getHolder(bind));
  27707. bitmask |= WRAP_PARTIAL_FLAG;
  27708. }
  27709. return createWrap(func, bitmask, thisArg, partials, holders);
  27710. });
  27711. /**
  27712. * Creates a function that invokes the method at `object[key]` with `partials`
  27713. * prepended to the arguments it receives.
  27714. *
  27715. * This method differs from `_.bind` by allowing bound functions to reference
  27716. * methods that may be redefined or don't yet exist. See
  27717. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27718. * for more details.
  27719. *
  27720. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27721. * builds, may be used as a placeholder for partially applied arguments.
  27722. *
  27723. * @static
  27724. * @memberOf _
  27725. * @since 0.10.0
  27726. * @category Function
  27727. * @param {Object} object The object to invoke the method on.
  27728. * @param {string} key The key of the method.
  27729. * @param {...*} [partials] The arguments to be partially applied.
  27730. * @returns {Function} Returns the new bound function.
  27731. * @example
  27732. *
  27733. * var object = {
  27734. * 'user': 'fred',
  27735. * 'greet': function(greeting, punctuation) {
  27736. * return greeting + ' ' + this.user + punctuation;
  27737. * }
  27738. * };
  27739. *
  27740. * var bound = _.bindKey(object, 'greet', 'hi');
  27741. * bound('!');
  27742. * // => 'hi fred!'
  27743. *
  27744. * object.greet = function(greeting, punctuation) {
  27745. * return greeting + 'ya ' + this.user + punctuation;
  27746. * };
  27747. *
  27748. * bound('!');
  27749. * // => 'hiya fred!'
  27750. *
  27751. * // Bound with placeholders.
  27752. * var bound = _.bindKey(object, 'greet', _, '!');
  27753. * bound('hi');
  27754. * // => 'hiya fred!'
  27755. */
  27756. var bindKey = baseRest(function(object, key, partials) {
  27757. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27758. if (partials.length) {
  27759. var holders = replaceHolders(partials, getHolder(bindKey));
  27760. bitmask |= WRAP_PARTIAL_FLAG;
  27761. }
  27762. return createWrap(key, bitmask, object, partials, holders);
  27763. });
  27764. /**
  27765. * Creates a function that accepts arguments of `func` and either invokes
  27766. * `func` returning its result, if at least `arity` number of arguments have
  27767. * been provided, or returns a function that accepts the remaining `func`
  27768. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27769. * is not sufficient.
  27770. *
  27771. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27772. * may be used as a placeholder for provided arguments.
  27773. *
  27774. * **Note:** This method doesn't set the "length" property of curried functions.
  27775. *
  27776. * @static
  27777. * @memberOf _
  27778. * @since 2.0.0
  27779. * @category Function
  27780. * @param {Function} func The function to curry.
  27781. * @param {number} [arity=func.length] The arity of `func`.
  27782. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27783. * @returns {Function} Returns the new curried function.
  27784. * @example
  27785. *
  27786. * var abc = function(a, b, c) {
  27787. * return [a, b, c];
  27788. * };
  27789. *
  27790. * var curried = _.curry(abc);
  27791. *
  27792. * curried(1)(2)(3);
  27793. * // => [1, 2, 3]
  27794. *
  27795. * curried(1, 2)(3);
  27796. * // => [1, 2, 3]
  27797. *
  27798. * curried(1, 2, 3);
  27799. * // => [1, 2, 3]
  27800. *
  27801. * // Curried with placeholders.
  27802. * curried(1)(_, 3)(2);
  27803. * // => [1, 2, 3]
  27804. */
  27805. function curry(func, arity, guard) {
  27806. arity = guard ? undefined : arity;
  27807. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27808. result.placeholder = curry.placeholder;
  27809. return result;
  27810. }
  27811. /**
  27812. * This method is like `_.curry` except that arguments are applied to `func`
  27813. * in the manner of `_.partialRight` instead of `_.partial`.
  27814. *
  27815. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27816. * builds, may be used as a placeholder for provided arguments.
  27817. *
  27818. * **Note:** This method doesn't set the "length" property of curried functions.
  27819. *
  27820. * @static
  27821. * @memberOf _
  27822. * @since 3.0.0
  27823. * @category Function
  27824. * @param {Function} func The function to curry.
  27825. * @param {number} [arity=func.length] The arity of `func`.
  27826. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27827. * @returns {Function} Returns the new curried function.
  27828. * @example
  27829. *
  27830. * var abc = function(a, b, c) {
  27831. * return [a, b, c];
  27832. * };
  27833. *
  27834. * var curried = _.curryRight(abc);
  27835. *
  27836. * curried(3)(2)(1);
  27837. * // => [1, 2, 3]
  27838. *
  27839. * curried(2, 3)(1);
  27840. * // => [1, 2, 3]
  27841. *
  27842. * curried(1, 2, 3);
  27843. * // => [1, 2, 3]
  27844. *
  27845. * // Curried with placeholders.
  27846. * curried(3)(1, _)(2);
  27847. * // => [1, 2, 3]
  27848. */
  27849. function curryRight(func, arity, guard) {
  27850. arity = guard ? undefined : arity;
  27851. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27852. result.placeholder = curryRight.placeholder;
  27853. return result;
  27854. }
  27855. /**
  27856. * Creates a debounced function that delays invoking `func` until after `wait`
  27857. * milliseconds have elapsed since the last time the debounced function was
  27858. * invoked. The debounced function comes with a `cancel` method to cancel
  27859. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27860. * Provide `options` to indicate whether `func` should be invoked on the
  27861. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27862. * with the last arguments provided to the debounced function. Subsequent
  27863. * calls to the debounced function return the result of the last `func`
  27864. * invocation.
  27865. *
  27866. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27867. * invoked on the trailing edge of the timeout only if the debounced function
  27868. * is invoked more than once during the `wait` timeout.
  27869. *
  27870. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27871. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27872. *
  27873. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27874. * for details over the differences between `_.debounce` and `_.throttle`.
  27875. *
  27876. * @static
  27877. * @memberOf _
  27878. * @since 0.1.0
  27879. * @category Function
  27880. * @param {Function} func The function to debounce.
  27881. * @param {number} [wait=0] The number of milliseconds to delay.
  27882. * @param {Object} [options={}] The options object.
  27883. * @param {boolean} [options.leading=false]
  27884. * Specify invoking on the leading edge of the timeout.
  27885. * @param {number} [options.maxWait]
  27886. * The maximum time `func` is allowed to be delayed before it's invoked.
  27887. * @param {boolean} [options.trailing=true]
  27888. * Specify invoking on the trailing edge of the timeout.
  27889. * @returns {Function} Returns the new debounced function.
  27890. * @example
  27891. *
  27892. * // Avoid costly calculations while the window size is in flux.
  27893. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27894. *
  27895. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27896. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27897. * 'leading': true,
  27898. * 'trailing': false
  27899. * }));
  27900. *
  27901. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27902. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27903. * var source = new EventSource('/stream');
  27904. * jQuery(source).on('message', debounced);
  27905. *
  27906. * // Cancel the trailing debounced invocation.
  27907. * jQuery(window).on('popstate', debounced.cancel);
  27908. */
  27909. function debounce(func, wait, options) {
  27910. var lastArgs,
  27911. lastThis,
  27912. maxWait,
  27913. result,
  27914. timerId,
  27915. lastCallTime,
  27916. lastInvokeTime = 0,
  27917. leading = false,
  27918. maxing = false,
  27919. trailing = true;
  27920. if (typeof func != 'function') {
  27921. throw new TypeError(FUNC_ERROR_TEXT);
  27922. }
  27923. wait = toNumber(wait) || 0;
  27924. if (isObject(options)) {
  27925. leading = !!options.leading;
  27926. maxing = 'maxWait' in options;
  27927. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27928. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27929. }
  27930. function invokeFunc(time) {
  27931. var args = lastArgs,
  27932. thisArg = lastThis;
  27933. lastArgs = lastThis = undefined;
  27934. lastInvokeTime = time;
  27935. result = func.apply(thisArg, args);
  27936. return result;
  27937. }
  27938. function leadingEdge(time) {
  27939. // Reset any `maxWait` timer.
  27940. lastInvokeTime = time;
  27941. // Start the timer for the trailing edge.
  27942. timerId = setTimeout(timerExpired, wait);
  27943. // Invoke the leading edge.
  27944. return leading ? invokeFunc(time) : result;
  27945. }
  27946. function remainingWait(time) {
  27947. var timeSinceLastCall = time - lastCallTime,
  27948. timeSinceLastInvoke = time - lastInvokeTime,
  27949. timeWaiting = wait - timeSinceLastCall;
  27950. return maxing
  27951. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27952. : timeWaiting;
  27953. }
  27954. function shouldInvoke(time) {
  27955. var timeSinceLastCall = time - lastCallTime,
  27956. timeSinceLastInvoke = time - lastInvokeTime;
  27957. // Either this is the first call, activity has stopped and we're at the
  27958. // trailing edge, the system time has gone backwards and we're treating
  27959. // it as the trailing edge, or we've hit the `maxWait` limit.
  27960. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27961. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27962. }
  27963. function timerExpired() {
  27964. var time = now();
  27965. if (shouldInvoke(time)) {
  27966. return trailingEdge(time);
  27967. }
  27968. // Restart the timer.
  27969. timerId = setTimeout(timerExpired, remainingWait(time));
  27970. }
  27971. function trailingEdge(time) {
  27972. timerId = undefined;
  27973. // Only invoke if we have `lastArgs` which means `func` has been
  27974. // debounced at least once.
  27975. if (trailing && lastArgs) {
  27976. return invokeFunc(time);
  27977. }
  27978. lastArgs = lastThis = undefined;
  27979. return result;
  27980. }
  27981. function cancel() {
  27982. if (timerId !== undefined) {
  27983. clearTimeout(timerId);
  27984. }
  27985. lastInvokeTime = 0;
  27986. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27987. }
  27988. function flush() {
  27989. return timerId === undefined ? result : trailingEdge(now());
  27990. }
  27991. function debounced() {
  27992. var time = now(),
  27993. isInvoking = shouldInvoke(time);
  27994. lastArgs = arguments;
  27995. lastThis = this;
  27996. lastCallTime = time;
  27997. if (isInvoking) {
  27998. if (timerId === undefined) {
  27999. return leadingEdge(lastCallTime);
  28000. }
  28001. if (maxing) {
  28002. // Handle invocations in a tight loop.
  28003. clearTimeout(timerId);
  28004. timerId = setTimeout(timerExpired, wait);
  28005. return invokeFunc(lastCallTime);
  28006. }
  28007. }
  28008. if (timerId === undefined) {
  28009. timerId = setTimeout(timerExpired, wait);
  28010. }
  28011. return result;
  28012. }
  28013. debounced.cancel = cancel;
  28014. debounced.flush = flush;
  28015. return debounced;
  28016. }
  28017. /**
  28018. * Defers invoking the `func` until the current call stack has cleared. Any
  28019. * additional arguments are provided to `func` when it's invoked.
  28020. *
  28021. * @static
  28022. * @memberOf _
  28023. * @since 0.1.0
  28024. * @category Function
  28025. * @param {Function} func The function to defer.
  28026. * @param {...*} [args] The arguments to invoke `func` with.
  28027. * @returns {number} Returns the timer id.
  28028. * @example
  28029. *
  28030. * _.defer(function(text) {
  28031. * console.log(text);
  28032. * }, 'deferred');
  28033. * // => Logs 'deferred' after one millisecond.
  28034. */
  28035. var defer = baseRest(function(func, args) {
  28036. return baseDelay(func, 1, args);
  28037. });
  28038. /**
  28039. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28040. * provided to `func` when it's invoked.
  28041. *
  28042. * @static
  28043. * @memberOf _
  28044. * @since 0.1.0
  28045. * @category Function
  28046. * @param {Function} func The function to delay.
  28047. * @param {number} wait The number of milliseconds to delay invocation.
  28048. * @param {...*} [args] The arguments to invoke `func` with.
  28049. * @returns {number} Returns the timer id.
  28050. * @example
  28051. *
  28052. * _.delay(function(text) {
  28053. * console.log(text);
  28054. * }, 1000, 'later');
  28055. * // => Logs 'later' after one second.
  28056. */
  28057. var delay = baseRest(function(func, wait, args) {
  28058. return baseDelay(func, toNumber(wait) || 0, args);
  28059. });
  28060. /**
  28061. * Creates a function that invokes `func` with arguments reversed.
  28062. *
  28063. * @static
  28064. * @memberOf _
  28065. * @since 4.0.0
  28066. * @category Function
  28067. * @param {Function} func The function to flip arguments for.
  28068. * @returns {Function} Returns the new flipped function.
  28069. * @example
  28070. *
  28071. * var flipped = _.flip(function() {
  28072. * return _.toArray(arguments);
  28073. * });
  28074. *
  28075. * flipped('a', 'b', 'c', 'd');
  28076. * // => ['d', 'c', 'b', 'a']
  28077. */
  28078. function flip(func) {
  28079. return createWrap(func, WRAP_FLIP_FLAG);
  28080. }
  28081. /**
  28082. * Creates a function that memoizes the result of `func`. If `resolver` is
  28083. * provided, it determines the cache key for storing the result based on the
  28084. * arguments provided to the memoized function. By default, the first argument
  28085. * provided to the memoized function is used as the map cache key. The `func`
  28086. * is invoked with the `this` binding of the memoized function.
  28087. *
  28088. * **Note:** The cache is exposed as the `cache` property on the memoized
  28089. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28090. * constructor with one whose instances implement the
  28091. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28092. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28093. *
  28094. * @static
  28095. * @memberOf _
  28096. * @since 0.1.0
  28097. * @category Function
  28098. * @param {Function} func The function to have its output memoized.
  28099. * @param {Function} [resolver] The function to resolve the cache key.
  28100. * @returns {Function} Returns the new memoized function.
  28101. * @example
  28102. *
  28103. * var object = { 'a': 1, 'b': 2 };
  28104. * var other = { 'c': 3, 'd': 4 };
  28105. *
  28106. * var values = _.memoize(_.values);
  28107. * values(object);
  28108. * // => [1, 2]
  28109. *
  28110. * values(other);
  28111. * // => [3, 4]
  28112. *
  28113. * object.a = 2;
  28114. * values(object);
  28115. * // => [1, 2]
  28116. *
  28117. * // Modify the result cache.
  28118. * values.cache.set(object, ['a', 'b']);
  28119. * values(object);
  28120. * // => ['a', 'b']
  28121. *
  28122. * // Replace `_.memoize.Cache`.
  28123. * _.memoize.Cache = WeakMap;
  28124. */
  28125. function memoize(func, resolver) {
  28126. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28127. throw new TypeError(FUNC_ERROR_TEXT);
  28128. }
  28129. var memoized = function() {
  28130. var args = arguments,
  28131. key = resolver ? resolver.apply(this, args) : args[0],
  28132. cache = memoized.cache;
  28133. if (cache.has(key)) {
  28134. return cache.get(key);
  28135. }
  28136. var result = func.apply(this, args);
  28137. memoized.cache = cache.set(key, result) || cache;
  28138. return result;
  28139. };
  28140. memoized.cache = new (memoize.Cache || MapCache);
  28141. return memoized;
  28142. }
  28143. // Expose `MapCache`.
  28144. memoize.Cache = MapCache;
  28145. /**
  28146. * Creates a function that negates the result of the predicate `func`. The
  28147. * `func` predicate is invoked with the `this` binding and arguments of the
  28148. * created function.
  28149. *
  28150. * @static
  28151. * @memberOf _
  28152. * @since 3.0.0
  28153. * @category Function
  28154. * @param {Function} predicate The predicate to negate.
  28155. * @returns {Function} Returns the new negated function.
  28156. * @example
  28157. *
  28158. * function isEven(n) {
  28159. * return n % 2 == 0;
  28160. * }
  28161. *
  28162. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28163. * // => [1, 3, 5]
  28164. */
  28165. function negate(predicate) {
  28166. if (typeof predicate != 'function') {
  28167. throw new TypeError(FUNC_ERROR_TEXT);
  28168. }
  28169. return function() {
  28170. var args = arguments;
  28171. switch (args.length) {
  28172. case 0: return !predicate.call(this);
  28173. case 1: return !predicate.call(this, args[0]);
  28174. case 2: return !predicate.call(this, args[0], args[1]);
  28175. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28176. }
  28177. return !predicate.apply(this, args);
  28178. };
  28179. }
  28180. /**
  28181. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28182. * to the function return the value of the first invocation. The `func` is
  28183. * invoked with the `this` binding and arguments of the created function.
  28184. *
  28185. * @static
  28186. * @memberOf _
  28187. * @since 0.1.0
  28188. * @category Function
  28189. * @param {Function} func The function to restrict.
  28190. * @returns {Function} Returns the new restricted function.
  28191. * @example
  28192. *
  28193. * var initialize = _.once(createApplication);
  28194. * initialize();
  28195. * initialize();
  28196. * // => `createApplication` is invoked once
  28197. */
  28198. function once(func) {
  28199. return before(2, func);
  28200. }
  28201. /**
  28202. * Creates a function that invokes `func` with its arguments transformed.
  28203. *
  28204. * @static
  28205. * @since 4.0.0
  28206. * @memberOf _
  28207. * @category Function
  28208. * @param {Function} func The function to wrap.
  28209. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28210. * The argument transforms.
  28211. * @returns {Function} Returns the new function.
  28212. * @example
  28213. *
  28214. * function doubled(n) {
  28215. * return n * 2;
  28216. * }
  28217. *
  28218. * function square(n) {
  28219. * return n * n;
  28220. * }
  28221. *
  28222. * var func = _.overArgs(function(x, y) {
  28223. * return [x, y];
  28224. * }, [square, doubled]);
  28225. *
  28226. * func(9, 3);
  28227. * // => [81, 6]
  28228. *
  28229. * func(10, 5);
  28230. * // => [100, 10]
  28231. */
  28232. var overArgs = castRest(function(func, transforms) {
  28233. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28234. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28235. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28236. var funcsLength = transforms.length;
  28237. return baseRest(function(args) {
  28238. var index = -1,
  28239. length = nativeMin(args.length, funcsLength);
  28240. while (++index < length) {
  28241. args[index] = transforms[index].call(this, args[index]);
  28242. }
  28243. return apply(func, this, args);
  28244. });
  28245. });
  28246. /**
  28247. * Creates a function that invokes `func` with `partials` prepended to the
  28248. * arguments it receives. This method is like `_.bind` except it does **not**
  28249. * alter the `this` binding.
  28250. *
  28251. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28252. * builds, may be used as a placeholder for partially applied arguments.
  28253. *
  28254. * **Note:** This method doesn't set the "length" property of partially
  28255. * applied functions.
  28256. *
  28257. * @static
  28258. * @memberOf _
  28259. * @since 0.2.0
  28260. * @category Function
  28261. * @param {Function} func The function to partially apply arguments to.
  28262. * @param {...*} [partials] The arguments to be partially applied.
  28263. * @returns {Function} Returns the new partially applied function.
  28264. * @example
  28265. *
  28266. * function greet(greeting, name) {
  28267. * return greeting + ' ' + name;
  28268. * }
  28269. *
  28270. * var sayHelloTo = _.partial(greet, 'hello');
  28271. * sayHelloTo('fred');
  28272. * // => 'hello fred'
  28273. *
  28274. * // Partially applied with placeholders.
  28275. * var greetFred = _.partial(greet, _, 'fred');
  28276. * greetFred('hi');
  28277. * // => 'hi fred'
  28278. */
  28279. var partial = baseRest(function(func, partials) {
  28280. var holders = replaceHolders(partials, getHolder(partial));
  28281. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28282. });
  28283. /**
  28284. * This method is like `_.partial` except that partially applied arguments
  28285. * are appended to the arguments it receives.
  28286. *
  28287. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28288. * builds, may be used as a placeholder for partially applied arguments.
  28289. *
  28290. * **Note:** This method doesn't set the "length" property of partially
  28291. * applied functions.
  28292. *
  28293. * @static
  28294. * @memberOf _
  28295. * @since 1.0.0
  28296. * @category Function
  28297. * @param {Function} func The function to partially apply arguments to.
  28298. * @param {...*} [partials] The arguments to be partially applied.
  28299. * @returns {Function} Returns the new partially applied function.
  28300. * @example
  28301. *
  28302. * function greet(greeting, name) {
  28303. * return greeting + ' ' + name;
  28304. * }
  28305. *
  28306. * var greetFred = _.partialRight(greet, 'fred');
  28307. * greetFred('hi');
  28308. * // => 'hi fred'
  28309. *
  28310. * // Partially applied with placeholders.
  28311. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28312. * sayHelloTo('fred');
  28313. * // => 'hello fred'
  28314. */
  28315. var partialRight = baseRest(function(func, partials) {
  28316. var holders = replaceHolders(partials, getHolder(partialRight));
  28317. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28318. });
  28319. /**
  28320. * Creates a function that invokes `func` with arguments arranged according
  28321. * to the specified `indexes` where the argument value at the first index is
  28322. * provided as the first argument, the argument value at the second index is
  28323. * provided as the second argument, and so on.
  28324. *
  28325. * @static
  28326. * @memberOf _
  28327. * @since 3.0.0
  28328. * @category Function
  28329. * @param {Function} func The function to rearrange arguments for.
  28330. * @param {...(number|number[])} indexes The arranged argument indexes.
  28331. * @returns {Function} Returns the new function.
  28332. * @example
  28333. *
  28334. * var rearged = _.rearg(function(a, b, c) {
  28335. * return [a, b, c];
  28336. * }, [2, 0, 1]);
  28337. *
  28338. * rearged('b', 'c', 'a')
  28339. * // => ['a', 'b', 'c']
  28340. */
  28341. var rearg = flatRest(function(func, indexes) {
  28342. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28343. });
  28344. /**
  28345. * Creates a function that invokes `func` with the `this` binding of the
  28346. * created function and arguments from `start` and beyond provided as
  28347. * an array.
  28348. *
  28349. * **Note:** This method is based on the
  28350. * [rest parameter](https://mdn.io/rest_parameters).
  28351. *
  28352. * @static
  28353. * @memberOf _
  28354. * @since 4.0.0
  28355. * @category Function
  28356. * @param {Function} func The function to apply a rest parameter to.
  28357. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28358. * @returns {Function} Returns the new function.
  28359. * @example
  28360. *
  28361. * var say = _.rest(function(what, names) {
  28362. * return what + ' ' + _.initial(names).join(', ') +
  28363. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28364. * });
  28365. *
  28366. * say('hello', 'fred', 'barney', 'pebbles');
  28367. * // => 'hello fred, barney, & pebbles'
  28368. */
  28369. function rest(func, start) {
  28370. if (typeof func != 'function') {
  28371. throw new TypeError(FUNC_ERROR_TEXT);
  28372. }
  28373. start = start === undefined ? start : toInteger(start);
  28374. return baseRest(func, start);
  28375. }
  28376. /**
  28377. * Creates a function that invokes `func` with the `this` binding of the
  28378. * create function and an array of arguments much like
  28379. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28380. *
  28381. * **Note:** This method is based on the
  28382. * [spread operator](https://mdn.io/spread_operator).
  28383. *
  28384. * @static
  28385. * @memberOf _
  28386. * @since 3.2.0
  28387. * @category Function
  28388. * @param {Function} func The function to spread arguments over.
  28389. * @param {number} [start=0] The start position of the spread.
  28390. * @returns {Function} Returns the new function.
  28391. * @example
  28392. *
  28393. * var say = _.spread(function(who, what) {
  28394. * return who + ' says ' + what;
  28395. * });
  28396. *
  28397. * say(['fred', 'hello']);
  28398. * // => 'fred says hello'
  28399. *
  28400. * var numbers = Promise.all([
  28401. * Promise.resolve(40),
  28402. * Promise.resolve(36)
  28403. * ]);
  28404. *
  28405. * numbers.then(_.spread(function(x, y) {
  28406. * return x + y;
  28407. * }));
  28408. * // => a Promise of 76
  28409. */
  28410. function spread(func, start) {
  28411. if (typeof func != 'function') {
  28412. throw new TypeError(FUNC_ERROR_TEXT);
  28413. }
  28414. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28415. return baseRest(function(args) {
  28416. var array = args[start],
  28417. otherArgs = castSlice(args, 0, start);
  28418. if (array) {
  28419. arrayPush(otherArgs, array);
  28420. }
  28421. return apply(func, this, otherArgs);
  28422. });
  28423. }
  28424. /**
  28425. * Creates a throttled function that only invokes `func` at most once per
  28426. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28427. * method to cancel delayed `func` invocations and a `flush` method to
  28428. * immediately invoke them. Provide `options` to indicate whether `func`
  28429. * should be invoked on the leading and/or trailing edge of the `wait`
  28430. * timeout. The `func` is invoked with the last arguments provided to the
  28431. * throttled function. Subsequent calls to the throttled function return the
  28432. * result of the last `func` invocation.
  28433. *
  28434. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28435. * invoked on the trailing edge of the timeout only if the throttled function
  28436. * is invoked more than once during the `wait` timeout.
  28437. *
  28438. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28439. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28440. *
  28441. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28442. * for details over the differences between `_.throttle` and `_.debounce`.
  28443. *
  28444. * @static
  28445. * @memberOf _
  28446. * @since 0.1.0
  28447. * @category Function
  28448. * @param {Function} func The function to throttle.
  28449. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28450. * @param {Object} [options={}] The options object.
  28451. * @param {boolean} [options.leading=true]
  28452. * Specify invoking on the leading edge of the timeout.
  28453. * @param {boolean} [options.trailing=true]
  28454. * Specify invoking on the trailing edge of the timeout.
  28455. * @returns {Function} Returns the new throttled function.
  28456. * @example
  28457. *
  28458. * // Avoid excessively updating the position while scrolling.
  28459. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28460. *
  28461. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28462. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28463. * jQuery(element).on('click', throttled);
  28464. *
  28465. * // Cancel the trailing throttled invocation.
  28466. * jQuery(window).on('popstate', throttled.cancel);
  28467. */
  28468. function throttle(func, wait, options) {
  28469. var leading = true,
  28470. trailing = true;
  28471. if (typeof func != 'function') {
  28472. throw new TypeError(FUNC_ERROR_TEXT);
  28473. }
  28474. if (isObject(options)) {
  28475. leading = 'leading' in options ? !!options.leading : leading;
  28476. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28477. }
  28478. return debounce(func, wait, {
  28479. 'leading': leading,
  28480. 'maxWait': wait,
  28481. 'trailing': trailing
  28482. });
  28483. }
  28484. /**
  28485. * Creates a function that accepts up to one argument, ignoring any
  28486. * additional arguments.
  28487. *
  28488. * @static
  28489. * @memberOf _
  28490. * @since 4.0.0
  28491. * @category Function
  28492. * @param {Function} func The function to cap arguments for.
  28493. * @returns {Function} Returns the new capped function.
  28494. * @example
  28495. *
  28496. * _.map(['6', '8', '10'], _.unary(parseInt));
  28497. * // => [6, 8, 10]
  28498. */
  28499. function unary(func) {
  28500. return ary(func, 1);
  28501. }
  28502. /**
  28503. * Creates a function that provides `value` to `wrapper` as its first
  28504. * argument. Any additional arguments provided to the function are appended
  28505. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28506. * binding of the created function.
  28507. *
  28508. * @static
  28509. * @memberOf _
  28510. * @since 0.1.0
  28511. * @category Function
  28512. * @param {*} value The value to wrap.
  28513. * @param {Function} [wrapper=identity] The wrapper function.
  28514. * @returns {Function} Returns the new function.
  28515. * @example
  28516. *
  28517. * var p = _.wrap(_.escape, function(func, text) {
  28518. * return '<p>' + func(text) + '</p>';
  28519. * });
  28520. *
  28521. * p('fred, barney, & pebbles');
  28522. * // => '<p>fred, barney, &amp; pebbles</p>'
  28523. */
  28524. function wrap(value, wrapper) {
  28525. return partial(castFunction(wrapper), value);
  28526. }
  28527. /*------------------------------------------------------------------------*/
  28528. /**
  28529. * Casts `value` as an array if it's not one.
  28530. *
  28531. * @static
  28532. * @memberOf _
  28533. * @since 4.4.0
  28534. * @category Lang
  28535. * @param {*} value The value to inspect.
  28536. * @returns {Array} Returns the cast array.
  28537. * @example
  28538. *
  28539. * _.castArray(1);
  28540. * // => [1]
  28541. *
  28542. * _.castArray({ 'a': 1 });
  28543. * // => [{ 'a': 1 }]
  28544. *
  28545. * _.castArray('abc');
  28546. * // => ['abc']
  28547. *
  28548. * _.castArray(null);
  28549. * // => [null]
  28550. *
  28551. * _.castArray(undefined);
  28552. * // => [undefined]
  28553. *
  28554. * _.castArray();
  28555. * // => []
  28556. *
  28557. * var array = [1, 2, 3];
  28558. * console.log(_.castArray(array) === array);
  28559. * // => true
  28560. */
  28561. function castArray() {
  28562. if (!arguments.length) {
  28563. return [];
  28564. }
  28565. var value = arguments[0];
  28566. return isArray(value) ? value : [value];
  28567. }
  28568. /**
  28569. * Creates a shallow clone of `value`.
  28570. *
  28571. * **Note:** This method is loosely based on the
  28572. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28573. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28574. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28575. * arrays. The own enumerable properties of `arguments` objects are cloned
  28576. * as plain objects. An empty object is returned for uncloneable values such
  28577. * as error objects, functions, DOM nodes, and WeakMaps.
  28578. *
  28579. * @static
  28580. * @memberOf _
  28581. * @since 0.1.0
  28582. * @category Lang
  28583. * @param {*} value The value to clone.
  28584. * @returns {*} Returns the cloned value.
  28585. * @see _.cloneDeep
  28586. * @example
  28587. *
  28588. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28589. *
  28590. * var shallow = _.clone(objects);
  28591. * console.log(shallow[0] === objects[0]);
  28592. * // => true
  28593. */
  28594. function clone(value) {
  28595. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28596. }
  28597. /**
  28598. * This method is like `_.clone` except that it accepts `customizer` which
  28599. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28600. * cloning is handled by the method instead. The `customizer` is invoked with
  28601. * up to four arguments; (value [, index|key, object, stack]).
  28602. *
  28603. * @static
  28604. * @memberOf _
  28605. * @since 4.0.0
  28606. * @category Lang
  28607. * @param {*} value The value to clone.
  28608. * @param {Function} [customizer] The function to customize cloning.
  28609. * @returns {*} Returns the cloned value.
  28610. * @see _.cloneDeepWith
  28611. * @example
  28612. *
  28613. * function customizer(value) {
  28614. * if (_.isElement(value)) {
  28615. * return value.cloneNode(false);
  28616. * }
  28617. * }
  28618. *
  28619. * var el = _.cloneWith(document.body, customizer);
  28620. *
  28621. * console.log(el === document.body);
  28622. * // => false
  28623. * console.log(el.nodeName);
  28624. * // => 'BODY'
  28625. * console.log(el.childNodes.length);
  28626. * // => 0
  28627. */
  28628. function cloneWith(value, customizer) {
  28629. customizer = typeof customizer == 'function' ? customizer : undefined;
  28630. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28631. }
  28632. /**
  28633. * This method is like `_.clone` except that it recursively clones `value`.
  28634. *
  28635. * @static
  28636. * @memberOf _
  28637. * @since 1.0.0
  28638. * @category Lang
  28639. * @param {*} value The value to recursively clone.
  28640. * @returns {*} Returns the deep cloned value.
  28641. * @see _.clone
  28642. * @example
  28643. *
  28644. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28645. *
  28646. * var deep = _.cloneDeep(objects);
  28647. * console.log(deep[0] === objects[0]);
  28648. * // => false
  28649. */
  28650. function cloneDeep(value) {
  28651. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28652. }
  28653. /**
  28654. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28655. *
  28656. * @static
  28657. * @memberOf _
  28658. * @since 4.0.0
  28659. * @category Lang
  28660. * @param {*} value The value to recursively clone.
  28661. * @param {Function} [customizer] The function to customize cloning.
  28662. * @returns {*} Returns the deep cloned value.
  28663. * @see _.cloneWith
  28664. * @example
  28665. *
  28666. * function customizer(value) {
  28667. * if (_.isElement(value)) {
  28668. * return value.cloneNode(true);
  28669. * }
  28670. * }
  28671. *
  28672. * var el = _.cloneDeepWith(document.body, customizer);
  28673. *
  28674. * console.log(el === document.body);
  28675. * // => false
  28676. * console.log(el.nodeName);
  28677. * // => 'BODY'
  28678. * console.log(el.childNodes.length);
  28679. * // => 20
  28680. */
  28681. function cloneDeepWith(value, customizer) {
  28682. customizer = typeof customizer == 'function' ? customizer : undefined;
  28683. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28684. }
  28685. /**
  28686. * Checks if `object` conforms to `source` by invoking the predicate
  28687. * properties of `source` with the corresponding property values of `object`.
  28688. *
  28689. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28690. * partially applied.
  28691. *
  28692. * @static
  28693. * @memberOf _
  28694. * @since 4.14.0
  28695. * @category Lang
  28696. * @param {Object} object The object to inspect.
  28697. * @param {Object} source The object of property predicates to conform to.
  28698. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28699. * @example
  28700. *
  28701. * var object = { 'a': 1, 'b': 2 };
  28702. *
  28703. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28704. * // => true
  28705. *
  28706. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28707. * // => false
  28708. */
  28709. function conformsTo(object, source) {
  28710. return source == null || baseConformsTo(object, source, keys(source));
  28711. }
  28712. /**
  28713. * Performs a
  28714. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28715. * comparison between two values to determine if they are equivalent.
  28716. *
  28717. * @static
  28718. * @memberOf _
  28719. * @since 4.0.0
  28720. * @category Lang
  28721. * @param {*} value The value to compare.
  28722. * @param {*} other The other value to compare.
  28723. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28724. * @example
  28725. *
  28726. * var object = { 'a': 1 };
  28727. * var other = { 'a': 1 };
  28728. *
  28729. * _.eq(object, object);
  28730. * // => true
  28731. *
  28732. * _.eq(object, other);
  28733. * // => false
  28734. *
  28735. * _.eq('a', 'a');
  28736. * // => true
  28737. *
  28738. * _.eq('a', Object('a'));
  28739. * // => false
  28740. *
  28741. * _.eq(NaN, NaN);
  28742. * // => true
  28743. */
  28744. function eq(value, other) {
  28745. return value === other || (value !== value && other !== other);
  28746. }
  28747. /**
  28748. * Checks if `value` is greater than `other`.
  28749. *
  28750. * @static
  28751. * @memberOf _
  28752. * @since 3.9.0
  28753. * @category Lang
  28754. * @param {*} value The value to compare.
  28755. * @param {*} other The other value to compare.
  28756. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28757. * else `false`.
  28758. * @see _.lt
  28759. * @example
  28760. *
  28761. * _.gt(3, 1);
  28762. * // => true
  28763. *
  28764. * _.gt(3, 3);
  28765. * // => false
  28766. *
  28767. * _.gt(1, 3);
  28768. * // => false
  28769. */
  28770. var gt = createRelationalOperation(baseGt);
  28771. /**
  28772. * Checks if `value` is greater than or equal to `other`.
  28773. *
  28774. * @static
  28775. * @memberOf _
  28776. * @since 3.9.0
  28777. * @category Lang
  28778. * @param {*} value The value to compare.
  28779. * @param {*} other The other value to compare.
  28780. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28781. * `other`, else `false`.
  28782. * @see _.lte
  28783. * @example
  28784. *
  28785. * _.gte(3, 1);
  28786. * // => true
  28787. *
  28788. * _.gte(3, 3);
  28789. * // => true
  28790. *
  28791. * _.gte(1, 3);
  28792. * // => false
  28793. */
  28794. var gte = createRelationalOperation(function(value, other) {
  28795. return value >= other;
  28796. });
  28797. /**
  28798. * Checks if `value` is likely an `arguments` object.
  28799. *
  28800. * @static
  28801. * @memberOf _
  28802. * @since 0.1.0
  28803. * @category Lang
  28804. * @param {*} value The value to check.
  28805. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28806. * else `false`.
  28807. * @example
  28808. *
  28809. * _.isArguments(function() { return arguments; }());
  28810. * // => true
  28811. *
  28812. * _.isArguments([1, 2, 3]);
  28813. * // => false
  28814. */
  28815. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28816. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28817. !propertyIsEnumerable.call(value, 'callee');
  28818. };
  28819. /**
  28820. * Checks if `value` is classified as an `Array` object.
  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 array, else `false`.
  28828. * @example
  28829. *
  28830. * _.isArray([1, 2, 3]);
  28831. * // => true
  28832. *
  28833. * _.isArray(document.body.children);
  28834. * // => false
  28835. *
  28836. * _.isArray('abc');
  28837. * // => false
  28838. *
  28839. * _.isArray(_.noop);
  28840. * // => false
  28841. */
  28842. var isArray = Array.isArray;
  28843. /**
  28844. * Checks if `value` is classified as an `ArrayBuffer` object.
  28845. *
  28846. * @static
  28847. * @memberOf _
  28848. * @since 4.3.0
  28849. * @category Lang
  28850. * @param {*} value The value to check.
  28851. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28852. * @example
  28853. *
  28854. * _.isArrayBuffer(new ArrayBuffer(2));
  28855. * // => true
  28856. *
  28857. * _.isArrayBuffer(new Array(2));
  28858. * // => false
  28859. */
  28860. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28861. /**
  28862. * Checks if `value` is array-like. A value is considered array-like if it's
  28863. * not a function and has a `value.length` that's an integer greater than or
  28864. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28865. *
  28866. * @static
  28867. * @memberOf _
  28868. * @since 4.0.0
  28869. * @category Lang
  28870. * @param {*} value The value to check.
  28871. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28872. * @example
  28873. *
  28874. * _.isArrayLike([1, 2, 3]);
  28875. * // => true
  28876. *
  28877. * _.isArrayLike(document.body.children);
  28878. * // => true
  28879. *
  28880. * _.isArrayLike('abc');
  28881. * // => true
  28882. *
  28883. * _.isArrayLike(_.noop);
  28884. * // => false
  28885. */
  28886. function isArrayLike(value) {
  28887. return value != null && isLength(value.length) && !isFunction(value);
  28888. }
  28889. /**
  28890. * This method is like `_.isArrayLike` except that it also checks if `value`
  28891. * is an object.
  28892. *
  28893. * @static
  28894. * @memberOf _
  28895. * @since 4.0.0
  28896. * @category Lang
  28897. * @param {*} value The value to check.
  28898. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28899. * else `false`.
  28900. * @example
  28901. *
  28902. * _.isArrayLikeObject([1, 2, 3]);
  28903. * // => true
  28904. *
  28905. * _.isArrayLikeObject(document.body.children);
  28906. * // => true
  28907. *
  28908. * _.isArrayLikeObject('abc');
  28909. * // => false
  28910. *
  28911. * _.isArrayLikeObject(_.noop);
  28912. * // => false
  28913. */
  28914. function isArrayLikeObject(value) {
  28915. return isObjectLike(value) && isArrayLike(value);
  28916. }
  28917. /**
  28918. * Checks if `value` is classified as a boolean primitive or object.
  28919. *
  28920. * @static
  28921. * @memberOf _
  28922. * @since 0.1.0
  28923. * @category Lang
  28924. * @param {*} value The value to check.
  28925. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28926. * @example
  28927. *
  28928. * _.isBoolean(false);
  28929. * // => true
  28930. *
  28931. * _.isBoolean(null);
  28932. * // => false
  28933. */
  28934. function isBoolean(value) {
  28935. return value === true || value === false ||
  28936. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28937. }
  28938. /**
  28939. * Checks if `value` is a buffer.
  28940. *
  28941. * @static
  28942. * @memberOf _
  28943. * @since 4.3.0
  28944. * @category Lang
  28945. * @param {*} value The value to check.
  28946. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28947. * @example
  28948. *
  28949. * _.isBuffer(new Buffer(2));
  28950. * // => true
  28951. *
  28952. * _.isBuffer(new Uint8Array(2));
  28953. * // => false
  28954. */
  28955. var isBuffer = nativeIsBuffer || stubFalse;
  28956. /**
  28957. * Checks if `value` is classified as a `Date` object.
  28958. *
  28959. * @static
  28960. * @memberOf _
  28961. * @since 0.1.0
  28962. * @category Lang
  28963. * @param {*} value The value to check.
  28964. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28965. * @example
  28966. *
  28967. * _.isDate(new Date);
  28968. * // => true
  28969. *
  28970. * _.isDate('Mon April 23 2012');
  28971. * // => false
  28972. */
  28973. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28974. /**
  28975. * Checks if `value` is likely a DOM element.
  28976. *
  28977. * @static
  28978. * @memberOf _
  28979. * @since 0.1.0
  28980. * @category Lang
  28981. * @param {*} value The value to check.
  28982. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28983. * @example
  28984. *
  28985. * _.isElement(document.body);
  28986. * // => true
  28987. *
  28988. * _.isElement('<body>');
  28989. * // => false
  28990. */
  28991. function isElement(value) {
  28992. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28993. }
  28994. /**
  28995. * Checks if `value` is an empty object, collection, map, or set.
  28996. *
  28997. * Objects are considered empty if they have no own enumerable string keyed
  28998. * properties.
  28999. *
  29000. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29001. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29002. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29003. *
  29004. * @static
  29005. * @memberOf _
  29006. * @since 0.1.0
  29007. * @category Lang
  29008. * @param {*} value The value to check.
  29009. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29010. * @example
  29011. *
  29012. * _.isEmpty(null);
  29013. * // => true
  29014. *
  29015. * _.isEmpty(true);
  29016. * // => true
  29017. *
  29018. * _.isEmpty(1);
  29019. * // => true
  29020. *
  29021. * _.isEmpty([1, 2, 3]);
  29022. * // => false
  29023. *
  29024. * _.isEmpty({ 'a': 1 });
  29025. * // => false
  29026. */
  29027. function isEmpty(value) {
  29028. if (value == null) {
  29029. return true;
  29030. }
  29031. if (isArrayLike(value) &&
  29032. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29033. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29034. return !value.length;
  29035. }
  29036. var tag = getTag(value);
  29037. if (tag == mapTag || tag == setTag) {
  29038. return !value.size;
  29039. }
  29040. if (isPrototype(value)) {
  29041. return !baseKeys(value).length;
  29042. }
  29043. for (var key in value) {
  29044. if (hasOwnProperty.call(value, key)) {
  29045. return false;
  29046. }
  29047. }
  29048. return true;
  29049. }
  29050. /**
  29051. * Performs a deep comparison between two values to determine if they are
  29052. * equivalent.
  29053. *
  29054. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29055. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29056. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29057. * by their own, not inherited, enumerable properties. Functions and DOM
  29058. * nodes are compared by strict equality, i.e. `===`.
  29059. *
  29060. * @static
  29061. * @memberOf _
  29062. * @since 0.1.0
  29063. * @category Lang
  29064. * @param {*} value The value to compare.
  29065. * @param {*} other The other value to compare.
  29066. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29067. * @example
  29068. *
  29069. * var object = { 'a': 1 };
  29070. * var other = { 'a': 1 };
  29071. *
  29072. * _.isEqual(object, other);
  29073. * // => true
  29074. *
  29075. * object === other;
  29076. * // => false
  29077. */
  29078. function isEqual(value, other) {
  29079. return baseIsEqual(value, other);
  29080. }
  29081. /**
  29082. * This method is like `_.isEqual` except that it accepts `customizer` which
  29083. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29084. * are handled by the method instead. The `customizer` is invoked with up to
  29085. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29086. *
  29087. * @static
  29088. * @memberOf _
  29089. * @since 4.0.0
  29090. * @category Lang
  29091. * @param {*} value The value to compare.
  29092. * @param {*} other The other value to compare.
  29093. * @param {Function} [customizer] The function to customize comparisons.
  29094. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29095. * @example
  29096. *
  29097. * function isGreeting(value) {
  29098. * return /^h(?:i|ello)$/.test(value);
  29099. * }
  29100. *
  29101. * function customizer(objValue, othValue) {
  29102. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29103. * return true;
  29104. * }
  29105. * }
  29106. *
  29107. * var array = ['hello', 'goodbye'];
  29108. * var other = ['hi', 'goodbye'];
  29109. *
  29110. * _.isEqualWith(array, other, customizer);
  29111. * // => true
  29112. */
  29113. function isEqualWith(value, other, customizer) {
  29114. customizer = typeof customizer == 'function' ? customizer : undefined;
  29115. var result = customizer ? customizer(value, other) : undefined;
  29116. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29117. }
  29118. /**
  29119. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29120. * `SyntaxError`, `TypeError`, or `URIError` object.
  29121. *
  29122. * @static
  29123. * @memberOf _
  29124. * @since 3.0.0
  29125. * @category Lang
  29126. * @param {*} value The value to check.
  29127. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29128. * @example
  29129. *
  29130. * _.isError(new Error);
  29131. * // => true
  29132. *
  29133. * _.isError(Error);
  29134. * // => false
  29135. */
  29136. function isError(value) {
  29137. if (!isObjectLike(value)) {
  29138. return false;
  29139. }
  29140. var tag = baseGetTag(value);
  29141. return tag == errorTag || tag == domExcTag ||
  29142. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29143. }
  29144. /**
  29145. * Checks if `value` is a finite primitive number.
  29146. *
  29147. * **Note:** This method is based on
  29148. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29149. *
  29150. * @static
  29151. * @memberOf _
  29152. * @since 0.1.0
  29153. * @category Lang
  29154. * @param {*} value The value to check.
  29155. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29156. * @example
  29157. *
  29158. * _.isFinite(3);
  29159. * // => true
  29160. *
  29161. * _.isFinite(Number.MIN_VALUE);
  29162. * // => true
  29163. *
  29164. * _.isFinite(Infinity);
  29165. * // => false
  29166. *
  29167. * _.isFinite('3');
  29168. * // => false
  29169. */
  29170. function isFinite(value) {
  29171. return typeof value == 'number' && nativeIsFinite(value);
  29172. }
  29173. /**
  29174. * Checks if `value` is classified as a `Function` object.
  29175. *
  29176. * @static
  29177. * @memberOf _
  29178. * @since 0.1.0
  29179. * @category Lang
  29180. * @param {*} value The value to check.
  29181. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29182. * @example
  29183. *
  29184. * _.isFunction(_);
  29185. * // => true
  29186. *
  29187. * _.isFunction(/abc/);
  29188. * // => false
  29189. */
  29190. function isFunction(value) {
  29191. if (!isObject(value)) {
  29192. return false;
  29193. }
  29194. // The use of `Object#toString` avoids issues with the `typeof` operator
  29195. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29196. var tag = baseGetTag(value);
  29197. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29198. }
  29199. /**
  29200. * Checks if `value` is an integer.
  29201. *
  29202. * **Note:** This method is based on
  29203. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29204. *
  29205. * @static
  29206. * @memberOf _
  29207. * @since 4.0.0
  29208. * @category Lang
  29209. * @param {*} value The value to check.
  29210. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29211. * @example
  29212. *
  29213. * _.isInteger(3);
  29214. * // => true
  29215. *
  29216. * _.isInteger(Number.MIN_VALUE);
  29217. * // => false
  29218. *
  29219. * _.isInteger(Infinity);
  29220. * // => false
  29221. *
  29222. * _.isInteger('3');
  29223. * // => false
  29224. */
  29225. function isInteger(value) {
  29226. return typeof value == 'number' && value == toInteger(value);
  29227. }
  29228. /**
  29229. * Checks if `value` is a valid array-like length.
  29230. *
  29231. * **Note:** This method is loosely based on
  29232. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29233. *
  29234. * @static
  29235. * @memberOf _
  29236. * @since 4.0.0
  29237. * @category Lang
  29238. * @param {*} value The value to check.
  29239. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29240. * @example
  29241. *
  29242. * _.isLength(3);
  29243. * // => true
  29244. *
  29245. * _.isLength(Number.MIN_VALUE);
  29246. * // => false
  29247. *
  29248. * _.isLength(Infinity);
  29249. * // => false
  29250. *
  29251. * _.isLength('3');
  29252. * // => false
  29253. */
  29254. function isLength(value) {
  29255. return typeof value == 'number' &&
  29256. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29257. }
  29258. /**
  29259. * Checks if `value` is the
  29260. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29261. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29262. *
  29263. * @static
  29264. * @memberOf _
  29265. * @since 0.1.0
  29266. * @category Lang
  29267. * @param {*} value The value to check.
  29268. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29269. * @example
  29270. *
  29271. * _.isObject({});
  29272. * // => true
  29273. *
  29274. * _.isObject([1, 2, 3]);
  29275. * // => true
  29276. *
  29277. * _.isObject(_.noop);
  29278. * // => true
  29279. *
  29280. * _.isObject(null);
  29281. * // => false
  29282. */
  29283. function isObject(value) {
  29284. var type = typeof value;
  29285. return value != null && (type == 'object' || type == 'function');
  29286. }
  29287. /**
  29288. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29289. * and has a `typeof` result of "object".
  29290. *
  29291. * @static
  29292. * @memberOf _
  29293. * @since 4.0.0
  29294. * @category Lang
  29295. * @param {*} value The value to check.
  29296. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29297. * @example
  29298. *
  29299. * _.isObjectLike({});
  29300. * // => true
  29301. *
  29302. * _.isObjectLike([1, 2, 3]);
  29303. * // => true
  29304. *
  29305. * _.isObjectLike(_.noop);
  29306. * // => false
  29307. *
  29308. * _.isObjectLike(null);
  29309. * // => false
  29310. */
  29311. function isObjectLike(value) {
  29312. return value != null && typeof value == 'object';
  29313. }
  29314. /**
  29315. * Checks if `value` is classified as a `Map` object.
  29316. *
  29317. * @static
  29318. * @memberOf _
  29319. * @since 4.3.0
  29320. * @category Lang
  29321. * @param {*} value The value to check.
  29322. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29323. * @example
  29324. *
  29325. * _.isMap(new Map);
  29326. * // => true
  29327. *
  29328. * _.isMap(new WeakMap);
  29329. * // => false
  29330. */
  29331. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29332. /**
  29333. * Performs a partial deep comparison between `object` and `source` to
  29334. * determine if `object` contains equivalent property values.
  29335. *
  29336. * **Note:** This method is equivalent to `_.matches` when `source` is
  29337. * partially applied.
  29338. *
  29339. * Partial comparisons will match empty array and empty object `source`
  29340. * values against any array or object value, respectively. See `_.isEqual`
  29341. * for a list of supported value comparisons.
  29342. *
  29343. * @static
  29344. * @memberOf _
  29345. * @since 3.0.0
  29346. * @category Lang
  29347. * @param {Object} object The object to inspect.
  29348. * @param {Object} source The object of property values to match.
  29349. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29350. * @example
  29351. *
  29352. * var object = { 'a': 1, 'b': 2 };
  29353. *
  29354. * _.isMatch(object, { 'b': 2 });
  29355. * // => true
  29356. *
  29357. * _.isMatch(object, { 'b': 1 });
  29358. * // => false
  29359. */
  29360. function isMatch(object, source) {
  29361. return object === source || baseIsMatch(object, source, getMatchData(source));
  29362. }
  29363. /**
  29364. * This method is like `_.isMatch` except that it accepts `customizer` which
  29365. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29366. * are handled by the method instead. The `customizer` is invoked with five
  29367. * arguments: (objValue, srcValue, index|key, object, source).
  29368. *
  29369. * @static
  29370. * @memberOf _
  29371. * @since 4.0.0
  29372. * @category Lang
  29373. * @param {Object} object The object to inspect.
  29374. * @param {Object} source The object of property values to match.
  29375. * @param {Function} [customizer] The function to customize comparisons.
  29376. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29377. * @example
  29378. *
  29379. * function isGreeting(value) {
  29380. * return /^h(?:i|ello)$/.test(value);
  29381. * }
  29382. *
  29383. * function customizer(objValue, srcValue) {
  29384. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29385. * return true;
  29386. * }
  29387. * }
  29388. *
  29389. * var object = { 'greeting': 'hello' };
  29390. * var source = { 'greeting': 'hi' };
  29391. *
  29392. * _.isMatchWith(object, source, customizer);
  29393. * // => true
  29394. */
  29395. function isMatchWith(object, source, customizer) {
  29396. customizer = typeof customizer == 'function' ? customizer : undefined;
  29397. return baseIsMatch(object, source, getMatchData(source), customizer);
  29398. }
  29399. /**
  29400. * Checks if `value` is `NaN`.
  29401. *
  29402. * **Note:** This method is based on
  29403. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29404. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29405. * `undefined` and other non-number values.
  29406. *
  29407. * @static
  29408. * @memberOf _
  29409. * @since 0.1.0
  29410. * @category Lang
  29411. * @param {*} value The value to check.
  29412. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29413. * @example
  29414. *
  29415. * _.isNaN(NaN);
  29416. * // => true
  29417. *
  29418. * _.isNaN(new Number(NaN));
  29419. * // => true
  29420. *
  29421. * isNaN(undefined);
  29422. * // => true
  29423. *
  29424. * _.isNaN(undefined);
  29425. * // => false
  29426. */
  29427. function isNaN(value) {
  29428. // An `NaN` primitive is the only value that is not equal to itself.
  29429. // Perform the `toStringTag` check first to avoid errors with some
  29430. // ActiveX objects in IE.
  29431. return isNumber(value) && value != +value;
  29432. }
  29433. /**
  29434. * Checks if `value` is a pristine native function.
  29435. *
  29436. * **Note:** This method can't reliably detect native functions in the presence
  29437. * of the core-js package because core-js circumvents this kind of detection.
  29438. * Despite multiple requests, the core-js maintainer has made it clear: any
  29439. * attempt to fix the detection will be obstructed. As a result, we're left
  29440. * with little choice but to throw an error. Unfortunately, this also affects
  29441. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29442. * which rely on core-js.
  29443. *
  29444. * @static
  29445. * @memberOf _
  29446. * @since 3.0.0
  29447. * @category Lang
  29448. * @param {*} value The value to check.
  29449. * @returns {boolean} Returns `true` if `value` is a native function,
  29450. * else `false`.
  29451. * @example
  29452. *
  29453. * _.isNative(Array.prototype.push);
  29454. * // => true
  29455. *
  29456. * _.isNative(_);
  29457. * // => false
  29458. */
  29459. function isNative(value) {
  29460. if (isMaskable(value)) {
  29461. throw new Error(CORE_ERROR_TEXT);
  29462. }
  29463. return baseIsNative(value);
  29464. }
  29465. /**
  29466. * Checks if `value` is `null`.
  29467. *
  29468. * @static
  29469. * @memberOf _
  29470. * @since 0.1.0
  29471. * @category Lang
  29472. * @param {*} value The value to check.
  29473. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29474. * @example
  29475. *
  29476. * _.isNull(null);
  29477. * // => true
  29478. *
  29479. * _.isNull(void 0);
  29480. * // => false
  29481. */
  29482. function isNull(value) {
  29483. return value === null;
  29484. }
  29485. /**
  29486. * Checks if `value` is `null` or `undefined`.
  29487. *
  29488. * @static
  29489. * @memberOf _
  29490. * @since 4.0.0
  29491. * @category Lang
  29492. * @param {*} value The value to check.
  29493. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29494. * @example
  29495. *
  29496. * _.isNil(null);
  29497. * // => true
  29498. *
  29499. * _.isNil(void 0);
  29500. * // => true
  29501. *
  29502. * _.isNil(NaN);
  29503. * // => false
  29504. */
  29505. function isNil(value) {
  29506. return value == null;
  29507. }
  29508. /**
  29509. * Checks if `value` is classified as a `Number` primitive or object.
  29510. *
  29511. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29512. * classified as numbers, use the `_.isFinite` method.
  29513. *
  29514. * @static
  29515. * @memberOf _
  29516. * @since 0.1.0
  29517. * @category Lang
  29518. * @param {*} value The value to check.
  29519. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29520. * @example
  29521. *
  29522. * _.isNumber(3);
  29523. * // => true
  29524. *
  29525. * _.isNumber(Number.MIN_VALUE);
  29526. * // => true
  29527. *
  29528. * _.isNumber(Infinity);
  29529. * // => true
  29530. *
  29531. * _.isNumber('3');
  29532. * // => false
  29533. */
  29534. function isNumber(value) {
  29535. return typeof value == 'number' ||
  29536. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29537. }
  29538. /**
  29539. * Checks if `value` is a plain object, that is, an object created by the
  29540. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29541. *
  29542. * @static
  29543. * @memberOf _
  29544. * @since 0.8.0
  29545. * @category Lang
  29546. * @param {*} value The value to check.
  29547. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29548. * @example
  29549. *
  29550. * function Foo() {
  29551. * this.a = 1;
  29552. * }
  29553. *
  29554. * _.isPlainObject(new Foo);
  29555. * // => false
  29556. *
  29557. * _.isPlainObject([1, 2, 3]);
  29558. * // => false
  29559. *
  29560. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29561. * // => true
  29562. *
  29563. * _.isPlainObject(Object.create(null));
  29564. * // => true
  29565. */
  29566. function isPlainObject(value) {
  29567. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29568. return false;
  29569. }
  29570. var proto = getPrototype(value);
  29571. if (proto === null) {
  29572. return true;
  29573. }
  29574. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29575. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29576. funcToString.call(Ctor) == objectCtorString;
  29577. }
  29578. /**
  29579. * Checks if `value` is classified as a `RegExp` object.
  29580. *
  29581. * @static
  29582. * @memberOf _
  29583. * @since 0.1.0
  29584. * @category Lang
  29585. * @param {*} value The value to check.
  29586. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29587. * @example
  29588. *
  29589. * _.isRegExp(/abc/);
  29590. * // => true
  29591. *
  29592. * _.isRegExp('/abc/');
  29593. * // => false
  29594. */
  29595. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29596. /**
  29597. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29598. * double precision number which isn't the result of a rounded unsafe integer.
  29599. *
  29600. * **Note:** This method is based on
  29601. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29602. *
  29603. * @static
  29604. * @memberOf _
  29605. * @since 4.0.0
  29606. * @category Lang
  29607. * @param {*} value The value to check.
  29608. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29609. * @example
  29610. *
  29611. * _.isSafeInteger(3);
  29612. * // => true
  29613. *
  29614. * _.isSafeInteger(Number.MIN_VALUE);
  29615. * // => false
  29616. *
  29617. * _.isSafeInteger(Infinity);
  29618. * // => false
  29619. *
  29620. * _.isSafeInteger('3');
  29621. * // => false
  29622. */
  29623. function isSafeInteger(value) {
  29624. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29625. }
  29626. /**
  29627. * Checks if `value` is classified as a `Set` object.
  29628. *
  29629. * @static
  29630. * @memberOf _
  29631. * @since 4.3.0
  29632. * @category Lang
  29633. * @param {*} value The value to check.
  29634. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29635. * @example
  29636. *
  29637. * _.isSet(new Set);
  29638. * // => true
  29639. *
  29640. * _.isSet(new WeakSet);
  29641. * // => false
  29642. */
  29643. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29644. /**
  29645. * Checks if `value` is classified as a `String` primitive or object.
  29646. *
  29647. * @static
  29648. * @since 0.1.0
  29649. * @memberOf _
  29650. * @category Lang
  29651. * @param {*} value The value to check.
  29652. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29653. * @example
  29654. *
  29655. * _.isString('abc');
  29656. * // => true
  29657. *
  29658. * _.isString(1);
  29659. * // => false
  29660. */
  29661. function isString(value) {
  29662. return typeof value == 'string' ||
  29663. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29664. }
  29665. /**
  29666. * Checks if `value` is classified as a `Symbol` primitive or object.
  29667. *
  29668. * @static
  29669. * @memberOf _
  29670. * @since 4.0.0
  29671. * @category Lang
  29672. * @param {*} value The value to check.
  29673. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29674. * @example
  29675. *
  29676. * _.isSymbol(Symbol.iterator);
  29677. * // => true
  29678. *
  29679. * _.isSymbol('abc');
  29680. * // => false
  29681. */
  29682. function isSymbol(value) {
  29683. return typeof value == 'symbol' ||
  29684. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29685. }
  29686. /**
  29687. * Checks if `value` is classified as a typed array.
  29688. *
  29689. * @static
  29690. * @memberOf _
  29691. * @since 3.0.0
  29692. * @category Lang
  29693. * @param {*} value The value to check.
  29694. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29695. * @example
  29696. *
  29697. * _.isTypedArray(new Uint8Array);
  29698. * // => true
  29699. *
  29700. * _.isTypedArray([]);
  29701. * // => false
  29702. */
  29703. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29704. /**
  29705. * Checks if `value` is `undefined`.
  29706. *
  29707. * @static
  29708. * @since 0.1.0
  29709. * @memberOf _
  29710. * @category Lang
  29711. * @param {*} value The value to check.
  29712. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29713. * @example
  29714. *
  29715. * _.isUndefined(void 0);
  29716. * // => true
  29717. *
  29718. * _.isUndefined(null);
  29719. * // => false
  29720. */
  29721. function isUndefined(value) {
  29722. return value === undefined;
  29723. }
  29724. /**
  29725. * Checks if `value` is classified as a `WeakMap` object.
  29726. *
  29727. * @static
  29728. * @memberOf _
  29729. * @since 4.3.0
  29730. * @category Lang
  29731. * @param {*} value The value to check.
  29732. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29733. * @example
  29734. *
  29735. * _.isWeakMap(new WeakMap);
  29736. * // => true
  29737. *
  29738. * _.isWeakMap(new Map);
  29739. * // => false
  29740. */
  29741. function isWeakMap(value) {
  29742. return isObjectLike(value) && getTag(value) == weakMapTag;
  29743. }
  29744. /**
  29745. * Checks if `value` is classified as a `WeakSet` object.
  29746. *
  29747. * @static
  29748. * @memberOf _
  29749. * @since 4.3.0
  29750. * @category Lang
  29751. * @param {*} value The value to check.
  29752. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29753. * @example
  29754. *
  29755. * _.isWeakSet(new WeakSet);
  29756. * // => true
  29757. *
  29758. * _.isWeakSet(new Set);
  29759. * // => false
  29760. */
  29761. function isWeakSet(value) {
  29762. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29763. }
  29764. /**
  29765. * Checks if `value` is less than `other`.
  29766. *
  29767. * @static
  29768. * @memberOf _
  29769. * @since 3.9.0
  29770. * @category Lang
  29771. * @param {*} value The value to compare.
  29772. * @param {*} other The other value to compare.
  29773. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29774. * else `false`.
  29775. * @see _.gt
  29776. * @example
  29777. *
  29778. * _.lt(1, 3);
  29779. * // => true
  29780. *
  29781. * _.lt(3, 3);
  29782. * // => false
  29783. *
  29784. * _.lt(3, 1);
  29785. * // => false
  29786. */
  29787. var lt = createRelationalOperation(baseLt);
  29788. /**
  29789. * Checks if `value` is less than or equal to `other`.
  29790. *
  29791. * @static
  29792. * @memberOf _
  29793. * @since 3.9.0
  29794. * @category Lang
  29795. * @param {*} value The value to compare.
  29796. * @param {*} other The other value to compare.
  29797. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29798. * `other`, else `false`.
  29799. * @see _.gte
  29800. * @example
  29801. *
  29802. * _.lte(1, 3);
  29803. * // => true
  29804. *
  29805. * _.lte(3, 3);
  29806. * // => true
  29807. *
  29808. * _.lte(3, 1);
  29809. * // => false
  29810. */
  29811. var lte = createRelationalOperation(function(value, other) {
  29812. return value <= other;
  29813. });
  29814. /**
  29815. * Converts `value` to an array.
  29816. *
  29817. * @static
  29818. * @since 0.1.0
  29819. * @memberOf _
  29820. * @category Lang
  29821. * @param {*} value The value to convert.
  29822. * @returns {Array} Returns the converted array.
  29823. * @example
  29824. *
  29825. * _.toArray({ 'a': 1, 'b': 2 });
  29826. * // => [1, 2]
  29827. *
  29828. * _.toArray('abc');
  29829. * // => ['a', 'b', 'c']
  29830. *
  29831. * _.toArray(1);
  29832. * // => []
  29833. *
  29834. * _.toArray(null);
  29835. * // => []
  29836. */
  29837. function toArray(value) {
  29838. if (!value) {
  29839. return [];
  29840. }
  29841. if (isArrayLike(value)) {
  29842. return isString(value) ? stringToArray(value) : copyArray(value);
  29843. }
  29844. if (symIterator && value[symIterator]) {
  29845. return iteratorToArray(value[symIterator]());
  29846. }
  29847. var tag = getTag(value),
  29848. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29849. return func(value);
  29850. }
  29851. /**
  29852. * Converts `value` to a finite number.
  29853. *
  29854. * @static
  29855. * @memberOf _
  29856. * @since 4.12.0
  29857. * @category Lang
  29858. * @param {*} value The value to convert.
  29859. * @returns {number} Returns the converted number.
  29860. * @example
  29861. *
  29862. * _.toFinite(3.2);
  29863. * // => 3.2
  29864. *
  29865. * _.toFinite(Number.MIN_VALUE);
  29866. * // => 5e-324
  29867. *
  29868. * _.toFinite(Infinity);
  29869. * // => 1.7976931348623157e+308
  29870. *
  29871. * _.toFinite('3.2');
  29872. * // => 3.2
  29873. */
  29874. function toFinite(value) {
  29875. if (!value) {
  29876. return value === 0 ? value : 0;
  29877. }
  29878. value = toNumber(value);
  29879. if (value === INFINITY || value === -INFINITY) {
  29880. var sign = (value < 0 ? -1 : 1);
  29881. return sign * MAX_INTEGER;
  29882. }
  29883. return value === value ? value : 0;
  29884. }
  29885. /**
  29886. * Converts `value` to an integer.
  29887. *
  29888. * **Note:** This method is loosely based on
  29889. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29890. *
  29891. * @static
  29892. * @memberOf _
  29893. * @since 4.0.0
  29894. * @category Lang
  29895. * @param {*} value The value to convert.
  29896. * @returns {number} Returns the converted integer.
  29897. * @example
  29898. *
  29899. * _.toInteger(3.2);
  29900. * // => 3
  29901. *
  29902. * _.toInteger(Number.MIN_VALUE);
  29903. * // => 0
  29904. *
  29905. * _.toInteger(Infinity);
  29906. * // => 1.7976931348623157e+308
  29907. *
  29908. * _.toInteger('3.2');
  29909. * // => 3
  29910. */
  29911. function toInteger(value) {
  29912. var result = toFinite(value),
  29913. remainder = result % 1;
  29914. return result === result ? (remainder ? result - remainder : result) : 0;
  29915. }
  29916. /**
  29917. * Converts `value` to an integer suitable for use as the length of an
  29918. * array-like object.
  29919. *
  29920. * **Note:** This method is based on
  29921. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29922. *
  29923. * @static
  29924. * @memberOf _
  29925. * @since 4.0.0
  29926. * @category Lang
  29927. * @param {*} value The value to convert.
  29928. * @returns {number} Returns the converted integer.
  29929. * @example
  29930. *
  29931. * _.toLength(3.2);
  29932. * // => 3
  29933. *
  29934. * _.toLength(Number.MIN_VALUE);
  29935. * // => 0
  29936. *
  29937. * _.toLength(Infinity);
  29938. * // => 4294967295
  29939. *
  29940. * _.toLength('3.2');
  29941. * // => 3
  29942. */
  29943. function toLength(value) {
  29944. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29945. }
  29946. /**
  29947. * Converts `value` to a number.
  29948. *
  29949. * @static
  29950. * @memberOf _
  29951. * @since 4.0.0
  29952. * @category Lang
  29953. * @param {*} value The value to process.
  29954. * @returns {number} Returns the number.
  29955. * @example
  29956. *
  29957. * _.toNumber(3.2);
  29958. * // => 3.2
  29959. *
  29960. * _.toNumber(Number.MIN_VALUE);
  29961. * // => 5e-324
  29962. *
  29963. * _.toNumber(Infinity);
  29964. * // => Infinity
  29965. *
  29966. * _.toNumber('3.2');
  29967. * // => 3.2
  29968. */
  29969. function toNumber(value) {
  29970. if (typeof value == 'number') {
  29971. return value;
  29972. }
  29973. if (isSymbol(value)) {
  29974. return NAN;
  29975. }
  29976. if (isObject(value)) {
  29977. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29978. value = isObject(other) ? (other + '') : other;
  29979. }
  29980. if (typeof value != 'string') {
  29981. return value === 0 ? value : +value;
  29982. }
  29983. value = value.replace(reTrim, '');
  29984. var isBinary = reIsBinary.test(value);
  29985. return (isBinary || reIsOctal.test(value))
  29986. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29987. : (reIsBadHex.test(value) ? NAN : +value);
  29988. }
  29989. /**
  29990. * Converts `value` to a plain object flattening inherited enumerable string
  29991. * keyed properties of `value` to own properties of the plain object.
  29992. *
  29993. * @static
  29994. * @memberOf _
  29995. * @since 3.0.0
  29996. * @category Lang
  29997. * @param {*} value The value to convert.
  29998. * @returns {Object} Returns the converted plain object.
  29999. * @example
  30000. *
  30001. * function Foo() {
  30002. * this.b = 2;
  30003. * }
  30004. *
  30005. * Foo.prototype.c = 3;
  30006. *
  30007. * _.assign({ 'a': 1 }, new Foo);
  30008. * // => { 'a': 1, 'b': 2 }
  30009. *
  30010. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30011. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30012. */
  30013. function toPlainObject(value) {
  30014. return copyObject(value, keysIn(value));
  30015. }
  30016. /**
  30017. * Converts `value` to a safe integer. A safe integer can be compared and
  30018. * represented correctly.
  30019. *
  30020. * @static
  30021. * @memberOf _
  30022. * @since 4.0.0
  30023. * @category Lang
  30024. * @param {*} value The value to convert.
  30025. * @returns {number} Returns the converted integer.
  30026. * @example
  30027. *
  30028. * _.toSafeInteger(3.2);
  30029. * // => 3
  30030. *
  30031. * _.toSafeInteger(Number.MIN_VALUE);
  30032. * // => 0
  30033. *
  30034. * _.toSafeInteger(Infinity);
  30035. * // => 9007199254740991
  30036. *
  30037. * _.toSafeInteger('3.2');
  30038. * // => 3
  30039. */
  30040. function toSafeInteger(value) {
  30041. return value
  30042. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30043. : (value === 0 ? value : 0);
  30044. }
  30045. /**
  30046. * Converts `value` to a string. An empty string is returned for `null`
  30047. * and `undefined` values. The sign of `-0` is preserved.
  30048. *
  30049. * @static
  30050. * @memberOf _
  30051. * @since 4.0.0
  30052. * @category Lang
  30053. * @param {*} value The value to convert.
  30054. * @returns {string} Returns the converted string.
  30055. * @example
  30056. *
  30057. * _.toString(null);
  30058. * // => ''
  30059. *
  30060. * _.toString(-0);
  30061. * // => '-0'
  30062. *
  30063. * _.toString([1, 2, 3]);
  30064. * // => '1,2,3'
  30065. */
  30066. function toString(value) {
  30067. return value == null ? '' : baseToString(value);
  30068. }
  30069. /*------------------------------------------------------------------------*/
  30070. /**
  30071. * Assigns own enumerable string keyed properties of source objects to the
  30072. * destination object. Source objects are applied from left to right.
  30073. * Subsequent sources overwrite property assignments of previous sources.
  30074. *
  30075. * **Note:** This method mutates `object` and is loosely based on
  30076. * [`Object.assign`](https://mdn.io/Object/assign).
  30077. *
  30078. * @static
  30079. * @memberOf _
  30080. * @since 0.10.0
  30081. * @category Object
  30082. * @param {Object} object The destination object.
  30083. * @param {...Object} [sources] The source objects.
  30084. * @returns {Object} Returns `object`.
  30085. * @see _.assignIn
  30086. * @example
  30087. *
  30088. * function Foo() {
  30089. * this.a = 1;
  30090. * }
  30091. *
  30092. * function Bar() {
  30093. * this.c = 3;
  30094. * }
  30095. *
  30096. * Foo.prototype.b = 2;
  30097. * Bar.prototype.d = 4;
  30098. *
  30099. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30100. * // => { 'a': 1, 'c': 3 }
  30101. */
  30102. var assign = createAssigner(function(object, source) {
  30103. if (isPrototype(source) || isArrayLike(source)) {
  30104. copyObject(source, keys(source), object);
  30105. return;
  30106. }
  30107. for (var key in source) {
  30108. if (hasOwnProperty.call(source, key)) {
  30109. assignValue(object, key, source[key]);
  30110. }
  30111. }
  30112. });
  30113. /**
  30114. * This method is like `_.assign` except that it iterates over own and
  30115. * inherited source properties.
  30116. *
  30117. * **Note:** This method mutates `object`.
  30118. *
  30119. * @static
  30120. * @memberOf _
  30121. * @since 4.0.0
  30122. * @alias extend
  30123. * @category Object
  30124. * @param {Object} object The destination object.
  30125. * @param {...Object} [sources] The source objects.
  30126. * @returns {Object} Returns `object`.
  30127. * @see _.assign
  30128. * @example
  30129. *
  30130. * function Foo() {
  30131. * this.a = 1;
  30132. * }
  30133. *
  30134. * function Bar() {
  30135. * this.c = 3;
  30136. * }
  30137. *
  30138. * Foo.prototype.b = 2;
  30139. * Bar.prototype.d = 4;
  30140. *
  30141. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30142. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30143. */
  30144. var assignIn = createAssigner(function(object, source) {
  30145. copyObject(source, keysIn(source), object);
  30146. });
  30147. /**
  30148. * This method is like `_.assignIn` except that it accepts `customizer`
  30149. * which is invoked to produce the assigned values. If `customizer` returns
  30150. * `undefined`, assignment is handled by the method instead. The `customizer`
  30151. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30152. *
  30153. * **Note:** This method mutates `object`.
  30154. *
  30155. * @static
  30156. * @memberOf _
  30157. * @since 4.0.0
  30158. * @alias extendWith
  30159. * @category Object
  30160. * @param {Object} object The destination object.
  30161. * @param {...Object} sources The source objects.
  30162. * @param {Function} [customizer] The function to customize assigned values.
  30163. * @returns {Object} Returns `object`.
  30164. * @see _.assignWith
  30165. * @example
  30166. *
  30167. * function customizer(objValue, srcValue) {
  30168. * return _.isUndefined(objValue) ? srcValue : objValue;
  30169. * }
  30170. *
  30171. * var defaults = _.partialRight(_.assignInWith, customizer);
  30172. *
  30173. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30174. * // => { 'a': 1, 'b': 2 }
  30175. */
  30176. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30177. copyObject(source, keysIn(source), object, customizer);
  30178. });
  30179. /**
  30180. * This method is like `_.assign` except that it accepts `customizer`
  30181. * which is invoked to produce the assigned values. If `customizer` returns
  30182. * `undefined`, assignment is handled by the method instead. The `customizer`
  30183. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30184. *
  30185. * **Note:** This method mutates `object`.
  30186. *
  30187. * @static
  30188. * @memberOf _
  30189. * @since 4.0.0
  30190. * @category Object
  30191. * @param {Object} object The destination object.
  30192. * @param {...Object} sources The source objects.
  30193. * @param {Function} [customizer] The function to customize assigned values.
  30194. * @returns {Object} Returns `object`.
  30195. * @see _.assignInWith
  30196. * @example
  30197. *
  30198. * function customizer(objValue, srcValue) {
  30199. * return _.isUndefined(objValue) ? srcValue : objValue;
  30200. * }
  30201. *
  30202. * var defaults = _.partialRight(_.assignWith, customizer);
  30203. *
  30204. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30205. * // => { 'a': 1, 'b': 2 }
  30206. */
  30207. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30208. copyObject(source, keys(source), object, customizer);
  30209. });
  30210. /**
  30211. * Creates an array of values corresponding to `paths` of `object`.
  30212. *
  30213. * @static
  30214. * @memberOf _
  30215. * @since 1.0.0
  30216. * @category Object
  30217. * @param {Object} object The object to iterate over.
  30218. * @param {...(string|string[])} [paths] The property paths to pick.
  30219. * @returns {Array} Returns the picked values.
  30220. * @example
  30221. *
  30222. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30223. *
  30224. * _.at(object, ['a[0].b.c', 'a[1]']);
  30225. * // => [3, 4]
  30226. */
  30227. var at = flatRest(baseAt);
  30228. /**
  30229. * Creates an object that inherits from the `prototype` object. If a
  30230. * `properties` object is given, its own enumerable string keyed properties
  30231. * are assigned to the created object.
  30232. *
  30233. * @static
  30234. * @memberOf _
  30235. * @since 2.3.0
  30236. * @category Object
  30237. * @param {Object} prototype The object to inherit from.
  30238. * @param {Object} [properties] The properties to assign to the object.
  30239. * @returns {Object} Returns the new object.
  30240. * @example
  30241. *
  30242. * function Shape() {
  30243. * this.x = 0;
  30244. * this.y = 0;
  30245. * }
  30246. *
  30247. * function Circle() {
  30248. * Shape.call(this);
  30249. * }
  30250. *
  30251. * Circle.prototype = _.create(Shape.prototype, {
  30252. * 'constructor': Circle
  30253. * });
  30254. *
  30255. * var circle = new Circle;
  30256. * circle instanceof Circle;
  30257. * // => true
  30258. *
  30259. * circle instanceof Shape;
  30260. * // => true
  30261. */
  30262. function create(prototype, properties) {
  30263. var result = baseCreate(prototype);
  30264. return properties == null ? result : baseAssign(result, properties);
  30265. }
  30266. /**
  30267. * Assigns own and inherited enumerable string keyed properties of source
  30268. * objects to the destination object for all destination properties that
  30269. * resolve to `undefined`. Source objects are applied from left to right.
  30270. * Once a property is set, additional values of the same property are ignored.
  30271. *
  30272. * **Note:** This method mutates `object`.
  30273. *
  30274. * @static
  30275. * @since 0.1.0
  30276. * @memberOf _
  30277. * @category Object
  30278. * @param {Object} object The destination object.
  30279. * @param {...Object} [sources] The source objects.
  30280. * @returns {Object} Returns `object`.
  30281. * @see _.defaultsDeep
  30282. * @example
  30283. *
  30284. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30285. * // => { 'a': 1, 'b': 2 }
  30286. */
  30287. var defaults = baseRest(function(object, sources) {
  30288. object = Object(object);
  30289. var index = -1;
  30290. var length = sources.length;
  30291. var guard = length > 2 ? sources[2] : undefined;
  30292. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30293. length = 1;
  30294. }
  30295. while (++index < length) {
  30296. var source = sources[index];
  30297. var props = keysIn(source);
  30298. var propsIndex = -1;
  30299. var propsLength = props.length;
  30300. while (++propsIndex < propsLength) {
  30301. var key = props[propsIndex];
  30302. var value = object[key];
  30303. if (value === undefined ||
  30304. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30305. object[key] = source[key];
  30306. }
  30307. }
  30308. }
  30309. return object;
  30310. });
  30311. /**
  30312. * This method is like `_.defaults` except that it recursively assigns
  30313. * default properties.
  30314. *
  30315. * **Note:** This method mutates `object`.
  30316. *
  30317. * @static
  30318. * @memberOf _
  30319. * @since 3.10.0
  30320. * @category Object
  30321. * @param {Object} object The destination object.
  30322. * @param {...Object} [sources] The source objects.
  30323. * @returns {Object} Returns `object`.
  30324. * @see _.defaults
  30325. * @example
  30326. *
  30327. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30328. * // => { 'a': { 'b': 2, 'c': 3 } }
  30329. */
  30330. var defaultsDeep = baseRest(function(args) {
  30331. args.push(undefined, customDefaultsMerge);
  30332. return apply(mergeWith, undefined, args);
  30333. });
  30334. /**
  30335. * This method is like `_.find` except that it returns the key of the first
  30336. * element `predicate` returns truthy for instead of the element itself.
  30337. *
  30338. * @static
  30339. * @memberOf _
  30340. * @since 1.1.0
  30341. * @category Object
  30342. * @param {Object} object The object to inspect.
  30343. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30344. * @returns {string|undefined} Returns the key of the matched element,
  30345. * else `undefined`.
  30346. * @example
  30347. *
  30348. * var users = {
  30349. * 'barney': { 'age': 36, 'active': true },
  30350. * 'fred': { 'age': 40, 'active': false },
  30351. * 'pebbles': { 'age': 1, 'active': true }
  30352. * };
  30353. *
  30354. * _.findKey(users, function(o) { return o.age < 40; });
  30355. * // => 'barney' (iteration order is not guaranteed)
  30356. *
  30357. * // The `_.matches` iteratee shorthand.
  30358. * _.findKey(users, { 'age': 1, 'active': true });
  30359. * // => 'pebbles'
  30360. *
  30361. * // The `_.matchesProperty` iteratee shorthand.
  30362. * _.findKey(users, ['active', false]);
  30363. * // => 'fred'
  30364. *
  30365. * // The `_.property` iteratee shorthand.
  30366. * _.findKey(users, 'active');
  30367. * // => 'barney'
  30368. */
  30369. function findKey(object, predicate) {
  30370. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30371. }
  30372. /**
  30373. * This method is like `_.findKey` except that it iterates over elements of
  30374. * a collection in the opposite order.
  30375. *
  30376. * @static
  30377. * @memberOf _
  30378. * @since 2.0.0
  30379. * @category Object
  30380. * @param {Object} object The object to inspect.
  30381. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30382. * @returns {string|undefined} Returns the key of the matched element,
  30383. * else `undefined`.
  30384. * @example
  30385. *
  30386. * var users = {
  30387. * 'barney': { 'age': 36, 'active': true },
  30388. * 'fred': { 'age': 40, 'active': false },
  30389. * 'pebbles': { 'age': 1, 'active': true }
  30390. * };
  30391. *
  30392. * _.findLastKey(users, function(o) { return o.age < 40; });
  30393. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30394. *
  30395. * // The `_.matches` iteratee shorthand.
  30396. * _.findLastKey(users, { 'age': 36, 'active': true });
  30397. * // => 'barney'
  30398. *
  30399. * // The `_.matchesProperty` iteratee shorthand.
  30400. * _.findLastKey(users, ['active', false]);
  30401. * // => 'fred'
  30402. *
  30403. * // The `_.property` iteratee shorthand.
  30404. * _.findLastKey(users, 'active');
  30405. * // => 'pebbles'
  30406. */
  30407. function findLastKey(object, predicate) {
  30408. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30409. }
  30410. /**
  30411. * Iterates over own and inherited enumerable string keyed properties of an
  30412. * object and invokes `iteratee` for each property. The iteratee is invoked
  30413. * with three arguments: (value, key, object). Iteratee functions may exit
  30414. * iteration early by explicitly returning `false`.
  30415. *
  30416. * @static
  30417. * @memberOf _
  30418. * @since 0.3.0
  30419. * @category Object
  30420. * @param {Object} object The object to iterate over.
  30421. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30422. * @returns {Object} Returns `object`.
  30423. * @see _.forInRight
  30424. * @example
  30425. *
  30426. * function Foo() {
  30427. * this.a = 1;
  30428. * this.b = 2;
  30429. * }
  30430. *
  30431. * Foo.prototype.c = 3;
  30432. *
  30433. * _.forIn(new Foo, function(value, key) {
  30434. * console.log(key);
  30435. * });
  30436. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30437. */
  30438. function forIn(object, iteratee) {
  30439. return object == null
  30440. ? object
  30441. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30442. }
  30443. /**
  30444. * This method is like `_.forIn` except that it iterates over properties of
  30445. * `object` in the opposite order.
  30446. *
  30447. * @static
  30448. * @memberOf _
  30449. * @since 2.0.0
  30450. * @category Object
  30451. * @param {Object} object The object to iterate over.
  30452. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30453. * @returns {Object} Returns `object`.
  30454. * @see _.forIn
  30455. * @example
  30456. *
  30457. * function Foo() {
  30458. * this.a = 1;
  30459. * this.b = 2;
  30460. * }
  30461. *
  30462. * Foo.prototype.c = 3;
  30463. *
  30464. * _.forInRight(new Foo, function(value, key) {
  30465. * console.log(key);
  30466. * });
  30467. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30468. */
  30469. function forInRight(object, iteratee) {
  30470. return object == null
  30471. ? object
  30472. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30473. }
  30474. /**
  30475. * Iterates over own enumerable string keyed properties of an object and
  30476. * invokes `iteratee` for each property. The iteratee is invoked with three
  30477. * arguments: (value, key, object). Iteratee functions may exit iteration
  30478. * early by explicitly returning `false`.
  30479. *
  30480. * @static
  30481. * @memberOf _
  30482. * @since 0.3.0
  30483. * @category Object
  30484. * @param {Object} object The object to iterate over.
  30485. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30486. * @returns {Object} Returns `object`.
  30487. * @see _.forOwnRight
  30488. * @example
  30489. *
  30490. * function Foo() {
  30491. * this.a = 1;
  30492. * this.b = 2;
  30493. * }
  30494. *
  30495. * Foo.prototype.c = 3;
  30496. *
  30497. * _.forOwn(new Foo, function(value, key) {
  30498. * console.log(key);
  30499. * });
  30500. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30501. */
  30502. function forOwn(object, iteratee) {
  30503. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30504. }
  30505. /**
  30506. * This method is like `_.forOwn` except that it iterates over properties of
  30507. * `object` in the opposite order.
  30508. *
  30509. * @static
  30510. * @memberOf _
  30511. * @since 2.0.0
  30512. * @category Object
  30513. * @param {Object} object The object to iterate over.
  30514. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30515. * @returns {Object} Returns `object`.
  30516. * @see _.forOwn
  30517. * @example
  30518. *
  30519. * function Foo() {
  30520. * this.a = 1;
  30521. * this.b = 2;
  30522. * }
  30523. *
  30524. * Foo.prototype.c = 3;
  30525. *
  30526. * _.forOwnRight(new Foo, function(value, key) {
  30527. * console.log(key);
  30528. * });
  30529. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30530. */
  30531. function forOwnRight(object, iteratee) {
  30532. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30533. }
  30534. /**
  30535. * Creates an array of function property names from own enumerable properties
  30536. * of `object`.
  30537. *
  30538. * @static
  30539. * @since 0.1.0
  30540. * @memberOf _
  30541. * @category Object
  30542. * @param {Object} object The object to inspect.
  30543. * @returns {Array} Returns the function names.
  30544. * @see _.functionsIn
  30545. * @example
  30546. *
  30547. * function Foo() {
  30548. * this.a = _.constant('a');
  30549. * this.b = _.constant('b');
  30550. * }
  30551. *
  30552. * Foo.prototype.c = _.constant('c');
  30553. *
  30554. * _.functions(new Foo);
  30555. * // => ['a', 'b']
  30556. */
  30557. function functions(object) {
  30558. return object == null ? [] : baseFunctions(object, keys(object));
  30559. }
  30560. /**
  30561. * Creates an array of function property names from own and inherited
  30562. * enumerable properties of `object`.
  30563. *
  30564. * @static
  30565. * @memberOf _
  30566. * @since 4.0.0
  30567. * @category Object
  30568. * @param {Object} object The object to inspect.
  30569. * @returns {Array} Returns the function names.
  30570. * @see _.functions
  30571. * @example
  30572. *
  30573. * function Foo() {
  30574. * this.a = _.constant('a');
  30575. * this.b = _.constant('b');
  30576. * }
  30577. *
  30578. * Foo.prototype.c = _.constant('c');
  30579. *
  30580. * _.functionsIn(new Foo);
  30581. * // => ['a', 'b', 'c']
  30582. */
  30583. function functionsIn(object) {
  30584. return object == null ? [] : baseFunctions(object, keysIn(object));
  30585. }
  30586. /**
  30587. * Gets the value at `path` of `object`. If the resolved value is
  30588. * `undefined`, the `defaultValue` is returned in its place.
  30589. *
  30590. * @static
  30591. * @memberOf _
  30592. * @since 3.7.0
  30593. * @category Object
  30594. * @param {Object} object The object to query.
  30595. * @param {Array|string} path The path of the property to get.
  30596. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30597. * @returns {*} Returns the resolved value.
  30598. * @example
  30599. *
  30600. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30601. *
  30602. * _.get(object, 'a[0].b.c');
  30603. * // => 3
  30604. *
  30605. * _.get(object, ['a', '0', 'b', 'c']);
  30606. * // => 3
  30607. *
  30608. * _.get(object, 'a.b.c', 'default');
  30609. * // => 'default'
  30610. */
  30611. function get(object, path, defaultValue) {
  30612. var result = object == null ? undefined : baseGet(object, path);
  30613. return result === undefined ? defaultValue : result;
  30614. }
  30615. /**
  30616. * Checks if `path` is a direct property of `object`.
  30617. *
  30618. * @static
  30619. * @since 0.1.0
  30620. * @memberOf _
  30621. * @category Object
  30622. * @param {Object} object The object to query.
  30623. * @param {Array|string} path The path to check.
  30624. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30625. * @example
  30626. *
  30627. * var object = { 'a': { 'b': 2 } };
  30628. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30629. *
  30630. * _.has(object, 'a');
  30631. * // => true
  30632. *
  30633. * _.has(object, 'a.b');
  30634. * // => true
  30635. *
  30636. * _.has(object, ['a', 'b']);
  30637. * // => true
  30638. *
  30639. * _.has(other, 'a');
  30640. * // => false
  30641. */
  30642. function has(object, path) {
  30643. return object != null && hasPath(object, path, baseHas);
  30644. }
  30645. /**
  30646. * Checks if `path` is a direct or inherited property of `object`.
  30647. *
  30648. * @static
  30649. * @memberOf _
  30650. * @since 4.0.0
  30651. * @category Object
  30652. * @param {Object} object The object to query.
  30653. * @param {Array|string} path The path to check.
  30654. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30655. * @example
  30656. *
  30657. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30658. *
  30659. * _.hasIn(object, 'a');
  30660. * // => true
  30661. *
  30662. * _.hasIn(object, 'a.b');
  30663. * // => true
  30664. *
  30665. * _.hasIn(object, ['a', 'b']);
  30666. * // => true
  30667. *
  30668. * _.hasIn(object, 'b');
  30669. * // => false
  30670. */
  30671. function hasIn(object, path) {
  30672. return object != null && hasPath(object, path, baseHasIn);
  30673. }
  30674. /**
  30675. * Creates an object composed of the inverted keys and values of `object`.
  30676. * If `object` contains duplicate values, subsequent values overwrite
  30677. * property assignments of previous values.
  30678. *
  30679. * @static
  30680. * @memberOf _
  30681. * @since 0.7.0
  30682. * @category Object
  30683. * @param {Object} object The object to invert.
  30684. * @returns {Object} Returns the new inverted object.
  30685. * @example
  30686. *
  30687. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30688. *
  30689. * _.invert(object);
  30690. * // => { '1': 'c', '2': 'b' }
  30691. */
  30692. var invert = createInverter(function(result, value, key) {
  30693. if (value != null &&
  30694. typeof value.toString != 'function') {
  30695. value = nativeObjectToString.call(value);
  30696. }
  30697. result[value] = key;
  30698. }, constant(identity));
  30699. /**
  30700. * This method is like `_.invert` except that the inverted object is generated
  30701. * from the results of running each element of `object` thru `iteratee`. The
  30702. * corresponding inverted value of each inverted key is an array of keys
  30703. * responsible for generating the inverted value. The iteratee is invoked
  30704. * with one argument: (value).
  30705. *
  30706. * @static
  30707. * @memberOf _
  30708. * @since 4.1.0
  30709. * @category Object
  30710. * @param {Object} object The object to invert.
  30711. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30712. * @returns {Object} Returns the new inverted object.
  30713. * @example
  30714. *
  30715. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30716. *
  30717. * _.invertBy(object);
  30718. * // => { '1': ['a', 'c'], '2': ['b'] }
  30719. *
  30720. * _.invertBy(object, function(value) {
  30721. * return 'group' + value;
  30722. * });
  30723. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30724. */
  30725. var invertBy = createInverter(function(result, value, key) {
  30726. if (value != null &&
  30727. typeof value.toString != 'function') {
  30728. value = nativeObjectToString.call(value);
  30729. }
  30730. if (hasOwnProperty.call(result, value)) {
  30731. result[value].push(key);
  30732. } else {
  30733. result[value] = [key];
  30734. }
  30735. }, getIteratee);
  30736. /**
  30737. * Invokes the method at `path` of `object`.
  30738. *
  30739. * @static
  30740. * @memberOf _
  30741. * @since 4.0.0
  30742. * @category Object
  30743. * @param {Object} object The object to query.
  30744. * @param {Array|string} path The path of the method to invoke.
  30745. * @param {...*} [args] The arguments to invoke the method with.
  30746. * @returns {*} Returns the result of the invoked method.
  30747. * @example
  30748. *
  30749. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30750. *
  30751. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30752. * // => [2, 3]
  30753. */
  30754. var invoke = baseRest(baseInvoke);
  30755. /**
  30756. * Creates an array of the own enumerable property names of `object`.
  30757. *
  30758. * **Note:** Non-object values are coerced to objects. See the
  30759. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30760. * for more details.
  30761. *
  30762. * @static
  30763. * @since 0.1.0
  30764. * @memberOf _
  30765. * @category Object
  30766. * @param {Object} object The object to query.
  30767. * @returns {Array} Returns the array of property names.
  30768. * @example
  30769. *
  30770. * function Foo() {
  30771. * this.a = 1;
  30772. * this.b = 2;
  30773. * }
  30774. *
  30775. * Foo.prototype.c = 3;
  30776. *
  30777. * _.keys(new Foo);
  30778. * // => ['a', 'b'] (iteration order is not guaranteed)
  30779. *
  30780. * _.keys('hi');
  30781. * // => ['0', '1']
  30782. */
  30783. function keys(object) {
  30784. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30785. }
  30786. /**
  30787. * Creates an array of the own and inherited enumerable property names of `object`.
  30788. *
  30789. * **Note:** Non-object values are coerced to objects.
  30790. *
  30791. * @static
  30792. * @memberOf _
  30793. * @since 3.0.0
  30794. * @category Object
  30795. * @param {Object} object The object to query.
  30796. * @returns {Array} Returns the array of property names.
  30797. * @example
  30798. *
  30799. * function Foo() {
  30800. * this.a = 1;
  30801. * this.b = 2;
  30802. * }
  30803. *
  30804. * Foo.prototype.c = 3;
  30805. *
  30806. * _.keysIn(new Foo);
  30807. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30808. */
  30809. function keysIn(object) {
  30810. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30811. }
  30812. /**
  30813. * The opposite of `_.mapValues`; this method creates an object with the
  30814. * same values as `object` and keys generated by running each own enumerable
  30815. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30816. * with three arguments: (value, key, object).
  30817. *
  30818. * @static
  30819. * @memberOf _
  30820. * @since 3.8.0
  30821. * @category Object
  30822. * @param {Object} object The object to iterate over.
  30823. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30824. * @returns {Object} Returns the new mapped object.
  30825. * @see _.mapValues
  30826. * @example
  30827. *
  30828. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30829. * return key + value;
  30830. * });
  30831. * // => { 'a1': 1, 'b2': 2 }
  30832. */
  30833. function mapKeys(object, iteratee) {
  30834. var result = {};
  30835. iteratee = getIteratee(iteratee, 3);
  30836. baseForOwn(object, function(value, key, object) {
  30837. baseAssignValue(result, iteratee(value, key, object), value);
  30838. });
  30839. return result;
  30840. }
  30841. /**
  30842. * Creates an object with the same keys as `object` and values generated
  30843. * by running each own enumerable string keyed property of `object` thru
  30844. * `iteratee`. The iteratee is invoked with three arguments:
  30845. * (value, key, object).
  30846. *
  30847. * @static
  30848. * @memberOf _
  30849. * @since 2.4.0
  30850. * @category Object
  30851. * @param {Object} object The object to iterate over.
  30852. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30853. * @returns {Object} Returns the new mapped object.
  30854. * @see _.mapKeys
  30855. * @example
  30856. *
  30857. * var users = {
  30858. * 'fred': { 'user': 'fred', 'age': 40 },
  30859. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30860. * };
  30861. *
  30862. * _.mapValues(users, function(o) { return o.age; });
  30863. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30864. *
  30865. * // The `_.property` iteratee shorthand.
  30866. * _.mapValues(users, 'age');
  30867. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30868. */
  30869. function mapValues(object, iteratee) {
  30870. var result = {};
  30871. iteratee = getIteratee(iteratee, 3);
  30872. baseForOwn(object, function(value, key, object) {
  30873. baseAssignValue(result, key, iteratee(value, key, object));
  30874. });
  30875. return result;
  30876. }
  30877. /**
  30878. * This method is like `_.assign` except that it recursively merges own and
  30879. * inherited enumerable string keyed properties of source objects into the
  30880. * destination object. Source properties that resolve to `undefined` are
  30881. * skipped if a destination value exists. Array and plain object properties
  30882. * are merged recursively. Other objects and value types are overridden by
  30883. * assignment. Source objects are applied from left to right. Subsequent
  30884. * sources overwrite property assignments of previous sources.
  30885. *
  30886. * **Note:** This method mutates `object`.
  30887. *
  30888. * @static
  30889. * @memberOf _
  30890. * @since 0.5.0
  30891. * @category Object
  30892. * @param {Object} object The destination object.
  30893. * @param {...Object} [sources] The source objects.
  30894. * @returns {Object} Returns `object`.
  30895. * @example
  30896. *
  30897. * var object = {
  30898. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30899. * };
  30900. *
  30901. * var other = {
  30902. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30903. * };
  30904. *
  30905. * _.merge(object, other);
  30906. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30907. */
  30908. var merge = createAssigner(function(object, source, srcIndex) {
  30909. baseMerge(object, source, srcIndex);
  30910. });
  30911. /**
  30912. * This method is like `_.merge` except that it accepts `customizer` which
  30913. * is invoked to produce the merged values of the destination and source
  30914. * properties. If `customizer` returns `undefined`, merging is handled by the
  30915. * method instead. The `customizer` is invoked with six arguments:
  30916. * (objValue, srcValue, key, object, source, stack).
  30917. *
  30918. * **Note:** This method mutates `object`.
  30919. *
  30920. * @static
  30921. * @memberOf _
  30922. * @since 4.0.0
  30923. * @category Object
  30924. * @param {Object} object The destination object.
  30925. * @param {...Object} sources The source objects.
  30926. * @param {Function} customizer The function to customize assigned values.
  30927. * @returns {Object} Returns `object`.
  30928. * @example
  30929. *
  30930. * function customizer(objValue, srcValue) {
  30931. * if (_.isArray(objValue)) {
  30932. * return objValue.concat(srcValue);
  30933. * }
  30934. * }
  30935. *
  30936. * var object = { 'a': [1], 'b': [2] };
  30937. * var other = { 'a': [3], 'b': [4] };
  30938. *
  30939. * _.mergeWith(object, other, customizer);
  30940. * // => { 'a': [1, 3], 'b': [2, 4] }
  30941. */
  30942. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30943. baseMerge(object, source, srcIndex, customizer);
  30944. });
  30945. /**
  30946. * The opposite of `_.pick`; this method creates an object composed of the
  30947. * own and inherited enumerable property paths of `object` that are not omitted.
  30948. *
  30949. * **Note:** This method is considerably slower than `_.pick`.
  30950. *
  30951. * @static
  30952. * @since 0.1.0
  30953. * @memberOf _
  30954. * @category Object
  30955. * @param {Object} object The source object.
  30956. * @param {...(string|string[])} [paths] The property paths to omit.
  30957. * @returns {Object} Returns the new object.
  30958. * @example
  30959. *
  30960. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30961. *
  30962. * _.omit(object, ['a', 'c']);
  30963. * // => { 'b': '2' }
  30964. */
  30965. var omit = flatRest(function(object, paths) {
  30966. var result = {};
  30967. if (object == null) {
  30968. return result;
  30969. }
  30970. var isDeep = false;
  30971. paths = arrayMap(paths, function(path) {
  30972. path = castPath(path, object);
  30973. isDeep || (isDeep = path.length > 1);
  30974. return path;
  30975. });
  30976. copyObject(object, getAllKeysIn(object), result);
  30977. if (isDeep) {
  30978. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30979. }
  30980. var length = paths.length;
  30981. while (length--) {
  30982. baseUnset(result, paths[length]);
  30983. }
  30984. return result;
  30985. });
  30986. /**
  30987. * The opposite of `_.pickBy`; this method creates an object composed of
  30988. * the own and inherited enumerable string keyed properties of `object` that
  30989. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30990. * arguments: (value, key).
  30991. *
  30992. * @static
  30993. * @memberOf _
  30994. * @since 4.0.0
  30995. * @category Object
  30996. * @param {Object} object The source object.
  30997. * @param {Function} [predicate=_.identity] The function invoked per property.
  30998. * @returns {Object} Returns the new object.
  30999. * @example
  31000. *
  31001. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31002. *
  31003. * _.omitBy(object, _.isNumber);
  31004. * // => { 'b': '2' }
  31005. */
  31006. function omitBy(object, predicate) {
  31007. return pickBy(object, negate(getIteratee(predicate)));
  31008. }
  31009. /**
  31010. * Creates an object composed of the picked `object` properties.
  31011. *
  31012. * @static
  31013. * @since 0.1.0
  31014. * @memberOf _
  31015. * @category Object
  31016. * @param {Object} object The source object.
  31017. * @param {...(string|string[])} [paths] The property paths to pick.
  31018. * @returns {Object} Returns the new object.
  31019. * @example
  31020. *
  31021. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31022. *
  31023. * _.pick(object, ['a', 'c']);
  31024. * // => { 'a': 1, 'c': 3 }
  31025. */
  31026. var pick = flatRest(function(object, paths) {
  31027. return object == null ? {} : basePick(object, paths);
  31028. });
  31029. /**
  31030. * Creates an object composed of the `object` properties `predicate` returns
  31031. * truthy for. The predicate is invoked with two arguments: (value, key).
  31032. *
  31033. * @static
  31034. * @memberOf _
  31035. * @since 4.0.0
  31036. * @category Object
  31037. * @param {Object} object The source object.
  31038. * @param {Function} [predicate=_.identity] The function invoked per property.
  31039. * @returns {Object} Returns the new object.
  31040. * @example
  31041. *
  31042. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31043. *
  31044. * _.pickBy(object, _.isNumber);
  31045. * // => { 'a': 1, 'c': 3 }
  31046. */
  31047. function pickBy(object, predicate) {
  31048. if (object == null) {
  31049. return {};
  31050. }
  31051. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31052. return [prop];
  31053. });
  31054. predicate = getIteratee(predicate);
  31055. return basePickBy(object, props, function(value, path) {
  31056. return predicate(value, path[0]);
  31057. });
  31058. }
  31059. /**
  31060. * This method is like `_.get` except that if the resolved value is a
  31061. * function it's invoked with the `this` binding of its parent object and
  31062. * its result is returned.
  31063. *
  31064. * @static
  31065. * @since 0.1.0
  31066. * @memberOf _
  31067. * @category Object
  31068. * @param {Object} object The object to query.
  31069. * @param {Array|string} path The path of the property to resolve.
  31070. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31071. * @returns {*} Returns the resolved value.
  31072. * @example
  31073. *
  31074. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31075. *
  31076. * _.result(object, 'a[0].b.c1');
  31077. * // => 3
  31078. *
  31079. * _.result(object, 'a[0].b.c2');
  31080. * // => 4
  31081. *
  31082. * _.result(object, 'a[0].b.c3', 'default');
  31083. * // => 'default'
  31084. *
  31085. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31086. * // => 'default'
  31087. */
  31088. function result(object, path, defaultValue) {
  31089. path = castPath(path, object);
  31090. var index = -1,
  31091. length = path.length;
  31092. // Ensure the loop is entered when path is empty.
  31093. if (!length) {
  31094. length = 1;
  31095. object = undefined;
  31096. }
  31097. while (++index < length) {
  31098. var value = object == null ? undefined : object[toKey(path[index])];
  31099. if (value === undefined) {
  31100. index = length;
  31101. value = defaultValue;
  31102. }
  31103. object = isFunction(value) ? value.call(object) : value;
  31104. }
  31105. return object;
  31106. }
  31107. /**
  31108. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31109. * it's created. Arrays are created for missing index properties while objects
  31110. * are created for all other missing properties. Use `_.setWith` to customize
  31111. * `path` creation.
  31112. *
  31113. * **Note:** This method mutates `object`.
  31114. *
  31115. * @static
  31116. * @memberOf _
  31117. * @since 3.7.0
  31118. * @category Object
  31119. * @param {Object} object The object to modify.
  31120. * @param {Array|string} path The path of the property to set.
  31121. * @param {*} value The value to set.
  31122. * @returns {Object} Returns `object`.
  31123. * @example
  31124. *
  31125. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31126. *
  31127. * _.set(object, 'a[0].b.c', 4);
  31128. * console.log(object.a[0].b.c);
  31129. * // => 4
  31130. *
  31131. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31132. * console.log(object.x[0].y.z);
  31133. * // => 5
  31134. */
  31135. function set(object, path, value) {
  31136. return object == null ? object : baseSet(object, path, value);
  31137. }
  31138. /**
  31139. * This method is like `_.set` except that it accepts `customizer` which is
  31140. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31141. * path creation is handled by the method instead. The `customizer` is invoked
  31142. * with three arguments: (nsValue, key, nsObject).
  31143. *
  31144. * **Note:** This method mutates `object`.
  31145. *
  31146. * @static
  31147. * @memberOf _
  31148. * @since 4.0.0
  31149. * @category Object
  31150. * @param {Object} object The object to modify.
  31151. * @param {Array|string} path The path of the property to set.
  31152. * @param {*} value The value to set.
  31153. * @param {Function} [customizer] The function to customize assigned values.
  31154. * @returns {Object} Returns `object`.
  31155. * @example
  31156. *
  31157. * var object = {};
  31158. *
  31159. * _.setWith(object, '[0][1]', 'a', Object);
  31160. * // => { '0': { '1': 'a' } }
  31161. */
  31162. function setWith(object, path, value, customizer) {
  31163. customizer = typeof customizer == 'function' ? customizer : undefined;
  31164. return object == null ? object : baseSet(object, path, value, customizer);
  31165. }
  31166. /**
  31167. * Creates an array of own enumerable string keyed-value pairs for `object`
  31168. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31169. * entries are returned.
  31170. *
  31171. * @static
  31172. * @memberOf _
  31173. * @since 4.0.0
  31174. * @alias entries
  31175. * @category Object
  31176. * @param {Object} object The object to query.
  31177. * @returns {Array} Returns the key-value pairs.
  31178. * @example
  31179. *
  31180. * function Foo() {
  31181. * this.a = 1;
  31182. * this.b = 2;
  31183. * }
  31184. *
  31185. * Foo.prototype.c = 3;
  31186. *
  31187. * _.toPairs(new Foo);
  31188. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31189. */
  31190. var toPairs = createToPairs(keys);
  31191. /**
  31192. * Creates an array of own and inherited enumerable string keyed-value pairs
  31193. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31194. * or set, its entries are returned.
  31195. *
  31196. * @static
  31197. * @memberOf _
  31198. * @since 4.0.0
  31199. * @alias entriesIn
  31200. * @category Object
  31201. * @param {Object} object The object to query.
  31202. * @returns {Array} Returns the key-value pairs.
  31203. * @example
  31204. *
  31205. * function Foo() {
  31206. * this.a = 1;
  31207. * this.b = 2;
  31208. * }
  31209. *
  31210. * Foo.prototype.c = 3;
  31211. *
  31212. * _.toPairsIn(new Foo);
  31213. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31214. */
  31215. var toPairsIn = createToPairs(keysIn);
  31216. /**
  31217. * An alternative to `_.reduce`; this method transforms `object` to a new
  31218. * `accumulator` object which is the result of running each of its own
  31219. * enumerable string keyed properties thru `iteratee`, with each invocation
  31220. * potentially mutating the `accumulator` object. If `accumulator` is not
  31221. * provided, a new object with the same `[[Prototype]]` will be used. The
  31222. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31223. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31224. *
  31225. * @static
  31226. * @memberOf _
  31227. * @since 1.3.0
  31228. * @category Object
  31229. * @param {Object} object The object to iterate over.
  31230. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31231. * @param {*} [accumulator] The custom accumulator value.
  31232. * @returns {*} Returns the accumulated value.
  31233. * @example
  31234. *
  31235. * _.transform([2, 3, 4], function(result, n) {
  31236. * result.push(n *= n);
  31237. * return n % 2 == 0;
  31238. * }, []);
  31239. * // => [4, 9]
  31240. *
  31241. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31242. * (result[value] || (result[value] = [])).push(key);
  31243. * }, {});
  31244. * // => { '1': ['a', 'c'], '2': ['b'] }
  31245. */
  31246. function transform(object, iteratee, accumulator) {
  31247. var isArr = isArray(object),
  31248. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31249. iteratee = getIteratee(iteratee, 4);
  31250. if (accumulator == null) {
  31251. var Ctor = object && object.constructor;
  31252. if (isArrLike) {
  31253. accumulator = isArr ? new Ctor : [];
  31254. }
  31255. else if (isObject(object)) {
  31256. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31257. }
  31258. else {
  31259. accumulator = {};
  31260. }
  31261. }
  31262. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31263. return iteratee(accumulator, value, index, object);
  31264. });
  31265. return accumulator;
  31266. }
  31267. /**
  31268. * Removes the property at `path` of `object`.
  31269. *
  31270. * **Note:** This method mutates `object`.
  31271. *
  31272. * @static
  31273. * @memberOf _
  31274. * @since 4.0.0
  31275. * @category Object
  31276. * @param {Object} object The object to modify.
  31277. * @param {Array|string} path The path of the property to unset.
  31278. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31279. * @example
  31280. *
  31281. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31282. * _.unset(object, 'a[0].b.c');
  31283. * // => true
  31284. *
  31285. * console.log(object);
  31286. * // => { 'a': [{ 'b': {} }] };
  31287. *
  31288. * _.unset(object, ['a', '0', 'b', 'c']);
  31289. * // => true
  31290. *
  31291. * console.log(object);
  31292. * // => { 'a': [{ 'b': {} }] };
  31293. */
  31294. function unset(object, path) {
  31295. return object == null ? true : baseUnset(object, path);
  31296. }
  31297. /**
  31298. * This method is like `_.set` except that accepts `updater` to produce the
  31299. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31300. * is invoked with one argument: (value).
  31301. *
  31302. * **Note:** This method mutates `object`.
  31303. *
  31304. * @static
  31305. * @memberOf _
  31306. * @since 4.6.0
  31307. * @category Object
  31308. * @param {Object} object The object to modify.
  31309. * @param {Array|string} path The path of the property to set.
  31310. * @param {Function} updater The function to produce the updated value.
  31311. * @returns {Object} Returns `object`.
  31312. * @example
  31313. *
  31314. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31315. *
  31316. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31317. * console.log(object.a[0].b.c);
  31318. * // => 9
  31319. *
  31320. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31321. * console.log(object.x[0].y.z);
  31322. * // => 0
  31323. */
  31324. function update(object, path, updater) {
  31325. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31326. }
  31327. /**
  31328. * This method is like `_.update` except that it accepts `customizer` which is
  31329. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31330. * path creation is handled by the method instead. The `customizer` is invoked
  31331. * with three arguments: (nsValue, key, nsObject).
  31332. *
  31333. * **Note:** This method mutates `object`.
  31334. *
  31335. * @static
  31336. * @memberOf _
  31337. * @since 4.6.0
  31338. * @category Object
  31339. * @param {Object} object The object to modify.
  31340. * @param {Array|string} path The path of the property to set.
  31341. * @param {Function} updater The function to produce the updated value.
  31342. * @param {Function} [customizer] The function to customize assigned values.
  31343. * @returns {Object} Returns `object`.
  31344. * @example
  31345. *
  31346. * var object = {};
  31347. *
  31348. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31349. * // => { '0': { '1': 'a' } }
  31350. */
  31351. function updateWith(object, path, updater, customizer) {
  31352. customizer = typeof customizer == 'function' ? customizer : undefined;
  31353. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31354. }
  31355. /**
  31356. * Creates an array of the own enumerable string keyed property values of `object`.
  31357. *
  31358. * **Note:** Non-object values are coerced to objects.
  31359. *
  31360. * @static
  31361. * @since 0.1.0
  31362. * @memberOf _
  31363. * @category Object
  31364. * @param {Object} object The object to query.
  31365. * @returns {Array} Returns the array of property values.
  31366. * @example
  31367. *
  31368. * function Foo() {
  31369. * this.a = 1;
  31370. * this.b = 2;
  31371. * }
  31372. *
  31373. * Foo.prototype.c = 3;
  31374. *
  31375. * _.values(new Foo);
  31376. * // => [1, 2] (iteration order is not guaranteed)
  31377. *
  31378. * _.values('hi');
  31379. * // => ['h', 'i']
  31380. */
  31381. function values(object) {
  31382. return object == null ? [] : baseValues(object, keys(object));
  31383. }
  31384. /**
  31385. * Creates an array of the own and inherited enumerable string keyed property
  31386. * values of `object`.
  31387. *
  31388. * **Note:** Non-object values are coerced to objects.
  31389. *
  31390. * @static
  31391. * @memberOf _
  31392. * @since 3.0.0
  31393. * @category Object
  31394. * @param {Object} object The object to query.
  31395. * @returns {Array} Returns the array of property values.
  31396. * @example
  31397. *
  31398. * function Foo() {
  31399. * this.a = 1;
  31400. * this.b = 2;
  31401. * }
  31402. *
  31403. * Foo.prototype.c = 3;
  31404. *
  31405. * _.valuesIn(new Foo);
  31406. * // => [1, 2, 3] (iteration order is not guaranteed)
  31407. */
  31408. function valuesIn(object) {
  31409. return object == null ? [] : baseValues(object, keysIn(object));
  31410. }
  31411. /*------------------------------------------------------------------------*/
  31412. /**
  31413. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31414. *
  31415. * @static
  31416. * @memberOf _
  31417. * @since 4.0.0
  31418. * @category Number
  31419. * @param {number} number The number to clamp.
  31420. * @param {number} [lower] The lower bound.
  31421. * @param {number} upper The upper bound.
  31422. * @returns {number} Returns the clamped number.
  31423. * @example
  31424. *
  31425. * _.clamp(-10, -5, 5);
  31426. * // => -5
  31427. *
  31428. * _.clamp(10, -5, 5);
  31429. * // => 5
  31430. */
  31431. function clamp(number, lower, upper) {
  31432. if (upper === undefined) {
  31433. upper = lower;
  31434. lower = undefined;
  31435. }
  31436. if (upper !== undefined) {
  31437. upper = toNumber(upper);
  31438. upper = upper === upper ? upper : 0;
  31439. }
  31440. if (lower !== undefined) {
  31441. lower = toNumber(lower);
  31442. lower = lower === lower ? lower : 0;
  31443. }
  31444. return baseClamp(toNumber(number), lower, upper);
  31445. }
  31446. /**
  31447. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31448. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31449. * If `start` is greater than `end` the params are swapped to support
  31450. * negative ranges.
  31451. *
  31452. * @static
  31453. * @memberOf _
  31454. * @since 3.3.0
  31455. * @category Number
  31456. * @param {number} number The number to check.
  31457. * @param {number} [start=0] The start of the range.
  31458. * @param {number} end The end of the range.
  31459. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31460. * @see _.range, _.rangeRight
  31461. * @example
  31462. *
  31463. * _.inRange(3, 2, 4);
  31464. * // => true
  31465. *
  31466. * _.inRange(4, 8);
  31467. * // => true
  31468. *
  31469. * _.inRange(4, 2);
  31470. * // => false
  31471. *
  31472. * _.inRange(2, 2);
  31473. * // => false
  31474. *
  31475. * _.inRange(1.2, 2);
  31476. * // => true
  31477. *
  31478. * _.inRange(5.2, 4);
  31479. * // => false
  31480. *
  31481. * _.inRange(-3, -2, -6);
  31482. * // => true
  31483. */
  31484. function inRange(number, start, end) {
  31485. start = toFinite(start);
  31486. if (end === undefined) {
  31487. end = start;
  31488. start = 0;
  31489. } else {
  31490. end = toFinite(end);
  31491. }
  31492. number = toNumber(number);
  31493. return baseInRange(number, start, end);
  31494. }
  31495. /**
  31496. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31497. * If only one argument is provided a number between `0` and the given number
  31498. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31499. * floats, a floating-point number is returned instead of an integer.
  31500. *
  31501. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31502. * floating-point values which can produce unexpected results.
  31503. *
  31504. * @static
  31505. * @memberOf _
  31506. * @since 0.7.0
  31507. * @category Number
  31508. * @param {number} [lower=0] The lower bound.
  31509. * @param {number} [upper=1] The upper bound.
  31510. * @param {boolean} [floating] Specify returning a floating-point number.
  31511. * @returns {number} Returns the random number.
  31512. * @example
  31513. *
  31514. * _.random(0, 5);
  31515. * // => an integer between 0 and 5
  31516. *
  31517. * _.random(5);
  31518. * // => also an integer between 0 and 5
  31519. *
  31520. * _.random(5, true);
  31521. * // => a floating-point number between 0 and 5
  31522. *
  31523. * _.random(1.2, 5.2);
  31524. * // => a floating-point number between 1.2 and 5.2
  31525. */
  31526. function random(lower, upper, floating) {
  31527. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31528. upper = floating = undefined;
  31529. }
  31530. if (floating === undefined) {
  31531. if (typeof upper == 'boolean') {
  31532. floating = upper;
  31533. upper = undefined;
  31534. }
  31535. else if (typeof lower == 'boolean') {
  31536. floating = lower;
  31537. lower = undefined;
  31538. }
  31539. }
  31540. if (lower === undefined && upper === undefined) {
  31541. lower = 0;
  31542. upper = 1;
  31543. }
  31544. else {
  31545. lower = toFinite(lower);
  31546. if (upper === undefined) {
  31547. upper = lower;
  31548. lower = 0;
  31549. } else {
  31550. upper = toFinite(upper);
  31551. }
  31552. }
  31553. if (lower > upper) {
  31554. var temp = lower;
  31555. lower = upper;
  31556. upper = temp;
  31557. }
  31558. if (floating || lower % 1 || upper % 1) {
  31559. var rand = nativeRandom();
  31560. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31561. }
  31562. return baseRandom(lower, upper);
  31563. }
  31564. /*------------------------------------------------------------------------*/
  31565. /**
  31566. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31567. *
  31568. * @static
  31569. * @memberOf _
  31570. * @since 3.0.0
  31571. * @category String
  31572. * @param {string} [string=''] The string to convert.
  31573. * @returns {string} Returns the camel cased string.
  31574. * @example
  31575. *
  31576. * _.camelCase('Foo Bar');
  31577. * // => 'fooBar'
  31578. *
  31579. * _.camelCase('--foo-bar--');
  31580. * // => 'fooBar'
  31581. *
  31582. * _.camelCase('__FOO_BAR__');
  31583. * // => 'fooBar'
  31584. */
  31585. var camelCase = createCompounder(function(result, word, index) {
  31586. word = word.toLowerCase();
  31587. return result + (index ? capitalize(word) : word);
  31588. });
  31589. /**
  31590. * Converts the first character of `string` to upper case and the remaining
  31591. * to lower case.
  31592. *
  31593. * @static
  31594. * @memberOf _
  31595. * @since 3.0.0
  31596. * @category String
  31597. * @param {string} [string=''] The string to capitalize.
  31598. * @returns {string} Returns the capitalized string.
  31599. * @example
  31600. *
  31601. * _.capitalize('FRED');
  31602. * // => 'Fred'
  31603. */
  31604. function capitalize(string) {
  31605. return upperFirst(toString(string).toLowerCase());
  31606. }
  31607. /**
  31608. * Deburrs `string` by converting
  31609. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31610. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31611. * letters to basic Latin letters and removing
  31612. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31613. *
  31614. * @static
  31615. * @memberOf _
  31616. * @since 3.0.0
  31617. * @category String
  31618. * @param {string} [string=''] The string to deburr.
  31619. * @returns {string} Returns the deburred string.
  31620. * @example
  31621. *
  31622. * _.deburr('déjà vu');
  31623. * // => 'deja vu'
  31624. */
  31625. function deburr(string) {
  31626. string = toString(string);
  31627. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31628. }
  31629. /**
  31630. * Checks if `string` ends with the given target string.
  31631. *
  31632. * @static
  31633. * @memberOf _
  31634. * @since 3.0.0
  31635. * @category String
  31636. * @param {string} [string=''] The string to inspect.
  31637. * @param {string} [target] The string to search for.
  31638. * @param {number} [position=string.length] The position to search up to.
  31639. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31640. * else `false`.
  31641. * @example
  31642. *
  31643. * _.endsWith('abc', 'c');
  31644. * // => true
  31645. *
  31646. * _.endsWith('abc', 'b');
  31647. * // => false
  31648. *
  31649. * _.endsWith('abc', 'b', 2);
  31650. * // => true
  31651. */
  31652. function endsWith(string, target, position) {
  31653. string = toString(string);
  31654. target = baseToString(target);
  31655. var length = string.length;
  31656. position = position === undefined
  31657. ? length
  31658. : baseClamp(toInteger(position), 0, length);
  31659. var end = position;
  31660. position -= target.length;
  31661. return position >= 0 && string.slice(position, end) == target;
  31662. }
  31663. /**
  31664. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31665. * corresponding HTML entities.
  31666. *
  31667. * **Note:** No other characters are escaped. To escape additional
  31668. * characters use a third-party library like [_he_](https://mths.be/he).
  31669. *
  31670. * Though the ">" character is escaped for symmetry, characters like
  31671. * ">" and "/" don't need escaping in HTML and have no special meaning
  31672. * unless they're part of a tag or unquoted attribute value. See
  31673. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31674. * (under "semi-related fun fact") for more details.
  31675. *
  31676. * When working with HTML you should always
  31677. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31678. * XSS vectors.
  31679. *
  31680. * @static
  31681. * @since 0.1.0
  31682. * @memberOf _
  31683. * @category String
  31684. * @param {string} [string=''] The string to escape.
  31685. * @returns {string} Returns the escaped string.
  31686. * @example
  31687. *
  31688. * _.escape('fred, barney, & pebbles');
  31689. * // => 'fred, barney, &amp; pebbles'
  31690. */
  31691. function escape(string) {
  31692. string = toString(string);
  31693. return (string && reHasUnescapedHtml.test(string))
  31694. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31695. : string;
  31696. }
  31697. /**
  31698. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31699. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31700. *
  31701. * @static
  31702. * @memberOf _
  31703. * @since 3.0.0
  31704. * @category String
  31705. * @param {string} [string=''] The string to escape.
  31706. * @returns {string} Returns the escaped string.
  31707. * @example
  31708. *
  31709. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31710. * // => '\[lodash\]\(https://lodash\.com/\)'
  31711. */
  31712. function escapeRegExp(string) {
  31713. string = toString(string);
  31714. return (string && reHasRegExpChar.test(string))
  31715. ? string.replace(reRegExpChar, '\\$&')
  31716. : string;
  31717. }
  31718. /**
  31719. * Converts `string` to
  31720. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31721. *
  31722. * @static
  31723. * @memberOf _
  31724. * @since 3.0.0
  31725. * @category String
  31726. * @param {string} [string=''] The string to convert.
  31727. * @returns {string} Returns the kebab cased string.
  31728. * @example
  31729. *
  31730. * _.kebabCase('Foo Bar');
  31731. * // => 'foo-bar'
  31732. *
  31733. * _.kebabCase('fooBar');
  31734. * // => 'foo-bar'
  31735. *
  31736. * _.kebabCase('__FOO_BAR__');
  31737. * // => 'foo-bar'
  31738. */
  31739. var kebabCase = createCompounder(function(result, word, index) {
  31740. return result + (index ? '-' : '') + word.toLowerCase();
  31741. });
  31742. /**
  31743. * Converts `string`, as space separated words, to lower case.
  31744. *
  31745. * @static
  31746. * @memberOf _
  31747. * @since 4.0.0
  31748. * @category String
  31749. * @param {string} [string=''] The string to convert.
  31750. * @returns {string} Returns the lower cased string.
  31751. * @example
  31752. *
  31753. * _.lowerCase('--Foo-Bar--');
  31754. * // => 'foo bar'
  31755. *
  31756. * _.lowerCase('fooBar');
  31757. * // => 'foo bar'
  31758. *
  31759. * _.lowerCase('__FOO_BAR__');
  31760. * // => 'foo bar'
  31761. */
  31762. var lowerCase = createCompounder(function(result, word, index) {
  31763. return result + (index ? ' ' : '') + word.toLowerCase();
  31764. });
  31765. /**
  31766. * Converts the first character of `string` to lower case.
  31767. *
  31768. * @static
  31769. * @memberOf _
  31770. * @since 4.0.0
  31771. * @category String
  31772. * @param {string} [string=''] The string to convert.
  31773. * @returns {string} Returns the converted string.
  31774. * @example
  31775. *
  31776. * _.lowerFirst('Fred');
  31777. * // => 'fred'
  31778. *
  31779. * _.lowerFirst('FRED');
  31780. * // => 'fRED'
  31781. */
  31782. var lowerFirst = createCaseFirst('toLowerCase');
  31783. /**
  31784. * Pads `string` on the left and right sides if it's shorter than `length`.
  31785. * Padding characters are truncated if they can't be evenly divided by `length`.
  31786. *
  31787. * @static
  31788. * @memberOf _
  31789. * @since 3.0.0
  31790. * @category String
  31791. * @param {string} [string=''] The string to pad.
  31792. * @param {number} [length=0] The padding length.
  31793. * @param {string} [chars=' '] The string used as padding.
  31794. * @returns {string} Returns the padded string.
  31795. * @example
  31796. *
  31797. * _.pad('abc', 8);
  31798. * // => ' abc '
  31799. *
  31800. * _.pad('abc', 8, '_-');
  31801. * // => '_-abc_-_'
  31802. *
  31803. * _.pad('abc', 3);
  31804. * // => 'abc'
  31805. */
  31806. function pad(string, length, chars) {
  31807. string = toString(string);
  31808. length = toInteger(length);
  31809. var strLength = length ? stringSize(string) : 0;
  31810. if (!length || strLength >= length) {
  31811. return string;
  31812. }
  31813. var mid = (length - strLength) / 2;
  31814. return (
  31815. createPadding(nativeFloor(mid), chars) +
  31816. string +
  31817. createPadding(nativeCeil(mid), chars)
  31818. );
  31819. }
  31820. /**
  31821. * Pads `string` on the right side if it's shorter than `length`. Padding
  31822. * characters are truncated if they exceed `length`.
  31823. *
  31824. * @static
  31825. * @memberOf _
  31826. * @since 4.0.0
  31827. * @category String
  31828. * @param {string} [string=''] The string to pad.
  31829. * @param {number} [length=0] The padding length.
  31830. * @param {string} [chars=' '] The string used as padding.
  31831. * @returns {string} Returns the padded string.
  31832. * @example
  31833. *
  31834. * _.padEnd('abc', 6);
  31835. * // => 'abc '
  31836. *
  31837. * _.padEnd('abc', 6, '_-');
  31838. * // => 'abc_-_'
  31839. *
  31840. * _.padEnd('abc', 3);
  31841. * // => 'abc'
  31842. */
  31843. function padEnd(string, length, chars) {
  31844. string = toString(string);
  31845. length = toInteger(length);
  31846. var strLength = length ? stringSize(string) : 0;
  31847. return (length && strLength < length)
  31848. ? (string + createPadding(length - strLength, chars))
  31849. : string;
  31850. }
  31851. /**
  31852. * Pads `string` on the left side if it's shorter than `length`. Padding
  31853. * characters are truncated if they exceed `length`.
  31854. *
  31855. * @static
  31856. * @memberOf _
  31857. * @since 4.0.0
  31858. * @category String
  31859. * @param {string} [string=''] The string to pad.
  31860. * @param {number} [length=0] The padding length.
  31861. * @param {string} [chars=' '] The string used as padding.
  31862. * @returns {string} Returns the padded string.
  31863. * @example
  31864. *
  31865. * _.padStart('abc', 6);
  31866. * // => ' abc'
  31867. *
  31868. * _.padStart('abc', 6, '_-');
  31869. * // => '_-_abc'
  31870. *
  31871. * _.padStart('abc', 3);
  31872. * // => 'abc'
  31873. */
  31874. function padStart(string, length, chars) {
  31875. string = toString(string);
  31876. length = toInteger(length);
  31877. var strLength = length ? stringSize(string) : 0;
  31878. return (length && strLength < length)
  31879. ? (createPadding(length - strLength, chars) + string)
  31880. : string;
  31881. }
  31882. /**
  31883. * Converts `string` to an integer of the specified radix. If `radix` is
  31884. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31885. * hexadecimal, in which case a `radix` of `16` is used.
  31886. *
  31887. * **Note:** This method aligns with the
  31888. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31889. *
  31890. * @static
  31891. * @memberOf _
  31892. * @since 1.1.0
  31893. * @category String
  31894. * @param {string} string The string to convert.
  31895. * @param {number} [radix=10] The radix to interpret `value` by.
  31896. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31897. * @returns {number} Returns the converted integer.
  31898. * @example
  31899. *
  31900. * _.parseInt('08');
  31901. * // => 8
  31902. *
  31903. * _.map(['6', '08', '10'], _.parseInt);
  31904. * // => [6, 8, 10]
  31905. */
  31906. function parseInt(string, radix, guard) {
  31907. if (guard || radix == null) {
  31908. radix = 0;
  31909. } else if (radix) {
  31910. radix = +radix;
  31911. }
  31912. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31913. }
  31914. /**
  31915. * Repeats the given string `n` times.
  31916. *
  31917. * @static
  31918. * @memberOf _
  31919. * @since 3.0.0
  31920. * @category String
  31921. * @param {string} [string=''] The string to repeat.
  31922. * @param {number} [n=1] The number of times to repeat the string.
  31923. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31924. * @returns {string} Returns the repeated string.
  31925. * @example
  31926. *
  31927. * _.repeat('*', 3);
  31928. * // => '***'
  31929. *
  31930. * _.repeat('abc', 2);
  31931. * // => 'abcabc'
  31932. *
  31933. * _.repeat('abc', 0);
  31934. * // => ''
  31935. */
  31936. function repeat(string, n, guard) {
  31937. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31938. n = 1;
  31939. } else {
  31940. n = toInteger(n);
  31941. }
  31942. return baseRepeat(toString(string), n);
  31943. }
  31944. /**
  31945. * Replaces matches for `pattern` in `string` with `replacement`.
  31946. *
  31947. * **Note:** This method is based on
  31948. * [`String#replace`](https://mdn.io/String/replace).
  31949. *
  31950. * @static
  31951. * @memberOf _
  31952. * @since 4.0.0
  31953. * @category String
  31954. * @param {string} [string=''] The string to modify.
  31955. * @param {RegExp|string} pattern The pattern to replace.
  31956. * @param {Function|string} replacement The match replacement.
  31957. * @returns {string} Returns the modified string.
  31958. * @example
  31959. *
  31960. * _.replace('Hi Fred', 'Fred', 'Barney');
  31961. * // => 'Hi Barney'
  31962. */
  31963. function replace() {
  31964. var args = arguments,
  31965. string = toString(args[0]);
  31966. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31967. }
  31968. /**
  31969. * Converts `string` to
  31970. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31971. *
  31972. * @static
  31973. * @memberOf _
  31974. * @since 3.0.0
  31975. * @category String
  31976. * @param {string} [string=''] The string to convert.
  31977. * @returns {string} Returns the snake cased string.
  31978. * @example
  31979. *
  31980. * _.snakeCase('Foo Bar');
  31981. * // => 'foo_bar'
  31982. *
  31983. * _.snakeCase('fooBar');
  31984. * // => 'foo_bar'
  31985. *
  31986. * _.snakeCase('--FOO-BAR--');
  31987. * // => 'foo_bar'
  31988. */
  31989. var snakeCase = createCompounder(function(result, word, index) {
  31990. return result + (index ? '_' : '') + word.toLowerCase();
  31991. });
  31992. /**
  31993. * Splits `string` by `separator`.
  31994. *
  31995. * **Note:** This method is based on
  31996. * [`String#split`](https://mdn.io/String/split).
  31997. *
  31998. * @static
  31999. * @memberOf _
  32000. * @since 4.0.0
  32001. * @category String
  32002. * @param {string} [string=''] The string to split.
  32003. * @param {RegExp|string} separator The separator pattern to split by.
  32004. * @param {number} [limit] The length to truncate results to.
  32005. * @returns {Array} Returns the string segments.
  32006. * @example
  32007. *
  32008. * _.split('a-b-c', '-', 2);
  32009. * // => ['a', 'b']
  32010. */
  32011. function split(string, separator, limit) {
  32012. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32013. separator = limit = undefined;
  32014. }
  32015. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32016. if (!limit) {
  32017. return [];
  32018. }
  32019. string = toString(string);
  32020. if (string && (
  32021. typeof separator == 'string' ||
  32022. (separator != null && !isRegExp(separator))
  32023. )) {
  32024. separator = baseToString(separator);
  32025. if (!separator && hasUnicode(string)) {
  32026. return castSlice(stringToArray(string), 0, limit);
  32027. }
  32028. }
  32029. return string.split(separator, limit);
  32030. }
  32031. /**
  32032. * Converts `string` to
  32033. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32034. *
  32035. * @static
  32036. * @memberOf _
  32037. * @since 3.1.0
  32038. * @category String
  32039. * @param {string} [string=''] The string to convert.
  32040. * @returns {string} Returns the start cased string.
  32041. * @example
  32042. *
  32043. * _.startCase('--foo-bar--');
  32044. * // => 'Foo Bar'
  32045. *
  32046. * _.startCase('fooBar');
  32047. * // => 'Foo Bar'
  32048. *
  32049. * _.startCase('__FOO_BAR__');
  32050. * // => 'FOO BAR'
  32051. */
  32052. var startCase = createCompounder(function(result, word, index) {
  32053. return result + (index ? ' ' : '') + upperFirst(word);
  32054. });
  32055. /**
  32056. * Checks if `string` starts with the given target string.
  32057. *
  32058. * @static
  32059. * @memberOf _
  32060. * @since 3.0.0
  32061. * @category String
  32062. * @param {string} [string=''] The string to inspect.
  32063. * @param {string} [target] The string to search for.
  32064. * @param {number} [position=0] The position to search from.
  32065. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32066. * else `false`.
  32067. * @example
  32068. *
  32069. * _.startsWith('abc', 'a');
  32070. * // => true
  32071. *
  32072. * _.startsWith('abc', 'b');
  32073. * // => false
  32074. *
  32075. * _.startsWith('abc', 'b', 1);
  32076. * // => true
  32077. */
  32078. function startsWith(string, target, position) {
  32079. string = toString(string);
  32080. position = position == null
  32081. ? 0
  32082. : baseClamp(toInteger(position), 0, string.length);
  32083. target = baseToString(target);
  32084. return string.slice(position, position + target.length) == target;
  32085. }
  32086. /**
  32087. * Creates a compiled template function that can interpolate data properties
  32088. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32089. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32090. * properties may be accessed as free variables in the template. If a setting
  32091. * object is given, it takes precedence over `_.templateSettings` values.
  32092. *
  32093. * **Note:** In the development build `_.template` utilizes
  32094. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32095. * for easier debugging.
  32096. *
  32097. * For more information on precompiling templates see
  32098. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32099. *
  32100. * For more information on Chrome extension sandboxes see
  32101. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32102. *
  32103. * @static
  32104. * @since 0.1.0
  32105. * @memberOf _
  32106. * @category String
  32107. * @param {string} [string=''] The template string.
  32108. * @param {Object} [options={}] The options object.
  32109. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32110. * The HTML "escape" delimiter.
  32111. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32112. * The "evaluate" delimiter.
  32113. * @param {Object} [options.imports=_.templateSettings.imports]
  32114. * An object to import into the template as free variables.
  32115. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32116. * The "interpolate" delimiter.
  32117. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32118. * The sourceURL of the compiled template.
  32119. * @param {string} [options.variable='obj']
  32120. * The data object variable name.
  32121. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32122. * @returns {Function} Returns the compiled template function.
  32123. * @example
  32124. *
  32125. * // Use the "interpolate" delimiter to create a compiled template.
  32126. * var compiled = _.template('hello <%= user %>!');
  32127. * compiled({ 'user': 'fred' });
  32128. * // => 'hello fred!'
  32129. *
  32130. * // Use the HTML "escape" delimiter to escape data property values.
  32131. * var compiled = _.template('<b><%- value %></b>');
  32132. * compiled({ 'value': '<script>' });
  32133. * // => '<b>&lt;script&gt;</b>'
  32134. *
  32135. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32136. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32137. * compiled({ 'users': ['fred', 'barney'] });
  32138. * // => '<li>fred</li><li>barney</li>'
  32139. *
  32140. * // Use the internal `print` function in "evaluate" delimiters.
  32141. * var compiled = _.template('<% print("hello " + user); %>!');
  32142. * compiled({ 'user': 'barney' });
  32143. * // => 'hello barney!'
  32144. *
  32145. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32146. * // Disable support by replacing the "interpolate" delimiter.
  32147. * var compiled = _.template('hello ${ user }!');
  32148. * compiled({ 'user': 'pebbles' });
  32149. * // => 'hello pebbles!'
  32150. *
  32151. * // Use backslashes to treat delimiters as plain text.
  32152. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32153. * compiled({ 'value': 'ignored' });
  32154. * // => '<%- value %>'
  32155. *
  32156. * // Use the `imports` option to import `jQuery` as `jq`.
  32157. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32158. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32159. * compiled({ 'users': ['fred', 'barney'] });
  32160. * // => '<li>fred</li><li>barney</li>'
  32161. *
  32162. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32163. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32164. * compiled(data);
  32165. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32166. *
  32167. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32168. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32169. * compiled.source;
  32170. * // => function(data) {
  32171. * // var __t, __p = '';
  32172. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32173. * // return __p;
  32174. * // }
  32175. *
  32176. * // Use custom template delimiters.
  32177. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32178. * var compiled = _.template('hello {{ user }}!');
  32179. * compiled({ 'user': 'mustache' });
  32180. * // => 'hello mustache!'
  32181. *
  32182. * // Use the `source` property to inline compiled templates for meaningful
  32183. * // line numbers in error messages and stack traces.
  32184. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32185. * var JST = {\
  32186. * "main": ' + _.template(mainText).source + '\
  32187. * };\
  32188. * ');
  32189. */
  32190. function template(string, options, guard) {
  32191. // Based on John Resig's `tmpl` implementation
  32192. // (http://ejohn.org/blog/javascript-micro-templating/)
  32193. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32194. var settings = lodash.templateSettings;
  32195. if (guard && isIterateeCall(string, options, guard)) {
  32196. options = undefined;
  32197. }
  32198. string = toString(string);
  32199. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32200. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32201. importsKeys = keys(imports),
  32202. importsValues = baseValues(imports, importsKeys);
  32203. var isEscaping,
  32204. isEvaluating,
  32205. index = 0,
  32206. interpolate = options.interpolate || reNoMatch,
  32207. source = "__p += '";
  32208. // Compile the regexp to match each delimiter.
  32209. var reDelimiters = RegExp(
  32210. (options.escape || reNoMatch).source + '|' +
  32211. interpolate.source + '|' +
  32212. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32213. (options.evaluate || reNoMatch).source + '|$'
  32214. , 'g');
  32215. // Use a sourceURL for easier debugging.
  32216. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32217. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32218. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32219. var sourceURL = '//# sourceURL=' +
  32220. (hasOwnProperty.call(options, 'sourceURL')
  32221. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32222. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32223. ) + '\n';
  32224. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32225. interpolateValue || (interpolateValue = esTemplateValue);
  32226. // Escape characters that can't be included in string literals.
  32227. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32228. // Replace delimiters with snippets.
  32229. if (escapeValue) {
  32230. isEscaping = true;
  32231. source += "' +\n__e(" + escapeValue + ") +\n'";
  32232. }
  32233. if (evaluateValue) {
  32234. isEvaluating = true;
  32235. source += "';\n" + evaluateValue + ";\n__p += '";
  32236. }
  32237. if (interpolateValue) {
  32238. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32239. }
  32240. index = offset + match.length;
  32241. // The JS engine embedded in Adobe products needs `match` returned in
  32242. // order to produce the correct `offset` value.
  32243. return match;
  32244. });
  32245. source += "';\n";
  32246. // If `variable` is not specified wrap a with-statement around the generated
  32247. // code to add the data object to the top of the scope chain.
  32248. // Like with sourceURL, we take care to not check the option's prototype,
  32249. // as this configuration is a code injection vector.
  32250. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32251. if (!variable) {
  32252. source = 'with (obj) {\n' + source + '\n}\n';
  32253. }
  32254. // Cleanup code by stripping empty strings.
  32255. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32256. .replace(reEmptyStringMiddle, '$1')
  32257. .replace(reEmptyStringTrailing, '$1;');
  32258. // Frame code as the function body.
  32259. source = 'function(' + (variable || 'obj') + ') {\n' +
  32260. (variable
  32261. ? ''
  32262. : 'obj || (obj = {});\n'
  32263. ) +
  32264. "var __t, __p = ''" +
  32265. (isEscaping
  32266. ? ', __e = _.escape'
  32267. : ''
  32268. ) +
  32269. (isEvaluating
  32270. ? ', __j = Array.prototype.join;\n' +
  32271. "function print() { __p += __j.call(arguments, '') }\n"
  32272. : ';\n'
  32273. ) +
  32274. source +
  32275. 'return __p\n}';
  32276. var result = attempt(function() {
  32277. return Function(importsKeys, sourceURL + 'return ' + source)
  32278. .apply(undefined, importsValues);
  32279. });
  32280. // Provide the compiled function's source by its `toString` method or
  32281. // the `source` property as a convenience for inlining compiled templates.
  32282. result.source = source;
  32283. if (isError(result)) {
  32284. throw result;
  32285. }
  32286. return result;
  32287. }
  32288. /**
  32289. * Converts `string`, as a whole, to lower case just like
  32290. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32291. *
  32292. * @static
  32293. * @memberOf _
  32294. * @since 4.0.0
  32295. * @category String
  32296. * @param {string} [string=''] The string to convert.
  32297. * @returns {string} Returns the lower cased string.
  32298. * @example
  32299. *
  32300. * _.toLower('--Foo-Bar--');
  32301. * // => '--foo-bar--'
  32302. *
  32303. * _.toLower('fooBar');
  32304. * // => 'foobar'
  32305. *
  32306. * _.toLower('__FOO_BAR__');
  32307. * // => '__foo_bar__'
  32308. */
  32309. function toLower(value) {
  32310. return toString(value).toLowerCase();
  32311. }
  32312. /**
  32313. * Converts `string`, as a whole, to upper case just like
  32314. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32315. *
  32316. * @static
  32317. * @memberOf _
  32318. * @since 4.0.0
  32319. * @category String
  32320. * @param {string} [string=''] The string to convert.
  32321. * @returns {string} Returns the upper cased string.
  32322. * @example
  32323. *
  32324. * _.toUpper('--foo-bar--');
  32325. * // => '--FOO-BAR--'
  32326. *
  32327. * _.toUpper('fooBar');
  32328. * // => 'FOOBAR'
  32329. *
  32330. * _.toUpper('__foo_bar__');
  32331. * // => '__FOO_BAR__'
  32332. */
  32333. function toUpper(value) {
  32334. return toString(value).toUpperCase();
  32335. }
  32336. /**
  32337. * Removes leading and trailing whitespace or specified characters from `string`.
  32338. *
  32339. * @static
  32340. * @memberOf _
  32341. * @since 3.0.0
  32342. * @category String
  32343. * @param {string} [string=''] The string to trim.
  32344. * @param {string} [chars=whitespace] The characters to trim.
  32345. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32346. * @returns {string} Returns the trimmed string.
  32347. * @example
  32348. *
  32349. * _.trim(' abc ');
  32350. * // => 'abc'
  32351. *
  32352. * _.trim('-_-abc-_-', '_-');
  32353. * // => 'abc'
  32354. *
  32355. * _.map([' foo ', ' bar '], _.trim);
  32356. * // => ['foo', 'bar']
  32357. */
  32358. function trim(string, chars, guard) {
  32359. string = toString(string);
  32360. if (string && (guard || chars === undefined)) {
  32361. return string.replace(reTrim, '');
  32362. }
  32363. if (!string || !(chars = baseToString(chars))) {
  32364. return string;
  32365. }
  32366. var strSymbols = stringToArray(string),
  32367. chrSymbols = stringToArray(chars),
  32368. start = charsStartIndex(strSymbols, chrSymbols),
  32369. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32370. return castSlice(strSymbols, start, end).join('');
  32371. }
  32372. /**
  32373. * Removes trailing whitespace or specified characters from `string`.
  32374. *
  32375. * @static
  32376. * @memberOf _
  32377. * @since 4.0.0
  32378. * @category String
  32379. * @param {string} [string=''] The string to trim.
  32380. * @param {string} [chars=whitespace] The characters to trim.
  32381. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32382. * @returns {string} Returns the trimmed string.
  32383. * @example
  32384. *
  32385. * _.trimEnd(' abc ');
  32386. * // => ' abc'
  32387. *
  32388. * _.trimEnd('-_-abc-_-', '_-');
  32389. * // => '-_-abc'
  32390. */
  32391. function trimEnd(string, chars, guard) {
  32392. string = toString(string);
  32393. if (string && (guard || chars === undefined)) {
  32394. return string.replace(reTrimEnd, '');
  32395. }
  32396. if (!string || !(chars = baseToString(chars))) {
  32397. return string;
  32398. }
  32399. var strSymbols = stringToArray(string),
  32400. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32401. return castSlice(strSymbols, 0, end).join('');
  32402. }
  32403. /**
  32404. * Removes leading whitespace or specified characters from `string`.
  32405. *
  32406. * @static
  32407. * @memberOf _
  32408. * @since 4.0.0
  32409. * @category String
  32410. * @param {string} [string=''] The string to trim.
  32411. * @param {string} [chars=whitespace] The characters to trim.
  32412. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32413. * @returns {string} Returns the trimmed string.
  32414. * @example
  32415. *
  32416. * _.trimStart(' abc ');
  32417. * // => 'abc '
  32418. *
  32419. * _.trimStart('-_-abc-_-', '_-');
  32420. * // => 'abc-_-'
  32421. */
  32422. function trimStart(string, chars, guard) {
  32423. string = toString(string);
  32424. if (string && (guard || chars === undefined)) {
  32425. return string.replace(reTrimStart, '');
  32426. }
  32427. if (!string || !(chars = baseToString(chars))) {
  32428. return string;
  32429. }
  32430. var strSymbols = stringToArray(string),
  32431. start = charsStartIndex(strSymbols, stringToArray(chars));
  32432. return castSlice(strSymbols, start).join('');
  32433. }
  32434. /**
  32435. * Truncates `string` if it's longer than the given maximum string length.
  32436. * The last characters of the truncated string are replaced with the omission
  32437. * string which defaults to "...".
  32438. *
  32439. * @static
  32440. * @memberOf _
  32441. * @since 4.0.0
  32442. * @category String
  32443. * @param {string} [string=''] The string to truncate.
  32444. * @param {Object} [options={}] The options object.
  32445. * @param {number} [options.length=30] The maximum string length.
  32446. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32447. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32448. * @returns {string} Returns the truncated string.
  32449. * @example
  32450. *
  32451. * _.truncate('hi-diddly-ho there, neighborino');
  32452. * // => 'hi-diddly-ho there, neighbo...'
  32453. *
  32454. * _.truncate('hi-diddly-ho there, neighborino', {
  32455. * 'length': 24,
  32456. * 'separator': ' '
  32457. * });
  32458. * // => 'hi-diddly-ho there,...'
  32459. *
  32460. * _.truncate('hi-diddly-ho there, neighborino', {
  32461. * 'length': 24,
  32462. * 'separator': /,? +/
  32463. * });
  32464. * // => 'hi-diddly-ho there...'
  32465. *
  32466. * _.truncate('hi-diddly-ho there, neighborino', {
  32467. * 'omission': ' [...]'
  32468. * });
  32469. * // => 'hi-diddly-ho there, neig [...]'
  32470. */
  32471. function truncate(string, options) {
  32472. var length = DEFAULT_TRUNC_LENGTH,
  32473. omission = DEFAULT_TRUNC_OMISSION;
  32474. if (isObject(options)) {
  32475. var separator = 'separator' in options ? options.separator : separator;
  32476. length = 'length' in options ? toInteger(options.length) : length;
  32477. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32478. }
  32479. string = toString(string);
  32480. var strLength = string.length;
  32481. if (hasUnicode(string)) {
  32482. var strSymbols = stringToArray(string);
  32483. strLength = strSymbols.length;
  32484. }
  32485. if (length >= strLength) {
  32486. return string;
  32487. }
  32488. var end = length - stringSize(omission);
  32489. if (end < 1) {
  32490. return omission;
  32491. }
  32492. var result = strSymbols
  32493. ? castSlice(strSymbols, 0, end).join('')
  32494. : string.slice(0, end);
  32495. if (separator === undefined) {
  32496. return result + omission;
  32497. }
  32498. if (strSymbols) {
  32499. end += (result.length - end);
  32500. }
  32501. if (isRegExp(separator)) {
  32502. if (string.slice(end).search(separator)) {
  32503. var match,
  32504. substring = result;
  32505. if (!separator.global) {
  32506. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32507. }
  32508. separator.lastIndex = 0;
  32509. while ((match = separator.exec(substring))) {
  32510. var newEnd = match.index;
  32511. }
  32512. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32513. }
  32514. } else if (string.indexOf(baseToString(separator), end) != end) {
  32515. var index = result.lastIndexOf(separator);
  32516. if (index > -1) {
  32517. result = result.slice(0, index);
  32518. }
  32519. }
  32520. return result + omission;
  32521. }
  32522. /**
  32523. * The inverse of `_.escape`; this method converts the HTML entities
  32524. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32525. * their corresponding characters.
  32526. *
  32527. * **Note:** No other HTML entities are unescaped. To unescape additional
  32528. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32529. *
  32530. * @static
  32531. * @memberOf _
  32532. * @since 0.6.0
  32533. * @category String
  32534. * @param {string} [string=''] The string to unescape.
  32535. * @returns {string} Returns the unescaped string.
  32536. * @example
  32537. *
  32538. * _.unescape('fred, barney, &amp; pebbles');
  32539. * // => 'fred, barney, & pebbles'
  32540. */
  32541. function unescape(string) {
  32542. string = toString(string);
  32543. return (string && reHasEscapedHtml.test(string))
  32544. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32545. : string;
  32546. }
  32547. /**
  32548. * Converts `string`, as space separated words, to upper case.
  32549. *
  32550. * @static
  32551. * @memberOf _
  32552. * @since 4.0.0
  32553. * @category String
  32554. * @param {string} [string=''] The string to convert.
  32555. * @returns {string} Returns the upper cased string.
  32556. * @example
  32557. *
  32558. * _.upperCase('--foo-bar');
  32559. * // => 'FOO BAR'
  32560. *
  32561. * _.upperCase('fooBar');
  32562. * // => 'FOO BAR'
  32563. *
  32564. * _.upperCase('__foo_bar__');
  32565. * // => 'FOO BAR'
  32566. */
  32567. var upperCase = createCompounder(function(result, word, index) {
  32568. return result + (index ? ' ' : '') + word.toUpperCase();
  32569. });
  32570. /**
  32571. * Converts the first character of `string` to upper case.
  32572. *
  32573. * @static
  32574. * @memberOf _
  32575. * @since 4.0.0
  32576. * @category String
  32577. * @param {string} [string=''] The string to convert.
  32578. * @returns {string} Returns the converted string.
  32579. * @example
  32580. *
  32581. * _.upperFirst('fred');
  32582. * // => 'Fred'
  32583. *
  32584. * _.upperFirst('FRED');
  32585. * // => 'FRED'
  32586. */
  32587. var upperFirst = createCaseFirst('toUpperCase');
  32588. /**
  32589. * Splits `string` into an array of its words.
  32590. *
  32591. * @static
  32592. * @memberOf _
  32593. * @since 3.0.0
  32594. * @category String
  32595. * @param {string} [string=''] The string to inspect.
  32596. * @param {RegExp|string} [pattern] The pattern to match words.
  32597. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32598. * @returns {Array} Returns the words of `string`.
  32599. * @example
  32600. *
  32601. * _.words('fred, barney, & pebbles');
  32602. * // => ['fred', 'barney', 'pebbles']
  32603. *
  32604. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32605. * // => ['fred', 'barney', '&', 'pebbles']
  32606. */
  32607. function words(string, pattern, guard) {
  32608. string = toString(string);
  32609. pattern = guard ? undefined : pattern;
  32610. if (pattern === undefined) {
  32611. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32612. }
  32613. return string.match(pattern) || [];
  32614. }
  32615. /*------------------------------------------------------------------------*/
  32616. /**
  32617. * Attempts to invoke `func`, returning either the result or the caught error
  32618. * object. Any additional arguments are provided to `func` when it's invoked.
  32619. *
  32620. * @static
  32621. * @memberOf _
  32622. * @since 3.0.0
  32623. * @category Util
  32624. * @param {Function} func The function to attempt.
  32625. * @param {...*} [args] The arguments to invoke `func` with.
  32626. * @returns {*} Returns the `func` result or error object.
  32627. * @example
  32628. *
  32629. * // Avoid throwing errors for invalid selectors.
  32630. * var elements = _.attempt(function(selector) {
  32631. * return document.querySelectorAll(selector);
  32632. * }, '>_>');
  32633. *
  32634. * if (_.isError(elements)) {
  32635. * elements = [];
  32636. * }
  32637. */
  32638. var attempt = baseRest(function(func, args) {
  32639. try {
  32640. return apply(func, undefined, args);
  32641. } catch (e) {
  32642. return isError(e) ? e : new Error(e);
  32643. }
  32644. });
  32645. /**
  32646. * Binds methods of an object to the object itself, overwriting the existing
  32647. * method.
  32648. *
  32649. * **Note:** This method doesn't set the "length" property of bound functions.
  32650. *
  32651. * @static
  32652. * @since 0.1.0
  32653. * @memberOf _
  32654. * @category Util
  32655. * @param {Object} object The object to bind and assign the bound methods to.
  32656. * @param {...(string|string[])} methodNames The object method names to bind.
  32657. * @returns {Object} Returns `object`.
  32658. * @example
  32659. *
  32660. * var view = {
  32661. * 'label': 'docs',
  32662. * 'click': function() {
  32663. * console.log('clicked ' + this.label);
  32664. * }
  32665. * };
  32666. *
  32667. * _.bindAll(view, ['click']);
  32668. * jQuery(element).on('click', view.click);
  32669. * // => Logs 'clicked docs' when clicked.
  32670. */
  32671. var bindAll = flatRest(function(object, methodNames) {
  32672. arrayEach(methodNames, function(key) {
  32673. key = toKey(key);
  32674. baseAssignValue(object, key, bind(object[key], object));
  32675. });
  32676. return object;
  32677. });
  32678. /**
  32679. * Creates a function that iterates over `pairs` and invokes the corresponding
  32680. * function of the first predicate to return truthy. The predicate-function
  32681. * pairs are invoked with the `this` binding and arguments of the created
  32682. * function.
  32683. *
  32684. * @static
  32685. * @memberOf _
  32686. * @since 4.0.0
  32687. * @category Util
  32688. * @param {Array} pairs The predicate-function pairs.
  32689. * @returns {Function} Returns the new composite function.
  32690. * @example
  32691. *
  32692. * var func = _.cond([
  32693. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32694. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32695. * [_.stubTrue, _.constant('no match')]
  32696. * ]);
  32697. *
  32698. * func({ 'a': 1, 'b': 2 });
  32699. * // => 'matches A'
  32700. *
  32701. * func({ 'a': 0, 'b': 1 });
  32702. * // => 'matches B'
  32703. *
  32704. * func({ 'a': '1', 'b': '2' });
  32705. * // => 'no match'
  32706. */
  32707. function cond(pairs) {
  32708. var length = pairs == null ? 0 : pairs.length,
  32709. toIteratee = getIteratee();
  32710. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32711. if (typeof pair[1] != 'function') {
  32712. throw new TypeError(FUNC_ERROR_TEXT);
  32713. }
  32714. return [toIteratee(pair[0]), pair[1]];
  32715. });
  32716. return baseRest(function(args) {
  32717. var index = -1;
  32718. while (++index < length) {
  32719. var pair = pairs[index];
  32720. if (apply(pair[0], this, args)) {
  32721. return apply(pair[1], this, args);
  32722. }
  32723. }
  32724. });
  32725. }
  32726. /**
  32727. * Creates a function that invokes the predicate properties of `source` with
  32728. * the corresponding property values of a given object, returning `true` if
  32729. * all predicates return truthy, else `false`.
  32730. *
  32731. * **Note:** The created function is equivalent to `_.conformsTo` with
  32732. * `source` partially applied.
  32733. *
  32734. * @static
  32735. * @memberOf _
  32736. * @since 4.0.0
  32737. * @category Util
  32738. * @param {Object} source The object of property predicates to conform to.
  32739. * @returns {Function} Returns the new spec function.
  32740. * @example
  32741. *
  32742. * var objects = [
  32743. * { 'a': 2, 'b': 1 },
  32744. * { 'a': 1, 'b': 2 }
  32745. * ];
  32746. *
  32747. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32748. * // => [{ 'a': 1, 'b': 2 }]
  32749. */
  32750. function conforms(source) {
  32751. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32752. }
  32753. /**
  32754. * Creates a function that returns `value`.
  32755. *
  32756. * @static
  32757. * @memberOf _
  32758. * @since 2.4.0
  32759. * @category Util
  32760. * @param {*} value The value to return from the new function.
  32761. * @returns {Function} Returns the new constant function.
  32762. * @example
  32763. *
  32764. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32765. *
  32766. * console.log(objects);
  32767. * // => [{ 'a': 1 }, { 'a': 1 }]
  32768. *
  32769. * console.log(objects[0] === objects[1]);
  32770. * // => true
  32771. */
  32772. function constant(value) {
  32773. return function() {
  32774. return value;
  32775. };
  32776. }
  32777. /**
  32778. * Checks `value` to determine whether a default value should be returned in
  32779. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32780. * or `undefined`.
  32781. *
  32782. * @static
  32783. * @memberOf _
  32784. * @since 4.14.0
  32785. * @category Util
  32786. * @param {*} value The value to check.
  32787. * @param {*} defaultValue The default value.
  32788. * @returns {*} Returns the resolved value.
  32789. * @example
  32790. *
  32791. * _.defaultTo(1, 10);
  32792. * // => 1
  32793. *
  32794. * _.defaultTo(undefined, 10);
  32795. * // => 10
  32796. */
  32797. function defaultTo(value, defaultValue) {
  32798. return (value == null || value !== value) ? defaultValue : value;
  32799. }
  32800. /**
  32801. * Creates a function that returns the result of invoking the given functions
  32802. * with the `this` binding of the created function, where each successive
  32803. * invocation is supplied the return value of the previous.
  32804. *
  32805. * @static
  32806. * @memberOf _
  32807. * @since 3.0.0
  32808. * @category Util
  32809. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32810. * @returns {Function} Returns the new composite function.
  32811. * @see _.flowRight
  32812. * @example
  32813. *
  32814. * function square(n) {
  32815. * return n * n;
  32816. * }
  32817. *
  32818. * var addSquare = _.flow([_.add, square]);
  32819. * addSquare(1, 2);
  32820. * // => 9
  32821. */
  32822. var flow = createFlow();
  32823. /**
  32824. * This method is like `_.flow` except that it creates a function that
  32825. * invokes the given functions from right to left.
  32826. *
  32827. * @static
  32828. * @since 3.0.0
  32829. * @memberOf _
  32830. * @category Util
  32831. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32832. * @returns {Function} Returns the new composite function.
  32833. * @see _.flow
  32834. * @example
  32835. *
  32836. * function square(n) {
  32837. * return n * n;
  32838. * }
  32839. *
  32840. * var addSquare = _.flowRight([square, _.add]);
  32841. * addSquare(1, 2);
  32842. * // => 9
  32843. */
  32844. var flowRight = createFlow(true);
  32845. /**
  32846. * This method returns the first argument it receives.
  32847. *
  32848. * @static
  32849. * @since 0.1.0
  32850. * @memberOf _
  32851. * @category Util
  32852. * @param {*} value Any value.
  32853. * @returns {*} Returns `value`.
  32854. * @example
  32855. *
  32856. * var object = { 'a': 1 };
  32857. *
  32858. * console.log(_.identity(object) === object);
  32859. * // => true
  32860. */
  32861. function identity(value) {
  32862. return value;
  32863. }
  32864. /**
  32865. * Creates a function that invokes `func` with the arguments of the created
  32866. * function. If `func` is a property name, the created function returns the
  32867. * property value for a given element. If `func` is an array or object, the
  32868. * created function returns `true` for elements that contain the equivalent
  32869. * source properties, otherwise it returns `false`.
  32870. *
  32871. * @static
  32872. * @since 4.0.0
  32873. * @memberOf _
  32874. * @category Util
  32875. * @param {*} [func=_.identity] The value to convert to a callback.
  32876. * @returns {Function} Returns the callback.
  32877. * @example
  32878. *
  32879. * var users = [
  32880. * { 'user': 'barney', 'age': 36, 'active': true },
  32881. * { 'user': 'fred', 'age': 40, 'active': false }
  32882. * ];
  32883. *
  32884. * // The `_.matches` iteratee shorthand.
  32885. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32886. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32887. *
  32888. * // The `_.matchesProperty` iteratee shorthand.
  32889. * _.filter(users, _.iteratee(['user', 'fred']));
  32890. * // => [{ 'user': 'fred', 'age': 40 }]
  32891. *
  32892. * // The `_.property` iteratee shorthand.
  32893. * _.map(users, _.iteratee('user'));
  32894. * // => ['barney', 'fred']
  32895. *
  32896. * // Create custom iteratee shorthands.
  32897. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32898. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32899. * return func.test(string);
  32900. * };
  32901. * });
  32902. *
  32903. * _.filter(['abc', 'def'], /ef/);
  32904. * // => ['def']
  32905. */
  32906. function iteratee(func) {
  32907. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32908. }
  32909. /**
  32910. * Creates a function that performs a partial deep comparison between a given
  32911. * object and `source`, returning `true` if the given object has equivalent
  32912. * property values, else `false`.
  32913. *
  32914. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32915. * partially applied.
  32916. *
  32917. * Partial comparisons will match empty array and empty object `source`
  32918. * values against any array or object value, respectively. See `_.isEqual`
  32919. * for a list of supported value comparisons.
  32920. *
  32921. * @static
  32922. * @memberOf _
  32923. * @since 3.0.0
  32924. * @category Util
  32925. * @param {Object} source The object of property values to match.
  32926. * @returns {Function} Returns the new spec function.
  32927. * @example
  32928. *
  32929. * var objects = [
  32930. * { 'a': 1, 'b': 2, 'c': 3 },
  32931. * { 'a': 4, 'b': 5, 'c': 6 }
  32932. * ];
  32933. *
  32934. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32935. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32936. */
  32937. function matches(source) {
  32938. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32939. }
  32940. /**
  32941. * Creates a function that performs a partial deep comparison between the
  32942. * value at `path` of a given object to `srcValue`, returning `true` if the
  32943. * object value is equivalent, else `false`.
  32944. *
  32945. * **Note:** Partial comparisons will match empty array and empty object
  32946. * `srcValue` values against any array or object value, respectively. See
  32947. * `_.isEqual` for a list of supported value comparisons.
  32948. *
  32949. * @static
  32950. * @memberOf _
  32951. * @since 3.2.0
  32952. * @category Util
  32953. * @param {Array|string} path The path of the property to get.
  32954. * @param {*} srcValue The value to match.
  32955. * @returns {Function} Returns the new spec function.
  32956. * @example
  32957. *
  32958. * var objects = [
  32959. * { 'a': 1, 'b': 2, 'c': 3 },
  32960. * { 'a': 4, 'b': 5, 'c': 6 }
  32961. * ];
  32962. *
  32963. * _.find(objects, _.matchesProperty('a', 4));
  32964. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32965. */
  32966. function matchesProperty(path, srcValue) {
  32967. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32968. }
  32969. /**
  32970. * Creates a function that invokes the method at `path` of a given object.
  32971. * Any additional arguments are provided to the invoked method.
  32972. *
  32973. * @static
  32974. * @memberOf _
  32975. * @since 3.7.0
  32976. * @category Util
  32977. * @param {Array|string} path The path of the method to invoke.
  32978. * @param {...*} [args] The arguments to invoke the method with.
  32979. * @returns {Function} Returns the new invoker function.
  32980. * @example
  32981. *
  32982. * var objects = [
  32983. * { 'a': { 'b': _.constant(2) } },
  32984. * { 'a': { 'b': _.constant(1) } }
  32985. * ];
  32986. *
  32987. * _.map(objects, _.method('a.b'));
  32988. * // => [2, 1]
  32989. *
  32990. * _.map(objects, _.method(['a', 'b']));
  32991. * // => [2, 1]
  32992. */
  32993. var method = baseRest(function(path, args) {
  32994. return function(object) {
  32995. return baseInvoke(object, path, args);
  32996. };
  32997. });
  32998. /**
  32999. * The opposite of `_.method`; this method creates a function that invokes
  33000. * the method at a given path of `object`. Any additional arguments are
  33001. * provided to the invoked method.
  33002. *
  33003. * @static
  33004. * @memberOf _
  33005. * @since 3.7.0
  33006. * @category Util
  33007. * @param {Object} object The object to query.
  33008. * @param {...*} [args] The arguments to invoke the method with.
  33009. * @returns {Function} Returns the new invoker function.
  33010. * @example
  33011. *
  33012. * var array = _.times(3, _.constant),
  33013. * object = { 'a': array, 'b': array, 'c': array };
  33014. *
  33015. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33016. * // => [2, 0]
  33017. *
  33018. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33019. * // => [2, 0]
  33020. */
  33021. var methodOf = baseRest(function(object, args) {
  33022. return function(path) {
  33023. return baseInvoke(object, path, args);
  33024. };
  33025. });
  33026. /**
  33027. * Adds all own enumerable string keyed function properties of a source
  33028. * object to the destination object. If `object` is a function, then methods
  33029. * are added to its prototype as well.
  33030. *
  33031. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33032. * avoid conflicts caused by modifying the original.
  33033. *
  33034. * @static
  33035. * @since 0.1.0
  33036. * @memberOf _
  33037. * @category Util
  33038. * @param {Function|Object} [object=lodash] The destination object.
  33039. * @param {Object} source The object of functions to add.
  33040. * @param {Object} [options={}] The options object.
  33041. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33042. * @returns {Function|Object} Returns `object`.
  33043. * @example
  33044. *
  33045. * function vowels(string) {
  33046. * return _.filter(string, function(v) {
  33047. * return /[aeiou]/i.test(v);
  33048. * });
  33049. * }
  33050. *
  33051. * _.mixin({ 'vowels': vowels });
  33052. * _.vowels('fred');
  33053. * // => ['e']
  33054. *
  33055. * _('fred').vowels().value();
  33056. * // => ['e']
  33057. *
  33058. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33059. * _('fred').vowels();
  33060. * // => ['e']
  33061. */
  33062. function mixin(object, source, options) {
  33063. var props = keys(source),
  33064. methodNames = baseFunctions(source, props);
  33065. if (options == null &&
  33066. !(isObject(source) && (methodNames.length || !props.length))) {
  33067. options = source;
  33068. source = object;
  33069. object = this;
  33070. methodNames = baseFunctions(source, keys(source));
  33071. }
  33072. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33073. isFunc = isFunction(object);
  33074. arrayEach(methodNames, function(methodName) {
  33075. var func = source[methodName];
  33076. object[methodName] = func;
  33077. if (isFunc) {
  33078. object.prototype[methodName] = function() {
  33079. var chainAll = this.__chain__;
  33080. if (chain || chainAll) {
  33081. var result = object(this.__wrapped__),
  33082. actions = result.__actions__ = copyArray(this.__actions__);
  33083. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33084. result.__chain__ = chainAll;
  33085. return result;
  33086. }
  33087. return func.apply(object, arrayPush([this.value()], arguments));
  33088. };
  33089. }
  33090. });
  33091. return object;
  33092. }
  33093. /**
  33094. * Reverts the `_` variable to its previous value and returns a reference to
  33095. * the `lodash` function.
  33096. *
  33097. * @static
  33098. * @since 0.1.0
  33099. * @memberOf _
  33100. * @category Util
  33101. * @returns {Function} Returns the `lodash` function.
  33102. * @example
  33103. *
  33104. * var lodash = _.noConflict();
  33105. */
  33106. function noConflict() {
  33107. if (root._ === this) {
  33108. root._ = oldDash;
  33109. }
  33110. return this;
  33111. }
  33112. /**
  33113. * This method returns `undefined`.
  33114. *
  33115. * @static
  33116. * @memberOf _
  33117. * @since 2.3.0
  33118. * @category Util
  33119. * @example
  33120. *
  33121. * _.times(2, _.noop);
  33122. * // => [undefined, undefined]
  33123. */
  33124. function noop() {
  33125. // No operation performed.
  33126. }
  33127. /**
  33128. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33129. * the nth argument from the end is returned.
  33130. *
  33131. * @static
  33132. * @memberOf _
  33133. * @since 4.0.0
  33134. * @category Util
  33135. * @param {number} [n=0] The index of the argument to return.
  33136. * @returns {Function} Returns the new pass-thru function.
  33137. * @example
  33138. *
  33139. * var func = _.nthArg(1);
  33140. * func('a', 'b', 'c', 'd');
  33141. * // => 'b'
  33142. *
  33143. * var func = _.nthArg(-2);
  33144. * func('a', 'b', 'c', 'd');
  33145. * // => 'c'
  33146. */
  33147. function nthArg(n) {
  33148. n = toInteger(n);
  33149. return baseRest(function(args) {
  33150. return baseNth(args, n);
  33151. });
  33152. }
  33153. /**
  33154. * Creates a function that invokes `iteratees` with the arguments it receives
  33155. * and returns their results.
  33156. *
  33157. * @static
  33158. * @memberOf _
  33159. * @since 4.0.0
  33160. * @category Util
  33161. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33162. * The iteratees to invoke.
  33163. * @returns {Function} Returns the new function.
  33164. * @example
  33165. *
  33166. * var func = _.over([Math.max, Math.min]);
  33167. *
  33168. * func(1, 2, 3, 4);
  33169. * // => [4, 1]
  33170. */
  33171. var over = createOver(arrayMap);
  33172. /**
  33173. * Creates a function that checks if **all** of the `predicates` return
  33174. * truthy when invoked with the arguments it receives.
  33175. *
  33176. * @static
  33177. * @memberOf _
  33178. * @since 4.0.0
  33179. * @category Util
  33180. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33181. * The predicates to check.
  33182. * @returns {Function} Returns the new function.
  33183. * @example
  33184. *
  33185. * var func = _.overEvery([Boolean, isFinite]);
  33186. *
  33187. * func('1');
  33188. * // => true
  33189. *
  33190. * func(null);
  33191. * // => false
  33192. *
  33193. * func(NaN);
  33194. * // => false
  33195. */
  33196. var overEvery = createOver(arrayEvery);
  33197. /**
  33198. * Creates a function that checks if **any** of the `predicates` return
  33199. * truthy when invoked with the arguments it receives.
  33200. *
  33201. * @static
  33202. * @memberOf _
  33203. * @since 4.0.0
  33204. * @category Util
  33205. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33206. * The predicates to check.
  33207. * @returns {Function} Returns the new function.
  33208. * @example
  33209. *
  33210. * var func = _.overSome([Boolean, isFinite]);
  33211. *
  33212. * func('1');
  33213. * // => true
  33214. *
  33215. * func(null);
  33216. * // => true
  33217. *
  33218. * func(NaN);
  33219. * // => false
  33220. */
  33221. var overSome = createOver(arraySome);
  33222. /**
  33223. * Creates a function that returns the value at `path` of a given object.
  33224. *
  33225. * @static
  33226. * @memberOf _
  33227. * @since 2.4.0
  33228. * @category Util
  33229. * @param {Array|string} path The path of the property to get.
  33230. * @returns {Function} Returns the new accessor function.
  33231. * @example
  33232. *
  33233. * var objects = [
  33234. * { 'a': { 'b': 2 } },
  33235. * { 'a': { 'b': 1 } }
  33236. * ];
  33237. *
  33238. * _.map(objects, _.property('a.b'));
  33239. * // => [2, 1]
  33240. *
  33241. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33242. * // => [1, 2]
  33243. */
  33244. function property(path) {
  33245. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33246. }
  33247. /**
  33248. * The opposite of `_.property`; this method creates a function that returns
  33249. * the value at a given path of `object`.
  33250. *
  33251. * @static
  33252. * @memberOf _
  33253. * @since 3.0.0
  33254. * @category Util
  33255. * @param {Object} object The object to query.
  33256. * @returns {Function} Returns the new accessor function.
  33257. * @example
  33258. *
  33259. * var array = [0, 1, 2],
  33260. * object = { 'a': array, 'b': array, 'c': array };
  33261. *
  33262. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33263. * // => [2, 0]
  33264. *
  33265. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33266. * // => [2, 0]
  33267. */
  33268. function propertyOf(object) {
  33269. return function(path) {
  33270. return object == null ? undefined : baseGet(object, path);
  33271. };
  33272. }
  33273. /**
  33274. * Creates an array of numbers (positive and/or negative) progressing from
  33275. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33276. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33277. * it's set to `start` with `start` then set to `0`.
  33278. *
  33279. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33280. * floating-point values which can produce unexpected results.
  33281. *
  33282. * @static
  33283. * @since 0.1.0
  33284. * @memberOf _
  33285. * @category Util
  33286. * @param {number} [start=0] The start of the range.
  33287. * @param {number} end The end of the range.
  33288. * @param {number} [step=1] The value to increment or decrement by.
  33289. * @returns {Array} Returns the range of numbers.
  33290. * @see _.inRange, _.rangeRight
  33291. * @example
  33292. *
  33293. * _.range(4);
  33294. * // => [0, 1, 2, 3]
  33295. *
  33296. * _.range(-4);
  33297. * // => [0, -1, -2, -3]
  33298. *
  33299. * _.range(1, 5);
  33300. * // => [1, 2, 3, 4]
  33301. *
  33302. * _.range(0, 20, 5);
  33303. * // => [0, 5, 10, 15]
  33304. *
  33305. * _.range(0, -4, -1);
  33306. * // => [0, -1, -2, -3]
  33307. *
  33308. * _.range(1, 4, 0);
  33309. * // => [1, 1, 1]
  33310. *
  33311. * _.range(0);
  33312. * // => []
  33313. */
  33314. var range = createRange();
  33315. /**
  33316. * This method is like `_.range` except that it populates values in
  33317. * descending order.
  33318. *
  33319. * @static
  33320. * @memberOf _
  33321. * @since 4.0.0
  33322. * @category Util
  33323. * @param {number} [start=0] The start of the range.
  33324. * @param {number} end The end of the range.
  33325. * @param {number} [step=1] The value to increment or decrement by.
  33326. * @returns {Array} Returns the range of numbers.
  33327. * @see _.inRange, _.range
  33328. * @example
  33329. *
  33330. * _.rangeRight(4);
  33331. * // => [3, 2, 1, 0]
  33332. *
  33333. * _.rangeRight(-4);
  33334. * // => [-3, -2, -1, 0]
  33335. *
  33336. * _.rangeRight(1, 5);
  33337. * // => [4, 3, 2, 1]
  33338. *
  33339. * _.rangeRight(0, 20, 5);
  33340. * // => [15, 10, 5, 0]
  33341. *
  33342. * _.rangeRight(0, -4, -1);
  33343. * // => [-3, -2, -1, 0]
  33344. *
  33345. * _.rangeRight(1, 4, 0);
  33346. * // => [1, 1, 1]
  33347. *
  33348. * _.rangeRight(0);
  33349. * // => []
  33350. */
  33351. var rangeRight = createRange(true);
  33352. /**
  33353. * This method returns a new empty array.
  33354. *
  33355. * @static
  33356. * @memberOf _
  33357. * @since 4.13.0
  33358. * @category Util
  33359. * @returns {Array} Returns the new empty array.
  33360. * @example
  33361. *
  33362. * var arrays = _.times(2, _.stubArray);
  33363. *
  33364. * console.log(arrays);
  33365. * // => [[], []]
  33366. *
  33367. * console.log(arrays[0] === arrays[1]);
  33368. * // => false
  33369. */
  33370. function stubArray() {
  33371. return [];
  33372. }
  33373. /**
  33374. * This method returns `false`.
  33375. *
  33376. * @static
  33377. * @memberOf _
  33378. * @since 4.13.0
  33379. * @category Util
  33380. * @returns {boolean} Returns `false`.
  33381. * @example
  33382. *
  33383. * _.times(2, _.stubFalse);
  33384. * // => [false, false]
  33385. */
  33386. function stubFalse() {
  33387. return false;
  33388. }
  33389. /**
  33390. * This method returns a new empty object.
  33391. *
  33392. * @static
  33393. * @memberOf _
  33394. * @since 4.13.0
  33395. * @category Util
  33396. * @returns {Object} Returns the new empty object.
  33397. * @example
  33398. *
  33399. * var objects = _.times(2, _.stubObject);
  33400. *
  33401. * console.log(objects);
  33402. * // => [{}, {}]
  33403. *
  33404. * console.log(objects[0] === objects[1]);
  33405. * // => false
  33406. */
  33407. function stubObject() {
  33408. return {};
  33409. }
  33410. /**
  33411. * This method returns an empty string.
  33412. *
  33413. * @static
  33414. * @memberOf _
  33415. * @since 4.13.0
  33416. * @category Util
  33417. * @returns {string} Returns the empty string.
  33418. * @example
  33419. *
  33420. * _.times(2, _.stubString);
  33421. * // => ['', '']
  33422. */
  33423. function stubString() {
  33424. return '';
  33425. }
  33426. /**
  33427. * This method returns `true`.
  33428. *
  33429. * @static
  33430. * @memberOf _
  33431. * @since 4.13.0
  33432. * @category Util
  33433. * @returns {boolean} Returns `true`.
  33434. * @example
  33435. *
  33436. * _.times(2, _.stubTrue);
  33437. * // => [true, true]
  33438. */
  33439. function stubTrue() {
  33440. return true;
  33441. }
  33442. /**
  33443. * Invokes the iteratee `n` times, returning an array of the results of
  33444. * each invocation. The iteratee is invoked with one argument; (index).
  33445. *
  33446. * @static
  33447. * @since 0.1.0
  33448. * @memberOf _
  33449. * @category Util
  33450. * @param {number} n The number of times to invoke `iteratee`.
  33451. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33452. * @returns {Array} Returns the array of results.
  33453. * @example
  33454. *
  33455. * _.times(3, String);
  33456. * // => ['0', '1', '2']
  33457. *
  33458. * _.times(4, _.constant(0));
  33459. * // => [0, 0, 0, 0]
  33460. */
  33461. function times(n, iteratee) {
  33462. n = toInteger(n);
  33463. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33464. return [];
  33465. }
  33466. var index = MAX_ARRAY_LENGTH,
  33467. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33468. iteratee = getIteratee(iteratee);
  33469. n -= MAX_ARRAY_LENGTH;
  33470. var result = baseTimes(length, iteratee);
  33471. while (++index < n) {
  33472. iteratee(index);
  33473. }
  33474. return result;
  33475. }
  33476. /**
  33477. * Converts `value` to a property path array.
  33478. *
  33479. * @static
  33480. * @memberOf _
  33481. * @since 4.0.0
  33482. * @category Util
  33483. * @param {*} value The value to convert.
  33484. * @returns {Array} Returns the new property path array.
  33485. * @example
  33486. *
  33487. * _.toPath('a.b.c');
  33488. * // => ['a', 'b', 'c']
  33489. *
  33490. * _.toPath('a[0].b.c');
  33491. * // => ['a', '0', 'b', 'c']
  33492. */
  33493. function toPath(value) {
  33494. if (isArray(value)) {
  33495. return arrayMap(value, toKey);
  33496. }
  33497. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33498. }
  33499. /**
  33500. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33501. *
  33502. * @static
  33503. * @since 0.1.0
  33504. * @memberOf _
  33505. * @category Util
  33506. * @param {string} [prefix=''] The value to prefix the ID with.
  33507. * @returns {string} Returns the unique ID.
  33508. * @example
  33509. *
  33510. * _.uniqueId('contact_');
  33511. * // => 'contact_104'
  33512. *
  33513. * _.uniqueId();
  33514. * // => '105'
  33515. */
  33516. function uniqueId(prefix) {
  33517. var id = ++idCounter;
  33518. return toString(prefix) + id;
  33519. }
  33520. /*------------------------------------------------------------------------*/
  33521. /**
  33522. * Adds two numbers.
  33523. *
  33524. * @static
  33525. * @memberOf _
  33526. * @since 3.4.0
  33527. * @category Math
  33528. * @param {number} augend The first number in an addition.
  33529. * @param {number} addend The second number in an addition.
  33530. * @returns {number} Returns the total.
  33531. * @example
  33532. *
  33533. * _.add(6, 4);
  33534. * // => 10
  33535. */
  33536. var add = createMathOperation(function(augend, addend) {
  33537. return augend + addend;
  33538. }, 0);
  33539. /**
  33540. * Computes `number` rounded up to `precision`.
  33541. *
  33542. * @static
  33543. * @memberOf _
  33544. * @since 3.10.0
  33545. * @category Math
  33546. * @param {number} number The number to round up.
  33547. * @param {number} [precision=0] The precision to round up to.
  33548. * @returns {number} Returns the rounded up number.
  33549. * @example
  33550. *
  33551. * _.ceil(4.006);
  33552. * // => 5
  33553. *
  33554. * _.ceil(6.004, 2);
  33555. * // => 6.01
  33556. *
  33557. * _.ceil(6040, -2);
  33558. * // => 6100
  33559. */
  33560. var ceil = createRound('ceil');
  33561. /**
  33562. * Divide two numbers.
  33563. *
  33564. * @static
  33565. * @memberOf _
  33566. * @since 4.7.0
  33567. * @category Math
  33568. * @param {number} dividend The first number in a division.
  33569. * @param {number} divisor The second number in a division.
  33570. * @returns {number} Returns the quotient.
  33571. * @example
  33572. *
  33573. * _.divide(6, 4);
  33574. * // => 1.5
  33575. */
  33576. var divide = createMathOperation(function(dividend, divisor) {
  33577. return dividend / divisor;
  33578. }, 1);
  33579. /**
  33580. * Computes `number` rounded down to `precision`.
  33581. *
  33582. * @static
  33583. * @memberOf _
  33584. * @since 3.10.0
  33585. * @category Math
  33586. * @param {number} number The number to round down.
  33587. * @param {number} [precision=0] The precision to round down to.
  33588. * @returns {number} Returns the rounded down number.
  33589. * @example
  33590. *
  33591. * _.floor(4.006);
  33592. * // => 4
  33593. *
  33594. * _.floor(0.046, 2);
  33595. * // => 0.04
  33596. *
  33597. * _.floor(4060, -2);
  33598. * // => 4000
  33599. */
  33600. var floor = createRound('floor');
  33601. /**
  33602. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33603. * `undefined` is returned.
  33604. *
  33605. * @static
  33606. * @since 0.1.0
  33607. * @memberOf _
  33608. * @category Math
  33609. * @param {Array} array The array to iterate over.
  33610. * @returns {*} Returns the maximum value.
  33611. * @example
  33612. *
  33613. * _.max([4, 2, 8, 6]);
  33614. * // => 8
  33615. *
  33616. * _.max([]);
  33617. * // => undefined
  33618. */
  33619. function max(array) {
  33620. return (array && array.length)
  33621. ? baseExtremum(array, identity, baseGt)
  33622. : undefined;
  33623. }
  33624. /**
  33625. * This method is like `_.max` except that it accepts `iteratee` which is
  33626. * invoked for each element in `array` to generate the criterion by which
  33627. * the value is ranked. The iteratee is invoked with one argument: (value).
  33628. *
  33629. * @static
  33630. * @memberOf _
  33631. * @since 4.0.0
  33632. * @category Math
  33633. * @param {Array} array The array to iterate over.
  33634. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33635. * @returns {*} Returns the maximum value.
  33636. * @example
  33637. *
  33638. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33639. *
  33640. * _.maxBy(objects, function(o) { return o.n; });
  33641. * // => { 'n': 2 }
  33642. *
  33643. * // The `_.property` iteratee shorthand.
  33644. * _.maxBy(objects, 'n');
  33645. * // => { 'n': 2 }
  33646. */
  33647. function maxBy(array, iteratee) {
  33648. return (array && array.length)
  33649. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33650. : undefined;
  33651. }
  33652. /**
  33653. * Computes the mean of the values in `array`.
  33654. *
  33655. * @static
  33656. * @memberOf _
  33657. * @since 4.0.0
  33658. * @category Math
  33659. * @param {Array} array The array to iterate over.
  33660. * @returns {number} Returns the mean.
  33661. * @example
  33662. *
  33663. * _.mean([4, 2, 8, 6]);
  33664. * // => 5
  33665. */
  33666. function mean(array) {
  33667. return baseMean(array, identity);
  33668. }
  33669. /**
  33670. * This method is like `_.mean` except that it accepts `iteratee` which is
  33671. * invoked for each element in `array` to generate the value to be averaged.
  33672. * The iteratee is invoked with one argument: (value).
  33673. *
  33674. * @static
  33675. * @memberOf _
  33676. * @since 4.7.0
  33677. * @category Math
  33678. * @param {Array} array The array to iterate over.
  33679. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33680. * @returns {number} Returns the mean.
  33681. * @example
  33682. *
  33683. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33684. *
  33685. * _.meanBy(objects, function(o) { return o.n; });
  33686. * // => 5
  33687. *
  33688. * // The `_.property` iteratee shorthand.
  33689. * _.meanBy(objects, 'n');
  33690. * // => 5
  33691. */
  33692. function meanBy(array, iteratee) {
  33693. return baseMean(array, getIteratee(iteratee, 2));
  33694. }
  33695. /**
  33696. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33697. * `undefined` is returned.
  33698. *
  33699. * @static
  33700. * @since 0.1.0
  33701. * @memberOf _
  33702. * @category Math
  33703. * @param {Array} array The array to iterate over.
  33704. * @returns {*} Returns the minimum value.
  33705. * @example
  33706. *
  33707. * _.min([4, 2, 8, 6]);
  33708. * // => 2
  33709. *
  33710. * _.min([]);
  33711. * // => undefined
  33712. */
  33713. function min(array) {
  33714. return (array && array.length)
  33715. ? baseExtremum(array, identity, baseLt)
  33716. : undefined;
  33717. }
  33718. /**
  33719. * This method is like `_.min` except that it accepts `iteratee` which is
  33720. * invoked for each element in `array` to generate the criterion by which
  33721. * the value is ranked. The iteratee is invoked with one argument: (value).
  33722. *
  33723. * @static
  33724. * @memberOf _
  33725. * @since 4.0.0
  33726. * @category Math
  33727. * @param {Array} array The array to iterate over.
  33728. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33729. * @returns {*} Returns the minimum value.
  33730. * @example
  33731. *
  33732. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33733. *
  33734. * _.minBy(objects, function(o) { return o.n; });
  33735. * // => { 'n': 1 }
  33736. *
  33737. * // The `_.property` iteratee shorthand.
  33738. * _.minBy(objects, 'n');
  33739. * // => { 'n': 1 }
  33740. */
  33741. function minBy(array, iteratee) {
  33742. return (array && array.length)
  33743. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33744. : undefined;
  33745. }
  33746. /**
  33747. * Multiply two numbers.
  33748. *
  33749. * @static
  33750. * @memberOf _
  33751. * @since 4.7.0
  33752. * @category Math
  33753. * @param {number} multiplier The first number in a multiplication.
  33754. * @param {number} multiplicand The second number in a multiplication.
  33755. * @returns {number} Returns the product.
  33756. * @example
  33757. *
  33758. * _.multiply(6, 4);
  33759. * // => 24
  33760. */
  33761. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33762. return multiplier * multiplicand;
  33763. }, 1);
  33764. /**
  33765. * Computes `number` rounded to `precision`.
  33766. *
  33767. * @static
  33768. * @memberOf _
  33769. * @since 3.10.0
  33770. * @category Math
  33771. * @param {number} number The number to round.
  33772. * @param {number} [precision=0] The precision to round to.
  33773. * @returns {number} Returns the rounded number.
  33774. * @example
  33775. *
  33776. * _.round(4.006);
  33777. * // => 4
  33778. *
  33779. * _.round(4.006, 2);
  33780. * // => 4.01
  33781. *
  33782. * _.round(4060, -2);
  33783. * // => 4100
  33784. */
  33785. var round = createRound('round');
  33786. /**
  33787. * Subtract two numbers.
  33788. *
  33789. * @static
  33790. * @memberOf _
  33791. * @since 4.0.0
  33792. * @category Math
  33793. * @param {number} minuend The first number in a subtraction.
  33794. * @param {number} subtrahend The second number in a subtraction.
  33795. * @returns {number} Returns the difference.
  33796. * @example
  33797. *
  33798. * _.subtract(6, 4);
  33799. * // => 2
  33800. */
  33801. var subtract = createMathOperation(function(minuend, subtrahend) {
  33802. return minuend - subtrahend;
  33803. }, 0);
  33804. /**
  33805. * Computes the sum of the values in `array`.
  33806. *
  33807. * @static
  33808. * @memberOf _
  33809. * @since 3.4.0
  33810. * @category Math
  33811. * @param {Array} array The array to iterate over.
  33812. * @returns {number} Returns the sum.
  33813. * @example
  33814. *
  33815. * _.sum([4, 2, 8, 6]);
  33816. * // => 20
  33817. */
  33818. function sum(array) {
  33819. return (array && array.length)
  33820. ? baseSum(array, identity)
  33821. : 0;
  33822. }
  33823. /**
  33824. * This method is like `_.sum` except that it accepts `iteratee` which is
  33825. * invoked for each element in `array` to generate the value to be summed.
  33826. * The iteratee is invoked with one argument: (value).
  33827. *
  33828. * @static
  33829. * @memberOf _
  33830. * @since 4.0.0
  33831. * @category Math
  33832. * @param {Array} array The array to iterate over.
  33833. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33834. * @returns {number} Returns the sum.
  33835. * @example
  33836. *
  33837. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33838. *
  33839. * _.sumBy(objects, function(o) { return o.n; });
  33840. * // => 20
  33841. *
  33842. * // The `_.property` iteratee shorthand.
  33843. * _.sumBy(objects, 'n');
  33844. * // => 20
  33845. */
  33846. function sumBy(array, iteratee) {
  33847. return (array && array.length)
  33848. ? baseSum(array, getIteratee(iteratee, 2))
  33849. : 0;
  33850. }
  33851. /*------------------------------------------------------------------------*/
  33852. // Add methods that return wrapped values in chain sequences.
  33853. lodash.after = after;
  33854. lodash.ary = ary;
  33855. lodash.assign = assign;
  33856. lodash.assignIn = assignIn;
  33857. lodash.assignInWith = assignInWith;
  33858. lodash.assignWith = assignWith;
  33859. lodash.at = at;
  33860. lodash.before = before;
  33861. lodash.bind = bind;
  33862. lodash.bindAll = bindAll;
  33863. lodash.bindKey = bindKey;
  33864. lodash.castArray = castArray;
  33865. lodash.chain = chain;
  33866. lodash.chunk = chunk;
  33867. lodash.compact = compact;
  33868. lodash.concat = concat;
  33869. lodash.cond = cond;
  33870. lodash.conforms = conforms;
  33871. lodash.constant = constant;
  33872. lodash.countBy = countBy;
  33873. lodash.create = create;
  33874. lodash.curry = curry;
  33875. lodash.curryRight = curryRight;
  33876. lodash.debounce = debounce;
  33877. lodash.defaults = defaults;
  33878. lodash.defaultsDeep = defaultsDeep;
  33879. lodash.defer = defer;
  33880. lodash.delay = delay;
  33881. lodash.difference = difference;
  33882. lodash.differenceBy = differenceBy;
  33883. lodash.differenceWith = differenceWith;
  33884. lodash.drop = drop;
  33885. lodash.dropRight = dropRight;
  33886. lodash.dropRightWhile = dropRightWhile;
  33887. lodash.dropWhile = dropWhile;
  33888. lodash.fill = fill;
  33889. lodash.filter = filter;
  33890. lodash.flatMap = flatMap;
  33891. lodash.flatMapDeep = flatMapDeep;
  33892. lodash.flatMapDepth = flatMapDepth;
  33893. lodash.flatten = flatten;
  33894. lodash.flattenDeep = flattenDeep;
  33895. lodash.flattenDepth = flattenDepth;
  33896. lodash.flip = flip;
  33897. lodash.flow = flow;
  33898. lodash.flowRight = flowRight;
  33899. lodash.fromPairs = fromPairs;
  33900. lodash.functions = functions;
  33901. lodash.functionsIn = functionsIn;
  33902. lodash.groupBy = groupBy;
  33903. lodash.initial = initial;
  33904. lodash.intersection = intersection;
  33905. lodash.intersectionBy = intersectionBy;
  33906. lodash.intersectionWith = intersectionWith;
  33907. lodash.invert = invert;
  33908. lodash.invertBy = invertBy;
  33909. lodash.invokeMap = invokeMap;
  33910. lodash.iteratee = iteratee;
  33911. lodash.keyBy = keyBy;
  33912. lodash.keys = keys;
  33913. lodash.keysIn = keysIn;
  33914. lodash.map = map;
  33915. lodash.mapKeys = mapKeys;
  33916. lodash.mapValues = mapValues;
  33917. lodash.matches = matches;
  33918. lodash.matchesProperty = matchesProperty;
  33919. lodash.memoize = memoize;
  33920. lodash.merge = merge;
  33921. lodash.mergeWith = mergeWith;
  33922. lodash.method = method;
  33923. lodash.methodOf = methodOf;
  33924. lodash.mixin = mixin;
  33925. lodash.negate = negate;
  33926. lodash.nthArg = nthArg;
  33927. lodash.omit = omit;
  33928. lodash.omitBy = omitBy;
  33929. lodash.once = once;
  33930. lodash.orderBy = orderBy;
  33931. lodash.over = over;
  33932. lodash.overArgs = overArgs;
  33933. lodash.overEvery = overEvery;
  33934. lodash.overSome = overSome;
  33935. lodash.partial = partial;
  33936. lodash.partialRight = partialRight;
  33937. lodash.partition = partition;
  33938. lodash.pick = pick;
  33939. lodash.pickBy = pickBy;
  33940. lodash.property = property;
  33941. lodash.propertyOf = propertyOf;
  33942. lodash.pull = pull;
  33943. lodash.pullAll = pullAll;
  33944. lodash.pullAllBy = pullAllBy;
  33945. lodash.pullAllWith = pullAllWith;
  33946. lodash.pullAt = pullAt;
  33947. lodash.range = range;
  33948. lodash.rangeRight = rangeRight;
  33949. lodash.rearg = rearg;
  33950. lodash.reject = reject;
  33951. lodash.remove = remove;
  33952. lodash.rest = rest;
  33953. lodash.reverse = reverse;
  33954. lodash.sampleSize = sampleSize;
  33955. lodash.set = set;
  33956. lodash.setWith = setWith;
  33957. lodash.shuffle = shuffle;
  33958. lodash.slice = slice;
  33959. lodash.sortBy = sortBy;
  33960. lodash.sortedUniq = sortedUniq;
  33961. lodash.sortedUniqBy = sortedUniqBy;
  33962. lodash.split = split;
  33963. lodash.spread = spread;
  33964. lodash.tail = tail;
  33965. lodash.take = take;
  33966. lodash.takeRight = takeRight;
  33967. lodash.takeRightWhile = takeRightWhile;
  33968. lodash.takeWhile = takeWhile;
  33969. lodash.tap = tap;
  33970. lodash.throttle = throttle;
  33971. lodash.thru = thru;
  33972. lodash.toArray = toArray;
  33973. lodash.toPairs = toPairs;
  33974. lodash.toPairsIn = toPairsIn;
  33975. lodash.toPath = toPath;
  33976. lodash.toPlainObject = toPlainObject;
  33977. lodash.transform = transform;
  33978. lodash.unary = unary;
  33979. lodash.union = union;
  33980. lodash.unionBy = unionBy;
  33981. lodash.unionWith = unionWith;
  33982. lodash.uniq = uniq;
  33983. lodash.uniqBy = uniqBy;
  33984. lodash.uniqWith = uniqWith;
  33985. lodash.unset = unset;
  33986. lodash.unzip = unzip;
  33987. lodash.unzipWith = unzipWith;
  33988. lodash.update = update;
  33989. lodash.updateWith = updateWith;
  33990. lodash.values = values;
  33991. lodash.valuesIn = valuesIn;
  33992. lodash.without = without;
  33993. lodash.words = words;
  33994. lodash.wrap = wrap;
  33995. lodash.xor = xor;
  33996. lodash.xorBy = xorBy;
  33997. lodash.xorWith = xorWith;
  33998. lodash.zip = zip;
  33999. lodash.zipObject = zipObject;
  34000. lodash.zipObjectDeep = zipObjectDeep;
  34001. lodash.zipWith = zipWith;
  34002. // Add aliases.
  34003. lodash.entries = toPairs;
  34004. lodash.entriesIn = toPairsIn;
  34005. lodash.extend = assignIn;
  34006. lodash.extendWith = assignInWith;
  34007. // Add methods to `lodash.prototype`.
  34008. mixin(lodash, lodash);
  34009. /*------------------------------------------------------------------------*/
  34010. // Add methods that return unwrapped values in chain sequences.
  34011. lodash.add = add;
  34012. lodash.attempt = attempt;
  34013. lodash.camelCase = camelCase;
  34014. lodash.capitalize = capitalize;
  34015. lodash.ceil = ceil;
  34016. lodash.clamp = clamp;
  34017. lodash.clone = clone;
  34018. lodash.cloneDeep = cloneDeep;
  34019. lodash.cloneDeepWith = cloneDeepWith;
  34020. lodash.cloneWith = cloneWith;
  34021. lodash.conformsTo = conformsTo;
  34022. lodash.deburr = deburr;
  34023. lodash.defaultTo = defaultTo;
  34024. lodash.divide = divide;
  34025. lodash.endsWith = endsWith;
  34026. lodash.eq = eq;
  34027. lodash.escape = escape;
  34028. lodash.escapeRegExp = escapeRegExp;
  34029. lodash.every = every;
  34030. lodash.find = find;
  34031. lodash.findIndex = findIndex;
  34032. lodash.findKey = findKey;
  34033. lodash.findLast = findLast;
  34034. lodash.findLastIndex = findLastIndex;
  34035. lodash.findLastKey = findLastKey;
  34036. lodash.floor = floor;
  34037. lodash.forEach = forEach;
  34038. lodash.forEachRight = forEachRight;
  34039. lodash.forIn = forIn;
  34040. lodash.forInRight = forInRight;
  34041. lodash.forOwn = forOwn;
  34042. lodash.forOwnRight = forOwnRight;
  34043. lodash.get = get;
  34044. lodash.gt = gt;
  34045. lodash.gte = gte;
  34046. lodash.has = has;
  34047. lodash.hasIn = hasIn;
  34048. lodash.head = head;
  34049. lodash.identity = identity;
  34050. lodash.includes = includes;
  34051. lodash.indexOf = indexOf;
  34052. lodash.inRange = inRange;
  34053. lodash.invoke = invoke;
  34054. lodash.isArguments = isArguments;
  34055. lodash.isArray = isArray;
  34056. lodash.isArrayBuffer = isArrayBuffer;
  34057. lodash.isArrayLike = isArrayLike;
  34058. lodash.isArrayLikeObject = isArrayLikeObject;
  34059. lodash.isBoolean = isBoolean;
  34060. lodash.isBuffer = isBuffer;
  34061. lodash.isDate = isDate;
  34062. lodash.isElement = isElement;
  34063. lodash.isEmpty = isEmpty;
  34064. lodash.isEqual = isEqual;
  34065. lodash.isEqualWith = isEqualWith;
  34066. lodash.isError = isError;
  34067. lodash.isFinite = isFinite;
  34068. lodash.isFunction = isFunction;
  34069. lodash.isInteger = isInteger;
  34070. lodash.isLength = isLength;
  34071. lodash.isMap = isMap;
  34072. lodash.isMatch = isMatch;
  34073. lodash.isMatchWith = isMatchWith;
  34074. lodash.isNaN = isNaN;
  34075. lodash.isNative = isNative;
  34076. lodash.isNil = isNil;
  34077. lodash.isNull = isNull;
  34078. lodash.isNumber = isNumber;
  34079. lodash.isObject = isObject;
  34080. lodash.isObjectLike = isObjectLike;
  34081. lodash.isPlainObject = isPlainObject;
  34082. lodash.isRegExp = isRegExp;
  34083. lodash.isSafeInteger = isSafeInteger;
  34084. lodash.isSet = isSet;
  34085. lodash.isString = isString;
  34086. lodash.isSymbol = isSymbol;
  34087. lodash.isTypedArray = isTypedArray;
  34088. lodash.isUndefined = isUndefined;
  34089. lodash.isWeakMap = isWeakMap;
  34090. lodash.isWeakSet = isWeakSet;
  34091. lodash.join = join;
  34092. lodash.kebabCase = kebabCase;
  34093. lodash.last = last;
  34094. lodash.lastIndexOf = lastIndexOf;
  34095. lodash.lowerCase = lowerCase;
  34096. lodash.lowerFirst = lowerFirst;
  34097. lodash.lt = lt;
  34098. lodash.lte = lte;
  34099. lodash.max = max;
  34100. lodash.maxBy = maxBy;
  34101. lodash.mean = mean;
  34102. lodash.meanBy = meanBy;
  34103. lodash.min = min;
  34104. lodash.minBy = minBy;
  34105. lodash.stubArray = stubArray;
  34106. lodash.stubFalse = stubFalse;
  34107. lodash.stubObject = stubObject;
  34108. lodash.stubString = stubString;
  34109. lodash.stubTrue = stubTrue;
  34110. lodash.multiply = multiply;
  34111. lodash.nth = nth;
  34112. lodash.noConflict = noConflict;
  34113. lodash.noop = noop;
  34114. lodash.now = now;
  34115. lodash.pad = pad;
  34116. lodash.padEnd = padEnd;
  34117. lodash.padStart = padStart;
  34118. lodash.parseInt = parseInt;
  34119. lodash.random = random;
  34120. lodash.reduce = reduce;
  34121. lodash.reduceRight = reduceRight;
  34122. lodash.repeat = repeat;
  34123. lodash.replace = replace;
  34124. lodash.result = result;
  34125. lodash.round = round;
  34126. lodash.runInContext = runInContext;
  34127. lodash.sample = sample;
  34128. lodash.size = size;
  34129. lodash.snakeCase = snakeCase;
  34130. lodash.some = some;
  34131. lodash.sortedIndex = sortedIndex;
  34132. lodash.sortedIndexBy = sortedIndexBy;
  34133. lodash.sortedIndexOf = sortedIndexOf;
  34134. lodash.sortedLastIndex = sortedLastIndex;
  34135. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34136. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34137. lodash.startCase = startCase;
  34138. lodash.startsWith = startsWith;
  34139. lodash.subtract = subtract;
  34140. lodash.sum = sum;
  34141. lodash.sumBy = sumBy;
  34142. lodash.template = template;
  34143. lodash.times = times;
  34144. lodash.toFinite = toFinite;
  34145. lodash.toInteger = toInteger;
  34146. lodash.toLength = toLength;
  34147. lodash.toLower = toLower;
  34148. lodash.toNumber = toNumber;
  34149. lodash.toSafeInteger = toSafeInteger;
  34150. lodash.toString = toString;
  34151. lodash.toUpper = toUpper;
  34152. lodash.trim = trim;
  34153. lodash.trimEnd = trimEnd;
  34154. lodash.trimStart = trimStart;
  34155. lodash.truncate = truncate;
  34156. lodash.unescape = unescape;
  34157. lodash.uniqueId = uniqueId;
  34158. lodash.upperCase = upperCase;
  34159. lodash.upperFirst = upperFirst;
  34160. // Add aliases.
  34161. lodash.each = forEach;
  34162. lodash.eachRight = forEachRight;
  34163. lodash.first = head;
  34164. mixin(lodash, (function() {
  34165. var source = {};
  34166. baseForOwn(lodash, function(func, methodName) {
  34167. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34168. source[methodName] = func;
  34169. }
  34170. });
  34171. return source;
  34172. }()), { 'chain': false });
  34173. /*------------------------------------------------------------------------*/
  34174. /**
  34175. * The semantic version number.
  34176. *
  34177. * @static
  34178. * @memberOf _
  34179. * @type {string}
  34180. */
  34181. lodash.VERSION = VERSION;
  34182. // Assign default placeholders.
  34183. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34184. lodash[methodName].placeholder = lodash;
  34185. });
  34186. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34187. arrayEach(['drop', 'take'], function(methodName, index) {
  34188. LazyWrapper.prototype[methodName] = function(n) {
  34189. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34190. var result = (this.__filtered__ && !index)
  34191. ? new LazyWrapper(this)
  34192. : this.clone();
  34193. if (result.__filtered__) {
  34194. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34195. } else {
  34196. result.__views__.push({
  34197. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34198. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34199. });
  34200. }
  34201. return result;
  34202. };
  34203. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34204. return this.reverse()[methodName](n).reverse();
  34205. };
  34206. });
  34207. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34208. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34209. var type = index + 1,
  34210. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34211. LazyWrapper.prototype[methodName] = function(iteratee) {
  34212. var result = this.clone();
  34213. result.__iteratees__.push({
  34214. 'iteratee': getIteratee(iteratee, 3),
  34215. 'type': type
  34216. });
  34217. result.__filtered__ = result.__filtered__ || isFilter;
  34218. return result;
  34219. };
  34220. });
  34221. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34222. arrayEach(['head', 'last'], function(methodName, index) {
  34223. var takeName = 'take' + (index ? 'Right' : '');
  34224. LazyWrapper.prototype[methodName] = function() {
  34225. return this[takeName](1).value()[0];
  34226. };
  34227. });
  34228. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34229. arrayEach(['initial', 'tail'], function(methodName, index) {
  34230. var dropName = 'drop' + (index ? '' : 'Right');
  34231. LazyWrapper.prototype[methodName] = function() {
  34232. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34233. };
  34234. });
  34235. LazyWrapper.prototype.compact = function() {
  34236. return this.filter(identity);
  34237. };
  34238. LazyWrapper.prototype.find = function(predicate) {
  34239. return this.filter(predicate).head();
  34240. };
  34241. LazyWrapper.prototype.findLast = function(predicate) {
  34242. return this.reverse().find(predicate);
  34243. };
  34244. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34245. if (typeof path == 'function') {
  34246. return new LazyWrapper(this);
  34247. }
  34248. return this.map(function(value) {
  34249. return baseInvoke(value, path, args);
  34250. });
  34251. });
  34252. LazyWrapper.prototype.reject = function(predicate) {
  34253. return this.filter(negate(getIteratee(predicate)));
  34254. };
  34255. LazyWrapper.prototype.slice = function(start, end) {
  34256. start = toInteger(start);
  34257. var result = this;
  34258. if (result.__filtered__ && (start > 0 || end < 0)) {
  34259. return new LazyWrapper(result);
  34260. }
  34261. if (start < 0) {
  34262. result = result.takeRight(-start);
  34263. } else if (start) {
  34264. result = result.drop(start);
  34265. }
  34266. if (end !== undefined) {
  34267. end = toInteger(end);
  34268. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34269. }
  34270. return result;
  34271. };
  34272. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34273. return this.reverse().takeWhile(predicate).reverse();
  34274. };
  34275. LazyWrapper.prototype.toArray = function() {
  34276. return this.take(MAX_ARRAY_LENGTH);
  34277. };
  34278. // Add `LazyWrapper` methods to `lodash.prototype`.
  34279. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34280. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34281. isTaker = /^(?:head|last)$/.test(methodName),
  34282. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34283. retUnwrapped = isTaker || /^find/.test(methodName);
  34284. if (!lodashFunc) {
  34285. return;
  34286. }
  34287. lodash.prototype[methodName] = function() {
  34288. var value = this.__wrapped__,
  34289. args = isTaker ? [1] : arguments,
  34290. isLazy = value instanceof LazyWrapper,
  34291. iteratee = args[0],
  34292. useLazy = isLazy || isArray(value);
  34293. var interceptor = function(value) {
  34294. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34295. return (isTaker && chainAll) ? result[0] : result;
  34296. };
  34297. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34298. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34299. isLazy = useLazy = false;
  34300. }
  34301. var chainAll = this.__chain__,
  34302. isHybrid = !!this.__actions__.length,
  34303. isUnwrapped = retUnwrapped && !chainAll,
  34304. onlyLazy = isLazy && !isHybrid;
  34305. if (!retUnwrapped && useLazy) {
  34306. value = onlyLazy ? value : new LazyWrapper(this);
  34307. var result = func.apply(value, args);
  34308. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34309. return new LodashWrapper(result, chainAll);
  34310. }
  34311. if (isUnwrapped && onlyLazy) {
  34312. return func.apply(this, args);
  34313. }
  34314. result = this.thru(interceptor);
  34315. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34316. };
  34317. });
  34318. // Add `Array` methods to `lodash.prototype`.
  34319. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34320. var func = arrayProto[methodName],
  34321. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34322. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34323. lodash.prototype[methodName] = function() {
  34324. var args = arguments;
  34325. if (retUnwrapped && !this.__chain__) {
  34326. var value = this.value();
  34327. return func.apply(isArray(value) ? value : [], args);
  34328. }
  34329. return this[chainName](function(value) {
  34330. return func.apply(isArray(value) ? value : [], args);
  34331. });
  34332. };
  34333. });
  34334. // Map minified method names to their real names.
  34335. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34336. var lodashFunc = lodash[methodName];
  34337. if (lodashFunc) {
  34338. var key = lodashFunc.name + '';
  34339. if (!hasOwnProperty.call(realNames, key)) {
  34340. realNames[key] = [];
  34341. }
  34342. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34343. }
  34344. });
  34345. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34346. 'name': 'wrapper',
  34347. 'func': undefined
  34348. }];
  34349. // Add methods to `LazyWrapper`.
  34350. LazyWrapper.prototype.clone = lazyClone;
  34351. LazyWrapper.prototype.reverse = lazyReverse;
  34352. LazyWrapper.prototype.value = lazyValue;
  34353. // Add chain sequence methods to the `lodash` wrapper.
  34354. lodash.prototype.at = wrapperAt;
  34355. lodash.prototype.chain = wrapperChain;
  34356. lodash.prototype.commit = wrapperCommit;
  34357. lodash.prototype.next = wrapperNext;
  34358. lodash.prototype.plant = wrapperPlant;
  34359. lodash.prototype.reverse = wrapperReverse;
  34360. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34361. // Add lazy aliases.
  34362. lodash.prototype.first = lodash.prototype.head;
  34363. if (symIterator) {
  34364. lodash.prototype[symIterator] = wrapperToIterator;
  34365. }
  34366. return lodash;
  34367. });
  34368. /*--------------------------------------------------------------------------*/
  34369. // Export lodash.
  34370. var _ = runInContext();
  34371. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34372. if (true) {
  34373. // Expose Lodash on the global object to prevent errors when Lodash is
  34374. // loaded by a script tag in the presence of an AMD loader.
  34375. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34376. // Use `_.noConflict` to remove Lodash from the global object.
  34377. root._ = _;
  34378. // Define as an anonymous module so, through path mapping, it can be
  34379. // referenced as the "underscore" module.
  34380. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34381. return _;
  34382. }).call(exports, __webpack_require__, exports, module),
  34383. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34384. }
  34385. // Check for `exports` after `define` in case a build optimizer adds it.
  34386. else {}
  34387. }.call(this));
  34388. /* 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)))
  34389. /***/ }),
  34390. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34391. /*!***************************************************!*\
  34392. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34393. \***************************************************/
  34394. /*! exports provided: default */
  34395. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34396. "use strict";
  34397. __webpack_require__.r(__webpack_exports__);
  34398. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34399. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34400. * @version 1.16.1
  34401. * @license
  34402. * Copyright (c) 2016 Federico Zivolo and contributors
  34403. *
  34404. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34405. * of this software and associated documentation files (the "Software"), to deal
  34406. * in the Software without restriction, including without limitation the rights
  34407. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34408. * copies of the Software, and to permit persons to whom the Software is
  34409. * furnished to do so, subject to the following conditions:
  34410. *
  34411. * The above copyright notice and this permission notice shall be included in all
  34412. * copies or substantial portions of the Software.
  34413. *
  34414. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34415. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34416. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34417. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34418. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34419. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34420. * SOFTWARE.
  34421. */
  34422. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34423. var timeoutDuration = function () {
  34424. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34425. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34426. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34427. return 1;
  34428. }
  34429. }
  34430. return 0;
  34431. }();
  34432. function microtaskDebounce(fn) {
  34433. var called = false;
  34434. return function () {
  34435. if (called) {
  34436. return;
  34437. }
  34438. called = true;
  34439. window.Promise.resolve().then(function () {
  34440. called = false;
  34441. fn();
  34442. });
  34443. };
  34444. }
  34445. function taskDebounce(fn) {
  34446. var scheduled = false;
  34447. return function () {
  34448. if (!scheduled) {
  34449. scheduled = true;
  34450. setTimeout(function () {
  34451. scheduled = false;
  34452. fn();
  34453. }, timeoutDuration);
  34454. }
  34455. };
  34456. }
  34457. var supportsMicroTasks = isBrowser && window.Promise;
  34458. /**
  34459. * Create a debounced version of a method, that's asynchronously deferred
  34460. * but called in the minimum time possible.
  34461. *
  34462. * @method
  34463. * @memberof Popper.Utils
  34464. * @argument {Function} fn
  34465. * @returns {Function}
  34466. */
  34467. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34468. /**
  34469. * Check if the given variable is a function
  34470. * @method
  34471. * @memberof Popper.Utils
  34472. * @argument {Any} functionToCheck - variable to check
  34473. * @returns {Boolean} answer to: is a function?
  34474. */
  34475. function isFunction(functionToCheck) {
  34476. var getType = {};
  34477. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34478. }
  34479. /**
  34480. * Get CSS computed property of the given element
  34481. * @method
  34482. * @memberof Popper.Utils
  34483. * @argument {Eement} element
  34484. * @argument {String} property
  34485. */
  34486. function getStyleComputedProperty(element, property) {
  34487. if (element.nodeType !== 1) {
  34488. return [];
  34489. }
  34490. // NOTE: 1 DOM access here
  34491. var window = element.ownerDocument.defaultView;
  34492. var css = window.getComputedStyle(element, null);
  34493. return property ? css[property] : css;
  34494. }
  34495. /**
  34496. * Returns the parentNode or the host of the element
  34497. * @method
  34498. * @memberof Popper.Utils
  34499. * @argument {Element} element
  34500. * @returns {Element} parent
  34501. */
  34502. function getParentNode(element) {
  34503. if (element.nodeName === 'HTML') {
  34504. return element;
  34505. }
  34506. return element.parentNode || element.host;
  34507. }
  34508. /**
  34509. * Returns the scrolling parent of the given element
  34510. * @method
  34511. * @memberof Popper.Utils
  34512. * @argument {Element} element
  34513. * @returns {Element} scroll parent
  34514. */
  34515. function getScrollParent(element) {
  34516. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34517. if (!element) {
  34518. return document.body;
  34519. }
  34520. switch (element.nodeName) {
  34521. case 'HTML':
  34522. case 'BODY':
  34523. return element.ownerDocument.body;
  34524. case '#document':
  34525. return element.body;
  34526. }
  34527. // Firefox want us to check `-x` and `-y` variations as well
  34528. var _getStyleComputedProp = getStyleComputedProperty(element),
  34529. overflow = _getStyleComputedProp.overflow,
  34530. overflowX = _getStyleComputedProp.overflowX,
  34531. overflowY = _getStyleComputedProp.overflowY;
  34532. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34533. return element;
  34534. }
  34535. return getScrollParent(getParentNode(element));
  34536. }
  34537. /**
  34538. * Returns the reference node of the reference object, or the reference object itself.
  34539. * @method
  34540. * @memberof Popper.Utils
  34541. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34542. * @returns {Element} parent
  34543. */
  34544. function getReferenceNode(reference) {
  34545. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34546. }
  34547. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34548. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34549. /**
  34550. * Determines if the browser is Internet Explorer
  34551. * @method
  34552. * @memberof Popper.Utils
  34553. * @param {Number} version to check
  34554. * @returns {Boolean} isIE
  34555. */
  34556. function isIE(version) {
  34557. if (version === 11) {
  34558. return isIE11;
  34559. }
  34560. if (version === 10) {
  34561. return isIE10;
  34562. }
  34563. return isIE11 || isIE10;
  34564. }
  34565. /**
  34566. * Returns the offset parent of the given element
  34567. * @method
  34568. * @memberof Popper.Utils
  34569. * @argument {Element} element
  34570. * @returns {Element} offset parent
  34571. */
  34572. function getOffsetParent(element) {
  34573. if (!element) {
  34574. return document.documentElement;
  34575. }
  34576. var noOffsetParent = isIE(10) ? document.body : null;
  34577. // NOTE: 1 DOM access here
  34578. var offsetParent = element.offsetParent || null;
  34579. // Skip hidden elements which don't have an offsetParent
  34580. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34581. offsetParent = (element = element.nextElementSibling).offsetParent;
  34582. }
  34583. var nodeName = offsetParent && offsetParent.nodeName;
  34584. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34585. return element ? element.ownerDocument.documentElement : document.documentElement;
  34586. }
  34587. // .offsetParent will return the closest TH, TD or TABLE in case
  34588. // no offsetParent is present, I hate this job...
  34589. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34590. return getOffsetParent(offsetParent);
  34591. }
  34592. return offsetParent;
  34593. }
  34594. function isOffsetContainer(element) {
  34595. var nodeName = element.nodeName;
  34596. if (nodeName === 'BODY') {
  34597. return false;
  34598. }
  34599. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34600. }
  34601. /**
  34602. * Finds the root node (document, shadowDOM root) of the given element
  34603. * @method
  34604. * @memberof Popper.Utils
  34605. * @argument {Element} node
  34606. * @returns {Element} root node
  34607. */
  34608. function getRoot(node) {
  34609. if (node.parentNode !== null) {
  34610. return getRoot(node.parentNode);
  34611. }
  34612. return node;
  34613. }
  34614. /**
  34615. * Finds the offset parent common to the two provided nodes
  34616. * @method
  34617. * @memberof Popper.Utils
  34618. * @argument {Element} element1
  34619. * @argument {Element} element2
  34620. * @returns {Element} common offset parent
  34621. */
  34622. function findCommonOffsetParent(element1, element2) {
  34623. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34624. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34625. return document.documentElement;
  34626. }
  34627. // Here we make sure to give as "start" the element that comes first in the DOM
  34628. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34629. var start = order ? element1 : element2;
  34630. var end = order ? element2 : element1;
  34631. // Get common ancestor container
  34632. var range = document.createRange();
  34633. range.setStart(start, 0);
  34634. range.setEnd(end, 0);
  34635. var commonAncestorContainer = range.commonAncestorContainer;
  34636. // Both nodes are inside #document
  34637. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34638. if (isOffsetContainer(commonAncestorContainer)) {
  34639. return commonAncestorContainer;
  34640. }
  34641. return getOffsetParent(commonAncestorContainer);
  34642. }
  34643. // one of the nodes is inside shadowDOM, find which one
  34644. var element1root = getRoot(element1);
  34645. if (element1root.host) {
  34646. return findCommonOffsetParent(element1root.host, element2);
  34647. } else {
  34648. return findCommonOffsetParent(element1, getRoot(element2).host);
  34649. }
  34650. }
  34651. /**
  34652. * Gets the scroll value of the given element in the given side (top and left)
  34653. * @method
  34654. * @memberof Popper.Utils
  34655. * @argument {Element} element
  34656. * @argument {String} side `top` or `left`
  34657. * @returns {number} amount of scrolled pixels
  34658. */
  34659. function getScroll(element) {
  34660. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34661. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34662. var nodeName = element.nodeName;
  34663. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34664. var html = element.ownerDocument.documentElement;
  34665. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34666. return scrollingElement[upperSide];
  34667. }
  34668. return element[upperSide];
  34669. }
  34670. /*
  34671. * Sum or subtract the element scroll values (left and top) from a given rect object
  34672. * @method
  34673. * @memberof Popper.Utils
  34674. * @param {Object} rect - Rect object you want to change
  34675. * @param {HTMLElement} element - The element from the function reads the scroll values
  34676. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34677. * @return {Object} rect - The modifier rect object
  34678. */
  34679. function includeScroll(rect, element) {
  34680. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34681. var scrollTop = getScroll(element, 'top');
  34682. var scrollLeft = getScroll(element, 'left');
  34683. var modifier = subtract ? -1 : 1;
  34684. rect.top += scrollTop * modifier;
  34685. rect.bottom += scrollTop * modifier;
  34686. rect.left += scrollLeft * modifier;
  34687. rect.right += scrollLeft * modifier;
  34688. return rect;
  34689. }
  34690. /*
  34691. * Helper to detect borders of a given element
  34692. * @method
  34693. * @memberof Popper.Utils
  34694. * @param {CSSStyleDeclaration} styles
  34695. * Result of `getStyleComputedProperty` on the given element
  34696. * @param {String} axis - `x` or `y`
  34697. * @return {number} borders - The borders size of the given axis
  34698. */
  34699. function getBordersSize(styles, axis) {
  34700. var sideA = axis === 'x' ? 'Left' : 'Top';
  34701. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34702. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34703. }
  34704. function getSize(axis, body, html, computedStyle) {
  34705. 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);
  34706. }
  34707. function getWindowSizes(document) {
  34708. var body = document.body;
  34709. var html = document.documentElement;
  34710. var computedStyle = isIE(10) && getComputedStyle(html);
  34711. return {
  34712. height: getSize('Height', body, html, computedStyle),
  34713. width: getSize('Width', body, html, computedStyle)
  34714. };
  34715. }
  34716. var classCallCheck = function (instance, Constructor) {
  34717. if (!(instance instanceof Constructor)) {
  34718. throw new TypeError("Cannot call a class as a function");
  34719. }
  34720. };
  34721. var createClass = function () {
  34722. function defineProperties(target, props) {
  34723. for (var i = 0; i < props.length; i++) {
  34724. var descriptor = props[i];
  34725. descriptor.enumerable = descriptor.enumerable || false;
  34726. descriptor.configurable = true;
  34727. if ("value" in descriptor) descriptor.writable = true;
  34728. Object.defineProperty(target, descriptor.key, descriptor);
  34729. }
  34730. }
  34731. return function (Constructor, protoProps, staticProps) {
  34732. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34733. if (staticProps) defineProperties(Constructor, staticProps);
  34734. return Constructor;
  34735. };
  34736. }();
  34737. var defineProperty = function (obj, key, value) {
  34738. if (key in obj) {
  34739. Object.defineProperty(obj, key, {
  34740. value: value,
  34741. enumerable: true,
  34742. configurable: true,
  34743. writable: true
  34744. });
  34745. } else {
  34746. obj[key] = value;
  34747. }
  34748. return obj;
  34749. };
  34750. var _extends = Object.assign || function (target) {
  34751. for (var i = 1; i < arguments.length; i++) {
  34752. var source = arguments[i];
  34753. for (var key in source) {
  34754. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34755. target[key] = source[key];
  34756. }
  34757. }
  34758. }
  34759. return target;
  34760. };
  34761. /**
  34762. * Given element offsets, generate an output similar to getBoundingClientRect
  34763. * @method
  34764. * @memberof Popper.Utils
  34765. * @argument {Object} offsets
  34766. * @returns {Object} ClientRect like output
  34767. */
  34768. function getClientRect(offsets) {
  34769. return _extends({}, offsets, {
  34770. right: offsets.left + offsets.width,
  34771. bottom: offsets.top + offsets.height
  34772. });
  34773. }
  34774. /**
  34775. * Get bounding client rect of given element
  34776. * @method
  34777. * @memberof Popper.Utils
  34778. * @param {HTMLElement} element
  34779. * @return {Object} client rect
  34780. */
  34781. function getBoundingClientRect(element) {
  34782. var rect = {};
  34783. // IE10 10 FIX: Please, don't ask, the element isn't
  34784. // considered in DOM in some circumstances...
  34785. // This isn't reproducible in IE10 compatibility mode of IE11
  34786. try {
  34787. if (isIE(10)) {
  34788. rect = element.getBoundingClientRect();
  34789. var scrollTop = getScroll(element, 'top');
  34790. var scrollLeft = getScroll(element, 'left');
  34791. rect.top += scrollTop;
  34792. rect.left += scrollLeft;
  34793. rect.bottom += scrollTop;
  34794. rect.right += scrollLeft;
  34795. } else {
  34796. rect = element.getBoundingClientRect();
  34797. }
  34798. } catch (e) {}
  34799. var result = {
  34800. left: rect.left,
  34801. top: rect.top,
  34802. width: rect.right - rect.left,
  34803. height: rect.bottom - rect.top
  34804. };
  34805. // subtract scrollbar size from sizes
  34806. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34807. var width = sizes.width || element.clientWidth || result.width;
  34808. var height = sizes.height || element.clientHeight || result.height;
  34809. var horizScrollbar = element.offsetWidth - width;
  34810. var vertScrollbar = element.offsetHeight - height;
  34811. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34812. // we make this check conditional for performance reasons
  34813. if (horizScrollbar || vertScrollbar) {
  34814. var styles = getStyleComputedProperty(element);
  34815. horizScrollbar -= getBordersSize(styles, 'x');
  34816. vertScrollbar -= getBordersSize(styles, 'y');
  34817. result.width -= horizScrollbar;
  34818. result.height -= vertScrollbar;
  34819. }
  34820. return getClientRect(result);
  34821. }
  34822. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34823. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34824. var isIE10 = isIE(10);
  34825. var isHTML = parent.nodeName === 'HTML';
  34826. var childrenRect = getBoundingClientRect(children);
  34827. var parentRect = getBoundingClientRect(parent);
  34828. var scrollParent = getScrollParent(children);
  34829. var styles = getStyleComputedProperty(parent);
  34830. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34831. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34832. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34833. if (fixedPosition && isHTML) {
  34834. parentRect.top = Math.max(parentRect.top, 0);
  34835. parentRect.left = Math.max(parentRect.left, 0);
  34836. }
  34837. var offsets = getClientRect({
  34838. top: childrenRect.top - parentRect.top - borderTopWidth,
  34839. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34840. width: childrenRect.width,
  34841. height: childrenRect.height
  34842. });
  34843. offsets.marginTop = 0;
  34844. offsets.marginLeft = 0;
  34845. // Subtract margins of documentElement in case it's being used as parent
  34846. // we do this only on HTML because it's the only element that behaves
  34847. // differently when margins are applied to it. The margins are included in
  34848. // the box of the documentElement, in the other cases not.
  34849. if (!isIE10 && isHTML) {
  34850. var marginTop = parseFloat(styles.marginTop);
  34851. var marginLeft = parseFloat(styles.marginLeft);
  34852. offsets.top -= borderTopWidth - marginTop;
  34853. offsets.bottom -= borderTopWidth - marginTop;
  34854. offsets.left -= borderLeftWidth - marginLeft;
  34855. offsets.right -= borderLeftWidth - marginLeft;
  34856. // Attach marginTop and marginLeft because in some circumstances we may need them
  34857. offsets.marginTop = marginTop;
  34858. offsets.marginLeft = marginLeft;
  34859. }
  34860. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34861. offsets = includeScroll(offsets, parent);
  34862. }
  34863. return offsets;
  34864. }
  34865. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34866. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34867. var html = element.ownerDocument.documentElement;
  34868. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34869. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34870. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34871. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34872. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34873. var offset = {
  34874. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34875. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34876. width: width,
  34877. height: height
  34878. };
  34879. return getClientRect(offset);
  34880. }
  34881. /**
  34882. * Check if the given element is fixed or is inside a fixed parent
  34883. * @method
  34884. * @memberof Popper.Utils
  34885. * @argument {Element} element
  34886. * @argument {Element} customContainer
  34887. * @returns {Boolean} answer to "isFixed?"
  34888. */
  34889. function isFixed(element) {
  34890. var nodeName = element.nodeName;
  34891. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34892. return false;
  34893. }
  34894. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34895. return true;
  34896. }
  34897. var parentNode = getParentNode(element);
  34898. if (!parentNode) {
  34899. return false;
  34900. }
  34901. return isFixed(parentNode);
  34902. }
  34903. /**
  34904. * Finds the first parent of an element that has a transformed property defined
  34905. * @method
  34906. * @memberof Popper.Utils
  34907. * @argument {Element} element
  34908. * @returns {Element} first transformed parent or documentElement
  34909. */
  34910. function getFixedPositionOffsetParent(element) {
  34911. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34912. if (!element || !element.parentElement || isIE()) {
  34913. return document.documentElement;
  34914. }
  34915. var el = element.parentElement;
  34916. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34917. el = el.parentElement;
  34918. }
  34919. return el || document.documentElement;
  34920. }
  34921. /**
  34922. * Computed the boundaries limits and return them
  34923. * @method
  34924. * @memberof Popper.Utils
  34925. * @param {HTMLElement} popper
  34926. * @param {HTMLElement} reference
  34927. * @param {number} padding
  34928. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34929. * @param {Boolean} fixedPosition - Is in fixed position mode
  34930. * @returns {Object} Coordinates of the boundaries
  34931. */
  34932. function getBoundaries(popper, reference, padding, boundariesElement) {
  34933. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34934. // NOTE: 1 DOM access here
  34935. var boundaries = { top: 0, left: 0 };
  34936. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34937. // Handle viewport case
  34938. if (boundariesElement === 'viewport') {
  34939. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34940. } else {
  34941. // Handle other cases based on DOM element used as boundaries
  34942. var boundariesNode = void 0;
  34943. if (boundariesElement === 'scrollParent') {
  34944. boundariesNode = getScrollParent(getParentNode(reference));
  34945. if (boundariesNode.nodeName === 'BODY') {
  34946. boundariesNode = popper.ownerDocument.documentElement;
  34947. }
  34948. } else if (boundariesElement === 'window') {
  34949. boundariesNode = popper.ownerDocument.documentElement;
  34950. } else {
  34951. boundariesNode = boundariesElement;
  34952. }
  34953. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34954. // In case of HTML, we need a different computation
  34955. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34956. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34957. height = _getWindowSizes.height,
  34958. width = _getWindowSizes.width;
  34959. boundaries.top += offsets.top - offsets.marginTop;
  34960. boundaries.bottom = height + offsets.top;
  34961. boundaries.left += offsets.left - offsets.marginLeft;
  34962. boundaries.right = width + offsets.left;
  34963. } else {
  34964. // for all the other DOM elements, this one is good
  34965. boundaries = offsets;
  34966. }
  34967. }
  34968. // Add paddings
  34969. padding = padding || 0;
  34970. var isPaddingNumber = typeof padding === 'number';
  34971. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34972. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34973. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34974. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34975. return boundaries;
  34976. }
  34977. function getArea(_ref) {
  34978. var width = _ref.width,
  34979. height = _ref.height;
  34980. return width * height;
  34981. }
  34982. /**
  34983. * Utility used to transform the `auto` placement to the placement with more
  34984. * available space.
  34985. * @method
  34986. * @memberof Popper.Utils
  34987. * @argument {Object} data - The data object generated by update method
  34988. * @argument {Object} options - Modifiers configuration and options
  34989. * @returns {Object} The data object, properly modified
  34990. */
  34991. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34992. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34993. if (placement.indexOf('auto') === -1) {
  34994. return placement;
  34995. }
  34996. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34997. var rects = {
  34998. top: {
  34999. width: boundaries.width,
  35000. height: refRect.top - boundaries.top
  35001. },
  35002. right: {
  35003. width: boundaries.right - refRect.right,
  35004. height: boundaries.height
  35005. },
  35006. bottom: {
  35007. width: boundaries.width,
  35008. height: boundaries.bottom - refRect.bottom
  35009. },
  35010. left: {
  35011. width: refRect.left - boundaries.left,
  35012. height: boundaries.height
  35013. }
  35014. };
  35015. var sortedAreas = Object.keys(rects).map(function (key) {
  35016. return _extends({
  35017. key: key
  35018. }, rects[key], {
  35019. area: getArea(rects[key])
  35020. });
  35021. }).sort(function (a, b) {
  35022. return b.area - a.area;
  35023. });
  35024. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35025. var width = _ref2.width,
  35026. height = _ref2.height;
  35027. return width >= popper.clientWidth && height >= popper.clientHeight;
  35028. });
  35029. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35030. var variation = placement.split('-')[1];
  35031. return computedPlacement + (variation ? '-' + variation : '');
  35032. }
  35033. /**
  35034. * Get offsets to the reference element
  35035. * @method
  35036. * @memberof Popper.Utils
  35037. * @param {Object} state
  35038. * @param {Element} popper - the popper element
  35039. * @param {Element} reference - the reference element (the popper will be relative to this)
  35040. * @param {Element} fixedPosition - is in fixed position mode
  35041. * @returns {Object} An object containing the offsets which will be applied to the popper
  35042. */
  35043. function getReferenceOffsets(state, popper, reference) {
  35044. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35045. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35046. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35047. }
  35048. /**
  35049. * Get the outer sizes of the given element (offset size + margins)
  35050. * @method
  35051. * @memberof Popper.Utils
  35052. * @argument {Element} element
  35053. * @returns {Object} object containing width and height properties
  35054. */
  35055. function getOuterSizes(element) {
  35056. var window = element.ownerDocument.defaultView;
  35057. var styles = window.getComputedStyle(element);
  35058. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35059. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35060. var result = {
  35061. width: element.offsetWidth + y,
  35062. height: element.offsetHeight + x
  35063. };
  35064. return result;
  35065. }
  35066. /**
  35067. * Get the opposite placement of the given one
  35068. * @method
  35069. * @memberof Popper.Utils
  35070. * @argument {String} placement
  35071. * @returns {String} flipped placement
  35072. */
  35073. function getOppositePlacement(placement) {
  35074. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35075. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35076. return hash[matched];
  35077. });
  35078. }
  35079. /**
  35080. * Get offsets to the popper
  35081. * @method
  35082. * @memberof Popper.Utils
  35083. * @param {Object} position - CSS position the Popper will get applied
  35084. * @param {HTMLElement} popper - the popper element
  35085. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35086. * @param {String} placement - one of the valid placement options
  35087. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35088. */
  35089. function getPopperOffsets(popper, referenceOffsets, placement) {
  35090. placement = placement.split('-')[0];
  35091. // Get popper node sizes
  35092. var popperRect = getOuterSizes(popper);
  35093. // Add position, width and height to our offsets object
  35094. var popperOffsets = {
  35095. width: popperRect.width,
  35096. height: popperRect.height
  35097. };
  35098. // depending by the popper placement we have to compute its offsets slightly differently
  35099. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35100. var mainSide = isHoriz ? 'top' : 'left';
  35101. var secondarySide = isHoriz ? 'left' : 'top';
  35102. var measurement = isHoriz ? 'height' : 'width';
  35103. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35104. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35105. if (placement === secondarySide) {
  35106. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35107. } else {
  35108. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35109. }
  35110. return popperOffsets;
  35111. }
  35112. /**
  35113. * Mimics the `find` method of Array
  35114. * @method
  35115. * @memberof Popper.Utils
  35116. * @argument {Array} arr
  35117. * @argument prop
  35118. * @argument value
  35119. * @returns index or -1
  35120. */
  35121. function find(arr, check) {
  35122. // use native find if supported
  35123. if (Array.prototype.find) {
  35124. return arr.find(check);
  35125. }
  35126. // use `filter` to obtain the same behavior of `find`
  35127. return arr.filter(check)[0];
  35128. }
  35129. /**
  35130. * Return the index of the matching object
  35131. * @method
  35132. * @memberof Popper.Utils
  35133. * @argument {Array} arr
  35134. * @argument prop
  35135. * @argument value
  35136. * @returns index or -1
  35137. */
  35138. function findIndex(arr, prop, value) {
  35139. // use native findIndex if supported
  35140. if (Array.prototype.findIndex) {
  35141. return arr.findIndex(function (cur) {
  35142. return cur[prop] === value;
  35143. });
  35144. }
  35145. // use `find` + `indexOf` if `findIndex` isn't supported
  35146. var match = find(arr, function (obj) {
  35147. return obj[prop] === value;
  35148. });
  35149. return arr.indexOf(match);
  35150. }
  35151. /**
  35152. * Loop trough the list of modifiers and run them in order,
  35153. * each of them will then edit the data object.
  35154. * @method
  35155. * @memberof Popper.Utils
  35156. * @param {dataObject} data
  35157. * @param {Array} modifiers
  35158. * @param {String} ends - Optional modifier name used as stopper
  35159. * @returns {dataObject}
  35160. */
  35161. function runModifiers(modifiers, data, ends) {
  35162. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35163. modifiersToRun.forEach(function (modifier) {
  35164. if (modifier['function']) {
  35165. // eslint-disable-line dot-notation
  35166. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35167. }
  35168. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35169. if (modifier.enabled && isFunction(fn)) {
  35170. // Add properties to offsets to make them a complete clientRect object
  35171. // we do this before each modifier to make sure the previous one doesn't
  35172. // mess with these values
  35173. data.offsets.popper = getClientRect(data.offsets.popper);
  35174. data.offsets.reference = getClientRect(data.offsets.reference);
  35175. data = fn(data, modifier);
  35176. }
  35177. });
  35178. return data;
  35179. }
  35180. /**
  35181. * Updates the position of the popper, computing the new offsets and applying
  35182. * the new style.<br />
  35183. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35184. * @method
  35185. * @memberof Popper
  35186. */
  35187. function update() {
  35188. // if popper is destroyed, don't perform any further update
  35189. if (this.state.isDestroyed) {
  35190. return;
  35191. }
  35192. var data = {
  35193. instance: this,
  35194. styles: {},
  35195. arrowStyles: {},
  35196. attributes: {},
  35197. flipped: false,
  35198. offsets: {}
  35199. };
  35200. // compute reference element offsets
  35201. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35202. // compute auto placement, store placement inside the data object,
  35203. // modifiers will be able to edit `placement` if needed
  35204. // and refer to originalPlacement to know the original value
  35205. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35206. // store the computed placement inside `originalPlacement`
  35207. data.originalPlacement = data.placement;
  35208. data.positionFixed = this.options.positionFixed;
  35209. // compute the popper offsets
  35210. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35211. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35212. // run the modifiers
  35213. data = runModifiers(this.modifiers, data);
  35214. // the first `update` will call `onCreate` callback
  35215. // the other ones will call `onUpdate` callback
  35216. if (!this.state.isCreated) {
  35217. this.state.isCreated = true;
  35218. this.options.onCreate(data);
  35219. } else {
  35220. this.options.onUpdate(data);
  35221. }
  35222. }
  35223. /**
  35224. * Helper used to know if the given modifier is enabled.
  35225. * @method
  35226. * @memberof Popper.Utils
  35227. * @returns {Boolean}
  35228. */
  35229. function isModifierEnabled(modifiers, modifierName) {
  35230. return modifiers.some(function (_ref) {
  35231. var name = _ref.name,
  35232. enabled = _ref.enabled;
  35233. return enabled && name === modifierName;
  35234. });
  35235. }
  35236. /**
  35237. * Get the prefixed supported property name
  35238. * @method
  35239. * @memberof Popper.Utils
  35240. * @argument {String} property (camelCase)
  35241. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35242. */
  35243. function getSupportedPropertyName(property) {
  35244. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35245. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35246. for (var i = 0; i < prefixes.length; i++) {
  35247. var prefix = prefixes[i];
  35248. var toCheck = prefix ? '' + prefix + upperProp : property;
  35249. if (typeof document.body.style[toCheck] !== 'undefined') {
  35250. return toCheck;
  35251. }
  35252. }
  35253. return null;
  35254. }
  35255. /**
  35256. * Destroys the popper.
  35257. * @method
  35258. * @memberof Popper
  35259. */
  35260. function destroy() {
  35261. this.state.isDestroyed = true;
  35262. // touch DOM only if `applyStyle` modifier is enabled
  35263. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35264. this.popper.removeAttribute('x-placement');
  35265. this.popper.style.position = '';
  35266. this.popper.style.top = '';
  35267. this.popper.style.left = '';
  35268. this.popper.style.right = '';
  35269. this.popper.style.bottom = '';
  35270. this.popper.style.willChange = '';
  35271. this.popper.style[getSupportedPropertyName('transform')] = '';
  35272. }
  35273. this.disableEventListeners();
  35274. // remove the popper if user explicitly asked for the deletion on destroy
  35275. // do not use `remove` because IE11 doesn't support it
  35276. if (this.options.removeOnDestroy) {
  35277. this.popper.parentNode.removeChild(this.popper);
  35278. }
  35279. return this;
  35280. }
  35281. /**
  35282. * Get the window associated with the element
  35283. * @argument {Element} element
  35284. * @returns {Window}
  35285. */
  35286. function getWindow(element) {
  35287. var ownerDocument = element.ownerDocument;
  35288. return ownerDocument ? ownerDocument.defaultView : window;
  35289. }
  35290. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35291. var isBody = scrollParent.nodeName === 'BODY';
  35292. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35293. target.addEventListener(event, callback, { passive: true });
  35294. if (!isBody) {
  35295. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35296. }
  35297. scrollParents.push(target);
  35298. }
  35299. /**
  35300. * Setup needed event listeners used to update the popper position
  35301. * @method
  35302. * @memberof Popper.Utils
  35303. * @private
  35304. */
  35305. function setupEventListeners(reference, options, state, updateBound) {
  35306. // Resize event listener on window
  35307. state.updateBound = updateBound;
  35308. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35309. // Scroll event listener on scroll parents
  35310. var scrollElement = getScrollParent(reference);
  35311. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35312. state.scrollElement = scrollElement;
  35313. state.eventsEnabled = true;
  35314. return state;
  35315. }
  35316. /**
  35317. * It will add resize/scroll events and start recalculating
  35318. * position of the popper element when they are triggered.
  35319. * @method
  35320. * @memberof Popper
  35321. */
  35322. function enableEventListeners() {
  35323. if (!this.state.eventsEnabled) {
  35324. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35325. }
  35326. }
  35327. /**
  35328. * Remove event listeners used to update the popper position
  35329. * @method
  35330. * @memberof Popper.Utils
  35331. * @private
  35332. */
  35333. function removeEventListeners(reference, state) {
  35334. // Remove resize event listener on window
  35335. getWindow(reference).removeEventListener('resize', state.updateBound);
  35336. // Remove scroll event listener on scroll parents
  35337. state.scrollParents.forEach(function (target) {
  35338. target.removeEventListener('scroll', state.updateBound);
  35339. });
  35340. // Reset state
  35341. state.updateBound = null;
  35342. state.scrollParents = [];
  35343. state.scrollElement = null;
  35344. state.eventsEnabled = false;
  35345. return state;
  35346. }
  35347. /**
  35348. * It will remove resize/scroll events and won't recalculate popper position
  35349. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35350. * unless you call `update` method manually.
  35351. * @method
  35352. * @memberof Popper
  35353. */
  35354. function disableEventListeners() {
  35355. if (this.state.eventsEnabled) {
  35356. cancelAnimationFrame(this.scheduleUpdate);
  35357. this.state = removeEventListeners(this.reference, this.state);
  35358. }
  35359. }
  35360. /**
  35361. * Tells if a given input is a number
  35362. * @method
  35363. * @memberof Popper.Utils
  35364. * @param {*} input to check
  35365. * @return {Boolean}
  35366. */
  35367. function isNumeric(n) {
  35368. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35369. }
  35370. /**
  35371. * Set the style to the given popper
  35372. * @method
  35373. * @memberof Popper.Utils
  35374. * @argument {Element} element - Element to apply the style to
  35375. * @argument {Object} styles
  35376. * Object with a list of properties and values which will be applied to the element
  35377. */
  35378. function setStyles(element, styles) {
  35379. Object.keys(styles).forEach(function (prop) {
  35380. var unit = '';
  35381. // add unit if the value is numeric and is one of the following
  35382. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35383. unit = 'px';
  35384. }
  35385. element.style[prop] = styles[prop] + unit;
  35386. });
  35387. }
  35388. /**
  35389. * Set the attributes to the given popper
  35390. * @method
  35391. * @memberof Popper.Utils
  35392. * @argument {Element} element - Element to apply the attributes to
  35393. * @argument {Object} styles
  35394. * Object with a list of properties and values which will be applied to the element
  35395. */
  35396. function setAttributes(element, attributes) {
  35397. Object.keys(attributes).forEach(function (prop) {
  35398. var value = attributes[prop];
  35399. if (value !== false) {
  35400. element.setAttribute(prop, attributes[prop]);
  35401. } else {
  35402. element.removeAttribute(prop);
  35403. }
  35404. });
  35405. }
  35406. /**
  35407. * @function
  35408. * @memberof Modifiers
  35409. * @argument {Object} data - The data object generated by `update` method
  35410. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35411. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35412. * @argument {Object} options - Modifiers configuration and options
  35413. * @returns {Object} The same data object
  35414. */
  35415. function applyStyle(data) {
  35416. // any property present in `data.styles` will be applied to the popper,
  35417. // in this way we can make the 3rd party modifiers add custom styles to it
  35418. // Be aware, modifiers could override the properties defined in the previous
  35419. // lines of this modifier!
  35420. setStyles(data.instance.popper, data.styles);
  35421. // any property present in `data.attributes` will be applied to the popper,
  35422. // they will be set as HTML attributes of the element
  35423. setAttributes(data.instance.popper, data.attributes);
  35424. // if arrowElement is defined and arrowStyles has some properties
  35425. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35426. setStyles(data.arrowElement, data.arrowStyles);
  35427. }
  35428. return data;
  35429. }
  35430. /**
  35431. * Set the x-placement attribute before everything else because it could be used
  35432. * to add margins to the popper margins needs to be calculated to get the
  35433. * correct popper offsets.
  35434. * @method
  35435. * @memberof Popper.modifiers
  35436. * @param {HTMLElement} reference - The reference element used to position the popper
  35437. * @param {HTMLElement} popper - The HTML element used as popper
  35438. * @param {Object} options - Popper.js options
  35439. */
  35440. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35441. // compute reference element offsets
  35442. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35443. // compute auto placement, store placement inside the data object,
  35444. // modifiers will be able to edit `placement` if needed
  35445. // and refer to originalPlacement to know the original value
  35446. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35447. popper.setAttribute('x-placement', placement);
  35448. // Apply `position` to popper before anything else because
  35449. // without the position applied we can't guarantee correct computations
  35450. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35451. return options;
  35452. }
  35453. /**
  35454. * @function
  35455. * @memberof Popper.Utils
  35456. * @argument {Object} data - The data object generated by `update` method
  35457. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35458. * @returns {Object} The popper's position offsets rounded
  35459. *
  35460. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35461. * good as it can be within reason.
  35462. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35463. *
  35464. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35465. * as well on High DPI screens).
  35466. *
  35467. * Firefox prefers no rounding for positioning and does not have blurriness on
  35468. * high DPI screens.
  35469. *
  35470. * Only horizontal placement and left/right values need to be considered.
  35471. */
  35472. function getRoundedOffsets(data, shouldRound) {
  35473. var _data$offsets = data.offsets,
  35474. popper = _data$offsets.popper,
  35475. reference = _data$offsets.reference;
  35476. var round = Math.round,
  35477. floor = Math.floor;
  35478. var noRound = function noRound(v) {
  35479. return v;
  35480. };
  35481. var referenceWidth = round(reference.width);
  35482. var popperWidth = round(popper.width);
  35483. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35484. var isVariation = data.placement.indexOf('-') !== -1;
  35485. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35486. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35487. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35488. var verticalToInteger = !shouldRound ? noRound : round;
  35489. return {
  35490. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35491. top: verticalToInteger(popper.top),
  35492. bottom: verticalToInteger(popper.bottom),
  35493. right: horizontalToInteger(popper.right)
  35494. };
  35495. }
  35496. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35497. /**
  35498. * @function
  35499. * @memberof Modifiers
  35500. * @argument {Object} data - The data object generated by `update` method
  35501. * @argument {Object} options - Modifiers configuration and options
  35502. * @returns {Object} The data object, properly modified
  35503. */
  35504. function computeStyle(data, options) {
  35505. var x = options.x,
  35506. y = options.y;
  35507. var popper = data.offsets.popper;
  35508. // Remove this legacy support in Popper.js v2
  35509. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35510. return modifier.name === 'applyStyle';
  35511. }).gpuAcceleration;
  35512. if (legacyGpuAccelerationOption !== undefined) {
  35513. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35514. }
  35515. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35516. var offsetParent = getOffsetParent(data.instance.popper);
  35517. var offsetParentRect = getBoundingClientRect(offsetParent);
  35518. // Styles
  35519. var styles = {
  35520. position: popper.position
  35521. };
  35522. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35523. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35524. var sideB = y === 'right' ? 'left' : 'right';
  35525. // if gpuAcceleration is set to `true` and transform is supported,
  35526. // we use `translate3d` to apply the position to the popper we
  35527. // automatically use the supported prefixed version if needed
  35528. var prefixedProperty = getSupportedPropertyName('transform');
  35529. // now, let's make a step back and look at this code closely (wtf?)
  35530. // If the content of the popper grows once it's been positioned, it
  35531. // may happen that the popper gets misplaced because of the new content
  35532. // overflowing its reference element
  35533. // To avoid this problem, we provide two options (x and y), which allow
  35534. // the consumer to define the offset origin.
  35535. // If we position a popper on top of a reference element, we can set
  35536. // `x` to `top` to make the popper grow towards its top instead of
  35537. // its bottom.
  35538. var left = void 0,
  35539. top = void 0;
  35540. if (sideA === 'bottom') {
  35541. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35542. // and not the bottom of the html element
  35543. if (offsetParent.nodeName === 'HTML') {
  35544. top = -offsetParent.clientHeight + offsets.bottom;
  35545. } else {
  35546. top = -offsetParentRect.height + offsets.bottom;
  35547. }
  35548. } else {
  35549. top = offsets.top;
  35550. }
  35551. if (sideB === 'right') {
  35552. if (offsetParent.nodeName === 'HTML') {
  35553. left = -offsetParent.clientWidth + offsets.right;
  35554. } else {
  35555. left = -offsetParentRect.width + offsets.right;
  35556. }
  35557. } else {
  35558. left = offsets.left;
  35559. }
  35560. if (gpuAcceleration && prefixedProperty) {
  35561. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35562. styles[sideA] = 0;
  35563. styles[sideB] = 0;
  35564. styles.willChange = 'transform';
  35565. } else {
  35566. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35567. var invertTop = sideA === 'bottom' ? -1 : 1;
  35568. var invertLeft = sideB === 'right' ? -1 : 1;
  35569. styles[sideA] = top * invertTop;
  35570. styles[sideB] = left * invertLeft;
  35571. styles.willChange = sideA + ', ' + sideB;
  35572. }
  35573. // Attributes
  35574. var attributes = {
  35575. 'x-placement': data.placement
  35576. };
  35577. // Update `data` attributes, styles and arrowStyles
  35578. data.attributes = _extends({}, attributes, data.attributes);
  35579. data.styles = _extends({}, styles, data.styles);
  35580. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35581. return data;
  35582. }
  35583. /**
  35584. * Helper used to know if the given modifier depends from another one.<br />
  35585. * It checks if the needed modifier is listed and enabled.
  35586. * @method
  35587. * @memberof Popper.Utils
  35588. * @param {Array} modifiers - list of modifiers
  35589. * @param {String} requestingName - name of requesting modifier
  35590. * @param {String} requestedName - name of requested modifier
  35591. * @returns {Boolean}
  35592. */
  35593. function isModifierRequired(modifiers, requestingName, requestedName) {
  35594. var requesting = find(modifiers, function (_ref) {
  35595. var name = _ref.name;
  35596. return name === requestingName;
  35597. });
  35598. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35599. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35600. });
  35601. if (!isRequired) {
  35602. var _requesting = '`' + requestingName + '`';
  35603. var requested = '`' + requestedName + '`';
  35604. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35605. }
  35606. return isRequired;
  35607. }
  35608. /**
  35609. * @function
  35610. * @memberof Modifiers
  35611. * @argument {Object} data - The data object generated by update method
  35612. * @argument {Object} options - Modifiers configuration and options
  35613. * @returns {Object} The data object, properly modified
  35614. */
  35615. function arrow(data, options) {
  35616. var _data$offsets$arrow;
  35617. // arrow depends on keepTogether in order to work
  35618. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35619. return data;
  35620. }
  35621. var arrowElement = options.element;
  35622. // if arrowElement is a string, suppose it's a CSS selector
  35623. if (typeof arrowElement === 'string') {
  35624. arrowElement = data.instance.popper.querySelector(arrowElement);
  35625. // if arrowElement is not found, don't run the modifier
  35626. if (!arrowElement) {
  35627. return data;
  35628. }
  35629. } else {
  35630. // if the arrowElement isn't a query selector we must check that the
  35631. // provided DOM node is child of its popper node
  35632. if (!data.instance.popper.contains(arrowElement)) {
  35633. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35634. return data;
  35635. }
  35636. }
  35637. var placement = data.placement.split('-')[0];
  35638. var _data$offsets = data.offsets,
  35639. popper = _data$offsets.popper,
  35640. reference = _data$offsets.reference;
  35641. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35642. var len = isVertical ? 'height' : 'width';
  35643. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35644. var side = sideCapitalized.toLowerCase();
  35645. var altSide = isVertical ? 'left' : 'top';
  35646. var opSide = isVertical ? 'bottom' : 'right';
  35647. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35648. //
  35649. // extends keepTogether behavior making sure the popper and its
  35650. // reference have enough pixels in conjunction
  35651. //
  35652. // top/left side
  35653. if (reference[opSide] - arrowElementSize < popper[side]) {
  35654. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35655. }
  35656. // bottom/right side
  35657. if (reference[side] + arrowElementSize > popper[opSide]) {
  35658. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35659. }
  35660. data.offsets.popper = getClientRect(data.offsets.popper);
  35661. // compute center of the popper
  35662. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35663. // Compute the sideValue using the updated popper offsets
  35664. // take popper margin in account because we don't have this info available
  35665. var css = getStyleComputedProperty(data.instance.popper);
  35666. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35667. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35668. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35669. // prevent arrowElement from being placed not contiguously to its popper
  35670. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35671. data.arrowElement = arrowElement;
  35672. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35673. return data;
  35674. }
  35675. /**
  35676. * Get the opposite placement variation of the given one
  35677. * @method
  35678. * @memberof Popper.Utils
  35679. * @argument {String} placement variation
  35680. * @returns {String} flipped placement variation
  35681. */
  35682. function getOppositeVariation(variation) {
  35683. if (variation === 'end') {
  35684. return 'start';
  35685. } else if (variation === 'start') {
  35686. return 'end';
  35687. }
  35688. return variation;
  35689. }
  35690. /**
  35691. * List of accepted placements to use as values of the `placement` option.<br />
  35692. * Valid placements are:
  35693. * - `auto`
  35694. * - `top`
  35695. * - `right`
  35696. * - `bottom`
  35697. * - `left`
  35698. *
  35699. * Each placement can have a variation from this list:
  35700. * - `-start`
  35701. * - `-end`
  35702. *
  35703. * Variations are interpreted easily if you think of them as the left to right
  35704. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35705. * is right.<br />
  35706. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35707. *
  35708. * Some valid examples are:
  35709. * - `top-end` (on top of reference, right aligned)
  35710. * - `right-start` (on right of reference, top aligned)
  35711. * - `bottom` (on bottom, centered)
  35712. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35713. *
  35714. * @static
  35715. * @type {Array}
  35716. * @enum {String}
  35717. * @readonly
  35718. * @method placements
  35719. * @memberof Popper
  35720. */
  35721. 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'];
  35722. // Get rid of `auto` `auto-start` and `auto-end`
  35723. var validPlacements = placements.slice(3);
  35724. /**
  35725. * Given an initial placement, returns all the subsequent placements
  35726. * clockwise (or counter-clockwise).
  35727. *
  35728. * @method
  35729. * @memberof Popper.Utils
  35730. * @argument {String} placement - A valid placement (it accepts variations)
  35731. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35732. * @returns {Array} placements including their variations
  35733. */
  35734. function clockwise(placement) {
  35735. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35736. var index = validPlacements.indexOf(placement);
  35737. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35738. return counter ? arr.reverse() : arr;
  35739. }
  35740. var BEHAVIORS = {
  35741. FLIP: 'flip',
  35742. CLOCKWISE: 'clockwise',
  35743. COUNTERCLOCKWISE: 'counterclockwise'
  35744. };
  35745. /**
  35746. * @function
  35747. * @memberof Modifiers
  35748. * @argument {Object} data - The data object generated by update method
  35749. * @argument {Object} options - Modifiers configuration and options
  35750. * @returns {Object} The data object, properly modified
  35751. */
  35752. function flip(data, options) {
  35753. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35754. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35755. return data;
  35756. }
  35757. if (data.flipped && data.placement === data.originalPlacement) {
  35758. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35759. return data;
  35760. }
  35761. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35762. var placement = data.placement.split('-')[0];
  35763. var placementOpposite = getOppositePlacement(placement);
  35764. var variation = data.placement.split('-')[1] || '';
  35765. var flipOrder = [];
  35766. switch (options.behavior) {
  35767. case BEHAVIORS.FLIP:
  35768. flipOrder = [placement, placementOpposite];
  35769. break;
  35770. case BEHAVIORS.CLOCKWISE:
  35771. flipOrder = clockwise(placement);
  35772. break;
  35773. case BEHAVIORS.COUNTERCLOCKWISE:
  35774. flipOrder = clockwise(placement, true);
  35775. break;
  35776. default:
  35777. flipOrder = options.behavior;
  35778. }
  35779. flipOrder.forEach(function (step, index) {
  35780. if (placement !== step || flipOrder.length === index + 1) {
  35781. return data;
  35782. }
  35783. placement = data.placement.split('-')[0];
  35784. placementOpposite = getOppositePlacement(placement);
  35785. var popperOffsets = data.offsets.popper;
  35786. var refOffsets = data.offsets.reference;
  35787. // using floor because the reference offsets may contain decimals we are not going to consider here
  35788. var floor = Math.floor;
  35789. 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);
  35790. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35791. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35792. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35793. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35794. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35795. // flip the variation if required
  35796. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35797. // flips variation if reference element overflows boundaries
  35798. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35799. // flips variation if popper content overflows boundaries
  35800. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35801. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35802. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35803. // this boolean to detect any flip loop
  35804. data.flipped = true;
  35805. if (overlapsRef || overflowsBoundaries) {
  35806. placement = flipOrder[index + 1];
  35807. }
  35808. if (flippedVariation) {
  35809. variation = getOppositeVariation(variation);
  35810. }
  35811. data.placement = placement + (variation ? '-' + variation : '');
  35812. // this object contains `position`, we want to preserve it along with
  35813. // any additional property we may add in the future
  35814. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35815. data = runModifiers(data.instance.modifiers, data, 'flip');
  35816. }
  35817. });
  35818. return data;
  35819. }
  35820. /**
  35821. * @function
  35822. * @memberof Modifiers
  35823. * @argument {Object} data - The data object generated by update method
  35824. * @argument {Object} options - Modifiers configuration and options
  35825. * @returns {Object} The data object, properly modified
  35826. */
  35827. function keepTogether(data) {
  35828. var _data$offsets = data.offsets,
  35829. popper = _data$offsets.popper,
  35830. reference = _data$offsets.reference;
  35831. var placement = data.placement.split('-')[0];
  35832. var floor = Math.floor;
  35833. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35834. var side = isVertical ? 'right' : 'bottom';
  35835. var opSide = isVertical ? 'left' : 'top';
  35836. var measurement = isVertical ? 'width' : 'height';
  35837. if (popper[side] < floor(reference[opSide])) {
  35838. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35839. }
  35840. if (popper[opSide] > floor(reference[side])) {
  35841. data.offsets.popper[opSide] = floor(reference[side]);
  35842. }
  35843. return data;
  35844. }
  35845. /**
  35846. * Converts a string containing value + unit into a px value number
  35847. * @function
  35848. * @memberof {modifiers~offset}
  35849. * @private
  35850. * @argument {String} str - Value + unit string
  35851. * @argument {String} measurement - `height` or `width`
  35852. * @argument {Object} popperOffsets
  35853. * @argument {Object} referenceOffsets
  35854. * @returns {Number|String}
  35855. * Value in pixels, or original string if no values were extracted
  35856. */
  35857. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35858. // separate value from unit
  35859. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35860. var value = +split[1];
  35861. var unit = split[2];
  35862. // If it's not a number it's an operator, I guess
  35863. if (!value) {
  35864. return str;
  35865. }
  35866. if (unit.indexOf('%') === 0) {
  35867. var element = void 0;
  35868. switch (unit) {
  35869. case '%p':
  35870. element = popperOffsets;
  35871. break;
  35872. case '%':
  35873. case '%r':
  35874. default:
  35875. element = referenceOffsets;
  35876. }
  35877. var rect = getClientRect(element);
  35878. return rect[measurement] / 100 * value;
  35879. } else if (unit === 'vh' || unit === 'vw') {
  35880. // if is a vh or vw, we calculate the size based on the viewport
  35881. var size = void 0;
  35882. if (unit === 'vh') {
  35883. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35884. } else {
  35885. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35886. }
  35887. return size / 100 * value;
  35888. } else {
  35889. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35890. // if is an implicit unit, it's px, and we return just the value
  35891. return value;
  35892. }
  35893. }
  35894. /**
  35895. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35896. * @function
  35897. * @memberof {modifiers~offset}
  35898. * @private
  35899. * @argument {String} offset
  35900. * @argument {Object} popperOffsets
  35901. * @argument {Object} referenceOffsets
  35902. * @argument {String} basePlacement
  35903. * @returns {Array} a two cells array with x and y offsets in numbers
  35904. */
  35905. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35906. var offsets = [0, 0];
  35907. // Use height if placement is left or right and index is 0 otherwise use width
  35908. // in this way the first offset will use an axis and the second one
  35909. // will use the other one
  35910. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35911. // Split the offset string to obtain a list of values and operands
  35912. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35913. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35914. return frag.trim();
  35915. });
  35916. // Detect if the offset string contains a pair of values or a single one
  35917. // they could be separated by comma or space
  35918. var divider = fragments.indexOf(find(fragments, function (frag) {
  35919. return frag.search(/,|\s/) !== -1;
  35920. }));
  35921. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35922. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35923. }
  35924. // If divider is found, we divide the list of values and operands to divide
  35925. // them by ofset X and Y.
  35926. var splitRegex = /\s*,\s*|\s+/;
  35927. 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];
  35928. // Convert the values with units to absolute pixels to allow our computations
  35929. ops = ops.map(function (op, index) {
  35930. // Most of the units rely on the orientation of the popper
  35931. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35932. var mergeWithPrevious = false;
  35933. return op
  35934. // This aggregates any `+` or `-` sign that aren't considered operators
  35935. // e.g.: 10 + +5 => [10, +, +5]
  35936. .reduce(function (a, b) {
  35937. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35938. a[a.length - 1] = b;
  35939. mergeWithPrevious = true;
  35940. return a;
  35941. } else if (mergeWithPrevious) {
  35942. a[a.length - 1] += b;
  35943. mergeWithPrevious = false;
  35944. return a;
  35945. } else {
  35946. return a.concat(b);
  35947. }
  35948. }, [])
  35949. // Here we convert the string values into number values (in px)
  35950. .map(function (str) {
  35951. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35952. });
  35953. });
  35954. // Loop trough the offsets arrays and execute the operations
  35955. ops.forEach(function (op, index) {
  35956. op.forEach(function (frag, index2) {
  35957. if (isNumeric(frag)) {
  35958. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35959. }
  35960. });
  35961. });
  35962. return offsets;
  35963. }
  35964. /**
  35965. * @function
  35966. * @memberof Modifiers
  35967. * @argument {Object} data - The data object generated by update method
  35968. * @argument {Object} options - Modifiers configuration and options
  35969. * @argument {Number|String} options.offset=0
  35970. * The offset value as described in the modifier description
  35971. * @returns {Object} The data object, properly modified
  35972. */
  35973. function offset(data, _ref) {
  35974. var offset = _ref.offset;
  35975. var placement = data.placement,
  35976. _data$offsets = data.offsets,
  35977. popper = _data$offsets.popper,
  35978. reference = _data$offsets.reference;
  35979. var basePlacement = placement.split('-')[0];
  35980. var offsets = void 0;
  35981. if (isNumeric(+offset)) {
  35982. offsets = [+offset, 0];
  35983. } else {
  35984. offsets = parseOffset(offset, popper, reference, basePlacement);
  35985. }
  35986. if (basePlacement === 'left') {
  35987. popper.top += offsets[0];
  35988. popper.left -= offsets[1];
  35989. } else if (basePlacement === 'right') {
  35990. popper.top += offsets[0];
  35991. popper.left += offsets[1];
  35992. } else if (basePlacement === 'top') {
  35993. popper.left += offsets[0];
  35994. popper.top -= offsets[1];
  35995. } else if (basePlacement === 'bottom') {
  35996. popper.left += offsets[0];
  35997. popper.top += offsets[1];
  35998. }
  35999. data.popper = popper;
  36000. return data;
  36001. }
  36002. /**
  36003. * @function
  36004. * @memberof Modifiers
  36005. * @argument {Object} data - The data object generated by `update` method
  36006. * @argument {Object} options - Modifiers configuration and options
  36007. * @returns {Object} The data object, properly modified
  36008. */
  36009. function preventOverflow(data, options) {
  36010. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36011. // If offsetParent is the reference element, we really want to
  36012. // go one step up and use the next offsetParent as reference to
  36013. // avoid to make this modifier completely useless and look like broken
  36014. if (data.instance.reference === boundariesElement) {
  36015. boundariesElement = getOffsetParent(boundariesElement);
  36016. }
  36017. // NOTE: DOM access here
  36018. // resets the popper's position so that the document size can be calculated excluding
  36019. // the size of the popper element itself
  36020. var transformProp = getSupportedPropertyName('transform');
  36021. var popperStyles = data.instance.popper.style; // assignment to help minification
  36022. var top = popperStyles.top,
  36023. left = popperStyles.left,
  36024. transform = popperStyles[transformProp];
  36025. popperStyles.top = '';
  36026. popperStyles.left = '';
  36027. popperStyles[transformProp] = '';
  36028. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36029. // NOTE: DOM access here
  36030. // restores the original style properties after the offsets have been computed
  36031. popperStyles.top = top;
  36032. popperStyles.left = left;
  36033. popperStyles[transformProp] = transform;
  36034. options.boundaries = boundaries;
  36035. var order = options.priority;
  36036. var popper = data.offsets.popper;
  36037. var check = {
  36038. primary: function primary(placement) {
  36039. var value = popper[placement];
  36040. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36041. value = Math.max(popper[placement], boundaries[placement]);
  36042. }
  36043. return defineProperty({}, placement, value);
  36044. },
  36045. secondary: function secondary(placement) {
  36046. var mainSide = placement === 'right' ? 'left' : 'top';
  36047. var value = popper[mainSide];
  36048. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36049. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36050. }
  36051. return defineProperty({}, mainSide, value);
  36052. }
  36053. };
  36054. order.forEach(function (placement) {
  36055. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36056. popper = _extends({}, popper, check[side](placement));
  36057. });
  36058. data.offsets.popper = popper;
  36059. return data;
  36060. }
  36061. /**
  36062. * @function
  36063. * @memberof Modifiers
  36064. * @argument {Object} data - The data object generated by `update` method
  36065. * @argument {Object} options - Modifiers configuration and options
  36066. * @returns {Object} The data object, properly modified
  36067. */
  36068. function shift(data) {
  36069. var placement = data.placement;
  36070. var basePlacement = placement.split('-')[0];
  36071. var shiftvariation = placement.split('-')[1];
  36072. // if shift shiftvariation is specified, run the modifier
  36073. if (shiftvariation) {
  36074. var _data$offsets = data.offsets,
  36075. reference = _data$offsets.reference,
  36076. popper = _data$offsets.popper;
  36077. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36078. var side = isVertical ? 'left' : 'top';
  36079. var measurement = isVertical ? 'width' : 'height';
  36080. var shiftOffsets = {
  36081. start: defineProperty({}, side, reference[side]),
  36082. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36083. };
  36084. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36085. }
  36086. return data;
  36087. }
  36088. /**
  36089. * @function
  36090. * @memberof Modifiers
  36091. * @argument {Object} data - The data object generated by update method
  36092. * @argument {Object} options - Modifiers configuration and options
  36093. * @returns {Object} The data object, properly modified
  36094. */
  36095. function hide(data) {
  36096. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36097. return data;
  36098. }
  36099. var refRect = data.offsets.reference;
  36100. var bound = find(data.instance.modifiers, function (modifier) {
  36101. return modifier.name === 'preventOverflow';
  36102. }).boundaries;
  36103. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36104. // Avoid unnecessary DOM access if visibility hasn't changed
  36105. if (data.hide === true) {
  36106. return data;
  36107. }
  36108. data.hide = true;
  36109. data.attributes['x-out-of-boundaries'] = '';
  36110. } else {
  36111. // Avoid unnecessary DOM access if visibility hasn't changed
  36112. if (data.hide === false) {
  36113. return data;
  36114. }
  36115. data.hide = false;
  36116. data.attributes['x-out-of-boundaries'] = false;
  36117. }
  36118. return data;
  36119. }
  36120. /**
  36121. * @function
  36122. * @memberof Modifiers
  36123. * @argument {Object} data - The data object generated by `update` method
  36124. * @argument {Object} options - Modifiers configuration and options
  36125. * @returns {Object} The data object, properly modified
  36126. */
  36127. function inner(data) {
  36128. var placement = data.placement;
  36129. var basePlacement = placement.split('-')[0];
  36130. var _data$offsets = data.offsets,
  36131. popper = _data$offsets.popper,
  36132. reference = _data$offsets.reference;
  36133. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36134. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36135. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36136. data.placement = getOppositePlacement(placement);
  36137. data.offsets.popper = getClientRect(popper);
  36138. return data;
  36139. }
  36140. /**
  36141. * Modifier function, each modifier can have a function of this type assigned
  36142. * to its `fn` property.<br />
  36143. * These functions will be called on each update, this means that you must
  36144. * make sure they are performant enough to avoid performance bottlenecks.
  36145. *
  36146. * @function ModifierFn
  36147. * @argument {dataObject} data - The data object generated by `update` method
  36148. * @argument {Object} options - Modifiers configuration and options
  36149. * @returns {dataObject} The data object, properly modified
  36150. */
  36151. /**
  36152. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36153. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36154. * needed by the library.
  36155. *
  36156. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36157. * All the other properties are configurations that could be tweaked.
  36158. * @namespace modifiers
  36159. */
  36160. var modifiers = {
  36161. /**
  36162. * Modifier used to shift the popper on the start or end of its reference
  36163. * element.<br />
  36164. * It will read the variation of the `placement` property.<br />
  36165. * It can be one either `-end` or `-start`.
  36166. * @memberof modifiers
  36167. * @inner
  36168. */
  36169. shift: {
  36170. /** @prop {number} order=100 - Index used to define the order of execution */
  36171. order: 100,
  36172. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36173. enabled: true,
  36174. /** @prop {ModifierFn} */
  36175. fn: shift
  36176. },
  36177. /**
  36178. * The `offset` modifier can shift your popper on both its axis.
  36179. *
  36180. * It accepts the following units:
  36181. * - `px` or unit-less, interpreted as pixels
  36182. * - `%` or `%r`, percentage relative to the length of the reference element
  36183. * - `%p`, percentage relative to the length of the popper element
  36184. * - `vw`, CSS viewport width unit
  36185. * - `vh`, CSS viewport height unit
  36186. *
  36187. * For length is intended the main axis relative to the placement of the popper.<br />
  36188. * This means that if the placement is `top` or `bottom`, the length will be the
  36189. * `width`. In case of `left` or `right`, it will be the `height`.
  36190. *
  36191. * You can provide a single value (as `Number` or `String`), or a pair of values
  36192. * as `String` divided by a comma or one (or more) white spaces.<br />
  36193. * The latter is a deprecated method because it leads to confusion and will be
  36194. * removed in v2.<br />
  36195. * Additionally, it accepts additions and subtractions between different units.
  36196. * Note that multiplications and divisions aren't supported.
  36197. *
  36198. * Valid examples are:
  36199. * ```
  36200. * 10
  36201. * '10%'
  36202. * '10, 10'
  36203. * '10%, 10'
  36204. * '10 + 10%'
  36205. * '10 - 5vh + 3%'
  36206. * '-10px + 5vh, 5px - 6%'
  36207. * ```
  36208. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36209. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36210. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36211. *
  36212. * @memberof modifiers
  36213. * @inner
  36214. */
  36215. offset: {
  36216. /** @prop {number} order=200 - Index used to define the order of execution */
  36217. order: 200,
  36218. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36219. enabled: true,
  36220. /** @prop {ModifierFn} */
  36221. fn: offset,
  36222. /** @prop {Number|String} offset=0
  36223. * The offset value as described in the modifier description
  36224. */
  36225. offset: 0
  36226. },
  36227. /**
  36228. * Modifier used to prevent the popper from being positioned outside the boundary.
  36229. *
  36230. * A scenario exists where the reference itself is not within the boundaries.<br />
  36231. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36232. * In this case we need to decide whether the popper should either:
  36233. *
  36234. * - detach from the reference and remain "trapped" in the boundaries, or
  36235. * - if it should ignore the boundary and "escape with its reference"
  36236. *
  36237. * When `escapeWithReference` is set to`true` and reference is completely
  36238. * outside its boundaries, the popper will overflow (or completely leave)
  36239. * the boundaries in order to remain attached to the edge of the reference.
  36240. *
  36241. * @memberof modifiers
  36242. * @inner
  36243. */
  36244. preventOverflow: {
  36245. /** @prop {number} order=300 - Index used to define the order of execution */
  36246. order: 300,
  36247. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36248. enabled: true,
  36249. /** @prop {ModifierFn} */
  36250. fn: preventOverflow,
  36251. /**
  36252. * @prop {Array} [priority=['left','right','top','bottom']]
  36253. * Popper will try to prevent overflow following these priorities by default,
  36254. * then, it could overflow on the left and on top of the `boundariesElement`
  36255. */
  36256. priority: ['left', 'right', 'top', 'bottom'],
  36257. /**
  36258. * @prop {number} padding=5
  36259. * Amount of pixel used to define a minimum distance between the boundaries
  36260. * and the popper. This makes sure the popper always has a little padding
  36261. * between the edges of its container
  36262. */
  36263. padding: 5,
  36264. /**
  36265. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36266. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36267. * `viewport` or any DOM element.
  36268. */
  36269. boundariesElement: 'scrollParent'
  36270. },
  36271. /**
  36272. * Modifier used to make sure the reference and its popper stay near each other
  36273. * without leaving any gap between the two. Especially useful when the arrow is
  36274. * enabled and you want to ensure that it points to its reference element.
  36275. * It cares only about the first axis. You can still have poppers with margin
  36276. * between the popper and its reference element.
  36277. * @memberof modifiers
  36278. * @inner
  36279. */
  36280. keepTogether: {
  36281. /** @prop {number} order=400 - Index used to define the order of execution */
  36282. order: 400,
  36283. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36284. enabled: true,
  36285. /** @prop {ModifierFn} */
  36286. fn: keepTogether
  36287. },
  36288. /**
  36289. * This modifier is used to move the `arrowElement` of the popper to make
  36290. * sure it is positioned between the reference element and its popper element.
  36291. * It will read the outer size of the `arrowElement` node to detect how many
  36292. * pixels of conjunction are needed.
  36293. *
  36294. * It has no effect if no `arrowElement` is provided.
  36295. * @memberof modifiers
  36296. * @inner
  36297. */
  36298. arrow: {
  36299. /** @prop {number} order=500 - Index used to define the order of execution */
  36300. order: 500,
  36301. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36302. enabled: true,
  36303. /** @prop {ModifierFn} */
  36304. fn: arrow,
  36305. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36306. element: '[x-arrow]'
  36307. },
  36308. /**
  36309. * Modifier used to flip the popper's placement when it starts to overlap its
  36310. * reference element.
  36311. *
  36312. * Requires the `preventOverflow` modifier before it in order to work.
  36313. *
  36314. * **NOTE:** this modifier will interrupt the current update cycle and will
  36315. * restart it if it detects the need to flip the placement.
  36316. * @memberof modifiers
  36317. * @inner
  36318. */
  36319. flip: {
  36320. /** @prop {number} order=600 - Index used to define the order of execution */
  36321. order: 600,
  36322. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36323. enabled: true,
  36324. /** @prop {ModifierFn} */
  36325. fn: flip,
  36326. /**
  36327. * @prop {String|Array} behavior='flip'
  36328. * The behavior used to change the popper's placement. It can be one of
  36329. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36330. * placements (with optional variations)
  36331. */
  36332. behavior: 'flip',
  36333. /**
  36334. * @prop {number} padding=5
  36335. * The popper will flip if it hits the edges of the `boundariesElement`
  36336. */
  36337. padding: 5,
  36338. /**
  36339. * @prop {String|HTMLElement} boundariesElement='viewport'
  36340. * The element which will define the boundaries of the popper position.
  36341. * The popper will never be placed outside of the defined boundaries
  36342. * (except if `keepTogether` is enabled)
  36343. */
  36344. boundariesElement: 'viewport',
  36345. /**
  36346. * @prop {Boolean} flipVariations=false
  36347. * The popper will switch placement variation between `-start` and `-end` when
  36348. * the reference element overlaps its boundaries.
  36349. *
  36350. * The original placement should have a set variation.
  36351. */
  36352. flipVariations: false,
  36353. /**
  36354. * @prop {Boolean} flipVariationsByContent=false
  36355. * The popper will switch placement variation between `-start` and `-end` when
  36356. * the popper element overlaps its reference boundaries.
  36357. *
  36358. * The original placement should have a set variation.
  36359. */
  36360. flipVariationsByContent: false
  36361. },
  36362. /**
  36363. * Modifier used to make the popper flow toward the inner of the reference element.
  36364. * By default, when this modifier is disabled, the popper will be placed outside
  36365. * the reference element.
  36366. * @memberof modifiers
  36367. * @inner
  36368. */
  36369. inner: {
  36370. /** @prop {number} order=700 - Index used to define the order of execution */
  36371. order: 700,
  36372. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36373. enabled: false,
  36374. /** @prop {ModifierFn} */
  36375. fn: inner
  36376. },
  36377. /**
  36378. * Modifier used to hide the popper when its reference element is outside of the
  36379. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36380. * be used to hide with a CSS selector the popper when its reference is
  36381. * out of boundaries.
  36382. *
  36383. * Requires the `preventOverflow` modifier before it in order to work.
  36384. * @memberof modifiers
  36385. * @inner
  36386. */
  36387. hide: {
  36388. /** @prop {number} order=800 - Index used to define the order of execution */
  36389. order: 800,
  36390. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36391. enabled: true,
  36392. /** @prop {ModifierFn} */
  36393. fn: hide
  36394. },
  36395. /**
  36396. * Computes the style that will be applied to the popper element to gets
  36397. * properly positioned.
  36398. *
  36399. * Note that this modifier will not touch the DOM, it just prepares the styles
  36400. * so that `applyStyle` modifier can apply it. This separation is useful
  36401. * in case you need to replace `applyStyle` with a custom implementation.
  36402. *
  36403. * This modifier has `850` as `order` value to maintain backward compatibility
  36404. * with previous versions of Popper.js. Expect the modifiers ordering method
  36405. * to change in future major versions of the library.
  36406. *
  36407. * @memberof modifiers
  36408. * @inner
  36409. */
  36410. computeStyle: {
  36411. /** @prop {number} order=850 - Index used to define the order of execution */
  36412. order: 850,
  36413. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36414. enabled: true,
  36415. /** @prop {ModifierFn} */
  36416. fn: computeStyle,
  36417. /**
  36418. * @prop {Boolean} gpuAcceleration=true
  36419. * If true, it uses the CSS 3D transformation to position the popper.
  36420. * Otherwise, it will use the `top` and `left` properties
  36421. */
  36422. gpuAcceleration: true,
  36423. /**
  36424. * @prop {string} [x='bottom']
  36425. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36426. * Change this if your popper should grow in a direction different from `bottom`
  36427. */
  36428. x: 'bottom',
  36429. /**
  36430. * @prop {string} [x='left']
  36431. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36432. * Change this if your popper should grow in a direction different from `right`
  36433. */
  36434. y: 'right'
  36435. },
  36436. /**
  36437. * Applies the computed styles to the popper element.
  36438. *
  36439. * All the DOM manipulations are limited to this modifier. This is useful in case
  36440. * you want to integrate Popper.js inside a framework or view library and you
  36441. * want to delegate all the DOM manipulations to it.
  36442. *
  36443. * Note that if you disable this modifier, you must make sure the popper element
  36444. * has its position set to `absolute` before Popper.js can do its work!
  36445. *
  36446. * Just disable this modifier and define your own to achieve the desired effect.
  36447. *
  36448. * @memberof modifiers
  36449. * @inner
  36450. */
  36451. applyStyle: {
  36452. /** @prop {number} order=900 - Index used to define the order of execution */
  36453. order: 900,
  36454. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36455. enabled: true,
  36456. /** @prop {ModifierFn} */
  36457. fn: applyStyle,
  36458. /** @prop {Function} */
  36459. onLoad: applyStyleOnLoad,
  36460. /**
  36461. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36462. * @prop {Boolean} gpuAcceleration=true
  36463. * If true, it uses the CSS 3D transformation to position the popper.
  36464. * Otherwise, it will use the `top` and `left` properties
  36465. */
  36466. gpuAcceleration: undefined
  36467. }
  36468. };
  36469. /**
  36470. * The `dataObject` is an object containing all the information used by Popper.js.
  36471. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36472. * @name dataObject
  36473. * @property {Object} data.instance The Popper.js instance
  36474. * @property {String} data.placement Placement applied to popper
  36475. * @property {String} data.originalPlacement Placement originally defined on init
  36476. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36477. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36478. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36479. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36480. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36481. * @property {Object} data.boundaries Offsets of the popper boundaries
  36482. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36483. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36484. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36485. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36486. */
  36487. /**
  36488. * Default options provided to Popper.js constructor.<br />
  36489. * These can be overridden using the `options` argument of Popper.js.<br />
  36490. * To override an option, simply pass an object with the same
  36491. * structure of the `options` object, as the 3rd argument. For example:
  36492. * ```
  36493. * new Popper(ref, pop, {
  36494. * modifiers: {
  36495. * preventOverflow: { enabled: false }
  36496. * }
  36497. * })
  36498. * ```
  36499. * @type {Object}
  36500. * @static
  36501. * @memberof Popper
  36502. */
  36503. var Defaults = {
  36504. /**
  36505. * Popper's placement.
  36506. * @prop {Popper.placements} placement='bottom'
  36507. */
  36508. placement: 'bottom',
  36509. /**
  36510. * Set this to true if you want popper to position it self in 'fixed' mode
  36511. * @prop {Boolean} positionFixed=false
  36512. */
  36513. positionFixed: false,
  36514. /**
  36515. * Whether events (resize, scroll) are initially enabled.
  36516. * @prop {Boolean} eventsEnabled=true
  36517. */
  36518. eventsEnabled: true,
  36519. /**
  36520. * Set to true if you want to automatically remove the popper when
  36521. * you call the `destroy` method.
  36522. * @prop {Boolean} removeOnDestroy=false
  36523. */
  36524. removeOnDestroy: false,
  36525. /**
  36526. * Callback called when the popper is created.<br />
  36527. * By default, it is set to no-op.<br />
  36528. * Access Popper.js instance with `data.instance`.
  36529. * @prop {onCreate}
  36530. */
  36531. onCreate: function onCreate() {},
  36532. /**
  36533. * Callback called when the popper is updated. This callback is not called
  36534. * on the initialization/creation of the popper, but only on subsequent
  36535. * updates.<br />
  36536. * By default, it is set to no-op.<br />
  36537. * Access Popper.js instance with `data.instance`.
  36538. * @prop {onUpdate}
  36539. */
  36540. onUpdate: function onUpdate() {},
  36541. /**
  36542. * List of modifiers used to modify the offsets before they are applied to the popper.
  36543. * They provide most of the functionalities of Popper.js.
  36544. * @prop {modifiers}
  36545. */
  36546. modifiers: modifiers
  36547. };
  36548. /**
  36549. * @callback onCreate
  36550. * @param {dataObject} data
  36551. */
  36552. /**
  36553. * @callback onUpdate
  36554. * @param {dataObject} data
  36555. */
  36556. // Utils
  36557. // Methods
  36558. var Popper = function () {
  36559. /**
  36560. * Creates a new Popper.js instance.
  36561. * @class Popper
  36562. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36563. * @param {Element} popper - The HTML / XML element used as the popper
  36564. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36565. * @return {Object} instance - The generated Popper.js instance
  36566. */
  36567. function Popper(reference, popper) {
  36568. var _this = this;
  36569. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36570. classCallCheck(this, Popper);
  36571. this.scheduleUpdate = function () {
  36572. return requestAnimationFrame(_this.update);
  36573. };
  36574. // make update() debounced, so that it only runs at most once-per-tick
  36575. this.update = debounce(this.update.bind(this));
  36576. // with {} we create a new object with the options inside it
  36577. this.options = _extends({}, Popper.Defaults, options);
  36578. // init state
  36579. this.state = {
  36580. isDestroyed: false,
  36581. isCreated: false,
  36582. scrollParents: []
  36583. };
  36584. // get reference and popper elements (allow jQuery wrappers)
  36585. this.reference = reference && reference.jquery ? reference[0] : reference;
  36586. this.popper = popper && popper.jquery ? popper[0] : popper;
  36587. // Deep merge modifiers options
  36588. this.options.modifiers = {};
  36589. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36590. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36591. });
  36592. // Refactoring modifiers' list (Object => Array)
  36593. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36594. return _extends({
  36595. name: name
  36596. }, _this.options.modifiers[name]);
  36597. })
  36598. // sort the modifiers by order
  36599. .sort(function (a, b) {
  36600. return a.order - b.order;
  36601. });
  36602. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36603. // such code is executed in the same order of its modifier
  36604. // they could add new properties to their options configuration
  36605. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36606. this.modifiers.forEach(function (modifierOptions) {
  36607. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36608. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36609. }
  36610. });
  36611. // fire the first update to position the popper in the right place
  36612. this.update();
  36613. var eventsEnabled = this.options.eventsEnabled;
  36614. if (eventsEnabled) {
  36615. // setup event listeners, they will take care of update the position in specific situations
  36616. this.enableEventListeners();
  36617. }
  36618. this.state.eventsEnabled = eventsEnabled;
  36619. }
  36620. // We can't use class properties because they don't get listed in the
  36621. // class prototype and break stuff like Sinon stubs
  36622. createClass(Popper, [{
  36623. key: 'update',
  36624. value: function update$$1() {
  36625. return update.call(this);
  36626. }
  36627. }, {
  36628. key: 'destroy',
  36629. value: function destroy$$1() {
  36630. return destroy.call(this);
  36631. }
  36632. }, {
  36633. key: 'enableEventListeners',
  36634. value: function enableEventListeners$$1() {
  36635. return enableEventListeners.call(this);
  36636. }
  36637. }, {
  36638. key: 'disableEventListeners',
  36639. value: function disableEventListeners$$1() {
  36640. return disableEventListeners.call(this);
  36641. }
  36642. /**
  36643. * Schedules an update. It will run on the next UI update available.
  36644. * @method scheduleUpdate
  36645. * @memberof Popper
  36646. */
  36647. /**
  36648. * Collection of utilities useful when writing custom modifiers.
  36649. * Starting from version 1.7, this method is available only if you
  36650. * include `popper-utils.js` before `popper.js`.
  36651. *
  36652. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36653. * and will be removed in v2! Use the PopperUtils module directly instead.
  36654. * Due to the high instability of the methods contained in Utils, we can't
  36655. * guarantee them to follow semver. Use them at your own risk!
  36656. * @static
  36657. * @private
  36658. * @type {Object}
  36659. * @deprecated since version 1.8
  36660. * @member Utils
  36661. * @memberof Popper
  36662. */
  36663. }]);
  36664. return Popper;
  36665. }();
  36666. /**
  36667. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36668. * and lets you use it as replacement of a real DOM node.<br />
  36669. * You can use this method to position a popper relatively to a set of coordinates
  36670. * in case you don't have a DOM node to use as reference.
  36671. *
  36672. * ```
  36673. * new Popper(referenceObject, popperNode);
  36674. * ```
  36675. *
  36676. * NB: This feature isn't supported in Internet Explorer 10.
  36677. * @name referenceObject
  36678. * @property {Function} data.getBoundingClientRect
  36679. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36680. * @property {number} data.clientWidth
  36681. * An ES6 getter that will return the width of the virtual reference element.
  36682. * @property {number} data.clientHeight
  36683. * An ES6 getter that will return the height of the virtual reference element.
  36684. */
  36685. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36686. Popper.placements = placements;
  36687. Popper.Defaults = Defaults;
  36688. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36689. //# sourceMappingURL=popper.js.map
  36690. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36691. /***/ }),
  36692. /***/ "./node_modules/process/browser.js":
  36693. /*!*****************************************!*\
  36694. !*** ./node_modules/process/browser.js ***!
  36695. \*****************************************/
  36696. /*! no static exports found */
  36697. /***/ (function(module, exports) {
  36698. // shim for using process in browser
  36699. var process = module.exports = {};
  36700. // cached from whatever global is present so that test runners that stub it
  36701. // don't break things. But we need to wrap it in a try catch in case it is
  36702. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36703. // function because try/catches deoptimize in certain engines.
  36704. var cachedSetTimeout;
  36705. var cachedClearTimeout;
  36706. function defaultSetTimout() {
  36707. throw new Error('setTimeout has not been defined');
  36708. }
  36709. function defaultClearTimeout () {
  36710. throw new Error('clearTimeout has not been defined');
  36711. }
  36712. (function () {
  36713. try {
  36714. if (typeof setTimeout === 'function') {
  36715. cachedSetTimeout = setTimeout;
  36716. } else {
  36717. cachedSetTimeout = defaultSetTimout;
  36718. }
  36719. } catch (e) {
  36720. cachedSetTimeout = defaultSetTimout;
  36721. }
  36722. try {
  36723. if (typeof clearTimeout === 'function') {
  36724. cachedClearTimeout = clearTimeout;
  36725. } else {
  36726. cachedClearTimeout = defaultClearTimeout;
  36727. }
  36728. } catch (e) {
  36729. cachedClearTimeout = defaultClearTimeout;
  36730. }
  36731. } ())
  36732. function runTimeout(fun) {
  36733. if (cachedSetTimeout === setTimeout) {
  36734. //normal enviroments in sane situations
  36735. return setTimeout(fun, 0);
  36736. }
  36737. // if setTimeout wasn't available but was latter defined
  36738. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36739. cachedSetTimeout = setTimeout;
  36740. return setTimeout(fun, 0);
  36741. }
  36742. try {
  36743. // when when somebody has screwed with setTimeout but no I.E. maddness
  36744. return cachedSetTimeout(fun, 0);
  36745. } catch(e){
  36746. try {
  36747. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36748. return cachedSetTimeout.call(null, fun, 0);
  36749. } catch(e){
  36750. // 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
  36751. return cachedSetTimeout.call(this, fun, 0);
  36752. }
  36753. }
  36754. }
  36755. function runClearTimeout(marker) {
  36756. if (cachedClearTimeout === clearTimeout) {
  36757. //normal enviroments in sane situations
  36758. return clearTimeout(marker);
  36759. }
  36760. // if clearTimeout wasn't available but was latter defined
  36761. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36762. cachedClearTimeout = clearTimeout;
  36763. return clearTimeout(marker);
  36764. }
  36765. try {
  36766. // when when somebody has screwed with setTimeout but no I.E. maddness
  36767. return cachedClearTimeout(marker);
  36768. } catch (e){
  36769. try {
  36770. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36771. return cachedClearTimeout.call(null, marker);
  36772. } catch (e){
  36773. // 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.
  36774. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36775. return cachedClearTimeout.call(this, marker);
  36776. }
  36777. }
  36778. }
  36779. var queue = [];
  36780. var draining = false;
  36781. var currentQueue;
  36782. var queueIndex = -1;
  36783. function cleanUpNextTick() {
  36784. if (!draining || !currentQueue) {
  36785. return;
  36786. }
  36787. draining = false;
  36788. if (currentQueue.length) {
  36789. queue = currentQueue.concat(queue);
  36790. } else {
  36791. queueIndex = -1;
  36792. }
  36793. if (queue.length) {
  36794. drainQueue();
  36795. }
  36796. }
  36797. function drainQueue() {
  36798. if (draining) {
  36799. return;
  36800. }
  36801. var timeout = runTimeout(cleanUpNextTick);
  36802. draining = true;
  36803. var len = queue.length;
  36804. while(len) {
  36805. currentQueue = queue;
  36806. queue = [];
  36807. while (++queueIndex < len) {
  36808. if (currentQueue) {
  36809. currentQueue[queueIndex].run();
  36810. }
  36811. }
  36812. queueIndex = -1;
  36813. len = queue.length;
  36814. }
  36815. currentQueue = null;
  36816. draining = false;
  36817. runClearTimeout(timeout);
  36818. }
  36819. process.nextTick = function (fun) {
  36820. var args = new Array(arguments.length - 1);
  36821. if (arguments.length > 1) {
  36822. for (var i = 1; i < arguments.length; i++) {
  36823. args[i - 1] = arguments[i];
  36824. }
  36825. }
  36826. queue.push(new Item(fun, args));
  36827. if (queue.length === 1 && !draining) {
  36828. runTimeout(drainQueue);
  36829. }
  36830. };
  36831. // v8 likes predictible objects
  36832. function Item(fun, array) {
  36833. this.fun = fun;
  36834. this.array = array;
  36835. }
  36836. Item.prototype.run = function () {
  36837. this.fun.apply(null, this.array);
  36838. };
  36839. process.title = 'browser';
  36840. process.browser = true;
  36841. process.env = {};
  36842. process.argv = [];
  36843. process.version = ''; // empty string to avoid regexp issues
  36844. process.versions = {};
  36845. function noop() {}
  36846. process.on = noop;
  36847. process.addListener = noop;
  36848. process.once = noop;
  36849. process.off = noop;
  36850. process.removeListener = noop;
  36851. process.removeAllListeners = noop;
  36852. process.emit = noop;
  36853. process.prependListener = noop;
  36854. process.prependOnceListener = noop;
  36855. process.listeners = function (name) { return [] }
  36856. process.binding = function (name) {
  36857. throw new Error('process.binding is not supported');
  36858. };
  36859. process.cwd = function () { return '/' };
  36860. process.chdir = function (dir) {
  36861. throw new Error('process.chdir is not supported');
  36862. };
  36863. process.umask = function() { return 0; };
  36864. /***/ }),
  36865. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36866. /*!***************************************************!*\
  36867. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36868. \***************************************************/
  36869. /*! no static exports found */
  36870. /***/ (function(module, exports, __webpack_require__) {
  36871. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36872. * Pusher JavaScript Library v5.0.3
  36873. * https://pusher.com/
  36874. *
  36875. * Copyright 2017, Pusher
  36876. * Released under the MIT licence.
  36877. */
  36878. (function webpackUniversalModuleDefinition(root, factory) {
  36879. if(true)
  36880. module.exports = factory();
  36881. else {}
  36882. })(window, function() {
  36883. return /******/ (function(modules) { // webpackBootstrap
  36884. /******/ // The module cache
  36885. /******/ var installedModules = {};
  36886. /******/
  36887. /******/ // The require function
  36888. /******/ function __webpack_require__(moduleId) {
  36889. /******/
  36890. /******/ // Check if module is in cache
  36891. /******/ if(installedModules[moduleId]) {
  36892. /******/ return installedModules[moduleId].exports;
  36893. /******/ }
  36894. /******/ // Create a new module (and put it into the cache)
  36895. /******/ var module = installedModules[moduleId] = {
  36896. /******/ i: moduleId,
  36897. /******/ l: false,
  36898. /******/ exports: {}
  36899. /******/ };
  36900. /******/
  36901. /******/ // Execute the module function
  36902. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36903. /******/
  36904. /******/ // Flag the module as loaded
  36905. /******/ module.l = true;
  36906. /******/
  36907. /******/ // Return the exports of the module
  36908. /******/ return module.exports;
  36909. /******/ }
  36910. /******/
  36911. /******/
  36912. /******/ // expose the modules object (__webpack_modules__)
  36913. /******/ __webpack_require__.m = modules;
  36914. /******/
  36915. /******/ // expose the module cache
  36916. /******/ __webpack_require__.c = installedModules;
  36917. /******/
  36918. /******/ // define getter function for harmony exports
  36919. /******/ __webpack_require__.d = function(exports, name, getter) {
  36920. /******/ if(!__webpack_require__.o(exports, name)) {
  36921. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36922. /******/ }
  36923. /******/ };
  36924. /******/
  36925. /******/ // define __esModule on exports
  36926. /******/ __webpack_require__.r = function(exports) {
  36927. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36928. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36929. /******/ }
  36930. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36931. /******/ };
  36932. /******/
  36933. /******/ // create a fake namespace object
  36934. /******/ // mode & 1: value is a module id, require it
  36935. /******/ // mode & 2: merge all properties of value into the ns
  36936. /******/ // mode & 4: return value when already ns object
  36937. /******/ // mode & 8|1: behave like require
  36938. /******/ __webpack_require__.t = function(value, mode) {
  36939. /******/ if(mode & 1) value = __webpack_require__(value);
  36940. /******/ if(mode & 8) return value;
  36941. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36942. /******/ var ns = Object.create(null);
  36943. /******/ __webpack_require__.r(ns);
  36944. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36945. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36946. /******/ return ns;
  36947. /******/ };
  36948. /******/
  36949. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36950. /******/ __webpack_require__.n = function(module) {
  36951. /******/ var getter = module && module.__esModule ?
  36952. /******/ function getDefault() { return module['default']; } :
  36953. /******/ function getModuleExports() { return module; };
  36954. /******/ __webpack_require__.d(getter, 'a', getter);
  36955. /******/ return getter;
  36956. /******/ };
  36957. /******/
  36958. /******/ // Object.prototype.hasOwnProperty.call
  36959. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36960. /******/
  36961. /******/ // __webpack_public_path__
  36962. /******/ __webpack_require__.p = "";
  36963. /******/
  36964. /******/
  36965. /******/ // Load entry module and return exports
  36966. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36967. /******/ })
  36968. /************************************************************************/
  36969. /******/ ([
  36970. /* 0 */
  36971. /***/ (function(module, exports, __webpack_require__) {
  36972. (function(nacl) {
  36973. 'use strict';
  36974. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36975. // Public domain.
  36976. //
  36977. // Implementation derived from TweetNaCl version 20140427.
  36978. // See for details: http://tweetnacl.cr.yp.to/
  36979. var gf = function(init) {
  36980. var i, r = new Float64Array(16);
  36981. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36982. return r;
  36983. };
  36984. // Pluggable, initialized in high-level API below.
  36985. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36986. var _0 = new Uint8Array(16);
  36987. var _9 = new Uint8Array(32); _9[0] = 9;
  36988. var gf0 = gf(),
  36989. gf1 = gf([1]),
  36990. _121665 = gf([0xdb41, 1]),
  36991. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36992. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36993. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36994. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36995. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36996. function ts64(x, i, h, l) {
  36997. x[i] = (h >> 24) & 0xff;
  36998. x[i+1] = (h >> 16) & 0xff;
  36999. x[i+2] = (h >> 8) & 0xff;
  37000. x[i+3] = h & 0xff;
  37001. x[i+4] = (l >> 24) & 0xff;
  37002. x[i+5] = (l >> 16) & 0xff;
  37003. x[i+6] = (l >> 8) & 0xff;
  37004. x[i+7] = l & 0xff;
  37005. }
  37006. function vn(x, xi, y, yi, n) {
  37007. var i,d = 0;
  37008. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37009. return (1 & ((d - 1) >>> 8)) - 1;
  37010. }
  37011. function crypto_verify_16(x, xi, y, yi) {
  37012. return vn(x,xi,y,yi,16);
  37013. }
  37014. function crypto_verify_32(x, xi, y, yi) {
  37015. return vn(x,xi,y,yi,32);
  37016. }
  37017. function core_salsa20(o, p, k, c) {
  37018. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37019. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37020. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37021. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37022. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37023. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37024. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37025. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37026. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37027. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37028. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37029. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37030. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37031. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37032. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37033. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37034. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37035. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37036. x15 = j15, u;
  37037. for (var i = 0; i < 20; i += 2) {
  37038. u = x0 + x12 | 0;
  37039. x4 ^= u<<7 | u>>>(32-7);
  37040. u = x4 + x0 | 0;
  37041. x8 ^= u<<9 | u>>>(32-9);
  37042. u = x8 + x4 | 0;
  37043. x12 ^= u<<13 | u>>>(32-13);
  37044. u = x12 + x8 | 0;
  37045. x0 ^= u<<18 | u>>>(32-18);
  37046. u = x5 + x1 | 0;
  37047. x9 ^= u<<7 | u>>>(32-7);
  37048. u = x9 + x5 | 0;
  37049. x13 ^= u<<9 | u>>>(32-9);
  37050. u = x13 + x9 | 0;
  37051. x1 ^= u<<13 | u>>>(32-13);
  37052. u = x1 + x13 | 0;
  37053. x5 ^= u<<18 | u>>>(32-18);
  37054. u = x10 + x6 | 0;
  37055. x14 ^= u<<7 | u>>>(32-7);
  37056. u = x14 + x10 | 0;
  37057. x2 ^= u<<9 | u>>>(32-9);
  37058. u = x2 + x14 | 0;
  37059. x6 ^= u<<13 | u>>>(32-13);
  37060. u = x6 + x2 | 0;
  37061. x10 ^= u<<18 | u>>>(32-18);
  37062. u = x15 + x11 | 0;
  37063. x3 ^= u<<7 | u>>>(32-7);
  37064. u = x3 + x15 | 0;
  37065. x7 ^= u<<9 | u>>>(32-9);
  37066. u = x7 + x3 | 0;
  37067. x11 ^= u<<13 | u>>>(32-13);
  37068. u = x11 + x7 | 0;
  37069. x15 ^= u<<18 | u>>>(32-18);
  37070. u = x0 + x3 | 0;
  37071. x1 ^= u<<7 | u>>>(32-7);
  37072. u = x1 + x0 | 0;
  37073. x2 ^= u<<9 | u>>>(32-9);
  37074. u = x2 + x1 | 0;
  37075. x3 ^= u<<13 | u>>>(32-13);
  37076. u = x3 + x2 | 0;
  37077. x0 ^= u<<18 | u>>>(32-18);
  37078. u = x5 + x4 | 0;
  37079. x6 ^= u<<7 | u>>>(32-7);
  37080. u = x6 + x5 | 0;
  37081. x7 ^= u<<9 | u>>>(32-9);
  37082. u = x7 + x6 | 0;
  37083. x4 ^= u<<13 | u>>>(32-13);
  37084. u = x4 + x7 | 0;
  37085. x5 ^= u<<18 | u>>>(32-18);
  37086. u = x10 + x9 | 0;
  37087. x11 ^= u<<7 | u>>>(32-7);
  37088. u = x11 + x10 | 0;
  37089. x8 ^= u<<9 | u>>>(32-9);
  37090. u = x8 + x11 | 0;
  37091. x9 ^= u<<13 | u>>>(32-13);
  37092. u = x9 + x8 | 0;
  37093. x10 ^= u<<18 | u>>>(32-18);
  37094. u = x15 + x14 | 0;
  37095. x12 ^= u<<7 | u>>>(32-7);
  37096. u = x12 + x15 | 0;
  37097. x13 ^= u<<9 | u>>>(32-9);
  37098. u = x13 + x12 | 0;
  37099. x14 ^= u<<13 | u>>>(32-13);
  37100. u = x14 + x13 | 0;
  37101. x15 ^= u<<18 | u>>>(32-18);
  37102. }
  37103. x0 = x0 + j0 | 0;
  37104. x1 = x1 + j1 | 0;
  37105. x2 = x2 + j2 | 0;
  37106. x3 = x3 + j3 | 0;
  37107. x4 = x4 + j4 | 0;
  37108. x5 = x5 + j5 | 0;
  37109. x6 = x6 + j6 | 0;
  37110. x7 = x7 + j7 | 0;
  37111. x8 = x8 + j8 | 0;
  37112. x9 = x9 + j9 | 0;
  37113. x10 = x10 + j10 | 0;
  37114. x11 = x11 + j11 | 0;
  37115. x12 = x12 + j12 | 0;
  37116. x13 = x13 + j13 | 0;
  37117. x14 = x14 + j14 | 0;
  37118. x15 = x15 + j15 | 0;
  37119. o[ 0] = x0 >>> 0 & 0xff;
  37120. o[ 1] = x0 >>> 8 & 0xff;
  37121. o[ 2] = x0 >>> 16 & 0xff;
  37122. o[ 3] = x0 >>> 24 & 0xff;
  37123. o[ 4] = x1 >>> 0 & 0xff;
  37124. o[ 5] = x1 >>> 8 & 0xff;
  37125. o[ 6] = x1 >>> 16 & 0xff;
  37126. o[ 7] = x1 >>> 24 & 0xff;
  37127. o[ 8] = x2 >>> 0 & 0xff;
  37128. o[ 9] = x2 >>> 8 & 0xff;
  37129. o[10] = x2 >>> 16 & 0xff;
  37130. o[11] = x2 >>> 24 & 0xff;
  37131. o[12] = x3 >>> 0 & 0xff;
  37132. o[13] = x3 >>> 8 & 0xff;
  37133. o[14] = x3 >>> 16 & 0xff;
  37134. o[15] = x3 >>> 24 & 0xff;
  37135. o[16] = x4 >>> 0 & 0xff;
  37136. o[17] = x4 >>> 8 & 0xff;
  37137. o[18] = x4 >>> 16 & 0xff;
  37138. o[19] = x4 >>> 24 & 0xff;
  37139. o[20] = x5 >>> 0 & 0xff;
  37140. o[21] = x5 >>> 8 & 0xff;
  37141. o[22] = x5 >>> 16 & 0xff;
  37142. o[23] = x5 >>> 24 & 0xff;
  37143. o[24] = x6 >>> 0 & 0xff;
  37144. o[25] = x6 >>> 8 & 0xff;
  37145. o[26] = x6 >>> 16 & 0xff;
  37146. o[27] = x6 >>> 24 & 0xff;
  37147. o[28] = x7 >>> 0 & 0xff;
  37148. o[29] = x7 >>> 8 & 0xff;
  37149. o[30] = x7 >>> 16 & 0xff;
  37150. o[31] = x7 >>> 24 & 0xff;
  37151. o[32] = x8 >>> 0 & 0xff;
  37152. o[33] = x8 >>> 8 & 0xff;
  37153. o[34] = x8 >>> 16 & 0xff;
  37154. o[35] = x8 >>> 24 & 0xff;
  37155. o[36] = x9 >>> 0 & 0xff;
  37156. o[37] = x9 >>> 8 & 0xff;
  37157. o[38] = x9 >>> 16 & 0xff;
  37158. o[39] = x9 >>> 24 & 0xff;
  37159. o[40] = x10 >>> 0 & 0xff;
  37160. o[41] = x10 >>> 8 & 0xff;
  37161. o[42] = x10 >>> 16 & 0xff;
  37162. o[43] = x10 >>> 24 & 0xff;
  37163. o[44] = x11 >>> 0 & 0xff;
  37164. o[45] = x11 >>> 8 & 0xff;
  37165. o[46] = x11 >>> 16 & 0xff;
  37166. o[47] = x11 >>> 24 & 0xff;
  37167. o[48] = x12 >>> 0 & 0xff;
  37168. o[49] = x12 >>> 8 & 0xff;
  37169. o[50] = x12 >>> 16 & 0xff;
  37170. o[51] = x12 >>> 24 & 0xff;
  37171. o[52] = x13 >>> 0 & 0xff;
  37172. o[53] = x13 >>> 8 & 0xff;
  37173. o[54] = x13 >>> 16 & 0xff;
  37174. o[55] = x13 >>> 24 & 0xff;
  37175. o[56] = x14 >>> 0 & 0xff;
  37176. o[57] = x14 >>> 8 & 0xff;
  37177. o[58] = x14 >>> 16 & 0xff;
  37178. o[59] = x14 >>> 24 & 0xff;
  37179. o[60] = x15 >>> 0 & 0xff;
  37180. o[61] = x15 >>> 8 & 0xff;
  37181. o[62] = x15 >>> 16 & 0xff;
  37182. o[63] = x15 >>> 24 & 0xff;
  37183. }
  37184. function core_hsalsa20(o,p,k,c) {
  37185. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37186. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37187. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37188. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37189. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37190. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37191. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37192. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37193. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37194. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37195. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37196. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37197. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37198. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37199. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37200. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37201. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37202. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37203. x15 = j15, u;
  37204. for (var i = 0; i < 20; i += 2) {
  37205. u = x0 + x12 | 0;
  37206. x4 ^= u<<7 | u>>>(32-7);
  37207. u = x4 + x0 | 0;
  37208. x8 ^= u<<9 | u>>>(32-9);
  37209. u = x8 + x4 | 0;
  37210. x12 ^= u<<13 | u>>>(32-13);
  37211. u = x12 + x8 | 0;
  37212. x0 ^= u<<18 | u>>>(32-18);
  37213. u = x5 + x1 | 0;
  37214. x9 ^= u<<7 | u>>>(32-7);
  37215. u = x9 + x5 | 0;
  37216. x13 ^= u<<9 | u>>>(32-9);
  37217. u = x13 + x9 | 0;
  37218. x1 ^= u<<13 | u>>>(32-13);
  37219. u = x1 + x13 | 0;
  37220. x5 ^= u<<18 | u>>>(32-18);
  37221. u = x10 + x6 | 0;
  37222. x14 ^= u<<7 | u>>>(32-7);
  37223. u = x14 + x10 | 0;
  37224. x2 ^= u<<9 | u>>>(32-9);
  37225. u = x2 + x14 | 0;
  37226. x6 ^= u<<13 | u>>>(32-13);
  37227. u = x6 + x2 | 0;
  37228. x10 ^= u<<18 | u>>>(32-18);
  37229. u = x15 + x11 | 0;
  37230. x3 ^= u<<7 | u>>>(32-7);
  37231. u = x3 + x15 | 0;
  37232. x7 ^= u<<9 | u>>>(32-9);
  37233. u = x7 + x3 | 0;
  37234. x11 ^= u<<13 | u>>>(32-13);
  37235. u = x11 + x7 | 0;
  37236. x15 ^= u<<18 | u>>>(32-18);
  37237. u = x0 + x3 | 0;
  37238. x1 ^= u<<7 | u>>>(32-7);
  37239. u = x1 + x0 | 0;
  37240. x2 ^= u<<9 | u>>>(32-9);
  37241. u = x2 + x1 | 0;
  37242. x3 ^= u<<13 | u>>>(32-13);
  37243. u = x3 + x2 | 0;
  37244. x0 ^= u<<18 | u>>>(32-18);
  37245. u = x5 + x4 | 0;
  37246. x6 ^= u<<7 | u>>>(32-7);
  37247. u = x6 + x5 | 0;
  37248. x7 ^= u<<9 | u>>>(32-9);
  37249. u = x7 + x6 | 0;
  37250. x4 ^= u<<13 | u>>>(32-13);
  37251. u = x4 + x7 | 0;
  37252. x5 ^= u<<18 | u>>>(32-18);
  37253. u = x10 + x9 | 0;
  37254. x11 ^= u<<7 | u>>>(32-7);
  37255. u = x11 + x10 | 0;
  37256. x8 ^= u<<9 | u>>>(32-9);
  37257. u = x8 + x11 | 0;
  37258. x9 ^= u<<13 | u>>>(32-13);
  37259. u = x9 + x8 | 0;
  37260. x10 ^= u<<18 | u>>>(32-18);
  37261. u = x15 + x14 | 0;
  37262. x12 ^= u<<7 | u>>>(32-7);
  37263. u = x12 + x15 | 0;
  37264. x13 ^= u<<9 | u>>>(32-9);
  37265. u = x13 + x12 | 0;
  37266. x14 ^= u<<13 | u>>>(32-13);
  37267. u = x14 + x13 | 0;
  37268. x15 ^= u<<18 | u>>>(32-18);
  37269. }
  37270. o[ 0] = x0 >>> 0 & 0xff;
  37271. o[ 1] = x0 >>> 8 & 0xff;
  37272. o[ 2] = x0 >>> 16 & 0xff;
  37273. o[ 3] = x0 >>> 24 & 0xff;
  37274. o[ 4] = x5 >>> 0 & 0xff;
  37275. o[ 5] = x5 >>> 8 & 0xff;
  37276. o[ 6] = x5 >>> 16 & 0xff;
  37277. o[ 7] = x5 >>> 24 & 0xff;
  37278. o[ 8] = x10 >>> 0 & 0xff;
  37279. o[ 9] = x10 >>> 8 & 0xff;
  37280. o[10] = x10 >>> 16 & 0xff;
  37281. o[11] = x10 >>> 24 & 0xff;
  37282. o[12] = x15 >>> 0 & 0xff;
  37283. o[13] = x15 >>> 8 & 0xff;
  37284. o[14] = x15 >>> 16 & 0xff;
  37285. o[15] = x15 >>> 24 & 0xff;
  37286. o[16] = x6 >>> 0 & 0xff;
  37287. o[17] = x6 >>> 8 & 0xff;
  37288. o[18] = x6 >>> 16 & 0xff;
  37289. o[19] = x6 >>> 24 & 0xff;
  37290. o[20] = x7 >>> 0 & 0xff;
  37291. o[21] = x7 >>> 8 & 0xff;
  37292. o[22] = x7 >>> 16 & 0xff;
  37293. o[23] = x7 >>> 24 & 0xff;
  37294. o[24] = x8 >>> 0 & 0xff;
  37295. o[25] = x8 >>> 8 & 0xff;
  37296. o[26] = x8 >>> 16 & 0xff;
  37297. o[27] = x8 >>> 24 & 0xff;
  37298. o[28] = x9 >>> 0 & 0xff;
  37299. o[29] = x9 >>> 8 & 0xff;
  37300. o[30] = x9 >>> 16 & 0xff;
  37301. o[31] = x9 >>> 24 & 0xff;
  37302. }
  37303. function crypto_core_salsa20(out,inp,k,c) {
  37304. core_salsa20(out,inp,k,c);
  37305. }
  37306. function crypto_core_hsalsa20(out,inp,k,c) {
  37307. core_hsalsa20(out,inp,k,c);
  37308. }
  37309. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37310. // "expand 32-byte k"
  37311. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37312. var z = new Uint8Array(16), x = new Uint8Array(64);
  37313. var u, i;
  37314. for (i = 0; i < 16; i++) z[i] = 0;
  37315. for (i = 0; i < 8; i++) z[i] = n[i];
  37316. while (b >= 64) {
  37317. crypto_core_salsa20(x,z,k,sigma);
  37318. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37319. u = 1;
  37320. for (i = 8; i < 16; i++) {
  37321. u = u + (z[i] & 0xff) | 0;
  37322. z[i] = u & 0xff;
  37323. u >>>= 8;
  37324. }
  37325. b -= 64;
  37326. cpos += 64;
  37327. mpos += 64;
  37328. }
  37329. if (b > 0) {
  37330. crypto_core_salsa20(x,z,k,sigma);
  37331. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37332. }
  37333. return 0;
  37334. }
  37335. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37336. var z = new Uint8Array(16), x = new Uint8Array(64);
  37337. var u, i;
  37338. for (i = 0; i < 16; i++) z[i] = 0;
  37339. for (i = 0; i < 8; i++) z[i] = n[i];
  37340. while (b >= 64) {
  37341. crypto_core_salsa20(x,z,k,sigma);
  37342. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37343. u = 1;
  37344. for (i = 8; i < 16; i++) {
  37345. u = u + (z[i] & 0xff) | 0;
  37346. z[i] = u & 0xff;
  37347. u >>>= 8;
  37348. }
  37349. b -= 64;
  37350. cpos += 64;
  37351. }
  37352. if (b > 0) {
  37353. crypto_core_salsa20(x,z,k,sigma);
  37354. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37355. }
  37356. return 0;
  37357. }
  37358. function crypto_stream(c,cpos,d,n,k) {
  37359. var s = new Uint8Array(32);
  37360. crypto_core_hsalsa20(s,n,k,sigma);
  37361. var sn = new Uint8Array(8);
  37362. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37363. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37364. }
  37365. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37366. var s = new Uint8Array(32);
  37367. crypto_core_hsalsa20(s,n,k,sigma);
  37368. var sn = new Uint8Array(8);
  37369. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37370. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37371. }
  37372. /*
  37373. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37374. * https://github.com/floodyberry/poly1305-donna
  37375. */
  37376. var poly1305 = function(key) {
  37377. this.buffer = new Uint8Array(16);
  37378. this.r = new Uint16Array(10);
  37379. this.h = new Uint16Array(10);
  37380. this.pad = new Uint16Array(8);
  37381. this.leftover = 0;
  37382. this.fin = 0;
  37383. var t0, t1, t2, t3, t4, t5, t6, t7;
  37384. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37385. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37386. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37387. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37388. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37389. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37390. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37391. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37392. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37393. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37394. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37395. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37396. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37397. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37398. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37399. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37400. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37401. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37402. };
  37403. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37404. var hibit = this.fin ? 0 : (1 << 11);
  37405. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37406. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37407. var h0 = this.h[0],
  37408. h1 = this.h[1],
  37409. h2 = this.h[2],
  37410. h3 = this.h[3],
  37411. h4 = this.h[4],
  37412. h5 = this.h[5],
  37413. h6 = this.h[6],
  37414. h7 = this.h[7],
  37415. h8 = this.h[8],
  37416. h9 = this.h[9];
  37417. var r0 = this.r[0],
  37418. r1 = this.r[1],
  37419. r2 = this.r[2],
  37420. r3 = this.r[3],
  37421. r4 = this.r[4],
  37422. r5 = this.r[5],
  37423. r6 = this.r[6],
  37424. r7 = this.r[7],
  37425. r8 = this.r[8],
  37426. r9 = this.r[9];
  37427. while (bytes >= 16) {
  37428. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37429. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37430. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37431. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37432. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37433. h5 += ((t4 >>> 1)) & 0x1fff;
  37434. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37435. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37436. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37437. h9 += ((t7 >>> 5)) | hibit;
  37438. c = 0;
  37439. d0 = c;
  37440. d0 += h0 * r0;
  37441. d0 += h1 * (5 * r9);
  37442. d0 += h2 * (5 * r8);
  37443. d0 += h3 * (5 * r7);
  37444. d0 += h4 * (5 * r6);
  37445. c = (d0 >>> 13); d0 &= 0x1fff;
  37446. d0 += h5 * (5 * r5);
  37447. d0 += h6 * (5 * r4);
  37448. d0 += h7 * (5 * r3);
  37449. d0 += h8 * (5 * r2);
  37450. d0 += h9 * (5 * r1);
  37451. c += (d0 >>> 13); d0 &= 0x1fff;
  37452. d1 = c;
  37453. d1 += h0 * r1;
  37454. d1 += h1 * r0;
  37455. d1 += h2 * (5 * r9);
  37456. d1 += h3 * (5 * r8);
  37457. d1 += h4 * (5 * r7);
  37458. c = (d1 >>> 13); d1 &= 0x1fff;
  37459. d1 += h5 * (5 * r6);
  37460. d1 += h6 * (5 * r5);
  37461. d1 += h7 * (5 * r4);
  37462. d1 += h8 * (5 * r3);
  37463. d1 += h9 * (5 * r2);
  37464. c += (d1 >>> 13); d1 &= 0x1fff;
  37465. d2 = c;
  37466. d2 += h0 * r2;
  37467. d2 += h1 * r1;
  37468. d2 += h2 * r0;
  37469. d2 += h3 * (5 * r9);
  37470. d2 += h4 * (5 * r8);
  37471. c = (d2 >>> 13); d2 &= 0x1fff;
  37472. d2 += h5 * (5 * r7);
  37473. d2 += h6 * (5 * r6);
  37474. d2 += h7 * (5 * r5);
  37475. d2 += h8 * (5 * r4);
  37476. d2 += h9 * (5 * r3);
  37477. c += (d2 >>> 13); d2 &= 0x1fff;
  37478. d3 = c;
  37479. d3 += h0 * r3;
  37480. d3 += h1 * r2;
  37481. d3 += h2 * r1;
  37482. d3 += h3 * r0;
  37483. d3 += h4 * (5 * r9);
  37484. c = (d3 >>> 13); d3 &= 0x1fff;
  37485. d3 += h5 * (5 * r8);
  37486. d3 += h6 * (5 * r7);
  37487. d3 += h7 * (5 * r6);
  37488. d3 += h8 * (5 * r5);
  37489. d3 += h9 * (5 * r4);
  37490. c += (d3 >>> 13); d3 &= 0x1fff;
  37491. d4 = c;
  37492. d4 += h0 * r4;
  37493. d4 += h1 * r3;
  37494. d4 += h2 * r2;
  37495. d4 += h3 * r1;
  37496. d4 += h4 * r0;
  37497. c = (d4 >>> 13); d4 &= 0x1fff;
  37498. d4 += h5 * (5 * r9);
  37499. d4 += h6 * (5 * r8);
  37500. d4 += h7 * (5 * r7);
  37501. d4 += h8 * (5 * r6);
  37502. d4 += h9 * (5 * r5);
  37503. c += (d4 >>> 13); d4 &= 0x1fff;
  37504. d5 = c;
  37505. d5 += h0 * r5;
  37506. d5 += h1 * r4;
  37507. d5 += h2 * r3;
  37508. d5 += h3 * r2;
  37509. d5 += h4 * r1;
  37510. c = (d5 >>> 13); d5 &= 0x1fff;
  37511. d5 += h5 * r0;
  37512. d5 += h6 * (5 * r9);
  37513. d5 += h7 * (5 * r8);
  37514. d5 += h8 * (5 * r7);
  37515. d5 += h9 * (5 * r6);
  37516. c += (d5 >>> 13); d5 &= 0x1fff;
  37517. d6 = c;
  37518. d6 += h0 * r6;
  37519. d6 += h1 * r5;
  37520. d6 += h2 * r4;
  37521. d6 += h3 * r3;
  37522. d6 += h4 * r2;
  37523. c = (d6 >>> 13); d6 &= 0x1fff;
  37524. d6 += h5 * r1;
  37525. d6 += h6 * r0;
  37526. d6 += h7 * (5 * r9);
  37527. d6 += h8 * (5 * r8);
  37528. d6 += h9 * (5 * r7);
  37529. c += (d6 >>> 13); d6 &= 0x1fff;
  37530. d7 = c;
  37531. d7 += h0 * r7;
  37532. d7 += h1 * r6;
  37533. d7 += h2 * r5;
  37534. d7 += h3 * r4;
  37535. d7 += h4 * r3;
  37536. c = (d7 >>> 13); d7 &= 0x1fff;
  37537. d7 += h5 * r2;
  37538. d7 += h6 * r1;
  37539. d7 += h7 * r0;
  37540. d7 += h8 * (5 * r9);
  37541. d7 += h9 * (5 * r8);
  37542. c += (d7 >>> 13); d7 &= 0x1fff;
  37543. d8 = c;
  37544. d8 += h0 * r8;
  37545. d8 += h1 * r7;
  37546. d8 += h2 * r6;
  37547. d8 += h3 * r5;
  37548. d8 += h4 * r4;
  37549. c = (d8 >>> 13); d8 &= 0x1fff;
  37550. d8 += h5 * r3;
  37551. d8 += h6 * r2;
  37552. d8 += h7 * r1;
  37553. d8 += h8 * r0;
  37554. d8 += h9 * (5 * r9);
  37555. c += (d8 >>> 13); d8 &= 0x1fff;
  37556. d9 = c;
  37557. d9 += h0 * r9;
  37558. d9 += h1 * r8;
  37559. d9 += h2 * r7;
  37560. d9 += h3 * r6;
  37561. d9 += h4 * r5;
  37562. c = (d9 >>> 13); d9 &= 0x1fff;
  37563. d9 += h5 * r4;
  37564. d9 += h6 * r3;
  37565. d9 += h7 * r2;
  37566. d9 += h8 * r1;
  37567. d9 += h9 * r0;
  37568. c += (d9 >>> 13); d9 &= 0x1fff;
  37569. c = (((c << 2) + c)) | 0;
  37570. c = (c + d0) | 0;
  37571. d0 = c & 0x1fff;
  37572. c = (c >>> 13);
  37573. d1 += c;
  37574. h0 = d0;
  37575. h1 = d1;
  37576. h2 = d2;
  37577. h3 = d3;
  37578. h4 = d4;
  37579. h5 = d5;
  37580. h6 = d6;
  37581. h7 = d7;
  37582. h8 = d8;
  37583. h9 = d9;
  37584. mpos += 16;
  37585. bytes -= 16;
  37586. }
  37587. this.h[0] = h0;
  37588. this.h[1] = h1;
  37589. this.h[2] = h2;
  37590. this.h[3] = h3;
  37591. this.h[4] = h4;
  37592. this.h[5] = h5;
  37593. this.h[6] = h6;
  37594. this.h[7] = h7;
  37595. this.h[8] = h8;
  37596. this.h[9] = h9;
  37597. };
  37598. poly1305.prototype.finish = function(mac, macpos) {
  37599. var g = new Uint16Array(10);
  37600. var c, mask, f, i;
  37601. if (this.leftover) {
  37602. i = this.leftover;
  37603. this.buffer[i++] = 1;
  37604. for (; i < 16; i++) this.buffer[i] = 0;
  37605. this.fin = 1;
  37606. this.blocks(this.buffer, 0, 16);
  37607. }
  37608. c = this.h[1] >>> 13;
  37609. this.h[1] &= 0x1fff;
  37610. for (i = 2; i < 10; i++) {
  37611. this.h[i] += c;
  37612. c = this.h[i] >>> 13;
  37613. this.h[i] &= 0x1fff;
  37614. }
  37615. this.h[0] += (c * 5);
  37616. c = this.h[0] >>> 13;
  37617. this.h[0] &= 0x1fff;
  37618. this.h[1] += c;
  37619. c = this.h[1] >>> 13;
  37620. this.h[1] &= 0x1fff;
  37621. this.h[2] += c;
  37622. g[0] = this.h[0] + 5;
  37623. c = g[0] >>> 13;
  37624. g[0] &= 0x1fff;
  37625. for (i = 1; i < 10; i++) {
  37626. g[i] = this.h[i] + c;
  37627. c = g[i] >>> 13;
  37628. g[i] &= 0x1fff;
  37629. }
  37630. g[9] -= (1 << 13);
  37631. mask = (c ^ 1) - 1;
  37632. for (i = 0; i < 10; i++) g[i] &= mask;
  37633. mask = ~mask;
  37634. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37635. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37636. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37637. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37638. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37639. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37640. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37641. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37642. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37643. f = this.h[0] + this.pad[0];
  37644. this.h[0] = f & 0xffff;
  37645. for (i = 1; i < 8; i++) {
  37646. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37647. this.h[i] = f & 0xffff;
  37648. }
  37649. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37650. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37651. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37652. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37653. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37654. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37655. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37656. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37657. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37658. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37659. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37660. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37661. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37662. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37663. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37664. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37665. };
  37666. poly1305.prototype.update = function(m, mpos, bytes) {
  37667. var i, want;
  37668. if (this.leftover) {
  37669. want = (16 - this.leftover);
  37670. if (want > bytes)
  37671. want = bytes;
  37672. for (i = 0; i < want; i++)
  37673. this.buffer[this.leftover + i] = m[mpos+i];
  37674. bytes -= want;
  37675. mpos += want;
  37676. this.leftover += want;
  37677. if (this.leftover < 16)
  37678. return;
  37679. this.blocks(this.buffer, 0, 16);
  37680. this.leftover = 0;
  37681. }
  37682. if (bytes >= 16) {
  37683. want = bytes - (bytes % 16);
  37684. this.blocks(m, mpos, want);
  37685. mpos += want;
  37686. bytes -= want;
  37687. }
  37688. if (bytes) {
  37689. for (i = 0; i < bytes; i++)
  37690. this.buffer[this.leftover + i] = m[mpos+i];
  37691. this.leftover += bytes;
  37692. }
  37693. };
  37694. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37695. var s = new poly1305(k);
  37696. s.update(m, mpos, n);
  37697. s.finish(out, outpos);
  37698. return 0;
  37699. }
  37700. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37701. var x = new Uint8Array(16);
  37702. crypto_onetimeauth(x,0,m,mpos,n,k);
  37703. return crypto_verify_16(h,hpos,x,0);
  37704. }
  37705. function crypto_secretbox(c,m,d,n,k) {
  37706. var i;
  37707. if (d < 32) return -1;
  37708. crypto_stream_xor(c,0,m,0,d,n,k);
  37709. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37710. for (i = 0; i < 16; i++) c[i] = 0;
  37711. return 0;
  37712. }
  37713. function crypto_secretbox_open(m,c,d,n,k) {
  37714. var i;
  37715. var x = new Uint8Array(32);
  37716. if (d < 32) return -1;
  37717. crypto_stream(x,0,32,n,k);
  37718. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37719. crypto_stream_xor(m,0,c,0,d,n,k);
  37720. for (i = 0; i < 32; i++) m[i] = 0;
  37721. return 0;
  37722. }
  37723. function set25519(r, a) {
  37724. var i;
  37725. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37726. }
  37727. function car25519(o) {
  37728. var i, v, c = 1;
  37729. for (i = 0; i < 16; i++) {
  37730. v = o[i] + c + 65535;
  37731. c = Math.floor(v / 65536);
  37732. o[i] = v - c * 65536;
  37733. }
  37734. o[0] += c-1 + 37 * (c-1);
  37735. }
  37736. function sel25519(p, q, b) {
  37737. var t, c = ~(b-1);
  37738. for (var i = 0; i < 16; i++) {
  37739. t = c & (p[i] ^ q[i]);
  37740. p[i] ^= t;
  37741. q[i] ^= t;
  37742. }
  37743. }
  37744. function pack25519(o, n) {
  37745. var i, j, b;
  37746. var m = gf(), t = gf();
  37747. for (i = 0; i < 16; i++) t[i] = n[i];
  37748. car25519(t);
  37749. car25519(t);
  37750. car25519(t);
  37751. for (j = 0; j < 2; j++) {
  37752. m[0] = t[0] - 0xffed;
  37753. for (i = 1; i < 15; i++) {
  37754. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37755. m[i-1] &= 0xffff;
  37756. }
  37757. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37758. b = (m[15]>>16) & 1;
  37759. m[14] &= 0xffff;
  37760. sel25519(t, m, 1-b);
  37761. }
  37762. for (i = 0; i < 16; i++) {
  37763. o[2*i] = t[i] & 0xff;
  37764. o[2*i+1] = t[i]>>8;
  37765. }
  37766. }
  37767. function neq25519(a, b) {
  37768. var c = new Uint8Array(32), d = new Uint8Array(32);
  37769. pack25519(c, a);
  37770. pack25519(d, b);
  37771. return crypto_verify_32(c, 0, d, 0);
  37772. }
  37773. function par25519(a) {
  37774. var d = new Uint8Array(32);
  37775. pack25519(d, a);
  37776. return d[0] & 1;
  37777. }
  37778. function unpack25519(o, n) {
  37779. var i;
  37780. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37781. o[15] &= 0x7fff;
  37782. }
  37783. function A(o, a, b) {
  37784. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37785. }
  37786. function Z(o, a, b) {
  37787. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37788. }
  37789. function M(o, a, b) {
  37790. var v, c,
  37791. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37792. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37793. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37794. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37795. b0 = b[0],
  37796. b1 = b[1],
  37797. b2 = b[2],
  37798. b3 = b[3],
  37799. b4 = b[4],
  37800. b5 = b[5],
  37801. b6 = b[6],
  37802. b7 = b[7],
  37803. b8 = b[8],
  37804. b9 = b[9],
  37805. b10 = b[10],
  37806. b11 = b[11],
  37807. b12 = b[12],
  37808. b13 = b[13],
  37809. b14 = b[14],
  37810. b15 = b[15];
  37811. v = a[0];
  37812. t0 += v * b0;
  37813. t1 += v * b1;
  37814. t2 += v * b2;
  37815. t3 += v * b3;
  37816. t4 += v * b4;
  37817. t5 += v * b5;
  37818. t6 += v * b6;
  37819. t7 += v * b7;
  37820. t8 += v * b8;
  37821. t9 += v * b9;
  37822. t10 += v * b10;
  37823. t11 += v * b11;
  37824. t12 += v * b12;
  37825. t13 += v * b13;
  37826. t14 += v * b14;
  37827. t15 += v * b15;
  37828. v = a[1];
  37829. t1 += v * b0;
  37830. t2 += v * b1;
  37831. t3 += v * b2;
  37832. t4 += v * b3;
  37833. t5 += v * b4;
  37834. t6 += v * b5;
  37835. t7 += v * b6;
  37836. t8 += v * b7;
  37837. t9 += v * b8;
  37838. t10 += v * b9;
  37839. t11 += v * b10;
  37840. t12 += v * b11;
  37841. t13 += v * b12;
  37842. t14 += v * b13;
  37843. t15 += v * b14;
  37844. t16 += v * b15;
  37845. v = a[2];
  37846. t2 += v * b0;
  37847. t3 += v * b1;
  37848. t4 += v * b2;
  37849. t5 += v * b3;
  37850. t6 += v * b4;
  37851. t7 += v * b5;
  37852. t8 += v * b6;
  37853. t9 += v * b7;
  37854. t10 += v * b8;
  37855. t11 += v * b9;
  37856. t12 += v * b10;
  37857. t13 += v * b11;
  37858. t14 += v * b12;
  37859. t15 += v * b13;
  37860. t16 += v * b14;
  37861. t17 += v * b15;
  37862. v = a[3];
  37863. t3 += v * b0;
  37864. t4 += v * b1;
  37865. t5 += v * b2;
  37866. t6 += v * b3;
  37867. t7 += v * b4;
  37868. t8 += v * b5;
  37869. t9 += v * b6;
  37870. t10 += v * b7;
  37871. t11 += v * b8;
  37872. t12 += v * b9;
  37873. t13 += v * b10;
  37874. t14 += v * b11;
  37875. t15 += v * b12;
  37876. t16 += v * b13;
  37877. t17 += v * b14;
  37878. t18 += v * b15;
  37879. v = a[4];
  37880. t4 += v * b0;
  37881. t5 += v * b1;
  37882. t6 += v * b2;
  37883. t7 += v * b3;
  37884. t8 += v * b4;
  37885. t9 += v * b5;
  37886. t10 += v * b6;
  37887. t11 += v * b7;
  37888. t12 += v * b8;
  37889. t13 += v * b9;
  37890. t14 += v * b10;
  37891. t15 += v * b11;
  37892. t16 += v * b12;
  37893. t17 += v * b13;
  37894. t18 += v * b14;
  37895. t19 += v * b15;
  37896. v = a[5];
  37897. t5 += v * b0;
  37898. t6 += v * b1;
  37899. t7 += v * b2;
  37900. t8 += v * b3;
  37901. t9 += v * b4;
  37902. t10 += v * b5;
  37903. t11 += v * b6;
  37904. t12 += v * b7;
  37905. t13 += v * b8;
  37906. t14 += v * b9;
  37907. t15 += v * b10;
  37908. t16 += v * b11;
  37909. t17 += v * b12;
  37910. t18 += v * b13;
  37911. t19 += v * b14;
  37912. t20 += v * b15;
  37913. v = a[6];
  37914. t6 += v * b0;
  37915. t7 += v * b1;
  37916. t8 += v * b2;
  37917. t9 += v * b3;
  37918. t10 += v * b4;
  37919. t11 += v * b5;
  37920. t12 += v * b6;
  37921. t13 += v * b7;
  37922. t14 += v * b8;
  37923. t15 += v * b9;
  37924. t16 += v * b10;
  37925. t17 += v * b11;
  37926. t18 += v * b12;
  37927. t19 += v * b13;
  37928. t20 += v * b14;
  37929. t21 += v * b15;
  37930. v = a[7];
  37931. t7 += v * b0;
  37932. t8 += v * b1;
  37933. t9 += v * b2;
  37934. t10 += v * b3;
  37935. t11 += v * b4;
  37936. t12 += v * b5;
  37937. t13 += v * b6;
  37938. t14 += v * b7;
  37939. t15 += v * b8;
  37940. t16 += v * b9;
  37941. t17 += v * b10;
  37942. t18 += v * b11;
  37943. t19 += v * b12;
  37944. t20 += v * b13;
  37945. t21 += v * b14;
  37946. t22 += v * b15;
  37947. v = a[8];
  37948. t8 += v * b0;
  37949. t9 += v * b1;
  37950. t10 += v * b2;
  37951. t11 += v * b3;
  37952. t12 += v * b4;
  37953. t13 += v * b5;
  37954. t14 += v * b6;
  37955. t15 += v * b7;
  37956. t16 += v * b8;
  37957. t17 += v * b9;
  37958. t18 += v * b10;
  37959. t19 += v * b11;
  37960. t20 += v * b12;
  37961. t21 += v * b13;
  37962. t22 += v * b14;
  37963. t23 += v * b15;
  37964. v = a[9];
  37965. t9 += v * b0;
  37966. t10 += v * b1;
  37967. t11 += v * b2;
  37968. t12 += v * b3;
  37969. t13 += v * b4;
  37970. t14 += v * b5;
  37971. t15 += v * b6;
  37972. t16 += v * b7;
  37973. t17 += v * b8;
  37974. t18 += v * b9;
  37975. t19 += v * b10;
  37976. t20 += v * b11;
  37977. t21 += v * b12;
  37978. t22 += v * b13;
  37979. t23 += v * b14;
  37980. t24 += v * b15;
  37981. v = a[10];
  37982. t10 += v * b0;
  37983. t11 += v * b1;
  37984. t12 += v * b2;
  37985. t13 += v * b3;
  37986. t14 += v * b4;
  37987. t15 += v * b5;
  37988. t16 += v * b6;
  37989. t17 += v * b7;
  37990. t18 += v * b8;
  37991. t19 += v * b9;
  37992. t20 += v * b10;
  37993. t21 += v * b11;
  37994. t22 += v * b12;
  37995. t23 += v * b13;
  37996. t24 += v * b14;
  37997. t25 += v * b15;
  37998. v = a[11];
  37999. t11 += v * b0;
  38000. t12 += v * b1;
  38001. t13 += v * b2;
  38002. t14 += v * b3;
  38003. t15 += v * b4;
  38004. t16 += v * b5;
  38005. t17 += v * b6;
  38006. t18 += v * b7;
  38007. t19 += v * b8;
  38008. t20 += v * b9;
  38009. t21 += v * b10;
  38010. t22 += v * b11;
  38011. t23 += v * b12;
  38012. t24 += v * b13;
  38013. t25 += v * b14;
  38014. t26 += v * b15;
  38015. v = a[12];
  38016. t12 += v * b0;
  38017. t13 += v * b1;
  38018. t14 += v * b2;
  38019. t15 += v * b3;
  38020. t16 += v * b4;
  38021. t17 += v * b5;
  38022. t18 += v * b6;
  38023. t19 += v * b7;
  38024. t20 += v * b8;
  38025. t21 += v * b9;
  38026. t22 += v * b10;
  38027. t23 += v * b11;
  38028. t24 += v * b12;
  38029. t25 += v * b13;
  38030. t26 += v * b14;
  38031. t27 += v * b15;
  38032. v = a[13];
  38033. t13 += v * b0;
  38034. t14 += v * b1;
  38035. t15 += v * b2;
  38036. t16 += v * b3;
  38037. t17 += v * b4;
  38038. t18 += v * b5;
  38039. t19 += v * b6;
  38040. t20 += v * b7;
  38041. t21 += v * b8;
  38042. t22 += v * b9;
  38043. t23 += v * b10;
  38044. t24 += v * b11;
  38045. t25 += v * b12;
  38046. t26 += v * b13;
  38047. t27 += v * b14;
  38048. t28 += v * b15;
  38049. v = a[14];
  38050. t14 += v * b0;
  38051. t15 += v * b1;
  38052. t16 += v * b2;
  38053. t17 += v * b3;
  38054. t18 += v * b4;
  38055. t19 += v * b5;
  38056. t20 += v * b6;
  38057. t21 += v * b7;
  38058. t22 += v * b8;
  38059. t23 += v * b9;
  38060. t24 += v * b10;
  38061. t25 += v * b11;
  38062. t26 += v * b12;
  38063. t27 += v * b13;
  38064. t28 += v * b14;
  38065. t29 += v * b15;
  38066. v = a[15];
  38067. t15 += v * b0;
  38068. t16 += v * b1;
  38069. t17 += v * b2;
  38070. t18 += v * b3;
  38071. t19 += v * b4;
  38072. t20 += v * b5;
  38073. t21 += v * b6;
  38074. t22 += v * b7;
  38075. t23 += v * b8;
  38076. t24 += v * b9;
  38077. t25 += v * b10;
  38078. t26 += v * b11;
  38079. t27 += v * b12;
  38080. t28 += v * b13;
  38081. t29 += v * b14;
  38082. t30 += v * b15;
  38083. t0 += 38 * t16;
  38084. t1 += 38 * t17;
  38085. t2 += 38 * t18;
  38086. t3 += 38 * t19;
  38087. t4 += 38 * t20;
  38088. t5 += 38 * t21;
  38089. t6 += 38 * t22;
  38090. t7 += 38 * t23;
  38091. t8 += 38 * t24;
  38092. t9 += 38 * t25;
  38093. t10 += 38 * t26;
  38094. t11 += 38 * t27;
  38095. t12 += 38 * t28;
  38096. t13 += 38 * t29;
  38097. t14 += 38 * t30;
  38098. // t15 left as is
  38099. // first car
  38100. c = 1;
  38101. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38102. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38103. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38104. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38105. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38106. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38107. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38108. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38109. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38110. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38111. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38112. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38113. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38114. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38115. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38116. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38117. t0 += c-1 + 37 * (c-1);
  38118. // second car
  38119. c = 1;
  38120. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38121. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38122. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38123. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38124. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38125. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38126. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38127. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38128. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38129. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38130. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38131. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38132. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38133. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38134. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38135. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38136. t0 += c-1 + 37 * (c-1);
  38137. o[ 0] = t0;
  38138. o[ 1] = t1;
  38139. o[ 2] = t2;
  38140. o[ 3] = t3;
  38141. o[ 4] = t4;
  38142. o[ 5] = t5;
  38143. o[ 6] = t6;
  38144. o[ 7] = t7;
  38145. o[ 8] = t8;
  38146. o[ 9] = t9;
  38147. o[10] = t10;
  38148. o[11] = t11;
  38149. o[12] = t12;
  38150. o[13] = t13;
  38151. o[14] = t14;
  38152. o[15] = t15;
  38153. }
  38154. function S(o, a) {
  38155. M(o, a, a);
  38156. }
  38157. function inv25519(o, i) {
  38158. var c = gf();
  38159. var a;
  38160. for (a = 0; a < 16; a++) c[a] = i[a];
  38161. for (a = 253; a >= 0; a--) {
  38162. S(c, c);
  38163. if(a !== 2 && a !== 4) M(c, c, i);
  38164. }
  38165. for (a = 0; a < 16; a++) o[a] = c[a];
  38166. }
  38167. function pow2523(o, i) {
  38168. var c = gf();
  38169. var a;
  38170. for (a = 0; a < 16; a++) c[a] = i[a];
  38171. for (a = 250; a >= 0; a--) {
  38172. S(c, c);
  38173. if(a !== 1) M(c, c, i);
  38174. }
  38175. for (a = 0; a < 16; a++) o[a] = c[a];
  38176. }
  38177. function crypto_scalarmult(q, n, p) {
  38178. var z = new Uint8Array(32);
  38179. var x = new Float64Array(80), r, i;
  38180. var a = gf(), b = gf(), c = gf(),
  38181. d = gf(), e = gf(), f = gf();
  38182. for (i = 0; i < 31; i++) z[i] = n[i];
  38183. z[31]=(n[31]&127)|64;
  38184. z[0]&=248;
  38185. unpack25519(x,p);
  38186. for (i = 0; i < 16; i++) {
  38187. b[i]=x[i];
  38188. d[i]=a[i]=c[i]=0;
  38189. }
  38190. a[0]=d[0]=1;
  38191. for (i=254; i>=0; --i) {
  38192. r=(z[i>>>3]>>>(i&7))&1;
  38193. sel25519(a,b,r);
  38194. sel25519(c,d,r);
  38195. A(e,a,c);
  38196. Z(a,a,c);
  38197. A(c,b,d);
  38198. Z(b,b,d);
  38199. S(d,e);
  38200. S(f,a);
  38201. M(a,c,a);
  38202. M(c,b,e);
  38203. A(e,a,c);
  38204. Z(a,a,c);
  38205. S(b,a);
  38206. Z(c,d,f);
  38207. M(a,c,_121665);
  38208. A(a,a,d);
  38209. M(c,c,a);
  38210. M(a,d,f);
  38211. M(d,b,x);
  38212. S(b,e);
  38213. sel25519(a,b,r);
  38214. sel25519(c,d,r);
  38215. }
  38216. for (i = 0; i < 16; i++) {
  38217. x[i+16]=a[i];
  38218. x[i+32]=c[i];
  38219. x[i+48]=b[i];
  38220. x[i+64]=d[i];
  38221. }
  38222. var x32 = x.subarray(32);
  38223. var x16 = x.subarray(16);
  38224. inv25519(x32,x32);
  38225. M(x16,x16,x32);
  38226. pack25519(q,x16);
  38227. return 0;
  38228. }
  38229. function crypto_scalarmult_base(q, n) {
  38230. return crypto_scalarmult(q, n, _9);
  38231. }
  38232. function crypto_box_keypair(y, x) {
  38233. randombytes(x, 32);
  38234. return crypto_scalarmult_base(y, x);
  38235. }
  38236. function crypto_box_beforenm(k, y, x) {
  38237. var s = new Uint8Array(32);
  38238. crypto_scalarmult(s, x, y);
  38239. return crypto_core_hsalsa20(k, _0, s, sigma);
  38240. }
  38241. var crypto_box_afternm = crypto_secretbox;
  38242. var crypto_box_open_afternm = crypto_secretbox_open;
  38243. function crypto_box(c, m, d, n, y, x) {
  38244. var k = new Uint8Array(32);
  38245. crypto_box_beforenm(k, y, x);
  38246. return crypto_box_afternm(c, m, d, n, k);
  38247. }
  38248. function crypto_box_open(m, c, d, n, y, x) {
  38249. var k = new Uint8Array(32);
  38250. crypto_box_beforenm(k, y, x);
  38251. return crypto_box_open_afternm(m, c, d, n, k);
  38252. }
  38253. var K = [
  38254. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38255. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38256. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38257. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38258. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38259. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38260. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38261. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38262. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38263. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38264. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38265. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38266. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38267. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38268. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38269. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38270. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38271. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38272. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38273. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38274. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38275. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38276. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38277. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38278. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38279. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38280. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38281. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38282. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38283. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38284. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38285. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38286. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38287. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38288. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38289. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38290. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38291. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38292. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38293. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38294. ];
  38295. function crypto_hashblocks_hl(hh, hl, m, n) {
  38296. var wh = new Int32Array(16), wl = new Int32Array(16),
  38297. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38298. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38299. th, tl, i, j, h, l, a, b, c, d;
  38300. var ah0 = hh[0],
  38301. ah1 = hh[1],
  38302. ah2 = hh[2],
  38303. ah3 = hh[3],
  38304. ah4 = hh[4],
  38305. ah5 = hh[5],
  38306. ah6 = hh[6],
  38307. ah7 = hh[7],
  38308. al0 = hl[0],
  38309. al1 = hl[1],
  38310. al2 = hl[2],
  38311. al3 = hl[3],
  38312. al4 = hl[4],
  38313. al5 = hl[5],
  38314. al6 = hl[6],
  38315. al7 = hl[7];
  38316. var pos = 0;
  38317. while (n >= 128) {
  38318. for (i = 0; i < 16; i++) {
  38319. j = 8 * i + pos;
  38320. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38321. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38322. }
  38323. for (i = 0; i < 80; i++) {
  38324. bh0 = ah0;
  38325. bh1 = ah1;
  38326. bh2 = ah2;
  38327. bh3 = ah3;
  38328. bh4 = ah4;
  38329. bh5 = ah5;
  38330. bh6 = ah6;
  38331. bh7 = ah7;
  38332. bl0 = al0;
  38333. bl1 = al1;
  38334. bl2 = al2;
  38335. bl3 = al3;
  38336. bl4 = al4;
  38337. bl5 = al5;
  38338. bl6 = al6;
  38339. bl7 = al7;
  38340. // add
  38341. h = ah7;
  38342. l = al7;
  38343. a = l & 0xffff; b = l >>> 16;
  38344. c = h & 0xffff; d = h >>> 16;
  38345. // Sigma1
  38346. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38347. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38348. a += l & 0xffff; b += l >>> 16;
  38349. c += h & 0xffff; d += h >>> 16;
  38350. // Ch
  38351. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38352. l = (al4 & al5) ^ (~al4 & al6);
  38353. a += l & 0xffff; b += l >>> 16;
  38354. c += h & 0xffff; d += h >>> 16;
  38355. // K
  38356. h = K[i*2];
  38357. l = K[i*2+1];
  38358. a += l & 0xffff; b += l >>> 16;
  38359. c += h & 0xffff; d += h >>> 16;
  38360. // w
  38361. h = wh[i%16];
  38362. l = wl[i%16];
  38363. a += l & 0xffff; b += l >>> 16;
  38364. c += h & 0xffff; d += h >>> 16;
  38365. b += a >>> 16;
  38366. c += b >>> 16;
  38367. d += c >>> 16;
  38368. th = c & 0xffff | d << 16;
  38369. tl = a & 0xffff | b << 16;
  38370. // add
  38371. h = th;
  38372. l = tl;
  38373. a = l & 0xffff; b = l >>> 16;
  38374. c = h & 0xffff; d = h >>> 16;
  38375. // Sigma0
  38376. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38377. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38378. a += l & 0xffff; b += l >>> 16;
  38379. c += h & 0xffff; d += h >>> 16;
  38380. // Maj
  38381. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38382. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38383. a += l & 0xffff; b += l >>> 16;
  38384. c += h & 0xffff; d += h >>> 16;
  38385. b += a >>> 16;
  38386. c += b >>> 16;
  38387. d += c >>> 16;
  38388. bh7 = (c & 0xffff) | (d << 16);
  38389. bl7 = (a & 0xffff) | (b << 16);
  38390. // add
  38391. h = bh3;
  38392. l = bl3;
  38393. a = l & 0xffff; b = l >>> 16;
  38394. c = h & 0xffff; d = h >>> 16;
  38395. h = th;
  38396. l = tl;
  38397. a += l & 0xffff; b += l >>> 16;
  38398. c += h & 0xffff; d += h >>> 16;
  38399. b += a >>> 16;
  38400. c += b >>> 16;
  38401. d += c >>> 16;
  38402. bh3 = (c & 0xffff) | (d << 16);
  38403. bl3 = (a & 0xffff) | (b << 16);
  38404. ah1 = bh0;
  38405. ah2 = bh1;
  38406. ah3 = bh2;
  38407. ah4 = bh3;
  38408. ah5 = bh4;
  38409. ah6 = bh5;
  38410. ah7 = bh6;
  38411. ah0 = bh7;
  38412. al1 = bl0;
  38413. al2 = bl1;
  38414. al3 = bl2;
  38415. al4 = bl3;
  38416. al5 = bl4;
  38417. al6 = bl5;
  38418. al7 = bl6;
  38419. al0 = bl7;
  38420. if (i%16 === 15) {
  38421. for (j = 0; j < 16; j++) {
  38422. // add
  38423. h = wh[j];
  38424. l = wl[j];
  38425. a = l & 0xffff; b = l >>> 16;
  38426. c = h & 0xffff; d = h >>> 16;
  38427. h = wh[(j+9)%16];
  38428. l = wl[(j+9)%16];
  38429. a += l & 0xffff; b += l >>> 16;
  38430. c += h & 0xffff; d += h >>> 16;
  38431. // sigma0
  38432. th = wh[(j+1)%16];
  38433. tl = wl[(j+1)%16];
  38434. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38435. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38436. a += l & 0xffff; b += l >>> 16;
  38437. c += h & 0xffff; d += h >>> 16;
  38438. // sigma1
  38439. th = wh[(j+14)%16];
  38440. tl = wl[(j+14)%16];
  38441. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38442. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38443. a += l & 0xffff; b += l >>> 16;
  38444. c += h & 0xffff; d += h >>> 16;
  38445. b += a >>> 16;
  38446. c += b >>> 16;
  38447. d += c >>> 16;
  38448. wh[j] = (c & 0xffff) | (d << 16);
  38449. wl[j] = (a & 0xffff) | (b << 16);
  38450. }
  38451. }
  38452. }
  38453. // add
  38454. h = ah0;
  38455. l = al0;
  38456. a = l & 0xffff; b = l >>> 16;
  38457. c = h & 0xffff; d = h >>> 16;
  38458. h = hh[0];
  38459. l = hl[0];
  38460. a += l & 0xffff; b += l >>> 16;
  38461. c += h & 0xffff; d += h >>> 16;
  38462. b += a >>> 16;
  38463. c += b >>> 16;
  38464. d += c >>> 16;
  38465. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38466. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38467. h = ah1;
  38468. l = al1;
  38469. a = l & 0xffff; b = l >>> 16;
  38470. c = h & 0xffff; d = h >>> 16;
  38471. h = hh[1];
  38472. l = hl[1];
  38473. a += l & 0xffff; b += l >>> 16;
  38474. c += h & 0xffff; d += h >>> 16;
  38475. b += a >>> 16;
  38476. c += b >>> 16;
  38477. d += c >>> 16;
  38478. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38479. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38480. h = ah2;
  38481. l = al2;
  38482. a = l & 0xffff; b = l >>> 16;
  38483. c = h & 0xffff; d = h >>> 16;
  38484. h = hh[2];
  38485. l = hl[2];
  38486. a += l & 0xffff; b += l >>> 16;
  38487. c += h & 0xffff; d += h >>> 16;
  38488. b += a >>> 16;
  38489. c += b >>> 16;
  38490. d += c >>> 16;
  38491. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38492. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38493. h = ah3;
  38494. l = al3;
  38495. a = l & 0xffff; b = l >>> 16;
  38496. c = h & 0xffff; d = h >>> 16;
  38497. h = hh[3];
  38498. l = hl[3];
  38499. a += l & 0xffff; b += l >>> 16;
  38500. c += h & 0xffff; d += h >>> 16;
  38501. b += a >>> 16;
  38502. c += b >>> 16;
  38503. d += c >>> 16;
  38504. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38505. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38506. h = ah4;
  38507. l = al4;
  38508. a = l & 0xffff; b = l >>> 16;
  38509. c = h & 0xffff; d = h >>> 16;
  38510. h = hh[4];
  38511. l = hl[4];
  38512. a += l & 0xffff; b += l >>> 16;
  38513. c += h & 0xffff; d += h >>> 16;
  38514. b += a >>> 16;
  38515. c += b >>> 16;
  38516. d += c >>> 16;
  38517. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38518. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38519. h = ah5;
  38520. l = al5;
  38521. a = l & 0xffff; b = l >>> 16;
  38522. c = h & 0xffff; d = h >>> 16;
  38523. h = hh[5];
  38524. l = hl[5];
  38525. a += l & 0xffff; b += l >>> 16;
  38526. c += h & 0xffff; d += h >>> 16;
  38527. b += a >>> 16;
  38528. c += b >>> 16;
  38529. d += c >>> 16;
  38530. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38531. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38532. h = ah6;
  38533. l = al6;
  38534. a = l & 0xffff; b = l >>> 16;
  38535. c = h & 0xffff; d = h >>> 16;
  38536. h = hh[6];
  38537. l = hl[6];
  38538. a += l & 0xffff; b += l >>> 16;
  38539. c += h & 0xffff; d += h >>> 16;
  38540. b += a >>> 16;
  38541. c += b >>> 16;
  38542. d += c >>> 16;
  38543. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38544. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38545. h = ah7;
  38546. l = al7;
  38547. a = l & 0xffff; b = l >>> 16;
  38548. c = h & 0xffff; d = h >>> 16;
  38549. h = hh[7];
  38550. l = hl[7];
  38551. a += l & 0xffff; b += l >>> 16;
  38552. c += h & 0xffff; d += h >>> 16;
  38553. b += a >>> 16;
  38554. c += b >>> 16;
  38555. d += c >>> 16;
  38556. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38557. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38558. pos += 128;
  38559. n -= 128;
  38560. }
  38561. return n;
  38562. }
  38563. function crypto_hash(out, m, n) {
  38564. var hh = new Int32Array(8),
  38565. hl = new Int32Array(8),
  38566. x = new Uint8Array(256),
  38567. i, b = n;
  38568. hh[0] = 0x6a09e667;
  38569. hh[1] = 0xbb67ae85;
  38570. hh[2] = 0x3c6ef372;
  38571. hh[3] = 0xa54ff53a;
  38572. hh[4] = 0x510e527f;
  38573. hh[5] = 0x9b05688c;
  38574. hh[6] = 0x1f83d9ab;
  38575. hh[7] = 0x5be0cd19;
  38576. hl[0] = 0xf3bcc908;
  38577. hl[1] = 0x84caa73b;
  38578. hl[2] = 0xfe94f82b;
  38579. hl[3] = 0x5f1d36f1;
  38580. hl[4] = 0xade682d1;
  38581. hl[5] = 0x2b3e6c1f;
  38582. hl[6] = 0xfb41bd6b;
  38583. hl[7] = 0x137e2179;
  38584. crypto_hashblocks_hl(hh, hl, m, n);
  38585. n %= 128;
  38586. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38587. x[n] = 128;
  38588. n = 256-128*(n<112?1:0);
  38589. x[n-9] = 0;
  38590. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38591. crypto_hashblocks_hl(hh, hl, x, n);
  38592. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38593. return 0;
  38594. }
  38595. function add(p, q) {
  38596. var a = gf(), b = gf(), c = gf(),
  38597. d = gf(), e = gf(), f = gf(),
  38598. g = gf(), h = gf(), t = gf();
  38599. Z(a, p[1], p[0]);
  38600. Z(t, q[1], q[0]);
  38601. M(a, a, t);
  38602. A(b, p[0], p[1]);
  38603. A(t, q[0], q[1]);
  38604. M(b, b, t);
  38605. M(c, p[3], q[3]);
  38606. M(c, c, D2);
  38607. M(d, p[2], q[2]);
  38608. A(d, d, d);
  38609. Z(e, b, a);
  38610. Z(f, d, c);
  38611. A(g, d, c);
  38612. A(h, b, a);
  38613. M(p[0], e, f);
  38614. M(p[1], h, g);
  38615. M(p[2], g, f);
  38616. M(p[3], e, h);
  38617. }
  38618. function cswap(p, q, b) {
  38619. var i;
  38620. for (i = 0; i < 4; i++) {
  38621. sel25519(p[i], q[i], b);
  38622. }
  38623. }
  38624. function pack(r, p) {
  38625. var tx = gf(), ty = gf(), zi = gf();
  38626. inv25519(zi, p[2]);
  38627. M(tx, p[0], zi);
  38628. M(ty, p[1], zi);
  38629. pack25519(r, ty);
  38630. r[31] ^= par25519(tx) << 7;
  38631. }
  38632. function scalarmult(p, q, s) {
  38633. var b, i;
  38634. set25519(p[0], gf0);
  38635. set25519(p[1], gf1);
  38636. set25519(p[2], gf1);
  38637. set25519(p[3], gf0);
  38638. for (i = 255; i >= 0; --i) {
  38639. b = (s[(i/8)|0] >> (i&7)) & 1;
  38640. cswap(p, q, b);
  38641. add(q, p);
  38642. add(p, p);
  38643. cswap(p, q, b);
  38644. }
  38645. }
  38646. function scalarbase(p, s) {
  38647. var q = [gf(), gf(), gf(), gf()];
  38648. set25519(q[0], X);
  38649. set25519(q[1], Y);
  38650. set25519(q[2], gf1);
  38651. M(q[3], X, Y);
  38652. scalarmult(p, q, s);
  38653. }
  38654. function crypto_sign_keypair(pk, sk, seeded) {
  38655. var d = new Uint8Array(64);
  38656. var p = [gf(), gf(), gf(), gf()];
  38657. var i;
  38658. if (!seeded) randombytes(sk, 32);
  38659. crypto_hash(d, sk, 32);
  38660. d[0] &= 248;
  38661. d[31] &= 127;
  38662. d[31] |= 64;
  38663. scalarbase(p, d);
  38664. pack(pk, p);
  38665. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38666. return 0;
  38667. }
  38668. 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]);
  38669. function modL(r, x) {
  38670. var carry, i, j, k;
  38671. for (i = 63; i >= 32; --i) {
  38672. carry = 0;
  38673. for (j = i - 32, k = i - 12; j < k; ++j) {
  38674. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38675. carry = (x[j] + 128) >> 8;
  38676. x[j] -= carry * 256;
  38677. }
  38678. x[j] += carry;
  38679. x[i] = 0;
  38680. }
  38681. carry = 0;
  38682. for (j = 0; j < 32; j++) {
  38683. x[j] += carry - (x[31] >> 4) * L[j];
  38684. carry = x[j] >> 8;
  38685. x[j] &= 255;
  38686. }
  38687. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38688. for (i = 0; i < 32; i++) {
  38689. x[i+1] += x[i] >> 8;
  38690. r[i] = x[i] & 255;
  38691. }
  38692. }
  38693. function reduce(r) {
  38694. var x = new Float64Array(64), i;
  38695. for (i = 0; i < 64; i++) x[i] = r[i];
  38696. for (i = 0; i < 64; i++) r[i] = 0;
  38697. modL(r, x);
  38698. }
  38699. // Note: difference from C - smlen returned, not passed as argument.
  38700. function crypto_sign(sm, m, n, sk) {
  38701. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38702. var i, j, x = new Float64Array(64);
  38703. var p = [gf(), gf(), gf(), gf()];
  38704. crypto_hash(d, sk, 32);
  38705. d[0] &= 248;
  38706. d[31] &= 127;
  38707. d[31] |= 64;
  38708. var smlen = n + 64;
  38709. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38710. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38711. crypto_hash(r, sm.subarray(32), n+32);
  38712. reduce(r);
  38713. scalarbase(p, r);
  38714. pack(sm, p);
  38715. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38716. crypto_hash(h, sm, n + 64);
  38717. reduce(h);
  38718. for (i = 0; i < 64; i++) x[i] = 0;
  38719. for (i = 0; i < 32; i++) x[i] = r[i];
  38720. for (i = 0; i < 32; i++) {
  38721. for (j = 0; j < 32; j++) {
  38722. x[i+j] += h[i] * d[j];
  38723. }
  38724. }
  38725. modL(sm.subarray(32), x);
  38726. return smlen;
  38727. }
  38728. function unpackneg(r, p) {
  38729. var t = gf(), chk = gf(), num = gf(),
  38730. den = gf(), den2 = gf(), den4 = gf(),
  38731. den6 = gf();
  38732. set25519(r[2], gf1);
  38733. unpack25519(r[1], p);
  38734. S(num, r[1]);
  38735. M(den, num, D);
  38736. Z(num, num, r[2]);
  38737. A(den, r[2], den);
  38738. S(den2, den);
  38739. S(den4, den2);
  38740. M(den6, den4, den2);
  38741. M(t, den6, num);
  38742. M(t, t, den);
  38743. pow2523(t, t);
  38744. M(t, t, num);
  38745. M(t, t, den);
  38746. M(t, t, den);
  38747. M(r[0], t, den);
  38748. S(chk, r[0]);
  38749. M(chk, chk, den);
  38750. if (neq25519(chk, num)) M(r[0], r[0], I);
  38751. S(chk, r[0]);
  38752. M(chk, chk, den);
  38753. if (neq25519(chk, num)) return -1;
  38754. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38755. M(r[3], r[0], r[1]);
  38756. return 0;
  38757. }
  38758. function crypto_sign_open(m, sm, n, pk) {
  38759. var i, mlen;
  38760. var t = new Uint8Array(32), h = new Uint8Array(64);
  38761. var p = [gf(), gf(), gf(), gf()],
  38762. q = [gf(), gf(), gf(), gf()];
  38763. mlen = -1;
  38764. if (n < 64) return -1;
  38765. if (unpackneg(q, pk)) return -1;
  38766. for (i = 0; i < n; i++) m[i] = sm[i];
  38767. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38768. crypto_hash(h, m, n);
  38769. reduce(h);
  38770. scalarmult(p, q, h);
  38771. scalarbase(q, sm.subarray(32));
  38772. add(p, q);
  38773. pack(t, p);
  38774. n -= 64;
  38775. if (crypto_verify_32(sm, 0, t, 0)) {
  38776. for (i = 0; i < n; i++) m[i] = 0;
  38777. return -1;
  38778. }
  38779. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38780. mlen = n;
  38781. return mlen;
  38782. }
  38783. var crypto_secretbox_KEYBYTES = 32,
  38784. crypto_secretbox_NONCEBYTES = 24,
  38785. crypto_secretbox_ZEROBYTES = 32,
  38786. crypto_secretbox_BOXZEROBYTES = 16,
  38787. crypto_scalarmult_BYTES = 32,
  38788. crypto_scalarmult_SCALARBYTES = 32,
  38789. crypto_box_PUBLICKEYBYTES = 32,
  38790. crypto_box_SECRETKEYBYTES = 32,
  38791. crypto_box_BEFORENMBYTES = 32,
  38792. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38793. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38794. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38795. crypto_sign_BYTES = 64,
  38796. crypto_sign_PUBLICKEYBYTES = 32,
  38797. crypto_sign_SECRETKEYBYTES = 64,
  38798. crypto_sign_SEEDBYTES = 32,
  38799. crypto_hash_BYTES = 64;
  38800. nacl.lowlevel = {
  38801. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38802. crypto_stream_xor: crypto_stream_xor,
  38803. crypto_stream: crypto_stream,
  38804. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38805. crypto_stream_salsa20: crypto_stream_salsa20,
  38806. crypto_onetimeauth: crypto_onetimeauth,
  38807. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38808. crypto_verify_16: crypto_verify_16,
  38809. crypto_verify_32: crypto_verify_32,
  38810. crypto_secretbox: crypto_secretbox,
  38811. crypto_secretbox_open: crypto_secretbox_open,
  38812. crypto_scalarmult: crypto_scalarmult,
  38813. crypto_scalarmult_base: crypto_scalarmult_base,
  38814. crypto_box_beforenm: crypto_box_beforenm,
  38815. crypto_box_afternm: crypto_box_afternm,
  38816. crypto_box: crypto_box,
  38817. crypto_box_open: crypto_box_open,
  38818. crypto_box_keypair: crypto_box_keypair,
  38819. crypto_hash: crypto_hash,
  38820. crypto_sign: crypto_sign,
  38821. crypto_sign_keypair: crypto_sign_keypair,
  38822. crypto_sign_open: crypto_sign_open,
  38823. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38824. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38825. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38826. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38827. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38828. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38829. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38830. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38831. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38832. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38833. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38834. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38835. crypto_sign_BYTES: crypto_sign_BYTES,
  38836. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38837. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38838. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38839. crypto_hash_BYTES: crypto_hash_BYTES
  38840. };
  38841. /* High-level API */
  38842. function checkLengths(k, n) {
  38843. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38844. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38845. }
  38846. function checkBoxLengths(pk, sk) {
  38847. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38848. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38849. }
  38850. function checkArrayTypes() {
  38851. for (var i = 0; i < arguments.length; i++) {
  38852. if (!(arguments[i] instanceof Uint8Array))
  38853. throw new TypeError('unexpected type, use Uint8Array');
  38854. }
  38855. }
  38856. function cleanup(arr) {
  38857. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38858. }
  38859. nacl.randomBytes = function(n) {
  38860. var b = new Uint8Array(n);
  38861. randombytes(b, n);
  38862. return b;
  38863. };
  38864. nacl.secretbox = function(msg, nonce, key) {
  38865. checkArrayTypes(msg, nonce, key);
  38866. checkLengths(key, nonce);
  38867. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38868. var c = new Uint8Array(m.length);
  38869. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38870. crypto_secretbox(c, m, m.length, nonce, key);
  38871. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38872. };
  38873. nacl.secretbox.open = function(box, nonce, key) {
  38874. checkArrayTypes(box, nonce, key);
  38875. checkLengths(key, nonce);
  38876. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38877. var m = new Uint8Array(c.length);
  38878. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38879. if (c.length < 32) return null;
  38880. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38881. return m.subarray(crypto_secretbox_ZEROBYTES);
  38882. };
  38883. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38884. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38885. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38886. nacl.scalarMult = function(n, p) {
  38887. checkArrayTypes(n, p);
  38888. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38889. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38890. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38891. crypto_scalarmult(q, n, p);
  38892. return q;
  38893. };
  38894. nacl.scalarMult.base = function(n) {
  38895. checkArrayTypes(n);
  38896. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38897. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38898. crypto_scalarmult_base(q, n);
  38899. return q;
  38900. };
  38901. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38902. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38903. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38904. var k = nacl.box.before(publicKey, secretKey);
  38905. return nacl.secretbox(msg, nonce, k);
  38906. };
  38907. nacl.box.before = function(publicKey, secretKey) {
  38908. checkArrayTypes(publicKey, secretKey);
  38909. checkBoxLengths(publicKey, secretKey);
  38910. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38911. crypto_box_beforenm(k, publicKey, secretKey);
  38912. return k;
  38913. };
  38914. nacl.box.after = nacl.secretbox;
  38915. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38916. var k = nacl.box.before(publicKey, secretKey);
  38917. return nacl.secretbox.open(msg, nonce, k);
  38918. };
  38919. nacl.box.open.after = nacl.secretbox.open;
  38920. nacl.box.keyPair = function() {
  38921. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38922. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38923. crypto_box_keypair(pk, sk);
  38924. return {publicKey: pk, secretKey: sk};
  38925. };
  38926. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38927. checkArrayTypes(secretKey);
  38928. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38929. throw new Error('bad secret key size');
  38930. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38931. crypto_scalarmult_base(pk, secretKey);
  38932. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38933. };
  38934. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38935. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38936. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38937. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38938. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38939. nacl.sign = function(msg, secretKey) {
  38940. checkArrayTypes(msg, secretKey);
  38941. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38942. throw new Error('bad secret key size');
  38943. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38944. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38945. return signedMsg;
  38946. };
  38947. nacl.sign.open = function(signedMsg, publicKey) {
  38948. checkArrayTypes(signedMsg, publicKey);
  38949. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38950. throw new Error('bad public key size');
  38951. var tmp = new Uint8Array(signedMsg.length);
  38952. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38953. if (mlen < 0) return null;
  38954. var m = new Uint8Array(mlen);
  38955. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38956. return m;
  38957. };
  38958. nacl.sign.detached = function(msg, secretKey) {
  38959. var signedMsg = nacl.sign(msg, secretKey);
  38960. var sig = new Uint8Array(crypto_sign_BYTES);
  38961. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38962. return sig;
  38963. };
  38964. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38965. checkArrayTypes(msg, sig, publicKey);
  38966. if (sig.length !== crypto_sign_BYTES)
  38967. throw new Error('bad signature size');
  38968. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38969. throw new Error('bad public key size');
  38970. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38971. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38972. var i;
  38973. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38974. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38975. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38976. };
  38977. nacl.sign.keyPair = function() {
  38978. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38979. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38980. crypto_sign_keypair(pk, sk);
  38981. return {publicKey: pk, secretKey: sk};
  38982. };
  38983. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38984. checkArrayTypes(secretKey);
  38985. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38986. throw new Error('bad secret key size');
  38987. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38988. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38989. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38990. };
  38991. nacl.sign.keyPair.fromSeed = function(seed) {
  38992. checkArrayTypes(seed);
  38993. if (seed.length !== crypto_sign_SEEDBYTES)
  38994. throw new Error('bad seed size');
  38995. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38996. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38997. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38998. crypto_sign_keypair(pk, sk, true);
  38999. return {publicKey: pk, secretKey: sk};
  39000. };
  39001. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39002. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39003. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39004. nacl.sign.signatureLength = crypto_sign_BYTES;
  39005. nacl.hash = function(msg) {
  39006. checkArrayTypes(msg);
  39007. var h = new Uint8Array(crypto_hash_BYTES);
  39008. crypto_hash(h, msg, msg.length);
  39009. return h;
  39010. };
  39011. nacl.hash.hashLength = crypto_hash_BYTES;
  39012. nacl.verify = function(x, y) {
  39013. checkArrayTypes(x, y);
  39014. // Zero length arguments are considered not equal.
  39015. if (x.length === 0 || y.length === 0) return false;
  39016. if (x.length !== y.length) return false;
  39017. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39018. };
  39019. nacl.setPRNG = function(fn) {
  39020. randombytes = fn;
  39021. };
  39022. (function() {
  39023. // Initialize PRNG if environment provides CSPRNG.
  39024. // If not, methods calling randombytes will throw.
  39025. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39026. if (crypto && crypto.getRandomValues) {
  39027. // Browsers.
  39028. var QUOTA = 65536;
  39029. nacl.setPRNG(function(x, n) {
  39030. var i, v = new Uint8Array(n);
  39031. for (i = 0; i < n; i += QUOTA) {
  39032. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39033. }
  39034. for (i = 0; i < n; i++) x[i] = v[i];
  39035. cleanup(v);
  39036. });
  39037. } else if (true) {
  39038. // Node.js.
  39039. crypto = __webpack_require__(3);
  39040. if (crypto && crypto.randomBytes) {
  39041. nacl.setPRNG(function(x, n) {
  39042. var i, v = crypto.randomBytes(n);
  39043. for (i = 0; i < n; i++) x[i] = v[i];
  39044. cleanup(v);
  39045. });
  39046. }
  39047. }
  39048. })();
  39049. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39050. /***/ }),
  39051. /* 1 */
  39052. /***/ (function(module, exports, __webpack_require__) {
  39053. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39054. // Public domain.
  39055. (function(root, f) {
  39056. 'use strict';
  39057. if ( true && module.exports) module.exports = f();
  39058. else if (root.nacl) root.nacl.util = f();
  39059. else {
  39060. root.nacl = {};
  39061. root.nacl.util = f();
  39062. }
  39063. }(this, function() {
  39064. 'use strict';
  39065. var util = {};
  39066. function validateBase64(s) {
  39067. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39068. throw new TypeError('invalid encoding');
  39069. }
  39070. }
  39071. util.decodeUTF8 = function(s) {
  39072. if (typeof s !== 'string') throw new TypeError('expected string');
  39073. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39074. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39075. return b;
  39076. };
  39077. util.encodeUTF8 = function(arr) {
  39078. var i, s = [];
  39079. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39080. return decodeURIComponent(escape(s.join('')));
  39081. };
  39082. if (typeof atob === 'undefined') {
  39083. // Node.js
  39084. if (typeof Buffer.from !== 'undefined') {
  39085. // Node v6 and later
  39086. util.encodeBase64 = function (arr) { // v6 and later
  39087. return Buffer.from(arr).toString('base64');
  39088. };
  39089. util.decodeBase64 = function (s) {
  39090. validateBase64(s);
  39091. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39092. };
  39093. } else {
  39094. // Node earlier than v6
  39095. util.encodeBase64 = function (arr) { // v6 and later
  39096. return (new Buffer(arr)).toString('base64');
  39097. };
  39098. util.decodeBase64 = function(s) {
  39099. validateBase64(s);
  39100. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39101. };
  39102. }
  39103. } else {
  39104. // Browsers
  39105. util.encodeBase64 = function(arr) {
  39106. var i, s = [], len = arr.length;
  39107. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39108. return btoa(s.join(''));
  39109. };
  39110. util.decodeBase64 = function(s) {
  39111. validateBase64(s);
  39112. var i, d = atob(s), b = new Uint8Array(d.length);
  39113. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39114. return b;
  39115. };
  39116. }
  39117. return util;
  39118. }));
  39119. /***/ }),
  39120. /* 2 */
  39121. /***/ (function(module, exports, __webpack_require__) {
  39122. // required so we don't have to do require('pusher').default etc.
  39123. module.exports = __webpack_require__(4).default;
  39124. /***/ }),
  39125. /* 3 */
  39126. /***/ (function(module, exports) {
  39127. /* (ignored) */
  39128. /***/ }),
  39129. /* 4 */
  39130. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39131. "use strict";
  39132. __webpack_require__.r(__webpack_exports__);
  39133. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39134. var ScriptReceiverFactory = (function () {
  39135. function ScriptReceiverFactory(prefix, name) {
  39136. this.lastId = 0;
  39137. this.prefix = prefix;
  39138. this.name = name;
  39139. }
  39140. ScriptReceiverFactory.prototype.create = function (callback) {
  39141. this.lastId++;
  39142. var number = this.lastId;
  39143. var id = this.prefix + number;
  39144. var name = this.name + "[" + number + "]";
  39145. var called = false;
  39146. var callbackWrapper = function () {
  39147. if (!called) {
  39148. callback.apply(null, arguments);
  39149. called = true;
  39150. }
  39151. };
  39152. this[number] = callbackWrapper;
  39153. return { number: number, id: id, name: name, callback: callbackWrapper };
  39154. };
  39155. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39156. delete this[receiver.number];
  39157. };
  39158. return ScriptReceiverFactory;
  39159. }());
  39160. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39161. // CONCATENATED MODULE: ./src/core/defaults.ts
  39162. var Defaults = {
  39163. VERSION: "5.0.3",
  39164. PROTOCOL: 7,
  39165. host: 'ws.pusherapp.com',
  39166. ws_port: 80,
  39167. wss_port: 443,
  39168. ws_path: '',
  39169. sockjs_host: 'sockjs.pusher.com',
  39170. sockjs_http_port: 80,
  39171. sockjs_https_port: 443,
  39172. sockjs_path: '/pusher',
  39173. stats_host: 'stats.pusher.com',
  39174. channel_auth_endpoint: '/pusher/auth',
  39175. channel_auth_transport: 'ajax',
  39176. activity_timeout: 120000,
  39177. pong_timeout: 30000,
  39178. unavailable_timeout: 10000,
  39179. cdn_http: "http://js.pusher.com",
  39180. cdn_https: "https://js.pusher.com",
  39181. dependency_suffix: ""
  39182. };
  39183. /* harmony default export */ var defaults = (Defaults);
  39184. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39185. var dependency_loader_DependencyLoader = (function () {
  39186. function DependencyLoader(options) {
  39187. this.options = options;
  39188. this.receivers = options.receivers || ScriptReceivers;
  39189. this.loading = {};
  39190. }
  39191. DependencyLoader.prototype.load = function (name, options, callback) {
  39192. var self = this;
  39193. if (self.loading[name] && self.loading[name].length > 0) {
  39194. self.loading[name].push(callback);
  39195. }
  39196. else {
  39197. self.loading[name] = [callback];
  39198. var request = runtime.createScriptRequest(self.getPath(name, options));
  39199. var receiver = self.receivers.create(function (error) {
  39200. self.receivers.remove(receiver);
  39201. if (self.loading[name]) {
  39202. var callbacks = self.loading[name];
  39203. delete self.loading[name];
  39204. var successCallback = function (wasSuccessful) {
  39205. if (!wasSuccessful) {
  39206. request.cleanup();
  39207. }
  39208. };
  39209. for (var i = 0; i < callbacks.length; i++) {
  39210. callbacks[i](error, successCallback);
  39211. }
  39212. }
  39213. });
  39214. request.send(receiver);
  39215. }
  39216. };
  39217. DependencyLoader.prototype.getRoot = function (options) {
  39218. var cdn;
  39219. var protocol = runtime.getDocument().location.protocol;
  39220. if ((options && options.useTLS) || protocol === "https:") {
  39221. cdn = this.options.cdn_https;
  39222. }
  39223. else {
  39224. cdn = this.options.cdn_http;
  39225. }
  39226. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39227. };
  39228. DependencyLoader.prototype.getPath = function (name, options) {
  39229. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39230. };
  39231. ;
  39232. return DependencyLoader;
  39233. }());
  39234. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39235. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39236. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39237. var Dependencies = new dependency_loader({
  39238. cdn_http: defaults.cdn_http,
  39239. cdn_https: defaults.cdn_https,
  39240. version: defaults.VERSION,
  39241. suffix: defaults.dependency_suffix,
  39242. receivers: DependenciesReceivers
  39243. });
  39244. // CONCATENATED MODULE: ./src/core/base64.ts
  39245. function encode(s) {
  39246. return btoa(utob(s));
  39247. }
  39248. var fromCharCode = String.fromCharCode;
  39249. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39250. var b64tab = {};
  39251. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39252. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39253. }
  39254. var cb_utob = function (c) {
  39255. var cc = c.charCodeAt(0);
  39256. return cc < 0x80
  39257. ? c
  39258. : cc < 0x800
  39259. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39260. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39261. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39262. fromCharCode(0x80 | (cc & 0x3f));
  39263. };
  39264. var utob = function (u) {
  39265. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39266. };
  39267. var cb_encode = function (ccc) {
  39268. var padlen = [0, 2, 1][ccc.length % 3];
  39269. var ord = (ccc.charCodeAt(0) << 16) |
  39270. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39271. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39272. var chars = [
  39273. b64chars.charAt(ord >>> 18),
  39274. b64chars.charAt((ord >>> 12) & 63),
  39275. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39276. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39277. ];
  39278. return chars.join('');
  39279. };
  39280. var btoa = window.btoa ||
  39281. function (b) {
  39282. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39283. };
  39284. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39285. var Timer = (function () {
  39286. function Timer(set, clear, delay, callback) {
  39287. var _this = this;
  39288. this.clear = clear;
  39289. this.timer = set(function () {
  39290. if (_this.timer) {
  39291. _this.timer = callback(_this.timer);
  39292. }
  39293. }, delay);
  39294. }
  39295. Timer.prototype.isRunning = function () {
  39296. return this.timer !== null;
  39297. };
  39298. Timer.prototype.ensureAborted = function () {
  39299. if (this.timer) {
  39300. this.clear(this.timer);
  39301. this.timer = null;
  39302. }
  39303. };
  39304. return Timer;
  39305. }());
  39306. /* harmony default export */ var abstract_timer = (Timer);
  39307. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39308. var __extends = (undefined && undefined.__extends) || (function () {
  39309. var extendStatics = function (d, b) {
  39310. extendStatics = Object.setPrototypeOf ||
  39311. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39312. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39313. return extendStatics(d, b);
  39314. };
  39315. return function (d, b) {
  39316. extendStatics(d, b);
  39317. function __() { this.constructor = d; }
  39318. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39319. };
  39320. })();
  39321. function timers_clearTimeout(timer) {
  39322. window.clearTimeout(timer);
  39323. }
  39324. function timers_clearInterval(timer) {
  39325. window.clearInterval(timer);
  39326. }
  39327. var OneOffTimer = (function (_super) {
  39328. __extends(OneOffTimer, _super);
  39329. function OneOffTimer(delay, callback) {
  39330. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39331. callback();
  39332. return null;
  39333. }) || this;
  39334. }
  39335. return OneOffTimer;
  39336. }(abstract_timer));
  39337. var PeriodicTimer = (function (_super) {
  39338. __extends(PeriodicTimer, _super);
  39339. function PeriodicTimer(delay, callback) {
  39340. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39341. callback();
  39342. return timer;
  39343. }) || this;
  39344. }
  39345. return PeriodicTimer;
  39346. }(abstract_timer));
  39347. // CONCATENATED MODULE: ./src/core/util.ts
  39348. var Util = {
  39349. now: function () {
  39350. if (Date.now) {
  39351. return Date.now();
  39352. }
  39353. else {
  39354. return new Date().valueOf();
  39355. }
  39356. },
  39357. defer: function (callback) {
  39358. return new OneOffTimer(0, callback);
  39359. },
  39360. method: function (name) {
  39361. var args = [];
  39362. for (var _i = 1; _i < arguments.length; _i++) {
  39363. args[_i - 1] = arguments[_i];
  39364. }
  39365. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39366. return function (object) {
  39367. return object[name].apply(object, boundArguments.concat(arguments));
  39368. };
  39369. }
  39370. };
  39371. /* harmony default export */ var util = (Util);
  39372. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39373. function extend(target) {
  39374. var sources = [];
  39375. for (var _i = 1; _i < arguments.length; _i++) {
  39376. sources[_i - 1] = arguments[_i];
  39377. }
  39378. for (var i = 0; i < sources.length; i++) {
  39379. var extensions = sources[i];
  39380. for (var property in extensions) {
  39381. if (extensions[property] && extensions[property].constructor &&
  39382. extensions[property].constructor === Object) {
  39383. target[property] = extend(target[property] || {}, extensions[property]);
  39384. }
  39385. else {
  39386. target[property] = extensions[property];
  39387. }
  39388. }
  39389. }
  39390. return target;
  39391. }
  39392. function stringify() {
  39393. var m = ["Pusher"];
  39394. for (var i = 0; i < arguments.length; i++) {
  39395. if (typeof arguments[i] === "string") {
  39396. m.push(arguments[i]);
  39397. }
  39398. else {
  39399. m.push(safeJSONStringify(arguments[i]));
  39400. }
  39401. }
  39402. return m.join(" : ");
  39403. }
  39404. function arrayIndexOf(array, item) {
  39405. var nativeIndexOf = Array.prototype.indexOf;
  39406. if (array === null) {
  39407. return -1;
  39408. }
  39409. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39410. return array.indexOf(item);
  39411. }
  39412. for (var i = 0, l = array.length; i < l; i++) {
  39413. if (array[i] === item) {
  39414. return i;
  39415. }
  39416. }
  39417. return -1;
  39418. }
  39419. function objectApply(object, f) {
  39420. for (var key in object) {
  39421. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39422. f(object[key], key, object);
  39423. }
  39424. }
  39425. }
  39426. function keys(object) {
  39427. var keys = [];
  39428. objectApply(object, function (_, key) {
  39429. keys.push(key);
  39430. });
  39431. return keys;
  39432. }
  39433. function values(object) {
  39434. var values = [];
  39435. objectApply(object, function (value) {
  39436. values.push(value);
  39437. });
  39438. return values;
  39439. }
  39440. function apply(array, f, context) {
  39441. for (var i = 0; i < array.length; i++) {
  39442. f.call(context || window, array[i], i, array);
  39443. }
  39444. }
  39445. function map(array, f) {
  39446. var result = [];
  39447. for (var i = 0; i < array.length; i++) {
  39448. result.push(f(array[i], i, array, result));
  39449. }
  39450. return result;
  39451. }
  39452. function mapObject(object, f) {
  39453. var result = {};
  39454. objectApply(object, function (value, key) {
  39455. result[key] = f(value);
  39456. });
  39457. return result;
  39458. }
  39459. function filter(array, test) {
  39460. test = test || function (value) { return !!value; };
  39461. var result = [];
  39462. for (var i = 0; i < array.length; i++) {
  39463. if (test(array[i], i, array, result)) {
  39464. result.push(array[i]);
  39465. }
  39466. }
  39467. return result;
  39468. }
  39469. function filterObject(object, test) {
  39470. var result = {};
  39471. objectApply(object, function (value, key) {
  39472. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39473. result[key] = value;
  39474. }
  39475. });
  39476. return result;
  39477. }
  39478. function flatten(object) {
  39479. var result = [];
  39480. objectApply(object, function (value, key) {
  39481. result.push([key, value]);
  39482. });
  39483. return result;
  39484. }
  39485. function any(array, test) {
  39486. for (var i = 0; i < array.length; i++) {
  39487. if (test(array[i], i, array)) {
  39488. return true;
  39489. }
  39490. }
  39491. return false;
  39492. }
  39493. function collections_all(array, test) {
  39494. for (var i = 0; i < array.length; i++) {
  39495. if (!test(array[i], i, array)) {
  39496. return false;
  39497. }
  39498. }
  39499. return true;
  39500. }
  39501. function encodeParamsObject(data) {
  39502. return mapObject(data, function (value) {
  39503. if (typeof value === "object") {
  39504. value = safeJSONStringify(value);
  39505. }
  39506. return encodeURIComponent(encode(value.toString()));
  39507. });
  39508. }
  39509. function buildQueryString(data) {
  39510. var params = filterObject(data, function (value) {
  39511. return value !== undefined;
  39512. });
  39513. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39514. return query;
  39515. }
  39516. function decycleObject(object) {
  39517. var objects = [], paths = [];
  39518. return (function derez(value, path) {
  39519. var i, name, nu;
  39520. switch (typeof value) {
  39521. case 'object':
  39522. if (!value) {
  39523. return null;
  39524. }
  39525. for (i = 0; i < objects.length; i += 1) {
  39526. if (objects[i] === value) {
  39527. return { $ref: paths[i] };
  39528. }
  39529. }
  39530. objects.push(value);
  39531. paths.push(path);
  39532. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39533. nu = [];
  39534. for (i = 0; i < value.length; i += 1) {
  39535. nu[i] = derez(value[i], path + '[' + i + ']');
  39536. }
  39537. }
  39538. else {
  39539. nu = {};
  39540. for (name in value) {
  39541. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39542. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39543. }
  39544. }
  39545. }
  39546. return nu;
  39547. case 'number':
  39548. case 'string':
  39549. case 'boolean':
  39550. return value;
  39551. }
  39552. }(object, '$'));
  39553. }
  39554. function safeJSONStringify(source) {
  39555. try {
  39556. return JSON.stringify(source);
  39557. }
  39558. catch (e) {
  39559. return JSON.stringify(decycleObject(source));
  39560. }
  39561. }
  39562. // CONCATENATED MODULE: ./src/core/logger.ts
  39563. var logger_Logger = (function () {
  39564. function Logger() {
  39565. this.globalLog = function (message) {
  39566. if (window.console && window.console.log) {
  39567. window.console.log(message);
  39568. }
  39569. };
  39570. }
  39571. Logger.prototype.debug = function () {
  39572. var args = [];
  39573. for (var _i = 0; _i < arguments.length; _i++) {
  39574. args[_i] = arguments[_i];
  39575. }
  39576. this.log(this.globalLog, args);
  39577. };
  39578. Logger.prototype.warn = function () {
  39579. var args = [];
  39580. for (var _i = 0; _i < arguments.length; _i++) {
  39581. args[_i] = arguments[_i];
  39582. }
  39583. this.log(this.globalLogWarn, args);
  39584. };
  39585. Logger.prototype.error = function () {
  39586. var args = [];
  39587. for (var _i = 0; _i < arguments.length; _i++) {
  39588. args[_i] = arguments[_i];
  39589. }
  39590. this.log(this.globalLogError, args);
  39591. };
  39592. Logger.prototype.globalLogWarn = function (message) {
  39593. if (window.console && window.console.warn) {
  39594. window.console.warn(message);
  39595. }
  39596. else {
  39597. this.globalLog(message);
  39598. }
  39599. };
  39600. Logger.prototype.globalLogError = function (message) {
  39601. if (window.console && window.console.error) {
  39602. window.console.error(message);
  39603. }
  39604. else {
  39605. this.globalLogWarn(message);
  39606. }
  39607. };
  39608. Logger.prototype.log = function (defaultLoggingFunction) {
  39609. var args = [];
  39610. for (var _i = 1; _i < arguments.length; _i++) {
  39611. args[_i - 1] = arguments[_i];
  39612. }
  39613. var message = stringify.apply(this, arguments);
  39614. if (core_pusher.log) {
  39615. core_pusher.log(message);
  39616. }
  39617. else if (core_pusher.logToConsole) {
  39618. var log = defaultLoggingFunction.bind(this);
  39619. log(message);
  39620. }
  39621. };
  39622. return Logger;
  39623. }());
  39624. /* harmony default export */ var logger = (new logger_Logger());
  39625. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39626. var urlStore = {
  39627. baseUrl: "https://pusher.com",
  39628. urls: {
  39629. authenticationEndpoint: {
  39630. path: "/docs/authenticating_users",
  39631. },
  39632. javascriptQuickStart: {
  39633. path: "/docs/javascript_quick_start"
  39634. },
  39635. triggeringClientEvents: {
  39636. path: "/docs/client_api_guide/client_events#trigger-events"
  39637. }
  39638. }
  39639. };
  39640. var buildLogSuffix = function (key) {
  39641. var urlPrefix = "See:";
  39642. var urlObj = urlStore.urls[key];
  39643. if (!urlObj)
  39644. return "";
  39645. var url;
  39646. if (urlObj.fullUrl) {
  39647. url = urlObj.fullUrl;
  39648. }
  39649. else if (urlObj.path) {
  39650. url = urlStore.baseUrl + urlObj.path;
  39651. }
  39652. if (!url)
  39653. return "";
  39654. return urlPrefix + " " + url;
  39655. };
  39656. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39657. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39658. var ajax = function (context, socketId, callback) {
  39659. var self = this, xhr;
  39660. xhr = runtime.createXHR();
  39661. xhr.open("POST", self.options.authEndpoint, true);
  39662. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39663. for (var headerName in this.authOptions.headers) {
  39664. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39665. }
  39666. xhr.onreadystatechange = function () {
  39667. if (xhr.readyState === 4) {
  39668. if (xhr.status === 200) {
  39669. var data, parsed = false;
  39670. try {
  39671. data = JSON.parse(xhr.responseText);
  39672. parsed = true;
  39673. }
  39674. catch (e) {
  39675. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39676. }
  39677. if (parsed) {
  39678. callback(false, data);
  39679. }
  39680. }
  39681. else {
  39682. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39683. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39684. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39685. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39686. callback(true, xhr.status);
  39687. }
  39688. }
  39689. };
  39690. xhr.send(this.composeQuery(socketId));
  39691. return xhr;
  39692. };
  39693. /* harmony default export */ var xhr_auth = (ajax);
  39694. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39695. var jsonp = function (context, socketId, callback) {
  39696. if (this.authOptions.headers !== undefined) {
  39697. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39698. }
  39699. var callbackName = context.nextAuthCallbackID.toString();
  39700. context.nextAuthCallbackID++;
  39701. var document = context.getDocument();
  39702. var script = document.createElement("script");
  39703. context.auth_callbacks[callbackName] = function (data) {
  39704. callback(false, data);
  39705. };
  39706. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39707. script.src = this.options.authEndpoint +
  39708. '?callback=' +
  39709. encodeURIComponent(callback_name) +
  39710. '&' +
  39711. this.composeQuery(socketId);
  39712. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39713. head.insertBefore(script, head.firstChild);
  39714. };
  39715. /* harmony default export */ var jsonp_auth = (jsonp);
  39716. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39717. var ScriptRequest = (function () {
  39718. function ScriptRequest(src) {
  39719. this.src = src;
  39720. }
  39721. ScriptRequest.prototype.send = function (receiver) {
  39722. var self = this;
  39723. var errorString = "Error loading " + self.src;
  39724. self.script = document.createElement("script");
  39725. self.script.id = receiver.id;
  39726. self.script.src = self.src;
  39727. self.script.type = "text/javascript";
  39728. self.script.charset = "UTF-8";
  39729. if (self.script.addEventListener) {
  39730. self.script.onerror = function () {
  39731. receiver.callback(errorString);
  39732. };
  39733. self.script.onload = function () {
  39734. receiver.callback(null);
  39735. };
  39736. }
  39737. else {
  39738. self.script.onreadystatechange = function () {
  39739. if (self.script.readyState === 'loaded' ||
  39740. self.script.readyState === 'complete') {
  39741. receiver.callback(null);
  39742. }
  39743. };
  39744. }
  39745. if (self.script.async === undefined && document.attachEvent &&
  39746. /opera/i.test(navigator.userAgent)) {
  39747. self.errorScript = document.createElement("script");
  39748. self.errorScript.id = receiver.id + "_error";
  39749. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39750. self.script.async = self.errorScript.async = false;
  39751. }
  39752. else {
  39753. self.script.async = true;
  39754. }
  39755. var head = document.getElementsByTagName('head')[0];
  39756. head.insertBefore(self.script, head.firstChild);
  39757. if (self.errorScript) {
  39758. head.insertBefore(self.errorScript, self.script.nextSibling);
  39759. }
  39760. };
  39761. ScriptRequest.prototype.cleanup = function () {
  39762. if (this.script) {
  39763. this.script.onload = this.script.onerror = null;
  39764. this.script.onreadystatechange = null;
  39765. }
  39766. if (this.script && this.script.parentNode) {
  39767. this.script.parentNode.removeChild(this.script);
  39768. }
  39769. if (this.errorScript && this.errorScript.parentNode) {
  39770. this.errorScript.parentNode.removeChild(this.errorScript);
  39771. }
  39772. this.script = null;
  39773. this.errorScript = null;
  39774. };
  39775. return ScriptRequest;
  39776. }());
  39777. /* harmony default export */ var script_request = (ScriptRequest);
  39778. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39779. var jsonp_request_JSONPRequest = (function () {
  39780. function JSONPRequest(url, data) {
  39781. this.url = url;
  39782. this.data = data;
  39783. }
  39784. JSONPRequest.prototype.send = function (receiver) {
  39785. if (this.request) {
  39786. return;
  39787. }
  39788. var query = buildQueryString(this.data);
  39789. var url = this.url + "/" + receiver.number + "?" + query;
  39790. this.request = runtime.createScriptRequest(url);
  39791. this.request.send(receiver);
  39792. };
  39793. JSONPRequest.prototype.cleanup = function () {
  39794. if (this.request) {
  39795. this.request.cleanup();
  39796. }
  39797. };
  39798. return JSONPRequest;
  39799. }());
  39800. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39801. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39802. var getAgent = function (sender, useTLS) {
  39803. return function (data, callback) {
  39804. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39805. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39806. var request = runtime.createJSONPRequest(url, data);
  39807. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39808. ScriptReceivers.remove(receiver);
  39809. request.cleanup();
  39810. if (result && result.host) {
  39811. sender.host = result.host;
  39812. }
  39813. if (callback) {
  39814. callback(error, result);
  39815. }
  39816. });
  39817. request.send(receiver);
  39818. };
  39819. };
  39820. var jsonp_timeline_jsonp = {
  39821. name: 'jsonp',
  39822. getAgent: getAgent
  39823. };
  39824. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39825. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39826. function getGenericURL(baseScheme, params, path) {
  39827. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39828. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39829. return scheme + "://" + host + path;
  39830. }
  39831. function getGenericPath(key, queryString) {
  39832. var path = "/app/" + key;
  39833. var query = "?protocol=" + defaults.PROTOCOL +
  39834. "&client=js" +
  39835. "&version=" + defaults.VERSION +
  39836. (queryString ? ("&" + queryString) : "");
  39837. return path + query;
  39838. }
  39839. var ws = {
  39840. getInitial: function (key, params) {
  39841. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39842. return getGenericURL("ws", params, path);
  39843. }
  39844. };
  39845. var http = {
  39846. getInitial: function (key, params) {
  39847. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39848. return getGenericURL("http", params, path);
  39849. }
  39850. };
  39851. var sockjs = {
  39852. getInitial: function (key, params) {
  39853. return getGenericURL("http", params, params.httpPath || "/pusher");
  39854. },
  39855. getPath: function (key, params) {
  39856. return getGenericPath(key);
  39857. }
  39858. };
  39859. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39860. var callback_registry_CallbackRegistry = (function () {
  39861. function CallbackRegistry() {
  39862. this._callbacks = {};
  39863. }
  39864. CallbackRegistry.prototype.get = function (name) {
  39865. return this._callbacks[prefix(name)];
  39866. };
  39867. CallbackRegistry.prototype.add = function (name, callback, context) {
  39868. var prefixedEventName = prefix(name);
  39869. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39870. this._callbacks[prefixedEventName].push({
  39871. fn: callback,
  39872. context: context
  39873. });
  39874. };
  39875. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39876. if (!name && !callback && !context) {
  39877. this._callbacks = {};
  39878. return;
  39879. }
  39880. var names = name ? [prefix(name)] : keys(this._callbacks);
  39881. if (callback || context) {
  39882. this.removeCallback(names, callback, context);
  39883. }
  39884. else {
  39885. this.removeAllCallbacks(names);
  39886. }
  39887. };
  39888. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39889. apply(names, function (name) {
  39890. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39891. return (callback && callback !== binding.fn) ||
  39892. (context && context !== binding.context);
  39893. });
  39894. if (this._callbacks[name].length === 0) {
  39895. delete this._callbacks[name];
  39896. }
  39897. }, this);
  39898. };
  39899. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39900. apply(names, function (name) {
  39901. delete this._callbacks[name];
  39902. }, this);
  39903. };
  39904. return CallbackRegistry;
  39905. }());
  39906. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39907. function prefix(name) {
  39908. return "_" + name;
  39909. }
  39910. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39911. var dispatcher_Dispatcher = (function () {
  39912. function Dispatcher(failThrough) {
  39913. this.callbacks = new callback_registry();
  39914. this.global_callbacks = [];
  39915. this.failThrough = failThrough;
  39916. }
  39917. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39918. this.callbacks.add(eventName, callback, context);
  39919. return this;
  39920. };
  39921. Dispatcher.prototype.bind_global = function (callback) {
  39922. this.global_callbacks.push(callback);
  39923. return this;
  39924. };
  39925. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39926. this.callbacks.remove(eventName, callback, context);
  39927. return this;
  39928. };
  39929. Dispatcher.prototype.unbind_global = function (callback) {
  39930. if (!callback) {
  39931. this.global_callbacks = [];
  39932. return this;
  39933. }
  39934. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39935. return this;
  39936. };
  39937. Dispatcher.prototype.unbind_all = function () {
  39938. this.unbind();
  39939. this.unbind_global();
  39940. return this;
  39941. };
  39942. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39943. for (var i = 0; i < this.global_callbacks.length; i++) {
  39944. this.global_callbacks[i](eventName, data);
  39945. }
  39946. var callbacks = this.callbacks.get(eventName);
  39947. var args = [];
  39948. if (metadata) {
  39949. args.push(data, metadata);
  39950. }
  39951. else if (data) {
  39952. args.push(data);
  39953. }
  39954. if (callbacks && callbacks.length > 0) {
  39955. for (var i = 0; i < callbacks.length; i++) {
  39956. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39957. }
  39958. }
  39959. else if (this.failThrough) {
  39960. this.failThrough(eventName, data);
  39961. }
  39962. return this;
  39963. };
  39964. return Dispatcher;
  39965. }());
  39966. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39967. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39968. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39969. var extendStatics = function (d, b) {
  39970. extendStatics = Object.setPrototypeOf ||
  39971. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39972. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39973. return extendStatics(d, b);
  39974. };
  39975. return function (d, b) {
  39976. extendStatics(d, b);
  39977. function __() { this.constructor = d; }
  39978. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39979. };
  39980. })();
  39981. var transport_connection_TransportConnection = (function (_super) {
  39982. transport_connection_extends(TransportConnection, _super);
  39983. function TransportConnection(hooks, name, priority, key, options) {
  39984. var _this = _super.call(this) || this;
  39985. _this.initialize = runtime.transportConnectionInitializer;
  39986. _this.hooks = hooks;
  39987. _this.name = name;
  39988. _this.priority = priority;
  39989. _this.key = key;
  39990. _this.options = options;
  39991. _this.state = "new";
  39992. _this.timeline = options.timeline;
  39993. _this.activityTimeout = options.activityTimeout;
  39994. _this.id = _this.timeline.generateUniqueID();
  39995. return _this;
  39996. }
  39997. TransportConnection.prototype.handlesActivityChecks = function () {
  39998. return Boolean(this.hooks.handlesActivityChecks);
  39999. };
  40000. TransportConnection.prototype.supportsPing = function () {
  40001. return Boolean(this.hooks.supportsPing);
  40002. };
  40003. TransportConnection.prototype.connect = function () {
  40004. var _this = this;
  40005. if (this.socket || this.state !== "initialized") {
  40006. return false;
  40007. }
  40008. var url = this.hooks.urls.getInitial(this.key, this.options);
  40009. try {
  40010. this.socket = this.hooks.getSocket(url, this.options);
  40011. }
  40012. catch (e) {
  40013. util.defer(function () {
  40014. _this.onError(e);
  40015. _this.changeState("closed");
  40016. });
  40017. return false;
  40018. }
  40019. this.bindListeners();
  40020. logger.debug("Connecting", { transport: this.name, url: url });
  40021. this.changeState("connecting");
  40022. return true;
  40023. };
  40024. TransportConnection.prototype.close = function () {
  40025. if (this.socket) {
  40026. this.socket.close();
  40027. return true;
  40028. }
  40029. else {
  40030. return false;
  40031. }
  40032. };
  40033. TransportConnection.prototype.send = function (data) {
  40034. var _this = this;
  40035. if (this.state === "open") {
  40036. util.defer(function () {
  40037. if (_this.socket) {
  40038. _this.socket.send(data);
  40039. }
  40040. });
  40041. return true;
  40042. }
  40043. else {
  40044. return false;
  40045. }
  40046. };
  40047. TransportConnection.prototype.ping = function () {
  40048. if (this.state === "open" && this.supportsPing()) {
  40049. this.socket.ping();
  40050. }
  40051. };
  40052. TransportConnection.prototype.onOpen = function () {
  40053. if (this.hooks.beforeOpen) {
  40054. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40055. }
  40056. this.changeState("open");
  40057. this.socket.onopen = undefined;
  40058. };
  40059. TransportConnection.prototype.onError = function (error) {
  40060. this.emit("error", { type: 'WebSocketError', error: error });
  40061. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40062. };
  40063. TransportConnection.prototype.onClose = function (closeEvent) {
  40064. if (closeEvent) {
  40065. this.changeState("closed", {
  40066. code: closeEvent.code,
  40067. reason: closeEvent.reason,
  40068. wasClean: closeEvent.wasClean
  40069. });
  40070. }
  40071. else {
  40072. this.changeState("closed");
  40073. }
  40074. this.unbindListeners();
  40075. this.socket = undefined;
  40076. };
  40077. TransportConnection.prototype.onMessage = function (message) {
  40078. this.emit("message", message);
  40079. };
  40080. TransportConnection.prototype.onActivity = function () {
  40081. this.emit("activity");
  40082. };
  40083. TransportConnection.prototype.bindListeners = function () {
  40084. var _this = this;
  40085. this.socket.onopen = function () {
  40086. _this.onOpen();
  40087. };
  40088. this.socket.onerror = function (error) {
  40089. _this.onError(error);
  40090. };
  40091. this.socket.onclose = function (closeEvent) {
  40092. _this.onClose(closeEvent);
  40093. };
  40094. this.socket.onmessage = function (message) {
  40095. _this.onMessage(message);
  40096. };
  40097. if (this.supportsPing()) {
  40098. this.socket.onactivity = function () { _this.onActivity(); };
  40099. }
  40100. };
  40101. TransportConnection.prototype.unbindListeners = function () {
  40102. if (this.socket) {
  40103. this.socket.onopen = undefined;
  40104. this.socket.onerror = undefined;
  40105. this.socket.onclose = undefined;
  40106. this.socket.onmessage = undefined;
  40107. if (this.supportsPing()) {
  40108. this.socket.onactivity = undefined;
  40109. }
  40110. }
  40111. };
  40112. TransportConnection.prototype.changeState = function (state, params) {
  40113. this.state = state;
  40114. this.timeline.info(this.buildTimelineMessage({
  40115. state: state,
  40116. params: params
  40117. }));
  40118. this.emit(state, params);
  40119. };
  40120. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40121. return extend({ cid: this.id }, message);
  40122. };
  40123. return TransportConnection;
  40124. }(dispatcher));
  40125. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40126. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40127. var transport_Transport = (function () {
  40128. function Transport(hooks) {
  40129. this.hooks = hooks;
  40130. }
  40131. Transport.prototype.isSupported = function (environment) {
  40132. return this.hooks.isSupported(environment);
  40133. };
  40134. Transport.prototype.createConnection = function (name, priority, key, options) {
  40135. return new transport_connection(this.hooks, name, priority, key, options);
  40136. };
  40137. return Transport;
  40138. }());
  40139. /* harmony default export */ var transports_transport = (transport_Transport);
  40140. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40141. var WSTransport = new transports_transport({
  40142. urls: ws,
  40143. handlesActivityChecks: false,
  40144. supportsPing: false,
  40145. isInitialized: function () {
  40146. return Boolean(runtime.getWebSocketAPI());
  40147. },
  40148. isSupported: function () {
  40149. return Boolean(runtime.getWebSocketAPI());
  40150. },
  40151. getSocket: function (url) {
  40152. return runtime.createWebSocket(url);
  40153. }
  40154. });
  40155. var httpConfiguration = {
  40156. urls: http,
  40157. handlesActivityChecks: false,
  40158. supportsPing: true,
  40159. isInitialized: function () {
  40160. return true;
  40161. }
  40162. };
  40163. var streamingConfiguration = extend({ getSocket: function (url) {
  40164. return runtime.HTTPFactory.createStreamingSocket(url);
  40165. }
  40166. }, httpConfiguration);
  40167. var pollingConfiguration = extend({ getSocket: function (url) {
  40168. return runtime.HTTPFactory.createPollingSocket(url);
  40169. }
  40170. }, httpConfiguration);
  40171. var xhrConfiguration = {
  40172. isSupported: function () {
  40173. return runtime.isXHRSupported();
  40174. }
  40175. };
  40176. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40177. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40178. var Transports = {
  40179. ws: WSTransport,
  40180. xhr_streaming: XHRStreamingTransport,
  40181. xhr_polling: XHRPollingTransport
  40182. };
  40183. /* harmony default export */ var transports = (Transports);
  40184. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40185. var SockJSTransport = new transports_transport({
  40186. file: "sockjs",
  40187. urls: sockjs,
  40188. handlesActivityChecks: true,
  40189. supportsPing: false,
  40190. isSupported: function () {
  40191. return true;
  40192. },
  40193. isInitialized: function () {
  40194. return window.SockJS !== undefined;
  40195. },
  40196. getSocket: function (url, options) {
  40197. return new window.SockJS(url, null, {
  40198. js_path: Dependencies.getPath("sockjs", {
  40199. useTLS: options.useTLS
  40200. }),
  40201. ignore_null_origin: options.ignoreNullOrigin
  40202. });
  40203. },
  40204. beforeOpen: function (socket, path) {
  40205. socket.send(JSON.stringify({
  40206. path: path
  40207. }));
  40208. }
  40209. });
  40210. var xdrConfiguration = {
  40211. isSupported: function (environment) {
  40212. var yes = runtime.isXDRSupported(environment.useTLS);
  40213. return yes;
  40214. }
  40215. };
  40216. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40217. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40218. transports.xdr_streaming = XDRStreamingTransport;
  40219. transports.xdr_polling = XDRPollingTransport;
  40220. transports.sockjs = SockJSTransport;
  40221. /* harmony default export */ var transports_transports = (transports);
  40222. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40223. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40224. var extendStatics = function (d, b) {
  40225. extendStatics = Object.setPrototypeOf ||
  40226. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40227. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40228. return extendStatics(d, b);
  40229. };
  40230. return function (d, b) {
  40231. extendStatics(d, b);
  40232. function __() { this.constructor = d; }
  40233. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40234. };
  40235. })();
  40236. var NetInfo = (function (_super) {
  40237. net_info_extends(NetInfo, _super);
  40238. function NetInfo() {
  40239. var _this = _super.call(this) || this;
  40240. var self = _this;
  40241. if (window.addEventListener !== undefined) {
  40242. window.addEventListener("online", function () {
  40243. self.emit('online');
  40244. }, false);
  40245. window.addEventListener("offline", function () {
  40246. self.emit('offline');
  40247. }, false);
  40248. }
  40249. return _this;
  40250. }
  40251. NetInfo.prototype.isOnline = function () {
  40252. if (window.navigator.onLine === undefined) {
  40253. return true;
  40254. }
  40255. else {
  40256. return window.navigator.onLine;
  40257. }
  40258. };
  40259. return NetInfo;
  40260. }(dispatcher));
  40261. var net_info_Network = new NetInfo();
  40262. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40263. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40264. function AssistantToTheTransportManager(manager, transport, options) {
  40265. this.manager = manager;
  40266. this.transport = transport;
  40267. this.minPingDelay = options.minPingDelay;
  40268. this.maxPingDelay = options.maxPingDelay;
  40269. this.pingDelay = undefined;
  40270. }
  40271. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40272. var _this = this;
  40273. options = extend({}, options, {
  40274. activityTimeout: this.pingDelay
  40275. });
  40276. var connection = this.transport.createConnection(name, priority, key, options);
  40277. var openTimestamp = null;
  40278. var onOpen = function () {
  40279. connection.unbind("open", onOpen);
  40280. connection.bind("closed", onClosed);
  40281. openTimestamp = util.now();
  40282. };
  40283. var onClosed = function (closeEvent) {
  40284. connection.unbind("closed", onClosed);
  40285. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40286. _this.manager.reportDeath();
  40287. }
  40288. else if (!closeEvent.wasClean && openTimestamp) {
  40289. var lifespan = util.now() - openTimestamp;
  40290. if (lifespan < 2 * _this.maxPingDelay) {
  40291. _this.manager.reportDeath();
  40292. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40293. }
  40294. }
  40295. };
  40296. connection.bind("open", onOpen);
  40297. return connection;
  40298. };
  40299. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40300. return this.manager.isAlive() && this.transport.isSupported(environment);
  40301. };
  40302. return AssistantToTheTransportManager;
  40303. }());
  40304. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40305. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40306. var Protocol = {
  40307. decodeMessage: function (messageEvent) {
  40308. try {
  40309. var messageData = JSON.parse(messageEvent.data);
  40310. var pusherEventData = messageData.data;
  40311. if (typeof pusherEventData === 'string') {
  40312. try {
  40313. pusherEventData = JSON.parse(messageData.data);
  40314. }
  40315. catch (e) { }
  40316. }
  40317. var pusherEvent = {
  40318. event: messageData.event,
  40319. channel: messageData.channel,
  40320. data: pusherEventData,
  40321. };
  40322. if (messageData.user_id) {
  40323. pusherEvent.user_id = messageData.user_id;
  40324. }
  40325. return pusherEvent;
  40326. }
  40327. catch (e) {
  40328. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40329. }
  40330. },
  40331. encodeMessage: function (event) {
  40332. return JSON.stringify(event);
  40333. },
  40334. processHandshake: function (messageEvent) {
  40335. var message = Protocol.decodeMessage(messageEvent);
  40336. if (message.event === "pusher:connection_established") {
  40337. if (!message.data.activity_timeout) {
  40338. throw "No activity timeout specified in handshake";
  40339. }
  40340. return {
  40341. action: "connected",
  40342. id: message.data.socket_id,
  40343. activityTimeout: message.data.activity_timeout * 1000
  40344. };
  40345. }
  40346. else if (message.event === "pusher:error") {
  40347. return {
  40348. action: this.getCloseAction(message.data),
  40349. error: this.getCloseError(message.data)
  40350. };
  40351. }
  40352. else {
  40353. throw "Invalid handshake";
  40354. }
  40355. },
  40356. getCloseAction: function (closeEvent) {
  40357. if (closeEvent.code < 4000) {
  40358. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40359. return "backoff";
  40360. }
  40361. else {
  40362. return null;
  40363. }
  40364. }
  40365. else if (closeEvent.code === 4000) {
  40366. return "tls_only";
  40367. }
  40368. else if (closeEvent.code < 4100) {
  40369. return "refused";
  40370. }
  40371. else if (closeEvent.code < 4200) {
  40372. return "backoff";
  40373. }
  40374. else if (closeEvent.code < 4300) {
  40375. return "retry";
  40376. }
  40377. else {
  40378. return "refused";
  40379. }
  40380. },
  40381. getCloseError: function (closeEvent) {
  40382. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40383. return {
  40384. type: 'PusherError',
  40385. data: {
  40386. code: closeEvent.code,
  40387. message: closeEvent.reason || closeEvent.message
  40388. }
  40389. };
  40390. }
  40391. else {
  40392. return null;
  40393. }
  40394. }
  40395. };
  40396. /* harmony default export */ var protocol_protocol = (Protocol);
  40397. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40398. var connection_extends = (undefined && undefined.__extends) || (function () {
  40399. var extendStatics = function (d, b) {
  40400. extendStatics = Object.setPrototypeOf ||
  40401. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40402. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40403. return extendStatics(d, b);
  40404. };
  40405. return function (d, b) {
  40406. extendStatics(d, b);
  40407. function __() { this.constructor = d; }
  40408. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40409. };
  40410. })();
  40411. var connection_Connection = (function (_super) {
  40412. connection_extends(Connection, _super);
  40413. function Connection(id, transport) {
  40414. var _this = _super.call(this) || this;
  40415. _this.id = id;
  40416. _this.transport = transport;
  40417. _this.activityTimeout = transport.activityTimeout;
  40418. _this.bindListeners();
  40419. return _this;
  40420. }
  40421. Connection.prototype.handlesActivityChecks = function () {
  40422. return this.transport.handlesActivityChecks();
  40423. };
  40424. Connection.prototype.send = function (data) {
  40425. return this.transport.send(data);
  40426. };
  40427. Connection.prototype.send_event = function (name, data, channel) {
  40428. var event = { event: name, data: data };
  40429. if (channel) {
  40430. event.channel = channel;
  40431. }
  40432. logger.debug('Event sent', event);
  40433. return this.send(protocol_protocol.encodeMessage(event));
  40434. };
  40435. Connection.prototype.ping = function () {
  40436. if (this.transport.supportsPing()) {
  40437. this.transport.ping();
  40438. }
  40439. else {
  40440. this.send_event('pusher:ping', {});
  40441. }
  40442. };
  40443. Connection.prototype.close = function () {
  40444. this.transport.close();
  40445. };
  40446. Connection.prototype.bindListeners = function () {
  40447. var _this = this;
  40448. var listeners = {
  40449. message: function (messageEvent) {
  40450. var pusherEvent;
  40451. try {
  40452. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40453. }
  40454. catch (e) {
  40455. _this.emit('error', {
  40456. type: 'MessageParseError',
  40457. error: e,
  40458. data: messageEvent.data
  40459. });
  40460. }
  40461. if (pusherEvent !== undefined) {
  40462. logger.debug('Event recd', pusherEvent);
  40463. switch (pusherEvent.event) {
  40464. case 'pusher:error':
  40465. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40466. break;
  40467. case 'pusher:ping':
  40468. _this.emit("ping");
  40469. break;
  40470. case 'pusher:pong':
  40471. _this.emit("pong");
  40472. break;
  40473. }
  40474. _this.emit('message', pusherEvent);
  40475. }
  40476. },
  40477. activity: function () {
  40478. _this.emit("activity");
  40479. },
  40480. error: function (error) {
  40481. _this.emit("error", { type: "WebSocketError", error: error });
  40482. },
  40483. closed: function (closeEvent) {
  40484. unbindListeners();
  40485. if (closeEvent && closeEvent.code) {
  40486. _this.handleCloseEvent(closeEvent);
  40487. }
  40488. _this.transport = null;
  40489. _this.emit("closed");
  40490. }
  40491. };
  40492. var unbindListeners = function () {
  40493. objectApply(listeners, function (listener, event) {
  40494. _this.transport.unbind(event, listener);
  40495. });
  40496. };
  40497. objectApply(listeners, function (listener, event) {
  40498. _this.transport.bind(event, listener);
  40499. });
  40500. };
  40501. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40502. var action = protocol_protocol.getCloseAction(closeEvent);
  40503. var error = protocol_protocol.getCloseError(closeEvent);
  40504. if (error) {
  40505. this.emit('error', error);
  40506. }
  40507. if (action) {
  40508. this.emit(action, { action: action, error: error });
  40509. }
  40510. };
  40511. return Connection;
  40512. }(dispatcher));
  40513. /* harmony default export */ var connection_connection = (connection_Connection);
  40514. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40515. var handshake_Handshake = (function () {
  40516. function Handshake(transport, callback) {
  40517. this.transport = transport;
  40518. this.callback = callback;
  40519. this.bindListeners();
  40520. }
  40521. Handshake.prototype.close = function () {
  40522. this.unbindListeners();
  40523. this.transport.close();
  40524. };
  40525. Handshake.prototype.bindListeners = function () {
  40526. var _this = this;
  40527. this.onMessage = function (m) {
  40528. _this.unbindListeners();
  40529. var result;
  40530. try {
  40531. result = protocol_protocol.processHandshake(m);
  40532. }
  40533. catch (e) {
  40534. _this.finish("error", { error: e });
  40535. _this.transport.close();
  40536. return;
  40537. }
  40538. if (result.action === "connected") {
  40539. _this.finish("connected", {
  40540. connection: new connection_connection(result.id, _this.transport),
  40541. activityTimeout: result.activityTimeout
  40542. });
  40543. }
  40544. else {
  40545. _this.finish(result.action, { error: result.error });
  40546. _this.transport.close();
  40547. }
  40548. };
  40549. this.onClosed = function (closeEvent) {
  40550. _this.unbindListeners();
  40551. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40552. var error = protocol_protocol.getCloseError(closeEvent);
  40553. _this.finish(action, { error: error });
  40554. };
  40555. this.transport.bind("message", this.onMessage);
  40556. this.transport.bind("closed", this.onClosed);
  40557. };
  40558. Handshake.prototype.unbindListeners = function () {
  40559. this.transport.unbind("message", this.onMessage);
  40560. this.transport.unbind("closed", this.onClosed);
  40561. };
  40562. Handshake.prototype.finish = function (action, params) {
  40563. this.callback(extend({ transport: this.transport, action: action }, params));
  40564. };
  40565. return Handshake;
  40566. }());
  40567. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40568. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40569. var pusher_authorizer_PusherAuthorizer = (function () {
  40570. function PusherAuthorizer(channel, options) {
  40571. this.channel = channel;
  40572. var authTransport = options.authTransport;
  40573. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40574. throw "'" + authTransport + "' is not a recognized auth transport";
  40575. }
  40576. this.type = authTransport;
  40577. this.options = options;
  40578. this.authOptions = (options || {}).auth || {};
  40579. }
  40580. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40581. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40582. '&channel_name=' + encodeURIComponent(this.channel.name);
  40583. for (var i in this.authOptions.params) {
  40584. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40585. }
  40586. return query;
  40587. };
  40588. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40589. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40590. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40591. };
  40592. return PusherAuthorizer;
  40593. }());
  40594. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40595. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40596. var timeline_sender_TimelineSender = (function () {
  40597. function TimelineSender(timeline, options) {
  40598. this.timeline = timeline;
  40599. this.options = options || {};
  40600. }
  40601. TimelineSender.prototype.send = function (useTLS, callback) {
  40602. if (this.timeline.isEmpty()) {
  40603. return;
  40604. }
  40605. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40606. };
  40607. return TimelineSender;
  40608. }());
  40609. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40610. // CONCATENATED MODULE: ./src/core/errors.ts
  40611. var errors_extends = (undefined && undefined.__extends) || (function () {
  40612. var extendStatics = function (d, b) {
  40613. extendStatics = Object.setPrototypeOf ||
  40614. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40615. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40616. return extendStatics(d, b);
  40617. };
  40618. return function (d, b) {
  40619. extendStatics(d, b);
  40620. function __() { this.constructor = d; }
  40621. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40622. };
  40623. })();
  40624. var BadEventName = (function (_super) {
  40625. errors_extends(BadEventName, _super);
  40626. function BadEventName(msg) {
  40627. var _newTarget = this.constructor;
  40628. var _this = _super.call(this, msg) || this;
  40629. Object.setPrototypeOf(_this, _newTarget.prototype);
  40630. return _this;
  40631. }
  40632. return BadEventName;
  40633. }(Error));
  40634. var RequestTimedOut = (function (_super) {
  40635. errors_extends(RequestTimedOut, _super);
  40636. function RequestTimedOut(msg) {
  40637. var _newTarget = this.constructor;
  40638. var _this = _super.call(this, msg) || this;
  40639. Object.setPrototypeOf(_this, _newTarget.prototype);
  40640. return _this;
  40641. }
  40642. return RequestTimedOut;
  40643. }(Error));
  40644. var TransportPriorityTooLow = (function (_super) {
  40645. errors_extends(TransportPriorityTooLow, _super);
  40646. function TransportPriorityTooLow(msg) {
  40647. var _newTarget = this.constructor;
  40648. var _this = _super.call(this, msg) || this;
  40649. Object.setPrototypeOf(_this, _newTarget.prototype);
  40650. return _this;
  40651. }
  40652. return TransportPriorityTooLow;
  40653. }(Error));
  40654. var TransportClosed = (function (_super) {
  40655. errors_extends(TransportClosed, _super);
  40656. function TransportClosed(msg) {
  40657. var _newTarget = this.constructor;
  40658. var _this = _super.call(this, msg) || this;
  40659. Object.setPrototypeOf(_this, _newTarget.prototype);
  40660. return _this;
  40661. }
  40662. return TransportClosed;
  40663. }(Error));
  40664. var UnsupportedFeature = (function (_super) {
  40665. errors_extends(UnsupportedFeature, _super);
  40666. function UnsupportedFeature(msg) {
  40667. var _newTarget = this.constructor;
  40668. var _this = _super.call(this, msg) || this;
  40669. Object.setPrototypeOf(_this, _newTarget.prototype);
  40670. return _this;
  40671. }
  40672. return UnsupportedFeature;
  40673. }(Error));
  40674. var UnsupportedTransport = (function (_super) {
  40675. errors_extends(UnsupportedTransport, _super);
  40676. function UnsupportedTransport(msg) {
  40677. var _newTarget = this.constructor;
  40678. var _this = _super.call(this, msg) || this;
  40679. Object.setPrototypeOf(_this, _newTarget.prototype);
  40680. return _this;
  40681. }
  40682. return UnsupportedTransport;
  40683. }(Error));
  40684. var UnsupportedStrategy = (function (_super) {
  40685. errors_extends(UnsupportedStrategy, _super);
  40686. function UnsupportedStrategy(msg) {
  40687. var _newTarget = this.constructor;
  40688. var _this = _super.call(this, msg) || this;
  40689. Object.setPrototypeOf(_this, _newTarget.prototype);
  40690. return _this;
  40691. }
  40692. return UnsupportedStrategy;
  40693. }(Error));
  40694. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40695. var channel_extends = (undefined && undefined.__extends) || (function () {
  40696. var extendStatics = function (d, b) {
  40697. extendStatics = Object.setPrototypeOf ||
  40698. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40699. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40700. return extendStatics(d, b);
  40701. };
  40702. return function (d, b) {
  40703. extendStatics(d, b);
  40704. function __() { this.constructor = d; }
  40705. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40706. };
  40707. })();
  40708. var channel_Channel = (function (_super) {
  40709. channel_extends(Channel, _super);
  40710. function Channel(name, pusher) {
  40711. var _this = _super.call(this, function (event, data) {
  40712. logger.debug('No callbacks on ' + name + ' for ' + event);
  40713. }) || this;
  40714. _this.name = name;
  40715. _this.pusher = pusher;
  40716. _this.subscribed = false;
  40717. _this.subscriptionPending = false;
  40718. _this.subscriptionCancelled = false;
  40719. return _this;
  40720. }
  40721. Channel.prototype.authorize = function (socketId, callback) {
  40722. return callback(false, {});
  40723. };
  40724. Channel.prototype.trigger = function (event, data) {
  40725. if (event.indexOf("client-") !== 0) {
  40726. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40727. }
  40728. if (!this.subscribed) {
  40729. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40730. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40731. }
  40732. return this.pusher.send_event(event, data, this.name);
  40733. };
  40734. Channel.prototype.disconnect = function () {
  40735. this.subscribed = false;
  40736. this.subscriptionPending = false;
  40737. };
  40738. Channel.prototype.handleEvent = function (event) {
  40739. var eventName = event.event;
  40740. var data = event.data;
  40741. if (eventName === "pusher_internal:subscription_succeeded") {
  40742. this.handleSubscriptionSucceededEvent(event);
  40743. }
  40744. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40745. var metadata = {};
  40746. this.emit(eventName, data, metadata);
  40747. }
  40748. };
  40749. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40750. this.subscriptionPending = false;
  40751. this.subscribed = true;
  40752. if (this.subscriptionCancelled) {
  40753. this.pusher.unsubscribe(this.name);
  40754. }
  40755. else {
  40756. this.emit("pusher:subscription_succeeded", event.data);
  40757. }
  40758. };
  40759. Channel.prototype.subscribe = function () {
  40760. var _this = this;
  40761. if (this.subscribed) {
  40762. return;
  40763. }
  40764. this.subscriptionPending = true;
  40765. this.subscriptionCancelled = false;
  40766. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40767. if (error) {
  40768. logger.error(data);
  40769. _this.emit('pusher:subscription_error', data);
  40770. }
  40771. else {
  40772. _this.pusher.send_event('pusher:subscribe', {
  40773. auth: data.auth,
  40774. channel_data: data.channel_data,
  40775. channel: _this.name
  40776. });
  40777. }
  40778. });
  40779. };
  40780. Channel.prototype.unsubscribe = function () {
  40781. this.subscribed = false;
  40782. this.pusher.send_event('pusher:unsubscribe', {
  40783. channel: this.name
  40784. });
  40785. };
  40786. Channel.prototype.cancelSubscription = function () {
  40787. this.subscriptionCancelled = true;
  40788. };
  40789. Channel.prototype.reinstateSubscription = function () {
  40790. this.subscriptionCancelled = false;
  40791. };
  40792. return Channel;
  40793. }(dispatcher));
  40794. /* harmony default export */ var channels_channel = (channel_Channel);
  40795. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40796. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40797. var extendStatics = function (d, b) {
  40798. extendStatics = Object.setPrototypeOf ||
  40799. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40800. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40801. return extendStatics(d, b);
  40802. };
  40803. return function (d, b) {
  40804. extendStatics(d, b);
  40805. function __() { this.constructor = d; }
  40806. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40807. };
  40808. })();
  40809. var private_channel_PrivateChannel = (function (_super) {
  40810. private_channel_extends(PrivateChannel, _super);
  40811. function PrivateChannel() {
  40812. return _super !== null && _super.apply(this, arguments) || this;
  40813. }
  40814. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40815. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40816. return authorizer.authorize(socketId, callback);
  40817. };
  40818. return PrivateChannel;
  40819. }(channels_channel));
  40820. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40821. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40822. var members_Members = (function () {
  40823. function Members() {
  40824. this.reset();
  40825. }
  40826. Members.prototype.get = function (id) {
  40827. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40828. return {
  40829. id: id,
  40830. info: this.members[id]
  40831. };
  40832. }
  40833. else {
  40834. return null;
  40835. }
  40836. };
  40837. Members.prototype.each = function (callback) {
  40838. var _this = this;
  40839. objectApply(this.members, function (member, id) {
  40840. callback(_this.get(id));
  40841. });
  40842. };
  40843. Members.prototype.setMyID = function (id) {
  40844. this.myID = id;
  40845. };
  40846. Members.prototype.onSubscription = function (subscriptionData) {
  40847. this.members = subscriptionData.presence.hash;
  40848. this.count = subscriptionData.presence.count;
  40849. this.me = this.get(this.myID);
  40850. };
  40851. Members.prototype.addMember = function (memberData) {
  40852. if (this.get(memberData.user_id) === null) {
  40853. this.count++;
  40854. }
  40855. this.members[memberData.user_id] = memberData.user_info;
  40856. return this.get(memberData.user_id);
  40857. };
  40858. Members.prototype.removeMember = function (memberData) {
  40859. var member = this.get(memberData.user_id);
  40860. if (member) {
  40861. delete this.members[memberData.user_id];
  40862. this.count--;
  40863. }
  40864. return member;
  40865. };
  40866. Members.prototype.reset = function () {
  40867. this.members = {};
  40868. this.count = 0;
  40869. this.myID = null;
  40870. this.me = null;
  40871. };
  40872. return Members;
  40873. }());
  40874. /* harmony default export */ var members = (members_Members);
  40875. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40876. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40877. var extendStatics = function (d, b) {
  40878. extendStatics = Object.setPrototypeOf ||
  40879. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40880. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40881. return extendStatics(d, b);
  40882. };
  40883. return function (d, b) {
  40884. extendStatics(d, b);
  40885. function __() { this.constructor = d; }
  40886. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40887. };
  40888. })();
  40889. var presence_channel_PresenceChannel = (function (_super) {
  40890. presence_channel_extends(PresenceChannel, _super);
  40891. function PresenceChannel(name, pusher) {
  40892. var _this = _super.call(this, name, pusher) || this;
  40893. _this.members = new members();
  40894. return _this;
  40895. }
  40896. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40897. var _this = this;
  40898. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40899. if (!error) {
  40900. if (authData.channel_data === undefined) {
  40901. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40902. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40903. ("expected 'channel_data' field. " + suffix));
  40904. callback("Invalid auth response");
  40905. return;
  40906. }
  40907. var channelData = JSON.parse(authData.channel_data);
  40908. _this.members.setMyID(channelData.user_id);
  40909. }
  40910. callback(error, authData);
  40911. });
  40912. };
  40913. PresenceChannel.prototype.handleEvent = function (event) {
  40914. var eventName = event.event;
  40915. if (eventName.indexOf("pusher_internal:") === 0) {
  40916. this.handleInternalEvent(event);
  40917. }
  40918. else {
  40919. var data = event.data;
  40920. var metadata = {};
  40921. if (event.user_id) {
  40922. metadata.user_id = event.user_id;
  40923. }
  40924. this.emit(eventName, data, metadata);
  40925. }
  40926. };
  40927. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40928. var eventName = event.event;
  40929. var data = event.data;
  40930. switch (eventName) {
  40931. case "pusher_internal:subscription_succeeded":
  40932. this.handleSubscriptionSucceededEvent(event);
  40933. break;
  40934. case "pusher_internal:member_added":
  40935. var addedMember = this.members.addMember(data);
  40936. this.emit('pusher:member_added', addedMember);
  40937. break;
  40938. case "pusher_internal:member_removed":
  40939. var removedMember = this.members.removeMember(data);
  40940. if (removedMember) {
  40941. this.emit('pusher:member_removed', removedMember);
  40942. }
  40943. break;
  40944. }
  40945. };
  40946. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40947. this.subscriptionPending = false;
  40948. this.subscribed = true;
  40949. if (this.subscriptionCancelled) {
  40950. this.pusher.unsubscribe(this.name);
  40951. }
  40952. else {
  40953. this.members.onSubscription(event.data);
  40954. this.emit("pusher:subscription_succeeded", this.members);
  40955. }
  40956. };
  40957. PresenceChannel.prototype.disconnect = function () {
  40958. this.members.reset();
  40959. _super.prototype.disconnect.call(this);
  40960. };
  40961. return PresenceChannel;
  40962. }(private_channel));
  40963. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40964. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40965. var nacl_fast = __webpack_require__(0);
  40966. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40967. var nacl_util = __webpack_require__(1);
  40968. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40969. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40970. var extendStatics = function (d, b) {
  40971. extendStatics = Object.setPrototypeOf ||
  40972. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40973. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40974. return extendStatics(d, b);
  40975. };
  40976. return function (d, b) {
  40977. extendStatics(d, b);
  40978. function __() { this.constructor = d; }
  40979. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40980. };
  40981. })();
  40982. var encrypted_channel_EncryptedChannel = (function (_super) {
  40983. encrypted_channel_extends(EncryptedChannel, _super);
  40984. function EncryptedChannel() {
  40985. var _this = _super !== null && _super.apply(this, arguments) || this;
  40986. _this.key = null;
  40987. return _this;
  40988. }
  40989. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40990. var _this = this;
  40991. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40992. if (error) {
  40993. callback(true, authData);
  40994. return;
  40995. }
  40996. var sharedSecret = authData["shared_secret"];
  40997. if (!sharedSecret) {
  40998. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40999. callback(true, errorMsg);
  41000. return;
  41001. }
  41002. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41003. delete authData["shared_secret"];
  41004. callback(false, authData);
  41005. });
  41006. };
  41007. EncryptedChannel.prototype.trigger = function (event, data) {
  41008. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41009. };
  41010. EncryptedChannel.prototype.handleEvent = function (event) {
  41011. var eventName = event.event;
  41012. var data = event.data;
  41013. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41014. _super.prototype.handleEvent.call(this, event);
  41015. return;
  41016. }
  41017. this.handleEncryptedEvent(eventName, data);
  41018. };
  41019. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41020. var _this = this;
  41021. if (!this.key) {
  41022. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41023. return;
  41024. }
  41025. if (!data.ciphertext || !data.nonce) {
  41026. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41027. return;
  41028. }
  41029. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41030. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41031. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41032. return;
  41033. }
  41034. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41035. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41036. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41037. return;
  41038. }
  41039. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41040. if (bytes === null) {
  41041. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41042. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41043. if (error) {
  41044. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41045. return;
  41046. }
  41047. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41048. if (bytes === null) {
  41049. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41050. return;
  41051. }
  41052. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41053. return;
  41054. });
  41055. return;
  41056. }
  41057. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41058. };
  41059. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41060. try {
  41061. this.emit(eventName, JSON.parse(data));
  41062. }
  41063. catch (e) {
  41064. this.emit(eventName, data);
  41065. }
  41066. return this;
  41067. };
  41068. return EncryptedChannel;
  41069. }(private_channel));
  41070. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41071. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41072. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41073. var extendStatics = function (d, b) {
  41074. extendStatics = Object.setPrototypeOf ||
  41075. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41076. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41077. return extendStatics(d, b);
  41078. };
  41079. return function (d, b) {
  41080. extendStatics(d, b);
  41081. function __() { this.constructor = d; }
  41082. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41083. };
  41084. })();
  41085. var connection_manager_ConnectionManager = (function (_super) {
  41086. connection_manager_extends(ConnectionManager, _super);
  41087. function ConnectionManager(key, options) {
  41088. var _this = _super.call(this) || this;
  41089. _this.key = key;
  41090. _this.options = options || {};
  41091. _this.state = "initialized";
  41092. _this.connection = null;
  41093. _this.usingTLS = !!options.useTLS;
  41094. _this.timeline = _this.options.timeline;
  41095. _this.errorCallbacks = _this.buildErrorCallbacks();
  41096. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41097. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41098. var Network = runtime.getNetwork();
  41099. Network.bind("online", function () {
  41100. _this.timeline.info({ netinfo: "online" });
  41101. if (_this.state === "connecting" || _this.state === "unavailable") {
  41102. _this.retryIn(0);
  41103. }
  41104. });
  41105. Network.bind("offline", function () {
  41106. _this.timeline.info({ netinfo: "offline" });
  41107. if (_this.connection) {
  41108. _this.sendActivityCheck();
  41109. }
  41110. });
  41111. _this.updateStrategy();
  41112. return _this;
  41113. }
  41114. ConnectionManager.prototype.connect = function () {
  41115. if (this.connection || this.runner) {
  41116. return;
  41117. }
  41118. if (!this.strategy.isSupported()) {
  41119. this.updateState("failed");
  41120. return;
  41121. }
  41122. this.updateState("connecting");
  41123. this.startConnecting();
  41124. this.setUnavailableTimer();
  41125. };
  41126. ;
  41127. ConnectionManager.prototype.send = function (data) {
  41128. if (this.connection) {
  41129. return this.connection.send(data);
  41130. }
  41131. else {
  41132. return false;
  41133. }
  41134. };
  41135. ;
  41136. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41137. if (this.connection) {
  41138. return this.connection.send_event(name, data, channel);
  41139. }
  41140. else {
  41141. return false;
  41142. }
  41143. };
  41144. ;
  41145. ConnectionManager.prototype.disconnect = function () {
  41146. this.disconnectInternally();
  41147. this.updateState("disconnected");
  41148. };
  41149. ;
  41150. ConnectionManager.prototype.isUsingTLS = function () {
  41151. return this.usingTLS;
  41152. };
  41153. ;
  41154. ConnectionManager.prototype.startConnecting = function () {
  41155. var _this = this;
  41156. var callback = function (error, handshake) {
  41157. if (error) {
  41158. _this.runner = _this.strategy.connect(0, callback);
  41159. }
  41160. else {
  41161. if (handshake.action === "error") {
  41162. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41163. _this.timeline.error({ handshakeError: handshake.error });
  41164. }
  41165. else {
  41166. _this.abortConnecting();
  41167. _this.handshakeCallbacks[handshake.action](handshake);
  41168. }
  41169. }
  41170. };
  41171. this.runner = this.strategy.connect(0, callback);
  41172. };
  41173. ;
  41174. ConnectionManager.prototype.abortConnecting = function () {
  41175. if (this.runner) {
  41176. this.runner.abort();
  41177. this.runner = null;
  41178. }
  41179. };
  41180. ;
  41181. ConnectionManager.prototype.disconnectInternally = function () {
  41182. this.abortConnecting();
  41183. this.clearRetryTimer();
  41184. this.clearUnavailableTimer();
  41185. if (this.connection) {
  41186. var connection = this.abandonConnection();
  41187. connection.close();
  41188. }
  41189. };
  41190. ;
  41191. ConnectionManager.prototype.updateStrategy = function () {
  41192. this.strategy = this.options.getStrategy({
  41193. key: this.key,
  41194. timeline: this.timeline,
  41195. useTLS: this.usingTLS
  41196. });
  41197. };
  41198. ;
  41199. ConnectionManager.prototype.retryIn = function (delay) {
  41200. var _this = this;
  41201. this.timeline.info({ action: "retry", delay: delay });
  41202. if (delay > 0) {
  41203. this.emit("connecting_in", Math.round(delay / 1000));
  41204. }
  41205. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41206. _this.disconnectInternally();
  41207. _this.connect();
  41208. });
  41209. };
  41210. ;
  41211. ConnectionManager.prototype.clearRetryTimer = function () {
  41212. if (this.retryTimer) {
  41213. this.retryTimer.ensureAborted();
  41214. this.retryTimer = null;
  41215. }
  41216. };
  41217. ;
  41218. ConnectionManager.prototype.setUnavailableTimer = function () {
  41219. var _this = this;
  41220. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41221. _this.updateState("unavailable");
  41222. });
  41223. };
  41224. ;
  41225. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41226. if (this.unavailableTimer) {
  41227. this.unavailableTimer.ensureAborted();
  41228. }
  41229. };
  41230. ;
  41231. ConnectionManager.prototype.sendActivityCheck = function () {
  41232. var _this = this;
  41233. this.stopActivityCheck();
  41234. this.connection.ping();
  41235. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41236. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41237. _this.retryIn(0);
  41238. });
  41239. };
  41240. ;
  41241. ConnectionManager.prototype.resetActivityCheck = function () {
  41242. var _this = this;
  41243. this.stopActivityCheck();
  41244. if (this.connection && !this.connection.handlesActivityChecks()) {
  41245. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41246. _this.sendActivityCheck();
  41247. });
  41248. }
  41249. };
  41250. ;
  41251. ConnectionManager.prototype.stopActivityCheck = function () {
  41252. if (this.activityTimer) {
  41253. this.activityTimer.ensureAborted();
  41254. }
  41255. };
  41256. ;
  41257. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41258. var _this = this;
  41259. return extend({}, errorCallbacks, {
  41260. message: function (message) {
  41261. _this.resetActivityCheck();
  41262. _this.emit('message', message);
  41263. },
  41264. ping: function () {
  41265. _this.send_event('pusher:pong', {});
  41266. },
  41267. activity: function () {
  41268. _this.resetActivityCheck();
  41269. },
  41270. error: function (error) {
  41271. _this.emit("error", { type: "WebSocketError", error: error });
  41272. },
  41273. closed: function () {
  41274. _this.abandonConnection();
  41275. if (_this.shouldRetry()) {
  41276. _this.retryIn(1000);
  41277. }
  41278. }
  41279. });
  41280. };
  41281. ;
  41282. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41283. var _this = this;
  41284. return extend({}, errorCallbacks, {
  41285. connected: function (handshake) {
  41286. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41287. _this.clearUnavailableTimer();
  41288. _this.setConnection(handshake.connection);
  41289. _this.socket_id = _this.connection.id;
  41290. _this.updateState("connected", { socket_id: _this.socket_id });
  41291. }
  41292. });
  41293. };
  41294. ;
  41295. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41296. var _this = this;
  41297. var withErrorEmitted = function (callback) {
  41298. return function (result) {
  41299. if (result.error) {
  41300. _this.emit("error", { type: "WebSocketError", error: result.error });
  41301. }
  41302. callback(result);
  41303. };
  41304. };
  41305. return {
  41306. tls_only: withErrorEmitted(function () {
  41307. _this.usingTLS = true;
  41308. _this.updateStrategy();
  41309. _this.retryIn(0);
  41310. }),
  41311. refused: withErrorEmitted(function () {
  41312. _this.disconnect();
  41313. }),
  41314. backoff: withErrorEmitted(function () {
  41315. _this.retryIn(1000);
  41316. }),
  41317. retry: withErrorEmitted(function () {
  41318. _this.retryIn(0);
  41319. })
  41320. };
  41321. };
  41322. ;
  41323. ConnectionManager.prototype.setConnection = function (connection) {
  41324. this.connection = connection;
  41325. for (var event in this.connectionCallbacks) {
  41326. this.connection.bind(event, this.connectionCallbacks[event]);
  41327. }
  41328. this.resetActivityCheck();
  41329. };
  41330. ;
  41331. ConnectionManager.prototype.abandonConnection = function () {
  41332. if (!this.connection) {
  41333. return;
  41334. }
  41335. this.stopActivityCheck();
  41336. for (var event in this.connectionCallbacks) {
  41337. this.connection.unbind(event, this.connectionCallbacks[event]);
  41338. }
  41339. var connection = this.connection;
  41340. this.connection = null;
  41341. return connection;
  41342. };
  41343. ConnectionManager.prototype.updateState = function (newState, data) {
  41344. var previousState = this.state;
  41345. this.state = newState;
  41346. if (previousState !== newState) {
  41347. var newStateDescription = newState;
  41348. if (newStateDescription === "connected") {
  41349. newStateDescription += " with new socket ID " + data.socket_id;
  41350. }
  41351. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41352. this.timeline.info({ state: newState, params: data });
  41353. this.emit('state_change', { previous: previousState, current: newState });
  41354. this.emit(newState, data);
  41355. }
  41356. };
  41357. ConnectionManager.prototype.shouldRetry = function () {
  41358. return this.state === "connecting" || this.state === "connected";
  41359. };
  41360. return ConnectionManager;
  41361. }(dispatcher));
  41362. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41363. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41364. var channels_Channels = (function () {
  41365. function Channels() {
  41366. this.channels = {};
  41367. }
  41368. Channels.prototype.add = function (name, pusher) {
  41369. if (!this.channels[name]) {
  41370. this.channels[name] = createChannel(name, pusher);
  41371. }
  41372. return this.channels[name];
  41373. };
  41374. Channels.prototype.all = function () {
  41375. return values(this.channels);
  41376. };
  41377. Channels.prototype.find = function (name) {
  41378. return this.channels[name];
  41379. };
  41380. Channels.prototype.remove = function (name) {
  41381. var channel = this.channels[name];
  41382. delete this.channels[name];
  41383. return channel;
  41384. };
  41385. Channels.prototype.disconnect = function () {
  41386. objectApply(this.channels, function (channel) {
  41387. channel.disconnect();
  41388. });
  41389. };
  41390. return Channels;
  41391. }());
  41392. /* harmony default export */ var channels = (channels_Channels);
  41393. function createChannel(name, pusher) {
  41394. if (name.indexOf('private-encrypted-') === 0) {
  41395. if (false) { var errorMsg; }
  41396. return factory.createEncryptedChannel(name, pusher);
  41397. }
  41398. else if (name.indexOf('private-') === 0) {
  41399. return factory.createPrivateChannel(name, pusher);
  41400. }
  41401. else if (name.indexOf('presence-') === 0) {
  41402. return factory.createPresenceChannel(name, pusher);
  41403. }
  41404. else {
  41405. return factory.createChannel(name, pusher);
  41406. }
  41407. }
  41408. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41409. var Factory = {
  41410. createChannels: function () {
  41411. return new channels();
  41412. },
  41413. createConnectionManager: function (key, options) {
  41414. return new connection_manager(key, options);
  41415. },
  41416. createChannel: function (name, pusher) {
  41417. return new channels_channel(name, pusher);
  41418. },
  41419. createPrivateChannel: function (name, pusher) {
  41420. return new private_channel(name, pusher);
  41421. },
  41422. createPresenceChannel: function (name, pusher) {
  41423. return new presence_channel(name, pusher);
  41424. },
  41425. createEncryptedChannel: function (name, pusher) {
  41426. return new encrypted_channel(name, pusher);
  41427. },
  41428. createTimelineSender: function (timeline, options) {
  41429. return new timeline_sender(timeline, options);
  41430. },
  41431. createAuthorizer: function (channel, options) {
  41432. if (options.authorizer) {
  41433. return options.authorizer(channel, options);
  41434. }
  41435. return new pusher_authorizer(channel, options);
  41436. },
  41437. createHandshake: function (transport, callback) {
  41438. return new connection_handshake(transport, callback);
  41439. },
  41440. createAssistantToTheTransportManager: function (manager, transport, options) {
  41441. return new assistant_to_the_transport_manager(manager, transport, options);
  41442. }
  41443. };
  41444. /* harmony default export */ var factory = (Factory);
  41445. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41446. var transport_manager_TransportManager = (function () {
  41447. function TransportManager(options) {
  41448. this.options = options || {};
  41449. this.livesLeft = this.options.lives || Infinity;
  41450. }
  41451. TransportManager.prototype.getAssistant = function (transport) {
  41452. return factory.createAssistantToTheTransportManager(this, transport, {
  41453. minPingDelay: this.options.minPingDelay,
  41454. maxPingDelay: this.options.maxPingDelay
  41455. });
  41456. };
  41457. TransportManager.prototype.isAlive = function () {
  41458. return this.livesLeft > 0;
  41459. };
  41460. TransportManager.prototype.reportDeath = function () {
  41461. this.livesLeft -= 1;
  41462. };
  41463. return TransportManager;
  41464. }());
  41465. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41466. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41467. var sequential_strategy_SequentialStrategy = (function () {
  41468. function SequentialStrategy(strategies, options) {
  41469. this.strategies = strategies;
  41470. this.loop = Boolean(options.loop);
  41471. this.failFast = Boolean(options.failFast);
  41472. this.timeout = options.timeout;
  41473. this.timeoutLimit = options.timeoutLimit;
  41474. }
  41475. SequentialStrategy.prototype.isSupported = function () {
  41476. return any(this.strategies, util.method("isSupported"));
  41477. };
  41478. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41479. var _this = this;
  41480. var strategies = this.strategies;
  41481. var current = 0;
  41482. var timeout = this.timeout;
  41483. var runner = null;
  41484. var tryNextStrategy = function (error, handshake) {
  41485. if (handshake) {
  41486. callback(null, handshake);
  41487. }
  41488. else {
  41489. current = current + 1;
  41490. if (_this.loop) {
  41491. current = current % strategies.length;
  41492. }
  41493. if (current < strategies.length) {
  41494. if (timeout) {
  41495. timeout = timeout * 2;
  41496. if (_this.timeoutLimit) {
  41497. timeout = Math.min(timeout, _this.timeoutLimit);
  41498. }
  41499. }
  41500. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41501. }
  41502. else {
  41503. callback(true);
  41504. }
  41505. }
  41506. };
  41507. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41508. return {
  41509. abort: function () {
  41510. runner.abort();
  41511. },
  41512. forceMinPriority: function (p) {
  41513. minPriority = p;
  41514. if (runner) {
  41515. runner.forceMinPriority(p);
  41516. }
  41517. }
  41518. };
  41519. };
  41520. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41521. var timer = null;
  41522. var runner = null;
  41523. if (options.timeout > 0) {
  41524. timer = new OneOffTimer(options.timeout, function () {
  41525. runner.abort();
  41526. callback(true);
  41527. });
  41528. }
  41529. runner = strategy.connect(minPriority, function (error, handshake) {
  41530. if (error && timer && timer.isRunning() && !options.failFast) {
  41531. return;
  41532. }
  41533. if (timer) {
  41534. timer.ensureAborted();
  41535. }
  41536. callback(error, handshake);
  41537. });
  41538. return {
  41539. abort: function () {
  41540. if (timer) {
  41541. timer.ensureAborted();
  41542. }
  41543. runner.abort();
  41544. },
  41545. forceMinPriority: function (p) {
  41546. runner.forceMinPriority(p);
  41547. }
  41548. };
  41549. };
  41550. return SequentialStrategy;
  41551. }());
  41552. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41553. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41554. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41555. function BestConnectedEverStrategy(strategies) {
  41556. this.strategies = strategies;
  41557. }
  41558. BestConnectedEverStrategy.prototype.isSupported = function () {
  41559. return any(this.strategies, util.method("isSupported"));
  41560. };
  41561. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41562. return connect(this.strategies, minPriority, function (i, runners) {
  41563. return function (error, handshake) {
  41564. runners[i].error = error;
  41565. if (error) {
  41566. if (allRunnersFailed(runners)) {
  41567. callback(true);
  41568. }
  41569. return;
  41570. }
  41571. apply(runners, function (runner) {
  41572. runner.forceMinPriority(handshake.transport.priority);
  41573. });
  41574. callback(null, handshake);
  41575. };
  41576. });
  41577. };
  41578. return BestConnectedEverStrategy;
  41579. }());
  41580. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41581. function connect(strategies, minPriority, callbackBuilder) {
  41582. var runners = map(strategies, function (strategy, i, _, rs) {
  41583. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41584. });
  41585. return {
  41586. abort: function () {
  41587. apply(runners, abortRunner);
  41588. },
  41589. forceMinPriority: function (p) {
  41590. apply(runners, function (runner) {
  41591. runner.forceMinPriority(p);
  41592. });
  41593. }
  41594. };
  41595. }
  41596. function allRunnersFailed(runners) {
  41597. return collections_all(runners, function (runner) {
  41598. return Boolean(runner.error);
  41599. });
  41600. }
  41601. function abortRunner(runner) {
  41602. if (!runner.error && !runner.aborted) {
  41603. runner.abort();
  41604. runner.aborted = true;
  41605. }
  41606. }
  41607. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41608. var cached_strategy_CachedStrategy = (function () {
  41609. function CachedStrategy(strategy, transports, options) {
  41610. this.strategy = strategy;
  41611. this.transports = transports;
  41612. this.ttl = options.ttl || 1800 * 1000;
  41613. this.usingTLS = options.useTLS;
  41614. this.timeline = options.timeline;
  41615. }
  41616. CachedStrategy.prototype.isSupported = function () {
  41617. return this.strategy.isSupported();
  41618. };
  41619. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41620. var usingTLS = this.usingTLS;
  41621. var info = fetchTransportCache(usingTLS);
  41622. var strategies = [this.strategy];
  41623. if (info && info.timestamp + this.ttl >= util.now()) {
  41624. var transport = this.transports[info.transport];
  41625. if (transport) {
  41626. this.timeline.info({
  41627. cached: true,
  41628. transport: info.transport,
  41629. latency: info.latency
  41630. });
  41631. strategies.push(new sequential_strategy([transport], {
  41632. timeout: info.latency * 2 + 1000,
  41633. failFast: true
  41634. }));
  41635. }
  41636. }
  41637. var startTimestamp = util.now();
  41638. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41639. if (error) {
  41640. flushTransportCache(usingTLS);
  41641. if (strategies.length > 0) {
  41642. startTimestamp = util.now();
  41643. runner = strategies.pop().connect(minPriority, cb);
  41644. }
  41645. else {
  41646. callback(error);
  41647. }
  41648. }
  41649. else {
  41650. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41651. callback(null, handshake);
  41652. }
  41653. });
  41654. return {
  41655. abort: function () {
  41656. runner.abort();
  41657. },
  41658. forceMinPriority: function (p) {
  41659. minPriority = p;
  41660. if (runner) {
  41661. runner.forceMinPriority(p);
  41662. }
  41663. }
  41664. };
  41665. };
  41666. return CachedStrategy;
  41667. }());
  41668. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41669. function getTransportCacheKey(usingTLS) {
  41670. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41671. }
  41672. function fetchTransportCache(usingTLS) {
  41673. var storage = runtime.getLocalStorage();
  41674. if (storage) {
  41675. try {
  41676. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41677. if (serializedCache) {
  41678. return JSON.parse(serializedCache);
  41679. }
  41680. }
  41681. catch (e) {
  41682. flushTransportCache(usingTLS);
  41683. }
  41684. }
  41685. return null;
  41686. }
  41687. function storeTransportCache(usingTLS, transport, latency) {
  41688. var storage = runtime.getLocalStorage();
  41689. if (storage) {
  41690. try {
  41691. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41692. timestamp: util.now(),
  41693. transport: transport,
  41694. latency: latency
  41695. });
  41696. }
  41697. catch (e) {
  41698. }
  41699. }
  41700. }
  41701. function flushTransportCache(usingTLS) {
  41702. var storage = runtime.getLocalStorage();
  41703. if (storage) {
  41704. try {
  41705. delete storage[getTransportCacheKey(usingTLS)];
  41706. }
  41707. catch (e) {
  41708. }
  41709. }
  41710. }
  41711. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41712. var delayed_strategy_DelayedStrategy = (function () {
  41713. function DelayedStrategy(strategy, _a) {
  41714. var number = _a.delay;
  41715. this.strategy = strategy;
  41716. this.options = { delay: number };
  41717. }
  41718. DelayedStrategy.prototype.isSupported = function () {
  41719. return this.strategy.isSupported();
  41720. };
  41721. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41722. var strategy = this.strategy;
  41723. var runner;
  41724. var timer = new OneOffTimer(this.options.delay, function () {
  41725. runner = strategy.connect(minPriority, callback);
  41726. });
  41727. return {
  41728. abort: function () {
  41729. timer.ensureAborted();
  41730. if (runner) {
  41731. runner.abort();
  41732. }
  41733. },
  41734. forceMinPriority: function (p) {
  41735. minPriority = p;
  41736. if (runner) {
  41737. runner.forceMinPriority(p);
  41738. }
  41739. }
  41740. };
  41741. };
  41742. return DelayedStrategy;
  41743. }());
  41744. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41745. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41746. var IfStrategy = (function () {
  41747. function IfStrategy(test, trueBranch, falseBranch) {
  41748. this.test = test;
  41749. this.trueBranch = trueBranch;
  41750. this.falseBranch = falseBranch;
  41751. }
  41752. IfStrategy.prototype.isSupported = function () {
  41753. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41754. return branch.isSupported();
  41755. };
  41756. IfStrategy.prototype.connect = function (minPriority, callback) {
  41757. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41758. return branch.connect(minPriority, callback);
  41759. };
  41760. return IfStrategy;
  41761. }());
  41762. /* harmony default export */ var if_strategy = (IfStrategy);
  41763. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41764. var FirstConnectedStrategy = (function () {
  41765. function FirstConnectedStrategy(strategy) {
  41766. this.strategy = strategy;
  41767. }
  41768. FirstConnectedStrategy.prototype.isSupported = function () {
  41769. return this.strategy.isSupported();
  41770. };
  41771. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41772. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41773. if (handshake) {
  41774. runner.abort();
  41775. }
  41776. callback(error, handshake);
  41777. });
  41778. return runner;
  41779. };
  41780. return FirstConnectedStrategy;
  41781. }());
  41782. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41783. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41784. function testSupportsStrategy(strategy) {
  41785. return function () {
  41786. return strategy.isSupported();
  41787. };
  41788. }
  41789. var getDefaultStrategy = function (config, defineTransport) {
  41790. var definedTransports = {};
  41791. function defineTransportStrategy(name, type, priority, options, manager) {
  41792. var transport = defineTransport(config, name, type, priority, options, manager);
  41793. definedTransports[name] = transport;
  41794. return transport;
  41795. }
  41796. var ws_options = {
  41797. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41798. hostTLS: config.wsHost + ":" + config.wssPort,
  41799. httpPath: config.wsPath
  41800. };
  41801. var wss_options = extend({}, ws_options, {
  41802. useTLS: true
  41803. });
  41804. var sockjs_options = {
  41805. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41806. hostTLS: config.httpHost + ":" + config.httpsPort,
  41807. httpPath: config.httpPath
  41808. };
  41809. var timeouts = {
  41810. loop: true,
  41811. timeout: 15000,
  41812. timeoutLimit: 60000
  41813. };
  41814. var ws_manager = new transport_manager({
  41815. lives: 2,
  41816. minPingDelay: 10000,
  41817. maxPingDelay: config.activity_timeout
  41818. });
  41819. var streaming_manager = new transport_manager({
  41820. lives: 2,
  41821. minPingDelay: 10000,
  41822. maxPingDelay: config.activity_timeout
  41823. });
  41824. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41825. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41826. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41827. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41828. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41829. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41830. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41831. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41832. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41833. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41834. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41835. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41836. 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);
  41837. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41838. var wsStrategy;
  41839. if (config.useTLS) {
  41840. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41841. }
  41842. else {
  41843. wsStrategy = new best_connected_ever_strategy([
  41844. ws_loop,
  41845. new delayed_strategy(wss_loop, { delay: 2000 }),
  41846. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41847. ]);
  41848. }
  41849. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41850. ttl: 1800000,
  41851. timeline: config.timeline,
  41852. useTLS: config.useTLS
  41853. });
  41854. };
  41855. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41856. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41857. /* harmony default export */ var transport_connection_initializer = (function () {
  41858. var self = this;
  41859. self.timeline.info(self.buildTimelineMessage({
  41860. transport: self.name + (self.options.useTLS ? "s" : "")
  41861. }));
  41862. if (self.hooks.isInitialized()) {
  41863. self.changeState("initialized");
  41864. }
  41865. else if (self.hooks.file) {
  41866. self.changeState("initializing");
  41867. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41868. if (self.hooks.isInitialized()) {
  41869. self.changeState("initialized");
  41870. callback(true);
  41871. }
  41872. else {
  41873. if (error) {
  41874. self.onError(error);
  41875. }
  41876. self.onClose();
  41877. callback(false);
  41878. }
  41879. });
  41880. }
  41881. else {
  41882. self.onClose();
  41883. }
  41884. });
  41885. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41886. var http_xdomain_request_hooks = {
  41887. getRequest: function (socket) {
  41888. var xdr = new window.XDomainRequest();
  41889. xdr.ontimeout = function () {
  41890. socket.emit("error", new RequestTimedOut());
  41891. socket.close();
  41892. };
  41893. xdr.onerror = function (e) {
  41894. socket.emit("error", e);
  41895. socket.close();
  41896. };
  41897. xdr.onprogress = function () {
  41898. if (xdr.responseText && xdr.responseText.length > 0) {
  41899. socket.onChunk(200, xdr.responseText);
  41900. }
  41901. };
  41902. xdr.onload = function () {
  41903. if (xdr.responseText && xdr.responseText.length > 0) {
  41904. socket.onChunk(200, xdr.responseText);
  41905. }
  41906. socket.emit("finished", 200);
  41907. socket.close();
  41908. };
  41909. return xdr;
  41910. },
  41911. abortRequest: function (xdr) {
  41912. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41913. xdr.abort();
  41914. }
  41915. };
  41916. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41917. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41918. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41919. var extendStatics = function (d, b) {
  41920. extendStatics = Object.setPrototypeOf ||
  41921. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41922. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41923. return extendStatics(d, b);
  41924. };
  41925. return function (d, b) {
  41926. extendStatics(d, b);
  41927. function __() { this.constructor = d; }
  41928. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41929. };
  41930. })();
  41931. var MAX_BUFFER_LENGTH = 256 * 1024;
  41932. var http_request_HTTPRequest = (function (_super) {
  41933. http_request_extends(HTTPRequest, _super);
  41934. function HTTPRequest(hooks, method, url) {
  41935. var _this = _super.call(this) || this;
  41936. _this.hooks = hooks;
  41937. _this.method = method;
  41938. _this.url = url;
  41939. return _this;
  41940. }
  41941. HTTPRequest.prototype.start = function (payload) {
  41942. var _this = this;
  41943. this.position = 0;
  41944. this.xhr = this.hooks.getRequest(this);
  41945. this.unloader = function () {
  41946. _this.close();
  41947. };
  41948. runtime.addUnloadListener(this.unloader);
  41949. this.xhr.open(this.method, this.url, true);
  41950. if (this.xhr.setRequestHeader) {
  41951. this.xhr.setRequestHeader("Content-Type", "application/json");
  41952. }
  41953. this.xhr.send(payload);
  41954. };
  41955. HTTPRequest.prototype.close = function () {
  41956. if (this.unloader) {
  41957. runtime.removeUnloadListener(this.unloader);
  41958. this.unloader = null;
  41959. }
  41960. if (this.xhr) {
  41961. this.hooks.abortRequest(this.xhr);
  41962. this.xhr = null;
  41963. }
  41964. };
  41965. HTTPRequest.prototype.onChunk = function (status, data) {
  41966. while (true) {
  41967. var chunk = this.advanceBuffer(data);
  41968. if (chunk) {
  41969. this.emit("chunk", { status: status, data: chunk });
  41970. }
  41971. else {
  41972. break;
  41973. }
  41974. }
  41975. if (this.isBufferTooLong(data)) {
  41976. this.emit("buffer_too_long");
  41977. }
  41978. };
  41979. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41980. var unreadData = buffer.slice(this.position);
  41981. var endOfLinePosition = unreadData.indexOf("\n");
  41982. if (endOfLinePosition !== -1) {
  41983. this.position += endOfLinePosition + 1;
  41984. return unreadData.slice(0, endOfLinePosition);
  41985. }
  41986. else {
  41987. return null;
  41988. }
  41989. };
  41990. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41991. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41992. };
  41993. return HTTPRequest;
  41994. }(dispatcher));
  41995. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41996. // CONCATENATED MODULE: ./src/core/http/state.ts
  41997. var State;
  41998. (function (State) {
  41999. State[State["CONNECTING"] = 0] = "CONNECTING";
  42000. State[State["OPEN"] = 1] = "OPEN";
  42001. State[State["CLOSED"] = 3] = "CLOSED";
  42002. })(State || (State = {}));
  42003. /* harmony default export */ var state = (State);
  42004. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42005. var autoIncrement = 1;
  42006. var http_socket_HTTPSocket = (function () {
  42007. function HTTPSocket(hooks, url) {
  42008. this.hooks = hooks;
  42009. this.session = randomNumber(1000) + "/" + randomString(8);
  42010. this.location = getLocation(url);
  42011. this.readyState = state.CONNECTING;
  42012. this.openStream();
  42013. }
  42014. HTTPSocket.prototype.send = function (payload) {
  42015. return this.sendRaw(JSON.stringify([payload]));
  42016. };
  42017. HTTPSocket.prototype.ping = function () {
  42018. this.hooks.sendHeartbeat(this);
  42019. };
  42020. HTTPSocket.prototype.close = function (code, reason) {
  42021. this.onClose(code, reason, true);
  42022. };
  42023. HTTPSocket.prototype.sendRaw = function (payload) {
  42024. if (this.readyState === state.OPEN) {
  42025. try {
  42026. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42027. return true;
  42028. }
  42029. catch (e) {
  42030. return false;
  42031. }
  42032. }
  42033. else {
  42034. return false;
  42035. }
  42036. };
  42037. HTTPSocket.prototype.reconnect = function () {
  42038. this.closeStream();
  42039. this.openStream();
  42040. };
  42041. ;
  42042. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42043. this.closeStream();
  42044. this.readyState = state.CLOSED;
  42045. if (this.onclose) {
  42046. this.onclose({
  42047. code: code,
  42048. reason: reason,
  42049. wasClean: wasClean
  42050. });
  42051. }
  42052. };
  42053. HTTPSocket.prototype.onChunk = function (chunk) {
  42054. if (chunk.status !== 200) {
  42055. return;
  42056. }
  42057. if (this.readyState === state.OPEN) {
  42058. this.onActivity();
  42059. }
  42060. var payload;
  42061. var type = chunk.data.slice(0, 1);
  42062. switch (type) {
  42063. case 'o':
  42064. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42065. this.onOpen(payload);
  42066. break;
  42067. case 'a':
  42068. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42069. for (var i = 0; i < payload.length; i++) {
  42070. this.onEvent(payload[i]);
  42071. }
  42072. break;
  42073. case 'm':
  42074. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42075. this.onEvent(payload);
  42076. break;
  42077. case 'h':
  42078. this.hooks.onHeartbeat(this);
  42079. break;
  42080. case 'c':
  42081. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42082. this.onClose(payload[0], payload[1], true);
  42083. break;
  42084. }
  42085. };
  42086. HTTPSocket.prototype.onOpen = function (options) {
  42087. if (this.readyState === state.CONNECTING) {
  42088. if (options && options.hostname) {
  42089. this.location.base = replaceHost(this.location.base, options.hostname);
  42090. }
  42091. this.readyState = state.OPEN;
  42092. if (this.onopen) {
  42093. this.onopen();
  42094. }
  42095. }
  42096. else {
  42097. this.onClose(1006, "Server lost session", true);
  42098. }
  42099. };
  42100. HTTPSocket.prototype.onEvent = function (event) {
  42101. if (this.readyState === state.OPEN && this.onmessage) {
  42102. this.onmessage({ data: event });
  42103. }
  42104. };
  42105. HTTPSocket.prototype.onActivity = function () {
  42106. if (this.onactivity) {
  42107. this.onactivity();
  42108. }
  42109. };
  42110. HTTPSocket.prototype.onError = function (error) {
  42111. if (this.onerror) {
  42112. this.onerror(error);
  42113. }
  42114. };
  42115. HTTPSocket.prototype.openStream = function () {
  42116. var _this = this;
  42117. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42118. this.stream.bind("chunk", function (chunk) {
  42119. _this.onChunk(chunk);
  42120. });
  42121. this.stream.bind("finished", function (status) {
  42122. _this.hooks.onFinished(_this, status);
  42123. });
  42124. this.stream.bind("buffer_too_long", function () {
  42125. _this.reconnect();
  42126. });
  42127. try {
  42128. this.stream.start();
  42129. }
  42130. catch (error) {
  42131. util.defer(function () {
  42132. _this.onError(error);
  42133. _this.onClose(1006, "Could not start streaming", false);
  42134. });
  42135. }
  42136. };
  42137. HTTPSocket.prototype.closeStream = function () {
  42138. if (this.stream) {
  42139. this.stream.unbind_all();
  42140. this.stream.close();
  42141. this.stream = null;
  42142. }
  42143. };
  42144. return HTTPSocket;
  42145. }());
  42146. function getLocation(url) {
  42147. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42148. return {
  42149. base: parts[1],
  42150. queryString: parts[2]
  42151. };
  42152. }
  42153. function getSendURL(url, session) {
  42154. return url.base + "/" + session + "/xhr_send";
  42155. }
  42156. function getUniqueURL(url) {
  42157. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42158. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42159. }
  42160. function replaceHost(url, hostname) {
  42161. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42162. return urlParts[1] + hostname + urlParts[3];
  42163. }
  42164. function randomNumber(max) {
  42165. return Math.floor(Math.random() * max);
  42166. }
  42167. function randomString(length) {
  42168. var result = [];
  42169. for (var i = 0; i < length; i++) {
  42170. result.push(randomNumber(32).toString(32));
  42171. }
  42172. return result.join('');
  42173. }
  42174. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42175. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42176. var http_streaming_socket_hooks = {
  42177. getReceiveURL: function (url, session) {
  42178. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42179. },
  42180. onHeartbeat: function (socket) {
  42181. socket.sendRaw("[]");
  42182. },
  42183. sendHeartbeat: function (socket) {
  42184. socket.sendRaw("[]");
  42185. },
  42186. onFinished: function (socket, status) {
  42187. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42188. }
  42189. };
  42190. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42191. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42192. var http_polling_socket_hooks = {
  42193. getReceiveURL: function (url, session) {
  42194. return url.base + "/" + session + "/xhr" + url.queryString;
  42195. },
  42196. onHeartbeat: function () {
  42197. },
  42198. sendHeartbeat: function (socket) {
  42199. socket.sendRaw("[]");
  42200. },
  42201. onFinished: function (socket, status) {
  42202. if (status === 200) {
  42203. socket.reconnect();
  42204. }
  42205. else {
  42206. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42207. }
  42208. }
  42209. };
  42210. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42211. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42212. var http_xhr_request_hooks = {
  42213. getRequest: function (socket) {
  42214. var Constructor = runtime.getXHRAPI();
  42215. var xhr = new Constructor();
  42216. xhr.onreadystatechange = xhr.onprogress = function () {
  42217. switch (xhr.readyState) {
  42218. case 3:
  42219. if (xhr.responseText && xhr.responseText.length > 0) {
  42220. socket.onChunk(xhr.status, xhr.responseText);
  42221. }
  42222. break;
  42223. case 4:
  42224. if (xhr.responseText && xhr.responseText.length > 0) {
  42225. socket.onChunk(xhr.status, xhr.responseText);
  42226. }
  42227. socket.emit("finished", xhr.status);
  42228. socket.close();
  42229. break;
  42230. }
  42231. };
  42232. return xhr;
  42233. },
  42234. abortRequest: function (xhr) {
  42235. xhr.onreadystatechange = null;
  42236. xhr.abort();
  42237. }
  42238. };
  42239. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42240. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42241. var HTTP = {
  42242. createStreamingSocket: function (url) {
  42243. return this.createSocket(http_streaming_socket, url);
  42244. },
  42245. createPollingSocket: function (url) {
  42246. return this.createSocket(http_polling_socket, url);
  42247. },
  42248. createSocket: function (hooks, url) {
  42249. return new http_socket(hooks, url);
  42250. },
  42251. createXHR: function (method, url) {
  42252. return this.createRequest(http_xhr_request, method, url);
  42253. },
  42254. createRequest: function (hooks, method, url) {
  42255. return new http_request(hooks, method, url);
  42256. }
  42257. };
  42258. /* harmony default export */ var http_http = (HTTP);
  42259. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42260. http_http.createXDR = function (method, url) {
  42261. return this.createRequest(http_xdomain_request, method, url);
  42262. };
  42263. /* harmony default export */ var web_http_http = (http_http);
  42264. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42265. var Runtime = {
  42266. nextAuthCallbackID: 1,
  42267. auth_callbacks: {},
  42268. ScriptReceivers: ScriptReceivers,
  42269. DependenciesReceivers: DependenciesReceivers,
  42270. getDefaultStrategy: default_strategy,
  42271. Transports: transports_transports,
  42272. transportConnectionInitializer: transport_connection_initializer,
  42273. HTTPFactory: web_http_http,
  42274. TimelineTransport: jsonp_timeline,
  42275. getXHRAPI: function () {
  42276. return window.XMLHttpRequest;
  42277. },
  42278. getWebSocketAPI: function () {
  42279. return window.WebSocket || window.MozWebSocket;
  42280. },
  42281. setup: function (PusherClass) {
  42282. var _this = this;
  42283. window.Pusher = PusherClass;
  42284. var initializeOnDocumentBody = function () {
  42285. _this.onDocumentBody(PusherClass.ready);
  42286. };
  42287. if (!window.JSON) {
  42288. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42289. }
  42290. else {
  42291. initializeOnDocumentBody();
  42292. }
  42293. },
  42294. getDocument: function () {
  42295. return document;
  42296. },
  42297. getProtocol: function () {
  42298. return this.getDocument().location.protocol;
  42299. },
  42300. getAuthorizers: function () {
  42301. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42302. },
  42303. onDocumentBody: function (callback) {
  42304. var _this = this;
  42305. if (document.body) {
  42306. callback();
  42307. }
  42308. else {
  42309. setTimeout(function () {
  42310. _this.onDocumentBody(callback);
  42311. }, 0);
  42312. }
  42313. },
  42314. createJSONPRequest: function (url, data) {
  42315. return new jsonp_request(url, data);
  42316. },
  42317. createScriptRequest: function (src) {
  42318. return new script_request(src);
  42319. },
  42320. getLocalStorage: function () {
  42321. try {
  42322. return window.localStorage;
  42323. }
  42324. catch (e) {
  42325. return undefined;
  42326. }
  42327. },
  42328. createXHR: function () {
  42329. if (this.getXHRAPI()) {
  42330. return this.createXMLHttpRequest();
  42331. }
  42332. else {
  42333. return this.createMicrosoftXHR();
  42334. }
  42335. },
  42336. createXMLHttpRequest: function () {
  42337. var Constructor = this.getXHRAPI();
  42338. return new Constructor();
  42339. },
  42340. createMicrosoftXHR: function () {
  42341. return new ActiveXObject("Microsoft.XMLHTTP");
  42342. },
  42343. getNetwork: function () {
  42344. return net_info_Network;
  42345. },
  42346. createWebSocket: function (url) {
  42347. var Constructor = this.getWebSocketAPI();
  42348. return new Constructor(url);
  42349. },
  42350. createSocketRequest: function (method, url) {
  42351. if (this.isXHRSupported()) {
  42352. return this.HTTPFactory.createXHR(method, url);
  42353. }
  42354. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42355. return this.HTTPFactory.createXDR(method, url);
  42356. }
  42357. else {
  42358. throw "Cross-origin HTTP requests are not supported";
  42359. }
  42360. },
  42361. isXHRSupported: function () {
  42362. var Constructor = this.getXHRAPI();
  42363. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42364. },
  42365. isXDRSupported: function (useTLS) {
  42366. var protocol = useTLS ? "https:" : "http:";
  42367. var documentProtocol = this.getProtocol();
  42368. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42369. },
  42370. addUnloadListener: function (listener) {
  42371. if (window.addEventListener !== undefined) {
  42372. window.addEventListener("unload", listener, false);
  42373. }
  42374. else if (window.attachEvent !== undefined) {
  42375. window.attachEvent("onunload", listener);
  42376. }
  42377. },
  42378. removeUnloadListener: function (listener) {
  42379. if (window.addEventListener !== undefined) {
  42380. window.removeEventListener("unload", listener, false);
  42381. }
  42382. else if (window.detachEvent !== undefined) {
  42383. window.detachEvent("onunload", listener);
  42384. }
  42385. }
  42386. };
  42387. /* harmony default export */ var runtime = (Runtime);
  42388. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42389. var TimelineLevel;
  42390. (function (TimelineLevel) {
  42391. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42392. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42393. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42394. })(TimelineLevel || (TimelineLevel = {}));
  42395. /* harmony default export */ var timeline_level = (TimelineLevel);
  42396. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42397. var timeline_Timeline = (function () {
  42398. function Timeline(key, session, options) {
  42399. this.key = key;
  42400. this.session = session;
  42401. this.events = [];
  42402. this.options = options || {};
  42403. this.sent = 0;
  42404. this.uniqueID = 0;
  42405. }
  42406. Timeline.prototype.log = function (level, event) {
  42407. if (level <= this.options.level) {
  42408. this.events.push(extend({}, event, { timestamp: util.now() }));
  42409. if (this.options.limit && this.events.length > this.options.limit) {
  42410. this.events.shift();
  42411. }
  42412. }
  42413. };
  42414. Timeline.prototype.error = function (event) {
  42415. this.log(timeline_level.ERROR, event);
  42416. };
  42417. Timeline.prototype.info = function (event) {
  42418. this.log(timeline_level.INFO, event);
  42419. };
  42420. Timeline.prototype.debug = function (event) {
  42421. this.log(timeline_level.DEBUG, event);
  42422. };
  42423. Timeline.prototype.isEmpty = function () {
  42424. return this.events.length === 0;
  42425. };
  42426. Timeline.prototype.send = function (sendfn, callback) {
  42427. var _this = this;
  42428. var data = extend({
  42429. session: this.session,
  42430. bundle: this.sent + 1,
  42431. key: this.key,
  42432. lib: "js",
  42433. version: this.options.version,
  42434. cluster: this.options.cluster,
  42435. features: this.options.features,
  42436. timeline: this.events
  42437. }, this.options.params);
  42438. this.events = [];
  42439. sendfn(data, function (error, result) {
  42440. if (!error) {
  42441. _this.sent++;
  42442. }
  42443. if (callback) {
  42444. callback(error, result);
  42445. }
  42446. });
  42447. return true;
  42448. };
  42449. Timeline.prototype.generateUniqueID = function () {
  42450. this.uniqueID++;
  42451. return this.uniqueID;
  42452. };
  42453. return Timeline;
  42454. }());
  42455. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42456. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42457. var transport_strategy_TransportStrategy = (function () {
  42458. function TransportStrategy(name, priority, transport, options) {
  42459. this.name = name;
  42460. this.priority = priority;
  42461. this.transport = transport;
  42462. this.options = options || {};
  42463. }
  42464. TransportStrategy.prototype.isSupported = function () {
  42465. return this.transport.isSupported({
  42466. useTLS: this.options.useTLS
  42467. });
  42468. };
  42469. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42470. var _this = this;
  42471. if (!this.isSupported()) {
  42472. return failAttempt(new UnsupportedStrategy(), callback);
  42473. }
  42474. else if (this.priority < minPriority) {
  42475. return failAttempt(new TransportPriorityTooLow(), callback);
  42476. }
  42477. var connected = false;
  42478. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42479. var handshake = null;
  42480. var onInitialized = function () {
  42481. transport.unbind("initialized", onInitialized);
  42482. transport.connect();
  42483. };
  42484. var onOpen = function () {
  42485. handshake = factory.createHandshake(transport, function (result) {
  42486. connected = true;
  42487. unbindListeners();
  42488. callback(null, result);
  42489. });
  42490. };
  42491. var onError = function (error) {
  42492. unbindListeners();
  42493. callback(error);
  42494. };
  42495. var onClosed = function () {
  42496. unbindListeners();
  42497. var serializedTransport;
  42498. serializedTransport = safeJSONStringify(transport);
  42499. callback(new TransportClosed(serializedTransport));
  42500. };
  42501. var unbindListeners = function () {
  42502. transport.unbind("initialized", onInitialized);
  42503. transport.unbind("open", onOpen);
  42504. transport.unbind("error", onError);
  42505. transport.unbind("closed", onClosed);
  42506. };
  42507. transport.bind("initialized", onInitialized);
  42508. transport.bind("open", onOpen);
  42509. transport.bind("error", onError);
  42510. transport.bind("closed", onClosed);
  42511. transport.initialize();
  42512. return {
  42513. abort: function () {
  42514. if (connected) {
  42515. return;
  42516. }
  42517. unbindListeners();
  42518. if (handshake) {
  42519. handshake.close();
  42520. }
  42521. else {
  42522. transport.close();
  42523. }
  42524. },
  42525. forceMinPriority: function (p) {
  42526. if (connected) {
  42527. return;
  42528. }
  42529. if (_this.priority < p) {
  42530. if (handshake) {
  42531. handshake.close();
  42532. }
  42533. else {
  42534. transport.close();
  42535. }
  42536. }
  42537. }
  42538. };
  42539. };
  42540. return TransportStrategy;
  42541. }());
  42542. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42543. function failAttempt(error, callback) {
  42544. util.defer(function () {
  42545. callback(error);
  42546. });
  42547. return {
  42548. abort: function () { },
  42549. forceMinPriority: function () { }
  42550. };
  42551. }
  42552. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42553. var strategy_builder_Transports = runtime.Transports;
  42554. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42555. var transportClass = strategy_builder_Transports[type];
  42556. if (!transportClass) {
  42557. throw new UnsupportedTransport(type);
  42558. }
  42559. var enabled = (!config.enabledTransports ||
  42560. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42561. (!config.disabledTransports ||
  42562. arrayIndexOf(config.disabledTransports, name) === -1);
  42563. var transport;
  42564. if (enabled) {
  42565. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42566. key: config.key,
  42567. useTLS: config.useTLS,
  42568. timeline: config.timeline,
  42569. ignoreNullOrigin: config.ignoreNullOrigin
  42570. }, options));
  42571. }
  42572. else {
  42573. transport = strategy_builder_UnsupportedStrategy;
  42574. }
  42575. return transport;
  42576. };
  42577. var strategy_builder_UnsupportedStrategy = {
  42578. isSupported: function () {
  42579. return false;
  42580. },
  42581. connect: function (_, callback) {
  42582. var deferred = util.defer(function () {
  42583. callback(new UnsupportedStrategy());
  42584. });
  42585. return {
  42586. abort: function () {
  42587. deferred.ensureAborted();
  42588. },
  42589. forceMinPriority: function () { }
  42590. };
  42591. }
  42592. };
  42593. // CONCATENATED MODULE: ./src/core/config.ts
  42594. var getGlobalConfig = function () {
  42595. return {
  42596. wsHost: defaults.host,
  42597. wsPort: defaults.ws_port,
  42598. wssPort: defaults.wss_port,
  42599. wsPath: defaults.ws_path,
  42600. httpHost: defaults.sockjs_host,
  42601. httpPort: defaults.sockjs_http_port,
  42602. httpsPort: defaults.sockjs_https_port,
  42603. httpPath: defaults.sockjs_path,
  42604. statsHost: defaults.stats_host,
  42605. authEndpoint: defaults.channel_auth_endpoint,
  42606. authTransport: defaults.channel_auth_transport,
  42607. activity_timeout: defaults.activity_timeout,
  42608. pong_timeout: defaults.pong_timeout,
  42609. unavailable_timeout: defaults.unavailable_timeout
  42610. };
  42611. };
  42612. var getClusterConfig = function (clusterName) {
  42613. return {
  42614. wsHost: 'ws-' + clusterName + '.pusher.com',
  42615. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42616. };
  42617. };
  42618. // CONCATENATED MODULE: ./src/core/pusher.ts
  42619. var pusher_Pusher = (function () {
  42620. function Pusher(app_key, options) {
  42621. var _this = this;
  42622. checkAppKey(app_key);
  42623. options = options || {};
  42624. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42625. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42626. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42627. }
  42628. this.key = app_key;
  42629. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42630. this.channels = factory.createChannels();
  42631. this.global_emitter = new dispatcher();
  42632. this.sessionID = Math.floor(Math.random() * 1000000000);
  42633. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42634. cluster: this.config.cluster,
  42635. features: Pusher.getClientFeatures(),
  42636. params: this.config.timelineParams || {},
  42637. limit: 50,
  42638. level: timeline_level.INFO,
  42639. version: defaults.VERSION
  42640. });
  42641. if (!this.config.disableStats) {
  42642. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42643. host: this.config.statsHost,
  42644. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42645. });
  42646. }
  42647. var getStrategy = function (options) {
  42648. var config = extend({}, _this.config, options);
  42649. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42650. };
  42651. this.connection = factory.createConnectionManager(this.key, extend({
  42652. getStrategy: getStrategy,
  42653. timeline: this.timeline,
  42654. activityTimeout: this.config.activity_timeout,
  42655. pongTimeout: this.config.pong_timeout,
  42656. unavailableTimeout: this.config.unavailable_timeout
  42657. }, this.config, { useTLS: this.shouldUseTLS() }));
  42658. this.connection.bind('connected', function () {
  42659. _this.subscribeAll();
  42660. if (_this.timelineSender) {
  42661. _this.timelineSender.send(_this.connection.isUsingTLS());
  42662. }
  42663. });
  42664. this.connection.bind('message', function (event) {
  42665. var eventName = event.event;
  42666. var internal = eventName.indexOf('pusher_internal:') === 0;
  42667. if (event.channel) {
  42668. var channel = _this.channel(event.channel);
  42669. if (channel) {
  42670. channel.handleEvent(event);
  42671. }
  42672. }
  42673. if (!internal) {
  42674. _this.global_emitter.emit(event.event, event.data);
  42675. }
  42676. });
  42677. this.connection.bind('connecting', function () {
  42678. _this.channels.disconnect();
  42679. });
  42680. this.connection.bind('disconnected', function () {
  42681. _this.channels.disconnect();
  42682. });
  42683. this.connection.bind('error', function (err) {
  42684. logger.warn(err);
  42685. });
  42686. Pusher.instances.push(this);
  42687. this.timeline.info({ instances: Pusher.instances.length });
  42688. if (Pusher.isReady) {
  42689. this.connect();
  42690. }
  42691. }
  42692. Pusher.ready = function () {
  42693. Pusher.isReady = true;
  42694. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42695. Pusher.instances[i].connect();
  42696. }
  42697. };
  42698. Pusher.getClientFeatures = function () {
  42699. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42700. return t.isSupported({});
  42701. }));
  42702. };
  42703. Pusher.prototype.channel = function (name) {
  42704. return this.channels.find(name);
  42705. };
  42706. Pusher.prototype.allChannels = function () {
  42707. return this.channels.all();
  42708. };
  42709. Pusher.prototype.connect = function () {
  42710. this.connection.connect();
  42711. if (this.timelineSender) {
  42712. if (!this.timelineSenderTimer) {
  42713. var usingTLS = this.connection.isUsingTLS();
  42714. var timelineSender = this.timelineSender;
  42715. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42716. timelineSender.send(usingTLS);
  42717. });
  42718. }
  42719. }
  42720. };
  42721. Pusher.prototype.disconnect = function () {
  42722. this.connection.disconnect();
  42723. if (this.timelineSenderTimer) {
  42724. this.timelineSenderTimer.ensureAborted();
  42725. this.timelineSenderTimer = null;
  42726. }
  42727. };
  42728. Pusher.prototype.bind = function (event_name, callback, context) {
  42729. this.global_emitter.bind(event_name, callback, context);
  42730. return this;
  42731. };
  42732. Pusher.prototype.unbind = function (event_name, callback, context) {
  42733. this.global_emitter.unbind(event_name, callback, context);
  42734. return this;
  42735. };
  42736. Pusher.prototype.bind_global = function (callback) {
  42737. this.global_emitter.bind_global(callback);
  42738. return this;
  42739. };
  42740. Pusher.prototype.unbind_global = function (callback) {
  42741. this.global_emitter.unbind_global(callback);
  42742. return this;
  42743. };
  42744. Pusher.prototype.unbind_all = function (callback) {
  42745. this.global_emitter.unbind_all();
  42746. return this;
  42747. };
  42748. Pusher.prototype.subscribeAll = function () {
  42749. var channelName;
  42750. for (channelName in this.channels.channels) {
  42751. if (this.channels.channels.hasOwnProperty(channelName)) {
  42752. this.subscribe(channelName);
  42753. }
  42754. }
  42755. };
  42756. Pusher.prototype.subscribe = function (channel_name) {
  42757. var channel = this.channels.add(channel_name, this);
  42758. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42759. channel.reinstateSubscription();
  42760. }
  42761. else if (!channel.subscriptionPending &&
  42762. this.connection.state === 'connected') {
  42763. channel.subscribe();
  42764. }
  42765. return channel;
  42766. };
  42767. Pusher.prototype.unsubscribe = function (channel_name) {
  42768. var channel = this.channels.find(channel_name);
  42769. if (channel && channel.subscriptionPending) {
  42770. channel.cancelSubscription();
  42771. }
  42772. else {
  42773. channel = this.channels.remove(channel_name);
  42774. if (channel && this.connection.state === 'connected') {
  42775. channel.unsubscribe();
  42776. }
  42777. }
  42778. };
  42779. Pusher.prototype.send_event = function (event_name, data, channel) {
  42780. return this.connection.send_event(event_name, data, channel);
  42781. };
  42782. Pusher.prototype.shouldUseTLS = function () {
  42783. if (runtime.getProtocol() === 'https:') {
  42784. return true;
  42785. }
  42786. else if (this.config.forceTLS === true) {
  42787. return true;
  42788. }
  42789. else {
  42790. return Boolean(this.config.encrypted);
  42791. }
  42792. };
  42793. Pusher.instances = [];
  42794. Pusher.isReady = false;
  42795. Pusher.logToConsole = false;
  42796. Pusher.Runtime = runtime;
  42797. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42798. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42799. Pusher.auth_callbacks = runtime.auth_callbacks;
  42800. return Pusher;
  42801. }());
  42802. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42803. function checkAppKey(key) {
  42804. if (key === null || key === undefined) {
  42805. throw 'You must pass your app key when you instantiate Pusher.';
  42806. }
  42807. }
  42808. runtime.setup(pusher_Pusher);
  42809. /***/ })
  42810. /******/ ]);
  42811. });
  42812. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42813. /***/ }),
  42814. /***/ "./node_modules/setimmediate/setImmediate.js":
  42815. /*!***************************************************!*\
  42816. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42817. \***************************************************/
  42818. /*! no static exports found */
  42819. /***/ (function(module, exports, __webpack_require__) {
  42820. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42821. "use strict";
  42822. if (global.setImmediate) {
  42823. return;
  42824. }
  42825. var nextHandle = 1; // Spec says greater than zero
  42826. var tasksByHandle = {};
  42827. var currentlyRunningATask = false;
  42828. var doc = global.document;
  42829. var registerImmediate;
  42830. function setImmediate(callback) {
  42831. // Callback can either be a function or a string
  42832. if (typeof callback !== "function") {
  42833. callback = new Function("" + callback);
  42834. }
  42835. // Copy function arguments
  42836. var args = new Array(arguments.length - 1);
  42837. for (var i = 0; i < args.length; i++) {
  42838. args[i] = arguments[i + 1];
  42839. }
  42840. // Store and register the task
  42841. var task = { callback: callback, args: args };
  42842. tasksByHandle[nextHandle] = task;
  42843. registerImmediate(nextHandle);
  42844. return nextHandle++;
  42845. }
  42846. function clearImmediate(handle) {
  42847. delete tasksByHandle[handle];
  42848. }
  42849. function run(task) {
  42850. var callback = task.callback;
  42851. var args = task.args;
  42852. switch (args.length) {
  42853. case 0:
  42854. callback();
  42855. break;
  42856. case 1:
  42857. callback(args[0]);
  42858. break;
  42859. case 2:
  42860. callback(args[0], args[1]);
  42861. break;
  42862. case 3:
  42863. callback(args[0], args[1], args[2]);
  42864. break;
  42865. default:
  42866. callback.apply(undefined, args);
  42867. break;
  42868. }
  42869. }
  42870. function runIfPresent(handle) {
  42871. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42872. // So if we're currently running a task, we'll need to delay this invocation.
  42873. if (currentlyRunningATask) {
  42874. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42875. // "too much recursion" error.
  42876. setTimeout(runIfPresent, 0, handle);
  42877. } else {
  42878. var task = tasksByHandle[handle];
  42879. if (task) {
  42880. currentlyRunningATask = true;
  42881. try {
  42882. run(task);
  42883. } finally {
  42884. clearImmediate(handle);
  42885. currentlyRunningATask = false;
  42886. }
  42887. }
  42888. }
  42889. }
  42890. function installNextTickImplementation() {
  42891. registerImmediate = function(handle) {
  42892. process.nextTick(function () { runIfPresent(handle); });
  42893. };
  42894. }
  42895. function canUsePostMessage() {
  42896. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42897. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42898. if (global.postMessage && !global.importScripts) {
  42899. var postMessageIsAsynchronous = true;
  42900. var oldOnMessage = global.onmessage;
  42901. global.onmessage = function() {
  42902. postMessageIsAsynchronous = false;
  42903. };
  42904. global.postMessage("", "*");
  42905. global.onmessage = oldOnMessage;
  42906. return postMessageIsAsynchronous;
  42907. }
  42908. }
  42909. function installPostMessageImplementation() {
  42910. // Installs an event handler on `global` for the `message` event: see
  42911. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42912. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42913. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42914. var onGlobalMessage = function(event) {
  42915. if (event.source === global &&
  42916. typeof event.data === "string" &&
  42917. event.data.indexOf(messagePrefix) === 0) {
  42918. runIfPresent(+event.data.slice(messagePrefix.length));
  42919. }
  42920. };
  42921. if (global.addEventListener) {
  42922. global.addEventListener("message", onGlobalMessage, false);
  42923. } else {
  42924. global.attachEvent("onmessage", onGlobalMessage);
  42925. }
  42926. registerImmediate = function(handle) {
  42927. global.postMessage(messagePrefix + handle, "*");
  42928. };
  42929. }
  42930. function installMessageChannelImplementation() {
  42931. var channel = new MessageChannel();
  42932. channel.port1.onmessage = function(event) {
  42933. var handle = event.data;
  42934. runIfPresent(handle);
  42935. };
  42936. registerImmediate = function(handle) {
  42937. channel.port2.postMessage(handle);
  42938. };
  42939. }
  42940. function installReadyStateChangeImplementation() {
  42941. var html = doc.documentElement;
  42942. registerImmediate = function(handle) {
  42943. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42944. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42945. var script = doc.createElement("script");
  42946. script.onreadystatechange = function () {
  42947. runIfPresent(handle);
  42948. script.onreadystatechange = null;
  42949. html.removeChild(script);
  42950. script = null;
  42951. };
  42952. html.appendChild(script);
  42953. };
  42954. }
  42955. function installSetTimeoutImplementation() {
  42956. registerImmediate = function(handle) {
  42957. setTimeout(runIfPresent, 0, handle);
  42958. };
  42959. }
  42960. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42961. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42962. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42963. // Don't get fooled by e.g. browserify environments.
  42964. if ({}.toString.call(global.process) === "[object process]") {
  42965. // For Node.js before 0.9
  42966. installNextTickImplementation();
  42967. } else if (canUsePostMessage()) {
  42968. // For non-IE10 modern browsers
  42969. installPostMessageImplementation();
  42970. } else if (global.MessageChannel) {
  42971. // For web workers, where supported
  42972. installMessageChannelImplementation();
  42973. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42974. // For IE 6–8
  42975. installReadyStateChangeImplementation();
  42976. } else {
  42977. // For older browsers
  42978. installSetTimeoutImplementation();
  42979. }
  42980. attachTo.setImmediate = setImmediate;
  42981. attachTo.clearImmediate = clearImmediate;
  42982. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42983. /* 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")))
  42984. /***/ }),
  42985. /***/ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  42986. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  42987. !*** ./node_modules/style-loader!./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  42988. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  42989. /*! no static exports found */
  42990. /***/ (function(module, exports, __webpack_require__) {
  42991. var content = __webpack_require__(/*! !../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  42992. if(typeof content === 'string') content = [[module.i, content, '']];
  42993. var transform;
  42994. var insertInto;
  42995. var options = {"hmr":true}
  42996. options.transform = transform
  42997. options.insertInto = undefined;
  42998. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  42999. if(content.locals) module.exports = content.locals;
  43000. if(false) {}
  43001. /***/ }),
  43002. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43003. /*!****************************************************!*\
  43004. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43005. \****************************************************/
  43006. /*! no static exports found */
  43007. /***/ (function(module, exports, __webpack_require__) {
  43008. /*
  43009. MIT License http://www.opensource.org/licenses/mit-license.php
  43010. Author Tobias Koppers @sokra
  43011. */
  43012. var stylesInDom = {};
  43013. var memoize = function (fn) {
  43014. var memo;
  43015. return function () {
  43016. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43017. return memo;
  43018. };
  43019. };
  43020. var isOldIE = memoize(function () {
  43021. // Test for IE <= 9 as proposed by Browserhacks
  43022. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43023. // Tests for existence of standard globals is to allow style-loader
  43024. // to operate correctly into non-standard environments
  43025. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43026. return window && document && document.all && !window.atob;
  43027. });
  43028. var getTarget = function (target, parent) {
  43029. if (parent){
  43030. return parent.querySelector(target);
  43031. }
  43032. return document.querySelector(target);
  43033. };
  43034. var getElement = (function (fn) {
  43035. var memo = {};
  43036. return function(target, parent) {
  43037. // If passing function in options, then use it for resolve "head" element.
  43038. // Useful for Shadow Root style i.e
  43039. // {
  43040. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43041. // }
  43042. if (typeof target === 'function') {
  43043. return target();
  43044. }
  43045. if (typeof memo[target] === "undefined") {
  43046. var styleTarget = getTarget.call(this, target, parent);
  43047. // Special case to return head of iframe instead of iframe itself
  43048. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43049. try {
  43050. // This will throw an exception if access to iframe is blocked
  43051. // due to cross-origin restrictions
  43052. styleTarget = styleTarget.contentDocument.head;
  43053. } catch(e) {
  43054. styleTarget = null;
  43055. }
  43056. }
  43057. memo[target] = styleTarget;
  43058. }
  43059. return memo[target]
  43060. };
  43061. })();
  43062. var singleton = null;
  43063. var singletonCounter = 0;
  43064. var stylesInsertedAtTop = [];
  43065. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43066. module.exports = function(list, options) {
  43067. if (typeof DEBUG !== "undefined" && DEBUG) {
  43068. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43069. }
  43070. options = options || {};
  43071. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43072. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43073. // tags it will allow on a page
  43074. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43075. // By default, add <style> tags to the <head> element
  43076. if (!options.insertInto) options.insertInto = "head";
  43077. // By default, add <style> tags to the bottom of the target
  43078. if (!options.insertAt) options.insertAt = "bottom";
  43079. var styles = listToStyles(list, options);
  43080. addStylesToDom(styles, options);
  43081. return function update (newList) {
  43082. var mayRemove = [];
  43083. for (var i = 0; i < styles.length; i++) {
  43084. var item = styles[i];
  43085. var domStyle = stylesInDom[item.id];
  43086. domStyle.refs--;
  43087. mayRemove.push(domStyle);
  43088. }
  43089. if(newList) {
  43090. var newStyles = listToStyles(newList, options);
  43091. addStylesToDom(newStyles, options);
  43092. }
  43093. for (var i = 0; i < mayRemove.length; i++) {
  43094. var domStyle = mayRemove[i];
  43095. if(domStyle.refs === 0) {
  43096. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43097. delete stylesInDom[domStyle.id];
  43098. }
  43099. }
  43100. };
  43101. };
  43102. function addStylesToDom (styles, options) {
  43103. for (var i = 0; i < styles.length; i++) {
  43104. var item = styles[i];
  43105. var domStyle = stylesInDom[item.id];
  43106. if(domStyle) {
  43107. domStyle.refs++;
  43108. for(var j = 0; j < domStyle.parts.length; j++) {
  43109. domStyle.parts[j](item.parts[j]);
  43110. }
  43111. for(; j < item.parts.length; j++) {
  43112. domStyle.parts.push(addStyle(item.parts[j], options));
  43113. }
  43114. } else {
  43115. var parts = [];
  43116. for(var j = 0; j < item.parts.length; j++) {
  43117. parts.push(addStyle(item.parts[j], options));
  43118. }
  43119. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43120. }
  43121. }
  43122. }
  43123. function listToStyles (list, options) {
  43124. var styles = [];
  43125. var newStyles = {};
  43126. for (var i = 0; i < list.length; i++) {
  43127. var item = list[i];
  43128. var id = options.base ? item[0] + options.base : item[0];
  43129. var css = item[1];
  43130. var media = item[2];
  43131. var sourceMap = item[3];
  43132. var part = {css: css, media: media, sourceMap: sourceMap};
  43133. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43134. else newStyles[id].parts.push(part);
  43135. }
  43136. return styles;
  43137. }
  43138. function insertStyleElement (options, style) {
  43139. var target = getElement(options.insertInto)
  43140. if (!target) {
  43141. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43142. }
  43143. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43144. if (options.insertAt === "top") {
  43145. if (!lastStyleElementInsertedAtTop) {
  43146. target.insertBefore(style, target.firstChild);
  43147. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  43148. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  43149. } else {
  43150. target.appendChild(style);
  43151. }
  43152. stylesInsertedAtTop.push(style);
  43153. } else if (options.insertAt === "bottom") {
  43154. target.appendChild(style);
  43155. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  43156. var nextSibling = getElement(options.insertAt.before, target);
  43157. target.insertBefore(style, nextSibling);
  43158. } else {
  43159. throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
  43160. }
  43161. }
  43162. function removeStyleElement (style) {
  43163. if (style.parentNode === null) return false;
  43164. style.parentNode.removeChild(style);
  43165. var idx = stylesInsertedAtTop.indexOf(style);
  43166. if(idx >= 0) {
  43167. stylesInsertedAtTop.splice(idx, 1);
  43168. }
  43169. }
  43170. function createStyleElement (options) {
  43171. var style = document.createElement("style");
  43172. if(options.attrs.type === undefined) {
  43173. options.attrs.type = "text/css";
  43174. }
  43175. if(options.attrs.nonce === undefined) {
  43176. var nonce = getNonce();
  43177. if (nonce) {
  43178. options.attrs.nonce = nonce;
  43179. }
  43180. }
  43181. addAttrs(style, options.attrs);
  43182. insertStyleElement(options, style);
  43183. return style;
  43184. }
  43185. function createLinkElement (options) {
  43186. var link = document.createElement("link");
  43187. if(options.attrs.type === undefined) {
  43188. options.attrs.type = "text/css";
  43189. }
  43190. options.attrs.rel = "stylesheet";
  43191. addAttrs(link, options.attrs);
  43192. insertStyleElement(options, link);
  43193. return link;
  43194. }
  43195. function addAttrs (el, attrs) {
  43196. Object.keys(attrs).forEach(function (key) {
  43197. el.setAttribute(key, attrs[key]);
  43198. });
  43199. }
  43200. function getNonce() {
  43201. if (false) {}
  43202. return __webpack_require__.nc;
  43203. }
  43204. function addStyle (obj, options) {
  43205. var style, update, remove, result;
  43206. // If a transform function was defined, run it on the css
  43207. if (options.transform && obj.css) {
  43208. result = typeof options.transform === 'function'
  43209. ? options.transform(obj.css)
  43210. : options.transform.default(obj.css);
  43211. if (result) {
  43212. // If transform returns a value, use that instead of the original css.
  43213. // This allows running runtime transformations on the css.
  43214. obj.css = result;
  43215. } else {
  43216. // If the transform function returns a falsy value, don't add this css.
  43217. // This allows conditional loading of css
  43218. return function() {
  43219. // noop
  43220. };
  43221. }
  43222. }
  43223. if (options.singleton) {
  43224. var styleIndex = singletonCounter++;
  43225. style = singleton || (singleton = createStyleElement(options));
  43226. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  43227. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  43228. } else if (
  43229. obj.sourceMap &&
  43230. typeof URL === "function" &&
  43231. typeof URL.createObjectURL === "function" &&
  43232. typeof URL.revokeObjectURL === "function" &&
  43233. typeof Blob === "function" &&
  43234. typeof btoa === "function"
  43235. ) {
  43236. style = createLinkElement(options);
  43237. update = updateLink.bind(null, style, options);
  43238. remove = function () {
  43239. removeStyleElement(style);
  43240. if(style.href) URL.revokeObjectURL(style.href);
  43241. };
  43242. } else {
  43243. style = createStyleElement(options);
  43244. update = applyToTag.bind(null, style);
  43245. remove = function () {
  43246. removeStyleElement(style);
  43247. };
  43248. }
  43249. update(obj);
  43250. return function updateStyle (newObj) {
  43251. if (newObj) {
  43252. if (
  43253. newObj.css === obj.css &&
  43254. newObj.media === obj.media &&
  43255. newObj.sourceMap === obj.sourceMap
  43256. ) {
  43257. return;
  43258. }
  43259. update(obj = newObj);
  43260. } else {
  43261. remove();
  43262. }
  43263. };
  43264. }
  43265. var replaceText = (function () {
  43266. var textStore = [];
  43267. return function (index, replacement) {
  43268. textStore[index] = replacement;
  43269. return textStore.filter(Boolean).join('\n');
  43270. };
  43271. })();
  43272. function applyToSingletonTag (style, index, remove, obj) {
  43273. var css = remove ? "" : obj.css;
  43274. if (style.styleSheet) {
  43275. style.styleSheet.cssText = replaceText(index, css);
  43276. } else {
  43277. var cssNode = document.createTextNode(css);
  43278. var childNodes = style.childNodes;
  43279. if (childNodes[index]) style.removeChild(childNodes[index]);
  43280. if (childNodes.length) {
  43281. style.insertBefore(cssNode, childNodes[index]);
  43282. } else {
  43283. style.appendChild(cssNode);
  43284. }
  43285. }
  43286. }
  43287. function applyToTag (style, obj) {
  43288. var css = obj.css;
  43289. var media = obj.media;
  43290. if(media) {
  43291. style.setAttribute("media", media)
  43292. }
  43293. if(style.styleSheet) {
  43294. style.styleSheet.cssText = css;
  43295. } else {
  43296. while(style.firstChild) {
  43297. style.removeChild(style.firstChild);
  43298. }
  43299. style.appendChild(document.createTextNode(css));
  43300. }
  43301. }
  43302. function updateLink (link, options, obj) {
  43303. var css = obj.css;
  43304. var sourceMap = obj.sourceMap;
  43305. /*
  43306. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  43307. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  43308. on by default. Otherwise default to the convertToAbsoluteUrls option
  43309. directly
  43310. */
  43311. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  43312. if (options.convertToAbsoluteUrls || autoFixUrls) {
  43313. css = fixUrls(css);
  43314. }
  43315. if (sourceMap) {
  43316. // http://stackoverflow.com/a/26603875
  43317. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  43318. }
  43319. var blob = new Blob([css], { type: "text/css" });
  43320. var oldSrc = link.href;
  43321. link.href = URL.createObjectURL(blob);
  43322. if(oldSrc) URL.revokeObjectURL(oldSrc);
  43323. }
  43324. /***/ }),
  43325. /***/ "./node_modules/style-loader/lib/urls.js":
  43326. /*!***********************************************!*\
  43327. !*** ./node_modules/style-loader/lib/urls.js ***!
  43328. \***********************************************/
  43329. /*! no static exports found */
  43330. /***/ (function(module, exports) {
  43331. /**
  43332. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  43333. * embed the css on the page. This breaks all relative urls because now they are relative to a
  43334. * bundle instead of the current page.
  43335. *
  43336. * One solution is to only use full urls, but that may be impossible.
  43337. *
  43338. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  43339. *
  43340. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  43341. *
  43342. */
  43343. module.exports = function (css) {
  43344. // get current location
  43345. var location = typeof window !== "undefined" && window.location;
  43346. if (!location) {
  43347. throw new Error("fixUrls requires window.location");
  43348. }
  43349. // blank or null?
  43350. if (!css || typeof css !== "string") {
  43351. return css;
  43352. }
  43353. var baseUrl = location.protocol + "//" + location.host;
  43354. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  43355. // convert each url(...)
  43356. /*
  43357. This regular expression is just a way to recursively match brackets within
  43358. a string.
  43359. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  43360. ( = Start a capturing group
  43361. (?: = Start a non-capturing group
  43362. [^)(] = Match anything that isn't a parentheses
  43363. | = OR
  43364. \( = Match a start parentheses
  43365. (?: = Start another non-capturing groups
  43366. [^)(]+ = Match anything that isn't a parentheses
  43367. | = OR
  43368. \( = Match a start parentheses
  43369. [^)(]* = Match anything that isn't a parentheses
  43370. \) = Match a end parentheses
  43371. ) = End Group
  43372. *\) = Match anything and then a close parens
  43373. ) = Close non-capturing group
  43374. * = Match anything
  43375. ) = Close capturing group
  43376. \) = Match a close parens
  43377. /gi = Get all matches, not the first. Be case insensitive.
  43378. */
  43379. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  43380. // strip quotes (if they exist)
  43381. var unquotedOrigUrl = origUrl
  43382. .trim()
  43383. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  43384. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  43385. // already a full url? no change
  43386. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  43387. return fullMatch;
  43388. }
  43389. // convert the url to a full url
  43390. var newUrl;
  43391. if (unquotedOrigUrl.indexOf("//") === 0) {
  43392. //TODO: should we add protocol?
  43393. newUrl = unquotedOrigUrl;
  43394. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  43395. // path should be relative to the base url
  43396. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  43397. } else {
  43398. // path should be relative to current directory
  43399. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  43400. }
  43401. // send back the fixed url(...)
  43402. return "url(" + JSON.stringify(newUrl) + ")";
  43403. });
  43404. // send back the fixed css
  43405. return fixedCss;
  43406. };
  43407. /***/ }),
  43408. /***/ "./node_modules/timers-browserify/main.js":
  43409. /*!************************************************!*\
  43410. !*** ./node_modules/timers-browserify/main.js ***!
  43411. \************************************************/
  43412. /*! no static exports found */
  43413. /***/ (function(module, exports, __webpack_require__) {
  43414. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43415. (typeof self !== "undefined" && self) ||
  43416. window;
  43417. var apply = Function.prototype.apply;
  43418. // DOM APIs, for completeness
  43419. exports.setTimeout = function() {
  43420. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43421. };
  43422. exports.setInterval = function() {
  43423. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43424. };
  43425. exports.clearTimeout =
  43426. exports.clearInterval = function(timeout) {
  43427. if (timeout) {
  43428. timeout.close();
  43429. }
  43430. };
  43431. function Timeout(id, clearFn) {
  43432. this._id = id;
  43433. this._clearFn = clearFn;
  43434. }
  43435. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43436. Timeout.prototype.close = function() {
  43437. this._clearFn.call(scope, this._id);
  43438. };
  43439. // Does not start the time, just sets up the members needed.
  43440. exports.enroll = function(item, msecs) {
  43441. clearTimeout(item._idleTimeoutId);
  43442. item._idleTimeout = msecs;
  43443. };
  43444. exports.unenroll = function(item) {
  43445. clearTimeout(item._idleTimeoutId);
  43446. item._idleTimeout = -1;
  43447. };
  43448. exports._unrefActive = exports.active = function(item) {
  43449. clearTimeout(item._idleTimeoutId);
  43450. var msecs = item._idleTimeout;
  43451. if (msecs >= 0) {
  43452. item._idleTimeoutId = setTimeout(function onTimeout() {
  43453. if (item._onTimeout)
  43454. item._onTimeout();
  43455. }, msecs);
  43456. }
  43457. };
  43458. // setimmediate attaches itself to the global object
  43459. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43460. // On some exotic environments, it's not clear which object `setimmediate` was
  43461. // able to install onto. Search each possibility in the same order as the
  43462. // `setimmediate` library.
  43463. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43464. (typeof global !== "undefined" && global.setImmediate) ||
  43465. (this && this.setImmediate);
  43466. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43467. (typeof global !== "undefined" && global.clearImmediate) ||
  43468. (this && this.clearImmediate);
  43469. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43470. /***/ }),
  43471. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  43472. /*!*****************************************************************************************************************************************************************************************************************************!*\
  43473. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  43474. \*****************************************************************************************************************************************************************************************************************************/
  43475. /*! exports provided: render, staticRenderFns */
  43476. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43477. "use strict";
  43478. __webpack_require__.r(__webpack_exports__);
  43479. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43480. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43481. var render = function() {
  43482. var _vm = this
  43483. var _h = _vm.$createElement
  43484. var _c = _vm._self._c || _h
  43485. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43486. _c("div", { staticClass: "input-group" }, [
  43487. _c("input", {
  43488. directives: [
  43489. {
  43490. name: "model",
  43491. rawName: "v-model",
  43492. value: _vm.searchText,
  43493. expression: "searchText"
  43494. }
  43495. ],
  43496. staticClass: "form-control",
  43497. attrs: { type: "text" },
  43498. domProps: { value: _vm.searchText },
  43499. on: {
  43500. input: [
  43501. function($event) {
  43502. if ($event.target.composing) {
  43503. return
  43504. }
  43505. _vm.searchText = $event.target.value
  43506. },
  43507. _vm.searchChanged
  43508. ]
  43509. }
  43510. }),
  43511. _vm._v(" "),
  43512. _c("div", { staticClass: "form-group-append" }, [
  43513. _c(
  43514. "a",
  43515. {
  43516. staticClass: "toggle input-group-text bg-primary text-light",
  43517. on: {
  43518. mousedown: function($event) {
  43519. $event.preventDefault()
  43520. },
  43521. click: function($event) {
  43522. return _vm.setOpen(!_vm.open)
  43523. }
  43524. }
  43525. },
  43526. [
  43527. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43528. _vm._v(" "),
  43529. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43530. ]
  43531. )
  43532. ])
  43533. ]),
  43534. _vm._v(" "),
  43535. _c(
  43536. "ul",
  43537. { staticClass: "suggestion-list list-unstyled" },
  43538. _vm._l(_vm.matches, function(suggestion, index) {
  43539. return _c(
  43540. "li",
  43541. {
  43542. key: index,
  43543. on: {
  43544. mousedown: function($event) {
  43545. $event.preventDefault()
  43546. },
  43547. click: function($event) {
  43548. return _vm.suggestionSelected(suggestion)
  43549. }
  43550. }
  43551. },
  43552. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43553. )
  43554. }),
  43555. 0
  43556. )
  43557. ])
  43558. }
  43559. var staticRenderFns = []
  43560. render._withStripped = true
  43561. /***/ }),
  43562. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  43563. /*!********************************************************************************************************************************************************************************************************!*\
  43564. !*** ./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=53ab54d2& ***!
  43565. \********************************************************************************************************************************************************************************************************/
  43566. /*! exports provided: render, staticRenderFns */
  43567. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43568. "use strict";
  43569. __webpack_require__.r(__webpack_exports__);
  43570. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43571. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43572. var render = function() {
  43573. var _vm = this
  43574. var _h = _vm.$createElement
  43575. var _c = _vm._self._c || _h
  43576. return _c("div", { staticClass: "modal fade" }, [
  43577. _c(
  43578. "div",
  43579. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43580. [
  43581. _c("div", { staticClass: "modal-content" }, [
  43582. _c(
  43583. "div",
  43584. { staticClass: "modal-header" },
  43585. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43586. 2
  43587. ),
  43588. _vm._v(" "),
  43589. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43590. _vm._v(" "),
  43591. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43592. ])
  43593. ]
  43594. )
  43595. ])
  43596. }
  43597. var staticRenderFns = [
  43598. function() {
  43599. var _vm = this
  43600. var _h = _vm.$createElement
  43601. var _c = _vm._self._c || _h
  43602. return _c(
  43603. "button",
  43604. {
  43605. staticClass: "close",
  43606. attrs: {
  43607. type: "button",
  43608. "data-dismiss": "modal",
  43609. "aria-label": "Close"
  43610. }
  43611. },
  43612. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43613. )
  43614. }
  43615. ]
  43616. render._withStripped = true
  43617. /***/ }),
  43618. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  43619. /*!******************************************************************************************************************************************************************************************************************!*\
  43620. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  43621. \******************************************************************************************************************************************************************************************************************/
  43622. /*! exports provided: render, staticRenderFns */
  43623. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43624. "use strict";
  43625. __webpack_require__.r(__webpack_exports__);
  43626. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43627. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43628. var render = function() {
  43629. var _vm = this
  43630. var _h = _vm.$createElement
  43631. var _c = _vm._self._c || _h
  43632. return _c(
  43633. "modal",
  43634. {
  43635. attrs: {
  43636. id: _vm.id,
  43637. tabindex: "-1",
  43638. role: "dialog",
  43639. "aria-labelledby": _vm.id + "Label"
  43640. }
  43641. },
  43642. [
  43643. _c(
  43644. "h5",
  43645. {
  43646. staticClass: "modal-title",
  43647. attrs: { slot: "header", id: _vm.id + "Label" },
  43648. slot: "header"
  43649. },
  43650. [_vm._v("\n Edit Work Order Information\n ")]
  43651. ),
  43652. _vm._v(" "),
  43653. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43654. _c(
  43655. "div",
  43656. { staticClass: "form-group" },
  43657. [
  43658. _c("label", { attrs: { for: "probdesc" } }, [
  43659. _vm._v("Problem Description")
  43660. ]),
  43661. _vm._v(" "),
  43662. _c("textarea", {
  43663. directives: [
  43664. {
  43665. name: "model",
  43666. rawName: "v-model",
  43667. value: _vm.data.probdesc,
  43668. expression: "data.probdesc"
  43669. }
  43670. ],
  43671. class: {
  43672. "form-control": true,
  43673. "is-invalid": _vm.errors.probdesc
  43674. },
  43675. attrs: { id: "probdesc", name: "probdesc" },
  43676. domProps: { value: _vm.data.probdesc },
  43677. on: {
  43678. input: function($event) {
  43679. if ($event.target.composing) {
  43680. return
  43681. }
  43682. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43683. }
  43684. }
  43685. }),
  43686. _vm._v(" "),
  43687. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  43688. ],
  43689. 1
  43690. ),
  43691. _vm._v(" "),
  43692. _c(
  43693. "div",
  43694. { staticClass: "form-group" },
  43695. [
  43696. _c("label", { attrs: { for: "suggested" } }, [
  43697. _vm._v("Suggested Solution")
  43698. ]),
  43699. _vm._v(" "),
  43700. _c("textarea", {
  43701. directives: [
  43702. {
  43703. name: "model",
  43704. rawName: "v-model",
  43705. value: _vm.data.suggested,
  43706. expression: "data.suggested"
  43707. }
  43708. ],
  43709. class: {
  43710. "form-control": true,
  43711. "is-invalid": _vm.errors.suggested
  43712. },
  43713. attrs: { id: "suggested", name: "suggested" },
  43714. domProps: { value: _vm.data.suggested },
  43715. on: {
  43716. input: function($event) {
  43717. if ($event.target.composing) {
  43718. return
  43719. }
  43720. _vm.$set(_vm.data, "suggested", $event.target.value)
  43721. }
  43722. }
  43723. }),
  43724. _vm._v(" "),
  43725. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  43726. ],
  43727. 1
  43728. ),
  43729. _vm._v(" "),
  43730. _c(
  43731. "div",
  43732. { staticClass: "form-group" },
  43733. [
  43734. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  43735. _vm._v(" "),
  43736. _c("autocomplete-custom-dropdown", {
  43737. attrs: { options: _vm.storeList, value: this.store },
  43738. model: {
  43739. value: _vm.store,
  43740. callback: function($$v) {
  43741. _vm.store = $$v
  43742. },
  43743. expression: "store"
  43744. }
  43745. })
  43746. ],
  43747. 1
  43748. )
  43749. ]),
  43750. _vm._v(" "),
  43751. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43752. _c(
  43753. "button",
  43754. {
  43755. staticClass: "btn btn-secondary",
  43756. attrs: { type: "button", "data-dismiss": "modal" }
  43757. },
  43758. [_vm._v("Close")]
  43759. ),
  43760. _vm._v(" "),
  43761. _c(
  43762. "button",
  43763. {
  43764. staticClass: "btn btn-primary",
  43765. attrs: { type: "button" },
  43766. on: {
  43767. click: function($event) {
  43768. return _vm.updateWorkOrder()
  43769. }
  43770. }
  43771. },
  43772. [_vm._v("Save")]
  43773. )
  43774. ])
  43775. ]
  43776. )
  43777. }
  43778. var staticRenderFns = []
  43779. render._withStripped = true
  43780. /***/ }),
  43781. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  43782. /*!****************************************************************************************************************************************************************************************************************!*\
  43783. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  43784. \****************************************************************************************************************************************************************************************************************/
  43785. /*! exports provided: render, staticRenderFns */
  43786. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43787. "use strict";
  43788. __webpack_require__.r(__webpack_exports__);
  43789. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43790. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43791. var render = function() {
  43792. var _vm = this
  43793. var _h = _vm.$createElement
  43794. var _c = _vm._self._c || _h
  43795. return _c(
  43796. "div",
  43797. [
  43798. _c("wo-info-edit-modal", {
  43799. attrs: {
  43800. "modal-id": "workordereditModal",
  43801. "populate-with": _vm.workOrder,
  43802. "store-list": this.storeList
  43803. }
  43804. }),
  43805. _vm._v(" "),
  43806. _c("p", [
  43807. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  43808. _vm._v(" "),
  43809. _c("span", {
  43810. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  43811. })
  43812. ]),
  43813. _vm._v(" "),
  43814. _c("p", [
  43815. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  43816. _vm._v(" "),
  43817. _c("span", {
  43818. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  43819. })
  43820. ]),
  43821. _vm._v(" "),
  43822. _c("p", [
  43823. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43824. _vm._v(" "),
  43825. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  43826. ]),
  43827. _vm._v(" "),
  43828. _c("p", [
  43829. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43830. _vm._v(" "),
  43831. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  43832. ]),
  43833. _vm._v(" "),
  43834. _c("p", [
  43835. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43836. _vm._v(" "),
  43837. _c(
  43838. "span",
  43839. {
  43840. staticClass: "dashed-underline",
  43841. attrs: {
  43842. "data-toggle": "tooltip",
  43843. "data-placement": "bottom",
  43844. title: this.getHRDate(_vm.workOrder.dropdate)
  43845. }
  43846. },
  43847. [
  43848. _vm._v(
  43849. "\n " +
  43850. _vm._s(
  43851. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  43852. ) +
  43853. " days ago\n "
  43854. )
  43855. ]
  43856. )
  43857. ]),
  43858. _vm._v(" "),
  43859. _c("p", [
  43860. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43861. _vm._v(" "),
  43862. !this.isZero(_vm.workOrder.pickupdate)
  43863. ? _c(
  43864. "span",
  43865. {
  43866. staticClass: "dashed-underline",
  43867. attrs: {
  43868. "data-toggle": "tooltip",
  43869. "data-placement": "bottom",
  43870. title: this.getHRDate(_vm.workOrder.pickupdate)
  43871. }
  43872. },
  43873. [
  43874. _vm._v(
  43875. "\n " +
  43876. _vm._s(
  43877. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  43878. ) +
  43879. " days ago\n "
  43880. )
  43881. ]
  43882. )
  43883. : _vm._e()
  43884. ]),
  43885. _vm._v(" "),
  43886. _c(
  43887. "button",
  43888. {
  43889. staticClass: "btn btn-primary",
  43890. attrs: {
  43891. type: "button",
  43892. "data-toggle": "modal",
  43893. "data-target": "#workordereditModal"
  43894. }
  43895. },
  43896. [_vm._v("Edit")]
  43897. )
  43898. ],
  43899. 1
  43900. )
  43901. }
  43902. var staticRenderFns = []
  43903. render._withStripped = true
  43904. /***/ }),
  43905. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  43906. /*!*************************************************************************************************************************************************************************************************!*\
  43907. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  43908. \*************************************************************************************************************************************************************************************************/
  43909. /*! exports provided: render, staticRenderFns */
  43910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43911. "use strict";
  43912. __webpack_require__.r(__webpack_exports__);
  43913. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43914. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43915. var render = function() {
  43916. var _vm = this
  43917. var _h = _vm.$createElement
  43918. var _c = _vm._self._c || _h
  43919. return _c("div", [
  43920. _c(
  43921. "nav",
  43922. {
  43923. staticClass:
  43924. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  43925. },
  43926. [
  43927. _c(
  43928. "div",
  43929. { staticClass: "container-fluid" },
  43930. [
  43931. _c(
  43932. "router-link",
  43933. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  43934. [_vm._v("\n UPCCRT\n ")]
  43935. ),
  43936. _vm._v(" "),
  43937. _vm._m(0),
  43938. _vm._v(" "),
  43939. _c(
  43940. "div",
  43941. {
  43942. staticClass: "collapse navbar-collapse",
  43943. attrs: { id: "navbarSupportedContent" }
  43944. },
  43945. [
  43946. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  43947. _vm._m(1),
  43948. _vm._v(" "),
  43949. _vm._m(2),
  43950. _vm._v(" "),
  43951. _c(
  43952. "li",
  43953. { staticClass: "nav-item" },
  43954. [
  43955. _c(
  43956. "router-link",
  43957. {
  43958. staticClass: "nav-link",
  43959. attrs: { to: { name: "dashboard" } }
  43960. },
  43961. [
  43962. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  43963. _vm._v(" "),
  43964. _c(
  43965. "span",
  43966. { staticClass: "d-none d-sm-block d-md-inline" },
  43967. [_vm._v("Dashboard")]
  43968. )
  43969. ]
  43970. )
  43971. ],
  43972. 1
  43973. ),
  43974. _vm._v(" "),
  43975. _vm._m(3)
  43976. ]),
  43977. _vm._v(" "),
  43978. _c(
  43979. "ul",
  43980. { staticClass: "navbar-nav ml-auto" },
  43981. [
  43982. !_vm.isLoggedIn
  43983. ? _c(
  43984. "router-link",
  43985. {
  43986. staticClass: "nav-link",
  43987. attrs: { to: { name: "login" } }
  43988. },
  43989. [_vm._v("Login")]
  43990. )
  43991. : _vm._e(),
  43992. _vm._v(" "),
  43993. _vm.isLoggedIn
  43994. ? _c("li", { staticClass: "nav-link" }, [
  43995. _vm._v(_vm._s(_vm.username))
  43996. ])
  43997. : _vm._e(),
  43998. _vm._v(" "),
  43999. _vm.isLoggedIn
  44000. ? _c(
  44001. "router-link",
  44002. {
  44003. staticClass: "nav-link",
  44004. attrs: { to: { name: "home" } }
  44005. },
  44006. [_vm._v("Home")]
  44007. )
  44008. : _vm._e()
  44009. ],
  44010. 1
  44011. )
  44012. ]
  44013. )
  44014. ],
  44015. 1
  44016. )
  44017. ]
  44018. ),
  44019. _vm._v(" "),
  44020. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  44021. ])
  44022. }
  44023. var staticRenderFns = [
  44024. function() {
  44025. var _vm = this
  44026. var _h = _vm.$createElement
  44027. var _c = _vm._self._c || _h
  44028. return _c(
  44029. "button",
  44030. {
  44031. staticClass: "navbar-toggler",
  44032. attrs: {
  44033. type: "button",
  44034. "data-toggle": "collapse",
  44035. "data-target": "#navbarSupportedContent",
  44036. "aria-controls": "navbarSupportedContent",
  44037. "aria-expanded": "false"
  44038. }
  44039. },
  44040. [_c("span", { staticClass: "navbar-toggler-icon" })]
  44041. )
  44042. },
  44043. function() {
  44044. var _vm = this
  44045. var _h = _vm.$createElement
  44046. var _c = _vm._self._c || _h
  44047. return _c("li", { staticClass: "nav-item" }, [
  44048. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44049. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  44050. _vm._v(" "),
  44051. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44052. _vm._v("Check-In")
  44053. ])
  44054. ])
  44055. ])
  44056. },
  44057. function() {
  44058. var _vm = this
  44059. var _h = _vm.$createElement
  44060. var _c = _vm._self._c || _h
  44061. return _c("li", { staticClass: "nav-item" }, [
  44062. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44063. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44064. _vm._v(" "),
  44065. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44066. _vm._v("Check-Out")
  44067. ])
  44068. ])
  44069. ])
  44070. },
  44071. function() {
  44072. var _vm = this
  44073. var _h = _vm.$createElement
  44074. var _c = _vm._self._c || _h
  44075. return _c("li", { staticClass: "nav-item" }, [
  44076. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44077. _c("i", { staticClass: "fas fa-chart-bar" }),
  44078. _vm._v(" "),
  44079. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44080. _vm._v("Reports")
  44081. ])
  44082. ])
  44083. ])
  44084. }
  44085. ]
  44086. render._withStripped = true
  44087. /***/ }),
  44088. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  44089. /*!*******************************************************************************************************************************************************************************************************!*\
  44090. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  44091. \*******************************************************************************************************************************************************************************************************/
  44092. /*! exports provided: render, staticRenderFns */
  44093. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44094. "use strict";
  44095. __webpack_require__.r(__webpack_exports__);
  44096. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44097. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44098. var render = function() {
  44099. var _vm = this
  44100. var _h = _vm.$createElement
  44101. var _c = _vm._self._c || _h
  44102. return _c("div", { staticClass: "container" }, [
  44103. _c("div", { staticClass: "row justify-content-center" }, [
  44104. _c(
  44105. "div",
  44106. { staticClass: "col-md-12" },
  44107. _vm._l(_vm.workOrders, function(workOrder, index) {
  44108. return _c("div", { key: workOrder.woid, staticClass: "col-md-4" }, [
  44109. _c("div", { staticClass: "card" }, [
  44110. _c("div", { staticClass: "card-header" }, [
  44111. _c("h4", { staticClass: "card-title" }, [
  44112. _vm._v(_vm._s(workOrder.woid))
  44113. ])
  44114. ]),
  44115. _vm._v(" "),
  44116. _c("div", { staticClass: "card-body card-body-dark" }, [
  44117. _c("div", [
  44118. _vm._v(
  44119. "\n " +
  44120. _vm._s(workOrder.probdesc) +
  44121. "\n "
  44122. )
  44123. ]),
  44124. _vm._v(" "),
  44125. _c("div", [
  44126. _vm._v(
  44127. "\n " +
  44128. _vm._s(workOrder.suggested) +
  44129. "\n "
  44130. )
  44131. ])
  44132. ])
  44133. ])
  44134. ])
  44135. }),
  44136. 0
  44137. )
  44138. ])
  44139. ])
  44140. }
  44141. var staticRenderFns = []
  44142. render._withStripped = true
  44143. /***/ }),
  44144. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  44145. /*!***************************************************************************************************************************************************************************************************!*\
  44146. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  44147. \***************************************************************************************************************************************************************************************************/
  44148. /*! exports provided: render, staticRenderFns */
  44149. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44150. "use strict";
  44151. __webpack_require__.r(__webpack_exports__);
  44152. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44153. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44154. var render = function() {
  44155. var _vm = this
  44156. var _h = _vm.$createElement
  44157. var _c = _vm._self._c || _h
  44158. return _c("div", { staticClass: "container" }, [
  44159. _c("div", { staticClass: "row justify-content-center" }, [
  44160. _c("div", { staticClass: "col-md-8" }, [
  44161. _c("div", { staticClass: "card card-default" }, [
  44162. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  44163. _vm._v(" "),
  44164. _c("div", { staticClass: "card-body" }, [
  44165. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  44166. _c("div", { staticClass: "form-group row" }, [
  44167. _c(
  44168. "label",
  44169. {
  44170. staticClass: "col-sm-4 col-form-label text-md-right",
  44171. attrs: { for: "username" }
  44172. },
  44173. [_vm._v("Username")]
  44174. ),
  44175. _vm._v(" "),
  44176. _c("div", { staticClass: "col-md-6" }, [
  44177. _c("input", {
  44178. directives: [
  44179. {
  44180. name: "model",
  44181. rawName: "v-model",
  44182. value: _vm.username,
  44183. expression: "username"
  44184. }
  44185. ],
  44186. staticClass: "form-control",
  44187. attrs: {
  44188. id: "username",
  44189. type: "username",
  44190. required: "",
  44191. autofocus: ""
  44192. },
  44193. domProps: { value: _vm.username },
  44194. on: {
  44195. input: function($event) {
  44196. if ($event.target.composing) {
  44197. return
  44198. }
  44199. _vm.username = $event.target.value
  44200. }
  44201. }
  44202. })
  44203. ])
  44204. ]),
  44205. _vm._v(" "),
  44206. _c("div", { staticClass: "form-group row" }, [
  44207. _c(
  44208. "label",
  44209. {
  44210. staticClass: "col-md-4 col-form-label text-md-right",
  44211. attrs: { for: "password" }
  44212. },
  44213. [_vm._v("Password")]
  44214. ),
  44215. _vm._v(" "),
  44216. _c("div", { staticClass: "col-md-6" }, [
  44217. _c("input", {
  44218. directives: [
  44219. {
  44220. name: "model",
  44221. rawName: "v-model",
  44222. value: _vm.password,
  44223. expression: "password"
  44224. }
  44225. ],
  44226. staticClass: "form-control",
  44227. attrs: { id: "password", type: "password", required: "" },
  44228. domProps: { value: _vm.password },
  44229. on: {
  44230. input: function($event) {
  44231. if ($event.target.composing) {
  44232. return
  44233. }
  44234. _vm.password = $event.target.value
  44235. }
  44236. }
  44237. })
  44238. ])
  44239. ]),
  44240. _vm._v(" "),
  44241. _c("div", { staticClass: "form-group row mb-0" }, [
  44242. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  44243. _c(
  44244. "button",
  44245. {
  44246. staticClass: "btn btn-primary",
  44247. attrs: { type: "submit" },
  44248. on: { click: _vm.handleSubmit }
  44249. },
  44250. [
  44251. _vm._v(
  44252. "\n Login\n "
  44253. )
  44254. ]
  44255. )
  44256. ])
  44257. ])
  44258. ])
  44259. ])
  44260. ])
  44261. ])
  44262. ])
  44263. ])
  44264. }
  44265. var staticRenderFns = []
  44266. render._withStripped = true
  44267. /***/ }),
  44268. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  44269. /*!*****************************************************************************************************************************************************************************************************************!*\
  44270. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  44271. \*****************************************************************************************************************************************************************************************************************/
  44272. /*! exports provided: render, staticRenderFns */
  44273. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44274. "use strict";
  44275. __webpack_require__.r(__webpack_exports__);
  44276. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44277. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44278. var render = function() {
  44279. var _vm = this
  44280. var _h = _vm.$createElement
  44281. var _c = _vm._self._c || _h
  44282. return _vm._m(0)
  44283. }
  44284. var staticRenderFns = [
  44285. function() {
  44286. var _vm = this
  44287. var _h = _vm.$createElement
  44288. var _c = _vm._self._c || _h
  44289. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  44290. _c("div", { staticClass: "content" }, [
  44291. _c("div", { staticClass: "m-b-md" }, [
  44292. _c("h2", { staticClass: "title m-b-md" }, [
  44293. _vm._v("\n UPCCRT\n ")
  44294. ]),
  44295. _vm._v(" "),
  44296. _c("h3", [
  44297. _vm._v(
  44298. "\n University PC Care Repair Tracker\n "
  44299. )
  44300. ])
  44301. ])
  44302. ])
  44303. ])
  44304. }
  44305. ]
  44306. render._withStripped = true
  44307. /***/ }),
  44308. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  44309. /*!*******************************************************************************************************************************************************************************************************!*\
  44310. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  44311. \*******************************************************************************************************************************************************************************************************/
  44312. /*! exports provided: render, staticRenderFns */
  44313. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44314. "use strict";
  44315. __webpack_require__.r(__webpack_exports__);
  44316. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44317. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44318. var render = function() {
  44319. var _vm = this
  44320. var _h = _vm.$createElement
  44321. var _c = _vm._self._c || _h
  44322. return _c("div", { staticClass: "container-fluid" }, [
  44323. _c("div", { staticClass: "row my-3" }, [
  44324. _vm._m(0),
  44325. _vm._v(" "),
  44326. _c("div", { staticClass: "col-lg-6" }, [
  44327. _c("div", { staticClass: "card h-100" }, [
  44328. _vm._m(1),
  44329. _vm._v(" "),
  44330. _c("div", { staticClass: "card-body" }, [
  44331. _c("div", { staticClass: "tab-content" }, [
  44332. _c(
  44333. "div",
  44334. {
  44335. staticClass: "tab-pane active",
  44336. attrs: {
  44337. id: "workordersumm",
  44338. role: "tabpanel",
  44339. "aria-labelledby": "workordersumm-tab"
  44340. }
  44341. },
  44342. [
  44343. _c("work-order-info", {
  44344. attrs: { "work-order": _vm.workOrder, stores: _vm.stores }
  44345. })
  44346. ],
  44347. 1
  44348. ),
  44349. _vm._v(" "),
  44350. _c(
  44351. "div",
  44352. {
  44353. staticClass: "tab-pane",
  44354. attrs: {
  44355. id: "attachments",
  44356. role: "tabpanel",
  44357. "aria-labelledby": "attachments-tab"
  44358. }
  44359. },
  44360. [
  44361. _vm._v(
  44362. "\n TODO 2\n "
  44363. )
  44364. ]
  44365. )
  44366. ])
  44367. ])
  44368. ])
  44369. ])
  44370. ])
  44371. ])
  44372. }
  44373. var staticRenderFns = [
  44374. function() {
  44375. var _vm = this
  44376. var _h = _vm.$createElement
  44377. var _c = _vm._self._c || _h
  44378. return _c("div", { staticClass: "col-lg-6" }, [
  44379. _c("div", { staticClass: "card h-100" }, [
  44380. _c("div", { staticClass: "card-header text-right" }, [
  44381. _c(
  44382. "button",
  44383. {
  44384. staticClass: "btn btn-default xs-toggle",
  44385. attrs: {
  44386. type: "button",
  44387. "data-toggle": "collapse",
  44388. "data-target": "#assetTab"
  44389. }
  44390. },
  44391. [
  44392. _c("span", { staticClass: "sr-only" }, [
  44393. _vm._v("Toggle Navigation")
  44394. ]),
  44395. _vm._v(" "),
  44396. _c("span", { staticClass: "icon-bar" }),
  44397. _vm._v(" "),
  44398. _c("span", { staticClass: "icon-bar" }),
  44399. _vm._v(" "),
  44400. _c("span", { staticClass: "icon-bar" })
  44401. ]
  44402. ),
  44403. _vm._v(" "),
  44404. _c(
  44405. "ul",
  44406. {
  44407. staticClass:
  44408. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  44409. attrs: { id: "assetTab", role: "tablist" }
  44410. },
  44411. [
  44412. _c("li", { staticClass: "nav-item" }, [
  44413. _c(
  44414. "a",
  44415. {
  44416. staticClass: "nav-link active",
  44417. attrs: {
  44418. id: "assetinfo-tab",
  44419. "data-toggle": "pill",
  44420. href: "#assetinfo",
  44421. role: "tab",
  44422. "aria-controls": "assetinfo",
  44423. "aria-selected": "true"
  44424. }
  44425. },
  44426. [_vm._v("Hardware")]
  44427. )
  44428. ]),
  44429. _vm._v(" "),
  44430. _c("li", { staticClass: "nav-item" }, [
  44431. _c(
  44432. "a",
  44433. {
  44434. staticClass: "nav-link",
  44435. attrs: {
  44436. id: "credentials-tab",
  44437. "data-toggle": "pill",
  44438. href: "#credentials",
  44439. role: "tab",
  44440. "aria-controls": "credentials",
  44441. "aria-selected": "false"
  44442. }
  44443. },
  44444. [_vm._v("Credentials")]
  44445. )
  44446. ])
  44447. ]
  44448. )
  44449. ]),
  44450. _vm._v(" "),
  44451. _c("div", { staticClass: "card-body" }, [
  44452. _c("div", { staticClass: "tab-content" }, [
  44453. _c("div", {
  44454. staticClass: "tab-pane active",
  44455. attrs: {
  44456. id: "assetinfo",
  44457. role: "tabpanel",
  44458. "aria-labelledby": "assetinfo-tab"
  44459. }
  44460. })
  44461. ])
  44462. ])
  44463. ])
  44464. ])
  44465. },
  44466. function() {
  44467. var _vm = this
  44468. var _h = _vm.$createElement
  44469. var _c = _vm._self._c || _h
  44470. return _c("div", { staticClass: "card-header text-right" }, [
  44471. _c(
  44472. "button",
  44473. {
  44474. staticClass: "btn btn-default xs-toggle",
  44475. attrs: {
  44476. type: "button",
  44477. "data-toggle": "collapse",
  44478. "data-target": "#workorderTab"
  44479. }
  44480. },
  44481. [
  44482. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  44483. _vm._v(" "),
  44484. _c("span", { staticClass: "icon-bar" }),
  44485. _vm._v(" "),
  44486. _c("span", { staticClass: "icon-bar" }),
  44487. _vm._v(" "),
  44488. _c("span", { staticClass: "icon-bar" })
  44489. ]
  44490. ),
  44491. _vm._v(" "),
  44492. _c(
  44493. "ul",
  44494. {
  44495. staticClass:
  44496. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  44497. attrs: { id: "workorderTab", role: "tablist" }
  44498. },
  44499. [
  44500. _c("li", { staticClass: "nav-item" }, [
  44501. _c(
  44502. "a",
  44503. {
  44504. staticClass: "nav-link active",
  44505. attrs: {
  44506. id: "workordersumm-tab",
  44507. "data-toggle": "pill",
  44508. href: "#workordersumm",
  44509. role: "tab",
  44510. "aria-controls": "workordersumm",
  44511. "aria-selected": "true"
  44512. }
  44513. },
  44514. [_vm._v("Summary")]
  44515. )
  44516. ]),
  44517. _vm._v(" "),
  44518. _c("li", { staticClass: "nav-item" }, [
  44519. _c(
  44520. "a",
  44521. {
  44522. staticClass: "nav-link",
  44523. attrs: {
  44524. id: "attachments-tab",
  44525. "data-toggle": "pill",
  44526. href: "#attachments",
  44527. role: "tab",
  44528. "aria-controls": "attachments",
  44529. "aria-selected": "false"
  44530. }
  44531. },
  44532. [_vm._v("Attachments")]
  44533. )
  44534. ])
  44535. ]
  44536. )
  44537. ])
  44538. }
  44539. ]
  44540. render._withStripped = true
  44541. /***/ }),
  44542. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44543. /*!********************************************************************!*\
  44544. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44545. \********************************************************************/
  44546. /*! exports provided: default */
  44547. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44548. "use strict";
  44549. __webpack_require__.r(__webpack_exports__);
  44550. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44551. /* globals __VUE_SSR_CONTEXT__ */
  44552. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44553. // This module is a runtime utility for cleaner component module output and will
  44554. // be included in the final webpack user bundle.
  44555. function normalizeComponent (
  44556. scriptExports,
  44557. render,
  44558. staticRenderFns,
  44559. functionalTemplate,
  44560. injectStyles,
  44561. scopeId,
  44562. moduleIdentifier, /* server only */
  44563. shadowMode /* vue-cli only */
  44564. ) {
  44565. // Vue.extend constructor export interop
  44566. var options = typeof scriptExports === 'function'
  44567. ? scriptExports.options
  44568. : scriptExports
  44569. // render functions
  44570. if (render) {
  44571. options.render = render
  44572. options.staticRenderFns = staticRenderFns
  44573. options._compiled = true
  44574. }
  44575. // functional template
  44576. if (functionalTemplate) {
  44577. options.functional = true
  44578. }
  44579. // scopedId
  44580. if (scopeId) {
  44581. options._scopeId = 'data-v-' + scopeId
  44582. }
  44583. var hook
  44584. if (moduleIdentifier) { // server build
  44585. hook = function (context) {
  44586. // 2.3 injection
  44587. context =
  44588. context || // cached call
  44589. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44590. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44591. // 2.2 with runInNewContext: true
  44592. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44593. context = __VUE_SSR_CONTEXT__
  44594. }
  44595. // inject component styles
  44596. if (injectStyles) {
  44597. injectStyles.call(this, context)
  44598. }
  44599. // register component module identifier for async chunk inferrence
  44600. if (context && context._registeredComponents) {
  44601. context._registeredComponents.add(moduleIdentifier)
  44602. }
  44603. }
  44604. // used by ssr in case component is cached and beforeCreate
  44605. // never gets called
  44606. options._ssrRegister = hook
  44607. } else if (injectStyles) {
  44608. hook = shadowMode
  44609. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44610. : injectStyles
  44611. }
  44612. if (hook) {
  44613. if (options.functional) {
  44614. // for template-only hot-reload because in that case the render fn doesn't
  44615. // go through the normalizer
  44616. options._injectStyles = hook
  44617. // register for functioal component in vue file
  44618. var originalRender = options.render
  44619. options.render = function renderWithStyleInjection (h, context) {
  44620. hook.call(context)
  44621. return originalRender(h, context)
  44622. }
  44623. } else {
  44624. // inject component registration as beforeCreate hook
  44625. var existing = options.beforeCreate
  44626. options.beforeCreate = existing
  44627. ? [].concat(existing, hook)
  44628. : [hook]
  44629. }
  44630. }
  44631. return {
  44632. exports: scriptExports,
  44633. options: options
  44634. }
  44635. }
  44636. /***/ }),
  44637. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  44638. /*!********************************************************!*\
  44639. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  44640. \********************************************************/
  44641. /*! exports provided: default */
  44642. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44643. "use strict";
  44644. __webpack_require__.r(__webpack_exports__);
  44645. /*!
  44646. * vue-router v3.1.6
  44647. * (c) 2020 Evan You
  44648. * @license MIT
  44649. */
  44650. /* */
  44651. function assert (condition, message) {
  44652. if (!condition) {
  44653. throw new Error(("[vue-router] " + message))
  44654. }
  44655. }
  44656. function warn (condition, message) {
  44657. if ( true && !condition) {
  44658. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  44659. }
  44660. }
  44661. function isError (err) {
  44662. return Object.prototype.toString.call(err).indexOf('Error') > -1
  44663. }
  44664. function isExtendedError (constructor, err) {
  44665. return (
  44666. err instanceof constructor ||
  44667. // _name is to support IE9 too
  44668. (err && (err.name === constructor.name || err._name === constructor._name))
  44669. )
  44670. }
  44671. function extend (a, b) {
  44672. for (var key in b) {
  44673. a[key] = b[key];
  44674. }
  44675. return a
  44676. }
  44677. var View = {
  44678. name: 'RouterView',
  44679. functional: true,
  44680. props: {
  44681. name: {
  44682. type: String,
  44683. default: 'default'
  44684. }
  44685. },
  44686. render: function render (_, ref) {
  44687. var props = ref.props;
  44688. var children = ref.children;
  44689. var parent = ref.parent;
  44690. var data = ref.data;
  44691. // used by devtools to display a router-view badge
  44692. data.routerView = true;
  44693. // directly use parent context's createElement() function
  44694. // so that components rendered by router-view can resolve named slots
  44695. var h = parent.$createElement;
  44696. var name = props.name;
  44697. var route = parent.$route;
  44698. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  44699. // determine current view depth, also check to see if the tree
  44700. // has been toggled inactive but kept-alive.
  44701. var depth = 0;
  44702. var inactive = false;
  44703. while (parent && parent._routerRoot !== parent) {
  44704. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  44705. if (vnodeData.routerView) {
  44706. depth++;
  44707. }
  44708. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  44709. inactive = true;
  44710. }
  44711. parent = parent.$parent;
  44712. }
  44713. data.routerViewDepth = depth;
  44714. // render previous view if the tree is inactive and kept-alive
  44715. if (inactive) {
  44716. var cachedData = cache[name];
  44717. var cachedComponent = cachedData && cachedData.component;
  44718. if (cachedComponent) {
  44719. // #2301
  44720. // pass props
  44721. if (cachedData.configProps) {
  44722. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  44723. }
  44724. return h(cachedComponent, data, children)
  44725. } else {
  44726. // render previous empty view
  44727. return h()
  44728. }
  44729. }
  44730. var matched = route.matched[depth];
  44731. var component = matched && matched.components[name];
  44732. // render empty node if no matched route or no config component
  44733. if (!matched || !component) {
  44734. cache[name] = null;
  44735. return h()
  44736. }
  44737. // cache component
  44738. cache[name] = { component: component };
  44739. // attach instance registration hook
  44740. // this will be called in the instance's injected lifecycle hooks
  44741. data.registerRouteInstance = function (vm, val) {
  44742. // val could be undefined for unregistration
  44743. var current = matched.instances[name];
  44744. if (
  44745. (val && current !== vm) ||
  44746. (!val && current === vm)
  44747. ) {
  44748. matched.instances[name] = val;
  44749. }
  44750. }
  44751. // also register instance in prepatch hook
  44752. // in case the same component instance is reused across different routes
  44753. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  44754. matched.instances[name] = vnode.componentInstance;
  44755. };
  44756. // register instance in init hook
  44757. // in case kept-alive component be actived when routes changed
  44758. data.hook.init = function (vnode) {
  44759. if (vnode.data.keepAlive &&
  44760. vnode.componentInstance &&
  44761. vnode.componentInstance !== matched.instances[name]
  44762. ) {
  44763. matched.instances[name] = vnode.componentInstance;
  44764. }
  44765. };
  44766. var configProps = matched.props && matched.props[name];
  44767. // save route and configProps in cachce
  44768. if (configProps) {
  44769. extend(cache[name], {
  44770. route: route,
  44771. configProps: configProps
  44772. });
  44773. fillPropsinData(component, data, route, configProps);
  44774. }
  44775. return h(component, data, children)
  44776. }
  44777. };
  44778. function fillPropsinData (component, data, route, configProps) {
  44779. // resolve props
  44780. var propsToPass = data.props = resolveProps(route, configProps);
  44781. if (propsToPass) {
  44782. // clone to prevent mutation
  44783. propsToPass = data.props = extend({}, propsToPass);
  44784. // pass non-declared props as attrs
  44785. var attrs = data.attrs = data.attrs || {};
  44786. for (var key in propsToPass) {
  44787. if (!component.props || !(key in component.props)) {
  44788. attrs[key] = propsToPass[key];
  44789. delete propsToPass[key];
  44790. }
  44791. }
  44792. }
  44793. }
  44794. function resolveProps (route, config) {
  44795. switch (typeof config) {
  44796. case 'undefined':
  44797. return
  44798. case 'object':
  44799. return config
  44800. case 'function':
  44801. return config(route)
  44802. case 'boolean':
  44803. return config ? route.params : undefined
  44804. default:
  44805. if (true) {
  44806. warn(
  44807. false,
  44808. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  44809. "expecting an object, function or boolean."
  44810. );
  44811. }
  44812. }
  44813. }
  44814. /* */
  44815. var encodeReserveRE = /[!'()*]/g;
  44816. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  44817. var commaRE = /%2C/g;
  44818. // fixed encodeURIComponent which is more conformant to RFC3986:
  44819. // - escapes [!'()*]
  44820. // - preserve commas
  44821. var encode = function (str) { return encodeURIComponent(str)
  44822. .replace(encodeReserveRE, encodeReserveReplacer)
  44823. .replace(commaRE, ','); };
  44824. var decode = decodeURIComponent;
  44825. function resolveQuery (
  44826. query,
  44827. extraQuery,
  44828. _parseQuery
  44829. ) {
  44830. if ( extraQuery === void 0 ) extraQuery = {};
  44831. var parse = _parseQuery || parseQuery;
  44832. var parsedQuery;
  44833. try {
  44834. parsedQuery = parse(query || '');
  44835. } catch (e) {
  44836. true && warn(false, e.message);
  44837. parsedQuery = {};
  44838. }
  44839. for (var key in extraQuery) {
  44840. parsedQuery[key] = extraQuery[key];
  44841. }
  44842. return parsedQuery
  44843. }
  44844. function parseQuery (query) {
  44845. var res = {};
  44846. query = query.trim().replace(/^(\?|#|&)/, '');
  44847. if (!query) {
  44848. return res
  44849. }
  44850. query.split('&').forEach(function (param) {
  44851. var parts = param.replace(/\+/g, ' ').split('=');
  44852. var key = decode(parts.shift());
  44853. var val = parts.length > 0
  44854. ? decode(parts.join('='))
  44855. : null;
  44856. if (res[key] === undefined) {
  44857. res[key] = val;
  44858. } else if (Array.isArray(res[key])) {
  44859. res[key].push(val);
  44860. } else {
  44861. res[key] = [res[key], val];
  44862. }
  44863. });
  44864. return res
  44865. }
  44866. function stringifyQuery (obj) {
  44867. var res = obj ? Object.keys(obj).map(function (key) {
  44868. var val = obj[key];
  44869. if (val === undefined) {
  44870. return ''
  44871. }
  44872. if (val === null) {
  44873. return encode(key)
  44874. }
  44875. if (Array.isArray(val)) {
  44876. var result = [];
  44877. val.forEach(function (val2) {
  44878. if (val2 === undefined) {
  44879. return
  44880. }
  44881. if (val2 === null) {
  44882. result.push(encode(key));
  44883. } else {
  44884. result.push(encode(key) + '=' + encode(val2));
  44885. }
  44886. });
  44887. return result.join('&')
  44888. }
  44889. return encode(key) + '=' + encode(val)
  44890. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  44891. return res ? ("?" + res) : ''
  44892. }
  44893. /* */
  44894. var trailingSlashRE = /\/?$/;
  44895. function createRoute (
  44896. record,
  44897. location,
  44898. redirectedFrom,
  44899. router
  44900. ) {
  44901. var stringifyQuery = router && router.options.stringifyQuery;
  44902. var query = location.query || {};
  44903. try {
  44904. query = clone(query);
  44905. } catch (e) {}
  44906. var route = {
  44907. name: location.name || (record && record.name),
  44908. meta: (record && record.meta) || {},
  44909. path: location.path || '/',
  44910. hash: location.hash || '',
  44911. query: query,
  44912. params: location.params || {},
  44913. fullPath: getFullPath(location, stringifyQuery),
  44914. matched: record ? formatMatch(record) : []
  44915. };
  44916. if (redirectedFrom) {
  44917. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  44918. }
  44919. return Object.freeze(route)
  44920. }
  44921. function clone (value) {
  44922. if (Array.isArray(value)) {
  44923. return value.map(clone)
  44924. } else if (value && typeof value === 'object') {
  44925. var res = {};
  44926. for (var key in value) {
  44927. res[key] = clone(value[key]);
  44928. }
  44929. return res
  44930. } else {
  44931. return value
  44932. }
  44933. }
  44934. // the starting route that represents the initial state
  44935. var START = createRoute(null, {
  44936. path: '/'
  44937. });
  44938. function formatMatch (record) {
  44939. var res = [];
  44940. while (record) {
  44941. res.unshift(record);
  44942. record = record.parent;
  44943. }
  44944. return res
  44945. }
  44946. function getFullPath (
  44947. ref,
  44948. _stringifyQuery
  44949. ) {
  44950. var path = ref.path;
  44951. var query = ref.query; if ( query === void 0 ) query = {};
  44952. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  44953. var stringify = _stringifyQuery || stringifyQuery;
  44954. return (path || '/') + stringify(query) + hash
  44955. }
  44956. function isSameRoute (a, b) {
  44957. if (b === START) {
  44958. return a === b
  44959. } else if (!b) {
  44960. return false
  44961. } else if (a.path && b.path) {
  44962. return (
  44963. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  44964. a.hash === b.hash &&
  44965. isObjectEqual(a.query, b.query)
  44966. )
  44967. } else if (a.name && b.name) {
  44968. return (
  44969. a.name === b.name &&
  44970. a.hash === b.hash &&
  44971. isObjectEqual(a.query, b.query) &&
  44972. isObjectEqual(a.params, b.params)
  44973. )
  44974. } else {
  44975. return false
  44976. }
  44977. }
  44978. function isObjectEqual (a, b) {
  44979. if ( a === void 0 ) a = {};
  44980. if ( b === void 0 ) b = {};
  44981. // handle null value #1566
  44982. if (!a || !b) { return a === b }
  44983. var aKeys = Object.keys(a);
  44984. var bKeys = Object.keys(b);
  44985. if (aKeys.length !== bKeys.length) {
  44986. return false
  44987. }
  44988. return aKeys.every(function (key) {
  44989. var aVal = a[key];
  44990. var bVal = b[key];
  44991. // check nested equality
  44992. if (typeof aVal === 'object' && typeof bVal === 'object') {
  44993. return isObjectEqual(aVal, bVal)
  44994. }
  44995. return String(aVal) === String(bVal)
  44996. })
  44997. }
  44998. function isIncludedRoute (current, target) {
  44999. return (
  45000. current.path.replace(trailingSlashRE, '/').indexOf(
  45001. target.path.replace(trailingSlashRE, '/')
  45002. ) === 0 &&
  45003. (!target.hash || current.hash === target.hash) &&
  45004. queryIncludes(current.query, target.query)
  45005. )
  45006. }
  45007. function queryIncludes (current, target) {
  45008. for (var key in target) {
  45009. if (!(key in current)) {
  45010. return false
  45011. }
  45012. }
  45013. return true
  45014. }
  45015. /* */
  45016. function resolvePath (
  45017. relative,
  45018. base,
  45019. append
  45020. ) {
  45021. var firstChar = relative.charAt(0);
  45022. if (firstChar === '/') {
  45023. return relative
  45024. }
  45025. if (firstChar === '?' || firstChar === '#') {
  45026. return base + relative
  45027. }
  45028. var stack = base.split('/');
  45029. // remove trailing segment if:
  45030. // - not appending
  45031. // - appending to trailing slash (last segment is empty)
  45032. if (!append || !stack[stack.length - 1]) {
  45033. stack.pop();
  45034. }
  45035. // resolve relative path
  45036. var segments = relative.replace(/^\//, '').split('/');
  45037. for (var i = 0; i < segments.length; i++) {
  45038. var segment = segments[i];
  45039. if (segment === '..') {
  45040. stack.pop();
  45041. } else if (segment !== '.') {
  45042. stack.push(segment);
  45043. }
  45044. }
  45045. // ensure leading slash
  45046. if (stack[0] !== '') {
  45047. stack.unshift('');
  45048. }
  45049. return stack.join('/')
  45050. }
  45051. function parsePath (path) {
  45052. var hash = '';
  45053. var query = '';
  45054. var hashIndex = path.indexOf('#');
  45055. if (hashIndex >= 0) {
  45056. hash = path.slice(hashIndex);
  45057. path = path.slice(0, hashIndex);
  45058. }
  45059. var queryIndex = path.indexOf('?');
  45060. if (queryIndex >= 0) {
  45061. query = path.slice(queryIndex + 1);
  45062. path = path.slice(0, queryIndex);
  45063. }
  45064. return {
  45065. path: path,
  45066. query: query,
  45067. hash: hash
  45068. }
  45069. }
  45070. function cleanPath (path) {
  45071. return path.replace(/\/\//g, '/')
  45072. }
  45073. var isarray = Array.isArray || function (arr) {
  45074. return Object.prototype.toString.call(arr) == '[object Array]';
  45075. };
  45076. /**
  45077. * Expose `pathToRegexp`.
  45078. */
  45079. var pathToRegexp_1 = pathToRegexp;
  45080. var parse_1 = parse;
  45081. var compile_1 = compile;
  45082. var tokensToFunction_1 = tokensToFunction;
  45083. var tokensToRegExp_1 = tokensToRegExp;
  45084. /**
  45085. * The main path matching regexp utility.
  45086. *
  45087. * @type {RegExp}
  45088. */
  45089. var PATH_REGEXP = new RegExp([
  45090. // Match escaped characters that would otherwise appear in future matches.
  45091. // This allows the user to escape special characters that won't transform.
  45092. '(\\\\.)',
  45093. // Match Express-style parameters and un-named parameters with a prefix
  45094. // and optional suffixes. Matches appear as:
  45095. //
  45096. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  45097. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  45098. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  45099. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  45100. ].join('|'), 'g');
  45101. /**
  45102. * Parse a string for the raw tokens.
  45103. *
  45104. * @param {string} str
  45105. * @param {Object=} options
  45106. * @return {!Array}
  45107. */
  45108. function parse (str, options) {
  45109. var tokens = [];
  45110. var key = 0;
  45111. var index = 0;
  45112. var path = '';
  45113. var defaultDelimiter = options && options.delimiter || '/';
  45114. var res;
  45115. while ((res = PATH_REGEXP.exec(str)) != null) {
  45116. var m = res[0];
  45117. var escaped = res[1];
  45118. var offset = res.index;
  45119. path += str.slice(index, offset);
  45120. index = offset + m.length;
  45121. // Ignore already escaped sequences.
  45122. if (escaped) {
  45123. path += escaped[1];
  45124. continue
  45125. }
  45126. var next = str[index];
  45127. var prefix = res[2];
  45128. var name = res[3];
  45129. var capture = res[4];
  45130. var group = res[5];
  45131. var modifier = res[6];
  45132. var asterisk = res[7];
  45133. // Push the current path onto the tokens.
  45134. if (path) {
  45135. tokens.push(path);
  45136. path = '';
  45137. }
  45138. var partial = prefix != null && next != null && next !== prefix;
  45139. var repeat = modifier === '+' || modifier === '*';
  45140. var optional = modifier === '?' || modifier === '*';
  45141. var delimiter = res[2] || defaultDelimiter;
  45142. var pattern = capture || group;
  45143. tokens.push({
  45144. name: name || key++,
  45145. prefix: prefix || '',
  45146. delimiter: delimiter,
  45147. optional: optional,
  45148. repeat: repeat,
  45149. partial: partial,
  45150. asterisk: !!asterisk,
  45151. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  45152. });
  45153. }
  45154. // Match any characters still remaining.
  45155. if (index < str.length) {
  45156. path += str.substr(index);
  45157. }
  45158. // If the path exists, push it onto the end.
  45159. if (path) {
  45160. tokens.push(path);
  45161. }
  45162. return tokens
  45163. }
  45164. /**
  45165. * Compile a string to a template function for the path.
  45166. *
  45167. * @param {string} str
  45168. * @param {Object=} options
  45169. * @return {!function(Object=, Object=)}
  45170. */
  45171. function compile (str, options) {
  45172. return tokensToFunction(parse(str, options))
  45173. }
  45174. /**
  45175. * Prettier encoding of URI path segments.
  45176. *
  45177. * @param {string}
  45178. * @return {string}
  45179. */
  45180. function encodeURIComponentPretty (str) {
  45181. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  45182. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  45183. })
  45184. }
  45185. /**
  45186. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  45187. *
  45188. * @param {string}
  45189. * @return {string}
  45190. */
  45191. function encodeAsterisk (str) {
  45192. return encodeURI(str).replace(/[?#]/g, function (c) {
  45193. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  45194. })
  45195. }
  45196. /**
  45197. * Expose a method for transforming tokens into the path function.
  45198. */
  45199. function tokensToFunction (tokens) {
  45200. // Compile all the tokens into regexps.
  45201. var matches = new Array(tokens.length);
  45202. // Compile all the patterns before compilation.
  45203. for (var i = 0; i < tokens.length; i++) {
  45204. if (typeof tokens[i] === 'object') {
  45205. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  45206. }
  45207. }
  45208. return function (obj, opts) {
  45209. var path = '';
  45210. var data = obj || {};
  45211. var options = opts || {};
  45212. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  45213. for (var i = 0; i < tokens.length; i++) {
  45214. var token = tokens[i];
  45215. if (typeof token === 'string') {
  45216. path += token;
  45217. continue
  45218. }
  45219. var value = data[token.name];
  45220. var segment;
  45221. if (value == null) {
  45222. if (token.optional) {
  45223. // Prepend partial segment prefixes.
  45224. if (token.partial) {
  45225. path += token.prefix;
  45226. }
  45227. continue
  45228. } else {
  45229. throw new TypeError('Expected "' + token.name + '" to be defined')
  45230. }
  45231. }
  45232. if (isarray(value)) {
  45233. if (!token.repeat) {
  45234. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  45235. }
  45236. if (value.length === 0) {
  45237. if (token.optional) {
  45238. continue
  45239. } else {
  45240. throw new TypeError('Expected "' + token.name + '" to not be empty')
  45241. }
  45242. }
  45243. for (var j = 0; j < value.length; j++) {
  45244. segment = encode(value[j]);
  45245. if (!matches[i].test(segment)) {
  45246. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  45247. }
  45248. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  45249. }
  45250. continue
  45251. }
  45252. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  45253. if (!matches[i].test(segment)) {
  45254. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  45255. }
  45256. path += token.prefix + segment;
  45257. }
  45258. return path
  45259. }
  45260. }
  45261. /**
  45262. * Escape a regular expression string.
  45263. *
  45264. * @param {string} str
  45265. * @return {string}
  45266. */
  45267. function escapeString (str) {
  45268. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  45269. }
  45270. /**
  45271. * Escape the capturing group by escaping special characters and meaning.
  45272. *
  45273. * @param {string} group
  45274. * @return {string}
  45275. */
  45276. function escapeGroup (group) {
  45277. return group.replace(/([=!:$\/()])/g, '\\$1')
  45278. }
  45279. /**
  45280. * Attach the keys as a property of the regexp.
  45281. *
  45282. * @param {!RegExp} re
  45283. * @param {Array} keys
  45284. * @return {!RegExp}
  45285. */
  45286. function attachKeys (re, keys) {
  45287. re.keys = keys;
  45288. return re
  45289. }
  45290. /**
  45291. * Get the flags for a regexp from the options.
  45292. *
  45293. * @param {Object} options
  45294. * @return {string}
  45295. */
  45296. function flags (options) {
  45297. return options.sensitive ? '' : 'i'
  45298. }
  45299. /**
  45300. * Pull out keys from a regexp.
  45301. *
  45302. * @param {!RegExp} path
  45303. * @param {!Array} keys
  45304. * @return {!RegExp}
  45305. */
  45306. function regexpToRegexp (path, keys) {
  45307. // Use a negative lookahead to match only capturing groups.
  45308. var groups = path.source.match(/\((?!\?)/g);
  45309. if (groups) {
  45310. for (var i = 0; i < groups.length; i++) {
  45311. keys.push({
  45312. name: i,
  45313. prefix: null,
  45314. delimiter: null,
  45315. optional: false,
  45316. repeat: false,
  45317. partial: false,
  45318. asterisk: false,
  45319. pattern: null
  45320. });
  45321. }
  45322. }
  45323. return attachKeys(path, keys)
  45324. }
  45325. /**
  45326. * Transform an array into a regexp.
  45327. *
  45328. * @param {!Array} path
  45329. * @param {Array} keys
  45330. * @param {!Object} options
  45331. * @return {!RegExp}
  45332. */
  45333. function arrayToRegexp (path, keys, options) {
  45334. var parts = [];
  45335. for (var i = 0; i < path.length; i++) {
  45336. parts.push(pathToRegexp(path[i], keys, options).source);
  45337. }
  45338. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  45339. return attachKeys(regexp, keys)
  45340. }
  45341. /**
  45342. * Create a path regexp from string input.
  45343. *
  45344. * @param {string} path
  45345. * @param {!Array} keys
  45346. * @param {!Object} options
  45347. * @return {!RegExp}
  45348. */
  45349. function stringToRegexp (path, keys, options) {
  45350. return tokensToRegExp(parse(path, options), keys, options)
  45351. }
  45352. /**
  45353. * Expose a function for taking tokens and returning a RegExp.
  45354. *
  45355. * @param {!Array} tokens
  45356. * @param {(Array|Object)=} keys
  45357. * @param {Object=} options
  45358. * @return {!RegExp}
  45359. */
  45360. function tokensToRegExp (tokens, keys, options) {
  45361. if (!isarray(keys)) {
  45362. options = /** @type {!Object} */ (keys || options);
  45363. keys = [];
  45364. }
  45365. options = options || {};
  45366. var strict = options.strict;
  45367. var end = options.end !== false;
  45368. var route = '';
  45369. // Iterate over the tokens and create our regexp string.
  45370. for (var i = 0; i < tokens.length; i++) {
  45371. var token = tokens[i];
  45372. if (typeof token === 'string') {
  45373. route += escapeString(token);
  45374. } else {
  45375. var prefix = escapeString(token.prefix);
  45376. var capture = '(?:' + token.pattern + ')';
  45377. keys.push(token);
  45378. if (token.repeat) {
  45379. capture += '(?:' + prefix + capture + ')*';
  45380. }
  45381. if (token.optional) {
  45382. if (!token.partial) {
  45383. capture = '(?:' + prefix + '(' + capture + '))?';
  45384. } else {
  45385. capture = prefix + '(' + capture + ')?';
  45386. }
  45387. } else {
  45388. capture = prefix + '(' + capture + ')';
  45389. }
  45390. route += capture;
  45391. }
  45392. }
  45393. var delimiter = escapeString(options.delimiter || '/');
  45394. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  45395. // In non-strict mode we allow a slash at the end of match. If the path to
  45396. // match already ends with a slash, we remove it for consistency. The slash
  45397. // is valid at the end of a path match, not in the middle. This is important
  45398. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  45399. if (!strict) {
  45400. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  45401. }
  45402. if (end) {
  45403. route += '$';
  45404. } else {
  45405. // In non-ending mode, we need the capturing groups to match as much as
  45406. // possible by using a positive lookahead to the end or next path segment.
  45407. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  45408. }
  45409. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  45410. }
  45411. /**
  45412. * Normalize the given path string, returning a regular expression.
  45413. *
  45414. * An empty array can be passed in for the keys, which will hold the
  45415. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  45416. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  45417. *
  45418. * @param {(string|RegExp|Array)} path
  45419. * @param {(Array|Object)=} keys
  45420. * @param {Object=} options
  45421. * @return {!RegExp}
  45422. */
  45423. function pathToRegexp (path, keys, options) {
  45424. if (!isarray(keys)) {
  45425. options = /** @type {!Object} */ (keys || options);
  45426. keys = [];
  45427. }
  45428. options = options || {};
  45429. if (path instanceof RegExp) {
  45430. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  45431. }
  45432. if (isarray(path)) {
  45433. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  45434. }
  45435. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  45436. }
  45437. pathToRegexp_1.parse = parse_1;
  45438. pathToRegexp_1.compile = compile_1;
  45439. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  45440. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  45441. /* */
  45442. // $flow-disable-line
  45443. var regexpCompileCache = Object.create(null);
  45444. function fillParams (
  45445. path,
  45446. params,
  45447. routeMsg
  45448. ) {
  45449. params = params || {};
  45450. try {
  45451. var filler =
  45452. regexpCompileCache[path] ||
  45453. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  45454. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  45455. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  45456. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  45457. return filler(params, { pretty: true })
  45458. } catch (e) {
  45459. if (true) {
  45460. // Fix #3072 no warn if `pathMatch` is string
  45461. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  45462. }
  45463. return ''
  45464. } finally {
  45465. // delete the 0 if it was added
  45466. delete params[0];
  45467. }
  45468. }
  45469. /* */
  45470. function normalizeLocation (
  45471. raw,
  45472. current,
  45473. append,
  45474. router
  45475. ) {
  45476. var next = typeof raw === 'string' ? { path: raw } : raw;
  45477. // named target
  45478. if (next._normalized) {
  45479. return next
  45480. } else if (next.name) {
  45481. next = extend({}, raw);
  45482. var params = next.params;
  45483. if (params && typeof params === 'object') {
  45484. next.params = extend({}, params);
  45485. }
  45486. return next
  45487. }
  45488. // relative params
  45489. if (!next.path && next.params && current) {
  45490. next = extend({}, next);
  45491. next._normalized = true;
  45492. var params$1 = extend(extend({}, current.params), next.params);
  45493. if (current.name) {
  45494. next.name = current.name;
  45495. next.params = params$1;
  45496. } else if (current.matched.length) {
  45497. var rawPath = current.matched[current.matched.length - 1].path;
  45498. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  45499. } else if (true) {
  45500. warn(false, "relative params navigation requires a current route.");
  45501. }
  45502. return next
  45503. }
  45504. var parsedPath = parsePath(next.path || '');
  45505. var basePath = (current && current.path) || '/';
  45506. var path = parsedPath.path
  45507. ? resolvePath(parsedPath.path, basePath, append || next.append)
  45508. : basePath;
  45509. var query = resolveQuery(
  45510. parsedPath.query,
  45511. next.query,
  45512. router && router.options.parseQuery
  45513. );
  45514. var hash = next.hash || parsedPath.hash;
  45515. if (hash && hash.charAt(0) !== '#') {
  45516. hash = "#" + hash;
  45517. }
  45518. return {
  45519. _normalized: true,
  45520. path: path,
  45521. query: query,
  45522. hash: hash
  45523. }
  45524. }
  45525. /* */
  45526. // work around weird flow bug
  45527. var toTypes = [String, Object];
  45528. var eventTypes = [String, Array];
  45529. var noop = function () {};
  45530. var Link = {
  45531. name: 'RouterLink',
  45532. props: {
  45533. to: {
  45534. type: toTypes,
  45535. required: true
  45536. },
  45537. tag: {
  45538. type: String,
  45539. default: 'a'
  45540. },
  45541. exact: Boolean,
  45542. append: Boolean,
  45543. replace: Boolean,
  45544. activeClass: String,
  45545. exactActiveClass: String,
  45546. event: {
  45547. type: eventTypes,
  45548. default: 'click'
  45549. }
  45550. },
  45551. render: function render (h) {
  45552. var this$1 = this;
  45553. var router = this.$router;
  45554. var current = this.$route;
  45555. var ref = router.resolve(
  45556. this.to,
  45557. current,
  45558. this.append
  45559. );
  45560. var location = ref.location;
  45561. var route = ref.route;
  45562. var href = ref.href;
  45563. var classes = {};
  45564. var globalActiveClass = router.options.linkActiveClass;
  45565. var globalExactActiveClass = router.options.linkExactActiveClass;
  45566. // Support global empty active class
  45567. var activeClassFallback =
  45568. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  45569. var exactActiveClassFallback =
  45570. globalExactActiveClass == null
  45571. ? 'router-link-exact-active'
  45572. : globalExactActiveClass;
  45573. var activeClass =
  45574. this.activeClass == null ? activeClassFallback : this.activeClass;
  45575. var exactActiveClass =
  45576. this.exactActiveClass == null
  45577. ? exactActiveClassFallback
  45578. : this.exactActiveClass;
  45579. var compareTarget = route.redirectedFrom
  45580. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  45581. : route;
  45582. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  45583. classes[activeClass] = this.exact
  45584. ? classes[exactActiveClass]
  45585. : isIncludedRoute(current, compareTarget);
  45586. var handler = function (e) {
  45587. if (guardEvent(e)) {
  45588. if (this$1.replace) {
  45589. router.replace(location, noop);
  45590. } else {
  45591. router.push(location, noop);
  45592. }
  45593. }
  45594. };
  45595. var on = { click: guardEvent };
  45596. if (Array.isArray(this.event)) {
  45597. this.event.forEach(function (e) {
  45598. on[e] = handler;
  45599. });
  45600. } else {
  45601. on[this.event] = handler;
  45602. }
  45603. var data = { class: classes };
  45604. var scopedSlot =
  45605. !this.$scopedSlots.$hasNormal &&
  45606. this.$scopedSlots.default &&
  45607. this.$scopedSlots.default({
  45608. href: href,
  45609. route: route,
  45610. navigate: handler,
  45611. isActive: classes[activeClass],
  45612. isExactActive: classes[exactActiveClass]
  45613. });
  45614. if (scopedSlot) {
  45615. if (scopedSlot.length === 1) {
  45616. return scopedSlot[0]
  45617. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  45618. if (true) {
  45619. warn(
  45620. false,
  45621. ("RouterLink with to=\"" + (this.to) + "\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.")
  45622. );
  45623. }
  45624. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  45625. }
  45626. }
  45627. if (this.tag === 'a') {
  45628. data.on = on;
  45629. data.attrs = { href: href };
  45630. } else {
  45631. // find the first <a> child and apply listener and href
  45632. var a = findAnchor(this.$slots.default);
  45633. if (a) {
  45634. // in case the <a> is a static node
  45635. a.isStatic = false;
  45636. var aData = (a.data = extend({}, a.data));
  45637. aData.on = aData.on || {};
  45638. // transform existing events in both objects into arrays so we can push later
  45639. for (var event in aData.on) {
  45640. var handler$1 = aData.on[event];
  45641. if (event in on) {
  45642. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  45643. }
  45644. }
  45645. // append new listeners for router-link
  45646. for (var event$1 in on) {
  45647. if (event$1 in aData.on) {
  45648. // on[event] is always a function
  45649. aData.on[event$1].push(on[event$1]);
  45650. } else {
  45651. aData.on[event$1] = handler;
  45652. }
  45653. }
  45654. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  45655. aAttrs.href = href;
  45656. } else {
  45657. // doesn't have <a> child, apply listener to self
  45658. data.on = on;
  45659. }
  45660. }
  45661. return h(this.tag, data, this.$slots.default)
  45662. }
  45663. };
  45664. function guardEvent (e) {
  45665. // don't redirect with control keys
  45666. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  45667. // don't redirect when preventDefault called
  45668. if (e.defaultPrevented) { return }
  45669. // don't redirect on right click
  45670. if (e.button !== undefined && e.button !== 0) { return }
  45671. // don't redirect if `target="_blank"`
  45672. if (e.currentTarget && e.currentTarget.getAttribute) {
  45673. var target = e.currentTarget.getAttribute('target');
  45674. if (/\b_blank\b/i.test(target)) { return }
  45675. }
  45676. // this may be a Weex event which doesn't have this method
  45677. if (e.preventDefault) {
  45678. e.preventDefault();
  45679. }
  45680. return true
  45681. }
  45682. function findAnchor (children) {
  45683. if (children) {
  45684. var child;
  45685. for (var i = 0; i < children.length; i++) {
  45686. child = children[i];
  45687. if (child.tag === 'a') {
  45688. return child
  45689. }
  45690. if (child.children && (child = findAnchor(child.children))) {
  45691. return child
  45692. }
  45693. }
  45694. }
  45695. }
  45696. var _Vue;
  45697. function install (Vue) {
  45698. if (install.installed && _Vue === Vue) { return }
  45699. install.installed = true;
  45700. _Vue = Vue;
  45701. var isDef = function (v) { return v !== undefined; };
  45702. var registerInstance = function (vm, callVal) {
  45703. var i = vm.$options._parentVnode;
  45704. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  45705. i(vm, callVal);
  45706. }
  45707. };
  45708. Vue.mixin({
  45709. beforeCreate: function beforeCreate () {
  45710. if (isDef(this.$options.router)) {
  45711. this._routerRoot = this;
  45712. this._router = this.$options.router;
  45713. this._router.init(this);
  45714. Vue.util.defineReactive(this, '_route', this._router.history.current);
  45715. } else {
  45716. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  45717. }
  45718. registerInstance(this, this);
  45719. },
  45720. destroyed: function destroyed () {
  45721. registerInstance(this);
  45722. }
  45723. });
  45724. Object.defineProperty(Vue.prototype, '$router', {
  45725. get: function get () { return this._routerRoot._router }
  45726. });
  45727. Object.defineProperty(Vue.prototype, '$route', {
  45728. get: function get () { return this._routerRoot._route }
  45729. });
  45730. Vue.component('RouterView', View);
  45731. Vue.component('RouterLink', Link);
  45732. var strats = Vue.config.optionMergeStrategies;
  45733. // use the same hook merging strategy for route hooks
  45734. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  45735. }
  45736. /* */
  45737. var inBrowser = typeof window !== 'undefined';
  45738. /* */
  45739. function createRouteMap (
  45740. routes,
  45741. oldPathList,
  45742. oldPathMap,
  45743. oldNameMap
  45744. ) {
  45745. // the path list is used to control path matching priority
  45746. var pathList = oldPathList || [];
  45747. // $flow-disable-line
  45748. var pathMap = oldPathMap || Object.create(null);
  45749. // $flow-disable-line
  45750. var nameMap = oldNameMap || Object.create(null);
  45751. routes.forEach(function (route) {
  45752. addRouteRecord(pathList, pathMap, nameMap, route);
  45753. });
  45754. // ensure wildcard routes are always at the end
  45755. for (var i = 0, l = pathList.length; i < l; i++) {
  45756. if (pathList[i] === '*') {
  45757. pathList.push(pathList.splice(i, 1)[0]);
  45758. l--;
  45759. i--;
  45760. }
  45761. }
  45762. if (true) {
  45763. // warn if routes do not include leading slashes
  45764. var found = pathList
  45765. // check for missing leading slash
  45766. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  45767. if (found.length > 0) {
  45768. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  45769. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  45770. }
  45771. }
  45772. return {
  45773. pathList: pathList,
  45774. pathMap: pathMap,
  45775. nameMap: nameMap
  45776. }
  45777. }
  45778. function addRouteRecord (
  45779. pathList,
  45780. pathMap,
  45781. nameMap,
  45782. route,
  45783. parent,
  45784. matchAs
  45785. ) {
  45786. var path = route.path;
  45787. var name = route.name;
  45788. if (true) {
  45789. assert(path != null, "\"path\" is required in a route configuration.");
  45790. assert(
  45791. typeof route.component !== 'string',
  45792. "route config \"component\" for path: " + (String(
  45793. path || name
  45794. )) + " cannot be a " + "string id. Use an actual component instead."
  45795. );
  45796. }
  45797. var pathToRegexpOptions =
  45798. route.pathToRegexpOptions || {};
  45799. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  45800. if (typeof route.caseSensitive === 'boolean') {
  45801. pathToRegexpOptions.sensitive = route.caseSensitive;
  45802. }
  45803. var record = {
  45804. path: normalizedPath,
  45805. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  45806. components: route.components || { default: route.component },
  45807. instances: {},
  45808. name: name,
  45809. parent: parent,
  45810. matchAs: matchAs,
  45811. redirect: route.redirect,
  45812. beforeEnter: route.beforeEnter,
  45813. meta: route.meta || {},
  45814. props:
  45815. route.props == null
  45816. ? {}
  45817. : route.components
  45818. ? route.props
  45819. : { default: route.props }
  45820. };
  45821. if (route.children) {
  45822. // Warn if route is named, does not redirect and has a default child route.
  45823. // If users navigate to this route by name, the default child will
  45824. // not be rendered (GH Issue #629)
  45825. if (true) {
  45826. if (
  45827. route.name &&
  45828. !route.redirect &&
  45829. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  45830. ) {
  45831. warn(
  45832. false,
  45833. "Named Route '" + (route.name) + "' has a default child route. " +
  45834. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  45835. "the default child route will not be rendered. Remove the name from " +
  45836. "this route and use the name of the default child route for named " +
  45837. "links instead."
  45838. );
  45839. }
  45840. }
  45841. route.children.forEach(function (child) {
  45842. var childMatchAs = matchAs
  45843. ? cleanPath((matchAs + "/" + (child.path)))
  45844. : undefined;
  45845. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  45846. });
  45847. }
  45848. if (!pathMap[record.path]) {
  45849. pathList.push(record.path);
  45850. pathMap[record.path] = record;
  45851. }
  45852. if (route.alias !== undefined) {
  45853. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  45854. for (var i = 0; i < aliases.length; ++i) {
  45855. var alias = aliases[i];
  45856. if ( true && alias === path) {
  45857. warn(
  45858. false,
  45859. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  45860. );
  45861. // skip in dev to make it work
  45862. continue
  45863. }
  45864. var aliasRoute = {
  45865. path: alias,
  45866. children: route.children
  45867. };
  45868. addRouteRecord(
  45869. pathList,
  45870. pathMap,
  45871. nameMap,
  45872. aliasRoute,
  45873. parent,
  45874. record.path || '/' // matchAs
  45875. );
  45876. }
  45877. }
  45878. if (name) {
  45879. if (!nameMap[name]) {
  45880. nameMap[name] = record;
  45881. } else if ( true && !matchAs) {
  45882. warn(
  45883. false,
  45884. "Duplicate named routes definition: " +
  45885. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  45886. );
  45887. }
  45888. }
  45889. }
  45890. function compileRouteRegex (
  45891. path,
  45892. pathToRegexpOptions
  45893. ) {
  45894. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  45895. if (true) {
  45896. var keys = Object.create(null);
  45897. regex.keys.forEach(function (key) {
  45898. warn(
  45899. !keys[key.name],
  45900. ("Duplicate param keys in route with path: \"" + path + "\"")
  45901. );
  45902. keys[key.name] = true;
  45903. });
  45904. }
  45905. return regex
  45906. }
  45907. function normalizePath (
  45908. path,
  45909. parent,
  45910. strict
  45911. ) {
  45912. if (!strict) { path = path.replace(/\/$/, ''); }
  45913. if (path[0] === '/') { return path }
  45914. if (parent == null) { return path }
  45915. return cleanPath(((parent.path) + "/" + path))
  45916. }
  45917. /* */
  45918. function createMatcher (
  45919. routes,
  45920. router
  45921. ) {
  45922. var ref = createRouteMap(routes);
  45923. var pathList = ref.pathList;
  45924. var pathMap = ref.pathMap;
  45925. var nameMap = ref.nameMap;
  45926. function addRoutes (routes) {
  45927. createRouteMap(routes, pathList, pathMap, nameMap);
  45928. }
  45929. function match (
  45930. raw,
  45931. currentRoute,
  45932. redirectedFrom
  45933. ) {
  45934. var location = normalizeLocation(raw, currentRoute, false, router);
  45935. var name = location.name;
  45936. if (name) {
  45937. var record = nameMap[name];
  45938. if (true) {
  45939. warn(record, ("Route with name '" + name + "' does not exist"));
  45940. }
  45941. if (!record) { return _createRoute(null, location) }
  45942. var paramNames = record.regex.keys
  45943. .filter(function (key) { return !key.optional; })
  45944. .map(function (key) { return key.name; });
  45945. if (typeof location.params !== 'object') {
  45946. location.params = {};
  45947. }
  45948. if (currentRoute && typeof currentRoute.params === 'object') {
  45949. for (var key in currentRoute.params) {
  45950. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  45951. location.params[key] = currentRoute.params[key];
  45952. }
  45953. }
  45954. }
  45955. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  45956. return _createRoute(record, location, redirectedFrom)
  45957. } else if (location.path) {
  45958. location.params = {};
  45959. for (var i = 0; i < pathList.length; i++) {
  45960. var path = pathList[i];
  45961. var record$1 = pathMap[path];
  45962. if (matchRoute(record$1.regex, location.path, location.params)) {
  45963. return _createRoute(record$1, location, redirectedFrom)
  45964. }
  45965. }
  45966. }
  45967. // no match
  45968. return _createRoute(null, location)
  45969. }
  45970. function redirect (
  45971. record,
  45972. location
  45973. ) {
  45974. var originalRedirect = record.redirect;
  45975. var redirect = typeof originalRedirect === 'function'
  45976. ? originalRedirect(createRoute(record, location, null, router))
  45977. : originalRedirect;
  45978. if (typeof redirect === 'string') {
  45979. redirect = { path: redirect };
  45980. }
  45981. if (!redirect || typeof redirect !== 'object') {
  45982. if (true) {
  45983. warn(
  45984. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  45985. );
  45986. }
  45987. return _createRoute(null, location)
  45988. }
  45989. var re = redirect;
  45990. var name = re.name;
  45991. var path = re.path;
  45992. var query = location.query;
  45993. var hash = location.hash;
  45994. var params = location.params;
  45995. query = re.hasOwnProperty('query') ? re.query : query;
  45996. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  45997. params = re.hasOwnProperty('params') ? re.params : params;
  45998. if (name) {
  45999. // resolved named direct
  46000. var targetRecord = nameMap[name];
  46001. if (true) {
  46002. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  46003. }
  46004. return match({
  46005. _normalized: true,
  46006. name: name,
  46007. query: query,
  46008. hash: hash,
  46009. params: params
  46010. }, undefined, location)
  46011. } else if (path) {
  46012. // 1. resolve relative redirect
  46013. var rawPath = resolveRecordPath(path, record);
  46014. // 2. resolve params
  46015. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  46016. // 3. rematch with existing query and hash
  46017. return match({
  46018. _normalized: true,
  46019. path: resolvedPath,
  46020. query: query,
  46021. hash: hash
  46022. }, undefined, location)
  46023. } else {
  46024. if (true) {
  46025. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  46026. }
  46027. return _createRoute(null, location)
  46028. }
  46029. }
  46030. function alias (
  46031. record,
  46032. location,
  46033. matchAs
  46034. ) {
  46035. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  46036. var aliasedMatch = match({
  46037. _normalized: true,
  46038. path: aliasedPath
  46039. });
  46040. if (aliasedMatch) {
  46041. var matched = aliasedMatch.matched;
  46042. var aliasedRecord = matched[matched.length - 1];
  46043. location.params = aliasedMatch.params;
  46044. return _createRoute(aliasedRecord, location)
  46045. }
  46046. return _createRoute(null, location)
  46047. }
  46048. function _createRoute (
  46049. record,
  46050. location,
  46051. redirectedFrom
  46052. ) {
  46053. if (record && record.redirect) {
  46054. return redirect(record, redirectedFrom || location)
  46055. }
  46056. if (record && record.matchAs) {
  46057. return alias(record, location, record.matchAs)
  46058. }
  46059. return createRoute(record, location, redirectedFrom, router)
  46060. }
  46061. return {
  46062. match: match,
  46063. addRoutes: addRoutes
  46064. }
  46065. }
  46066. function matchRoute (
  46067. regex,
  46068. path,
  46069. params
  46070. ) {
  46071. var m = path.match(regex);
  46072. if (!m) {
  46073. return false
  46074. } else if (!params) {
  46075. return true
  46076. }
  46077. for (var i = 1, len = m.length; i < len; ++i) {
  46078. var key = regex.keys[i - 1];
  46079. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  46080. if (key) {
  46081. // Fix #1994: using * with props: true generates a param named 0
  46082. params[key.name || 'pathMatch'] = val;
  46083. }
  46084. }
  46085. return true
  46086. }
  46087. function resolveRecordPath (path, record) {
  46088. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  46089. }
  46090. /* */
  46091. // use User Timing api (if present) for more accurate key precision
  46092. var Time =
  46093. inBrowser && window.performance && window.performance.now
  46094. ? window.performance
  46095. : Date;
  46096. function genStateKey () {
  46097. return Time.now().toFixed(3)
  46098. }
  46099. var _key = genStateKey();
  46100. function getStateKey () {
  46101. return _key
  46102. }
  46103. function setStateKey (key) {
  46104. return (_key = key)
  46105. }
  46106. /* */
  46107. var positionStore = Object.create(null);
  46108. function setupScroll () {
  46109. // Fix for #1585 for Firefox
  46110. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  46111. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  46112. // window.location.protocol + '//' + window.location.host
  46113. // location.host contains the port and location.hostname doesn't
  46114. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  46115. var absolutePath = window.location.href.replace(protocolAndPath, '');
  46116. // preserve existing history state as it could be overriden by the user
  46117. var stateCopy = extend({}, window.history.state);
  46118. stateCopy.key = getStateKey();
  46119. window.history.replaceState(stateCopy, '', absolutePath);
  46120. window.addEventListener('popstate', function (e) {
  46121. saveScrollPosition();
  46122. if (e.state && e.state.key) {
  46123. setStateKey(e.state.key);
  46124. }
  46125. });
  46126. }
  46127. function handleScroll (
  46128. router,
  46129. to,
  46130. from,
  46131. isPop
  46132. ) {
  46133. if (!router.app) {
  46134. return
  46135. }
  46136. var behavior = router.options.scrollBehavior;
  46137. if (!behavior) {
  46138. return
  46139. }
  46140. if (true) {
  46141. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  46142. }
  46143. // wait until re-render finishes before scrolling
  46144. router.app.$nextTick(function () {
  46145. var position = getScrollPosition();
  46146. var shouldScroll = behavior.call(
  46147. router,
  46148. to,
  46149. from,
  46150. isPop ? position : null
  46151. );
  46152. if (!shouldScroll) {
  46153. return
  46154. }
  46155. if (typeof shouldScroll.then === 'function') {
  46156. shouldScroll
  46157. .then(function (shouldScroll) {
  46158. scrollToPosition((shouldScroll), position);
  46159. })
  46160. .catch(function (err) {
  46161. if (true) {
  46162. assert(false, err.toString());
  46163. }
  46164. });
  46165. } else {
  46166. scrollToPosition(shouldScroll, position);
  46167. }
  46168. });
  46169. }
  46170. function saveScrollPosition () {
  46171. var key = getStateKey();
  46172. if (key) {
  46173. positionStore[key] = {
  46174. x: window.pageXOffset,
  46175. y: window.pageYOffset
  46176. };
  46177. }
  46178. }
  46179. function getScrollPosition () {
  46180. var key = getStateKey();
  46181. if (key) {
  46182. return positionStore[key]
  46183. }
  46184. }
  46185. function getElementPosition (el, offset) {
  46186. var docEl = document.documentElement;
  46187. var docRect = docEl.getBoundingClientRect();
  46188. var elRect = el.getBoundingClientRect();
  46189. return {
  46190. x: elRect.left - docRect.left - offset.x,
  46191. y: elRect.top - docRect.top - offset.y
  46192. }
  46193. }
  46194. function isValidPosition (obj) {
  46195. return isNumber(obj.x) || isNumber(obj.y)
  46196. }
  46197. function normalizePosition (obj) {
  46198. return {
  46199. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  46200. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  46201. }
  46202. }
  46203. function normalizeOffset (obj) {
  46204. return {
  46205. x: isNumber(obj.x) ? obj.x : 0,
  46206. y: isNumber(obj.y) ? obj.y : 0
  46207. }
  46208. }
  46209. function isNumber (v) {
  46210. return typeof v === 'number'
  46211. }
  46212. var hashStartsWithNumberRE = /^#\d/;
  46213. function scrollToPosition (shouldScroll, position) {
  46214. var isObject = typeof shouldScroll === 'object';
  46215. if (isObject && typeof shouldScroll.selector === 'string') {
  46216. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  46217. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  46218. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  46219. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  46220. : document.querySelector(shouldScroll.selector);
  46221. if (el) {
  46222. var offset =
  46223. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  46224. ? shouldScroll.offset
  46225. : {};
  46226. offset = normalizeOffset(offset);
  46227. position = getElementPosition(el, offset);
  46228. } else if (isValidPosition(shouldScroll)) {
  46229. position = normalizePosition(shouldScroll);
  46230. }
  46231. } else if (isObject && isValidPosition(shouldScroll)) {
  46232. position = normalizePosition(shouldScroll);
  46233. }
  46234. if (position) {
  46235. window.scrollTo(position.x, position.y);
  46236. }
  46237. }
  46238. /* */
  46239. var supportsPushState =
  46240. inBrowser &&
  46241. (function () {
  46242. var ua = window.navigator.userAgent;
  46243. if (
  46244. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  46245. ua.indexOf('Mobile Safari') !== -1 &&
  46246. ua.indexOf('Chrome') === -1 &&
  46247. ua.indexOf('Windows Phone') === -1
  46248. ) {
  46249. return false
  46250. }
  46251. return window.history && 'pushState' in window.history
  46252. })();
  46253. function pushState (url, replace) {
  46254. saveScrollPosition();
  46255. // try...catch the pushState call to get around Safari
  46256. // DOM Exception 18 where it limits to 100 pushState calls
  46257. var history = window.history;
  46258. try {
  46259. if (replace) {
  46260. // preserve existing history state as it could be overriden by the user
  46261. var stateCopy = extend({}, history.state);
  46262. stateCopy.key = getStateKey();
  46263. history.replaceState(stateCopy, '', url);
  46264. } else {
  46265. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  46266. }
  46267. } catch (e) {
  46268. window.location[replace ? 'replace' : 'assign'](url);
  46269. }
  46270. }
  46271. function replaceState (url) {
  46272. pushState(url, true);
  46273. }
  46274. /* */
  46275. function runQueue (queue, fn, cb) {
  46276. var step = function (index) {
  46277. if (index >= queue.length) {
  46278. cb();
  46279. } else {
  46280. if (queue[index]) {
  46281. fn(queue[index], function () {
  46282. step(index + 1);
  46283. });
  46284. } else {
  46285. step(index + 1);
  46286. }
  46287. }
  46288. };
  46289. step(0);
  46290. }
  46291. /* */
  46292. function resolveAsyncComponents (matched) {
  46293. return function (to, from, next) {
  46294. var hasAsync = false;
  46295. var pending = 0;
  46296. var error = null;
  46297. flatMapComponents(matched, function (def, _, match, key) {
  46298. // if it's a function and doesn't have cid attached,
  46299. // assume it's an async component resolve function.
  46300. // we are not using Vue's default async resolving mechanism because
  46301. // we want to halt the navigation until the incoming component has been
  46302. // resolved.
  46303. if (typeof def === 'function' && def.cid === undefined) {
  46304. hasAsync = true;
  46305. pending++;
  46306. var resolve = once(function (resolvedDef) {
  46307. if (isESModule(resolvedDef)) {
  46308. resolvedDef = resolvedDef.default;
  46309. }
  46310. // save resolved on async factory in case it's used elsewhere
  46311. def.resolved = typeof resolvedDef === 'function'
  46312. ? resolvedDef
  46313. : _Vue.extend(resolvedDef);
  46314. match.components[key] = resolvedDef;
  46315. pending--;
  46316. if (pending <= 0) {
  46317. next();
  46318. }
  46319. });
  46320. var reject = once(function (reason) {
  46321. var msg = "Failed to resolve async component " + key + ": " + reason;
  46322. true && warn(false, msg);
  46323. if (!error) {
  46324. error = isError(reason)
  46325. ? reason
  46326. : new Error(msg);
  46327. next(error);
  46328. }
  46329. });
  46330. var res;
  46331. try {
  46332. res = def(resolve, reject);
  46333. } catch (e) {
  46334. reject(e);
  46335. }
  46336. if (res) {
  46337. if (typeof res.then === 'function') {
  46338. res.then(resolve, reject);
  46339. } else {
  46340. // new syntax in Vue 2.3
  46341. var comp = res.component;
  46342. if (comp && typeof comp.then === 'function') {
  46343. comp.then(resolve, reject);
  46344. }
  46345. }
  46346. }
  46347. }
  46348. });
  46349. if (!hasAsync) { next(); }
  46350. }
  46351. }
  46352. function flatMapComponents (
  46353. matched,
  46354. fn
  46355. ) {
  46356. return flatten(matched.map(function (m) {
  46357. return Object.keys(m.components).map(function (key) { return fn(
  46358. m.components[key],
  46359. m.instances[key],
  46360. m, key
  46361. ); })
  46362. }))
  46363. }
  46364. function flatten (arr) {
  46365. return Array.prototype.concat.apply([], arr)
  46366. }
  46367. var hasSymbol =
  46368. typeof Symbol === 'function' &&
  46369. typeof Symbol.toStringTag === 'symbol';
  46370. function isESModule (obj) {
  46371. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  46372. }
  46373. // in Webpack 2, require.ensure now also returns a Promise
  46374. // so the resolve/reject functions may get called an extra time
  46375. // if the user uses an arrow function shorthand that happens to
  46376. // return that Promise.
  46377. function once (fn) {
  46378. var called = false;
  46379. return function () {
  46380. var args = [], len = arguments.length;
  46381. while ( len-- ) args[ len ] = arguments[ len ];
  46382. if (called) { return }
  46383. called = true;
  46384. return fn.apply(this, args)
  46385. }
  46386. }
  46387. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  46388. function NavigationDuplicated (normalizedLocation) {
  46389. Error.call(this);
  46390. this.name = this._name = 'NavigationDuplicated';
  46391. // passing the message to super() doesn't seem to work in the transpiled version
  46392. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  46393. // add a stack property so services like Sentry can correctly display it
  46394. Object.defineProperty(this, 'stack', {
  46395. value: new Error().stack,
  46396. writable: true,
  46397. configurable: true
  46398. });
  46399. // we could also have used
  46400. // Error.captureStackTrace(this, this.constructor)
  46401. // but it only exists on node and chrome
  46402. }
  46403. if ( Error ) NavigationDuplicated.__proto__ = Error;
  46404. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  46405. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  46406. return NavigationDuplicated;
  46407. }(Error));
  46408. // support IE9
  46409. NavigationDuplicated._name = 'NavigationDuplicated';
  46410. /* */
  46411. var History = function History (router, base) {
  46412. this.router = router;
  46413. this.base = normalizeBase(base);
  46414. // start with a route object that stands for "nowhere"
  46415. this.current = START;
  46416. this.pending = null;
  46417. this.ready = false;
  46418. this.readyCbs = [];
  46419. this.readyErrorCbs = [];
  46420. this.errorCbs = [];
  46421. };
  46422. History.prototype.listen = function listen (cb) {
  46423. this.cb = cb;
  46424. };
  46425. History.prototype.onReady = function onReady (cb, errorCb) {
  46426. if (this.ready) {
  46427. cb();
  46428. } else {
  46429. this.readyCbs.push(cb);
  46430. if (errorCb) {
  46431. this.readyErrorCbs.push(errorCb);
  46432. }
  46433. }
  46434. };
  46435. History.prototype.onError = function onError (errorCb) {
  46436. this.errorCbs.push(errorCb);
  46437. };
  46438. History.prototype.transitionTo = function transitionTo (
  46439. location,
  46440. onComplete,
  46441. onAbort
  46442. ) {
  46443. var this$1 = this;
  46444. var route = this.router.match(location, this.current);
  46445. this.confirmTransition(
  46446. route,
  46447. function () {
  46448. this$1.updateRoute(route);
  46449. onComplete && onComplete(route);
  46450. this$1.ensureURL();
  46451. // fire ready cbs once
  46452. if (!this$1.ready) {
  46453. this$1.ready = true;
  46454. this$1.readyCbs.forEach(function (cb) {
  46455. cb(route);
  46456. });
  46457. }
  46458. },
  46459. function (err) {
  46460. if (onAbort) {
  46461. onAbort(err);
  46462. }
  46463. if (err && !this$1.ready) {
  46464. this$1.ready = true;
  46465. this$1.readyErrorCbs.forEach(function (cb) {
  46466. cb(err);
  46467. });
  46468. }
  46469. }
  46470. );
  46471. };
  46472. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  46473. var this$1 = this;
  46474. var current = this.current;
  46475. var abort = function (err) {
  46476. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  46477. // When the user navigates through history through back/forward buttons
  46478. // we do not want to throw the error. We only throw it if directly calling
  46479. // push/replace. That's why it's not included in isError
  46480. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  46481. if (this$1.errorCbs.length) {
  46482. this$1.errorCbs.forEach(function (cb) {
  46483. cb(err);
  46484. });
  46485. } else {
  46486. warn(false, 'uncaught error during route navigation:');
  46487. console.error(err);
  46488. }
  46489. }
  46490. onAbort && onAbort(err);
  46491. };
  46492. if (
  46493. isSameRoute(route, current) &&
  46494. // in the case the route map has been dynamically appended to
  46495. route.matched.length === current.matched.length
  46496. ) {
  46497. this.ensureURL();
  46498. return abort(new NavigationDuplicated(route))
  46499. }
  46500. var ref = resolveQueue(
  46501. this.current.matched,
  46502. route.matched
  46503. );
  46504. var updated = ref.updated;
  46505. var deactivated = ref.deactivated;
  46506. var activated = ref.activated;
  46507. var queue = [].concat(
  46508. // in-component leave guards
  46509. extractLeaveGuards(deactivated),
  46510. // global before hooks
  46511. this.router.beforeHooks,
  46512. // in-component update hooks
  46513. extractUpdateHooks(updated),
  46514. // in-config enter guards
  46515. activated.map(function (m) { return m.beforeEnter; }),
  46516. // async components
  46517. resolveAsyncComponents(activated)
  46518. );
  46519. this.pending = route;
  46520. var iterator = function (hook, next) {
  46521. if (this$1.pending !== route) {
  46522. return abort()
  46523. }
  46524. try {
  46525. hook(route, current, function (to) {
  46526. if (to === false || isError(to)) {
  46527. // next(false) -> abort navigation, ensure current URL
  46528. this$1.ensureURL(true);
  46529. abort(to);
  46530. } else if (
  46531. typeof to === 'string' ||
  46532. (typeof to === 'object' &&
  46533. (typeof to.path === 'string' || typeof to.name === 'string'))
  46534. ) {
  46535. // next('/') or next({ path: '/' }) -> redirect
  46536. abort();
  46537. if (typeof to === 'object' && to.replace) {
  46538. this$1.replace(to);
  46539. } else {
  46540. this$1.push(to);
  46541. }
  46542. } else {
  46543. // confirm transition and pass on the value
  46544. next(to);
  46545. }
  46546. });
  46547. } catch (e) {
  46548. abort(e);
  46549. }
  46550. };
  46551. runQueue(queue, iterator, function () {
  46552. var postEnterCbs = [];
  46553. var isValid = function () { return this$1.current === route; };
  46554. // wait until async components are resolved before
  46555. // extracting in-component enter guards
  46556. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  46557. var queue = enterGuards.concat(this$1.router.resolveHooks);
  46558. runQueue(queue, iterator, function () {
  46559. if (this$1.pending !== route) {
  46560. return abort()
  46561. }
  46562. this$1.pending = null;
  46563. onComplete(route);
  46564. if (this$1.router.app) {
  46565. this$1.router.app.$nextTick(function () {
  46566. postEnterCbs.forEach(function (cb) {
  46567. cb();
  46568. });
  46569. });
  46570. }
  46571. });
  46572. });
  46573. };
  46574. History.prototype.updateRoute = function updateRoute (route) {
  46575. var prev = this.current;
  46576. this.current = route;
  46577. this.cb && this.cb(route);
  46578. this.router.afterHooks.forEach(function (hook) {
  46579. hook && hook(route, prev);
  46580. });
  46581. };
  46582. function normalizeBase (base) {
  46583. if (!base) {
  46584. if (inBrowser) {
  46585. // respect <base> tag
  46586. var baseEl = document.querySelector('base');
  46587. base = (baseEl && baseEl.getAttribute('href')) || '/';
  46588. // strip full URL origin
  46589. base = base.replace(/^https?:\/\/[^\/]+/, '');
  46590. } else {
  46591. base = '/';
  46592. }
  46593. }
  46594. // make sure there's the starting slash
  46595. if (base.charAt(0) !== '/') {
  46596. base = '/' + base;
  46597. }
  46598. // remove trailing slash
  46599. return base.replace(/\/$/, '')
  46600. }
  46601. function resolveQueue (
  46602. current,
  46603. next
  46604. ) {
  46605. var i;
  46606. var max = Math.max(current.length, next.length);
  46607. for (i = 0; i < max; i++) {
  46608. if (current[i] !== next[i]) {
  46609. break
  46610. }
  46611. }
  46612. return {
  46613. updated: next.slice(0, i),
  46614. activated: next.slice(i),
  46615. deactivated: current.slice(i)
  46616. }
  46617. }
  46618. function extractGuards (
  46619. records,
  46620. name,
  46621. bind,
  46622. reverse
  46623. ) {
  46624. var guards = flatMapComponents(records, function (def, instance, match, key) {
  46625. var guard = extractGuard(def, name);
  46626. if (guard) {
  46627. return Array.isArray(guard)
  46628. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  46629. : bind(guard, instance, match, key)
  46630. }
  46631. });
  46632. return flatten(reverse ? guards.reverse() : guards)
  46633. }
  46634. function extractGuard (
  46635. def,
  46636. key
  46637. ) {
  46638. if (typeof def !== 'function') {
  46639. // extend now so that global mixins are applied.
  46640. def = _Vue.extend(def);
  46641. }
  46642. return def.options[key]
  46643. }
  46644. function extractLeaveGuards (deactivated) {
  46645. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  46646. }
  46647. function extractUpdateHooks (updated) {
  46648. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  46649. }
  46650. function bindGuard (guard, instance) {
  46651. if (instance) {
  46652. return function boundRouteGuard () {
  46653. return guard.apply(instance, arguments)
  46654. }
  46655. }
  46656. }
  46657. function extractEnterGuards (
  46658. activated,
  46659. cbs,
  46660. isValid
  46661. ) {
  46662. return extractGuards(
  46663. activated,
  46664. 'beforeRouteEnter',
  46665. function (guard, _, match, key) {
  46666. return bindEnterGuard(guard, match, key, cbs, isValid)
  46667. }
  46668. )
  46669. }
  46670. function bindEnterGuard (
  46671. guard,
  46672. match,
  46673. key,
  46674. cbs,
  46675. isValid
  46676. ) {
  46677. return function routeEnterGuard (to, from, next) {
  46678. return guard(to, from, function (cb) {
  46679. if (typeof cb === 'function') {
  46680. cbs.push(function () {
  46681. // #750
  46682. // if a router-view is wrapped with an out-in transition,
  46683. // the instance may not have been registered at this time.
  46684. // we will need to poll for registration until current route
  46685. // is no longer valid.
  46686. poll(cb, match.instances, key, isValid);
  46687. });
  46688. }
  46689. next(cb);
  46690. })
  46691. }
  46692. }
  46693. function poll (
  46694. cb, // somehow flow cannot infer this is a function
  46695. instances,
  46696. key,
  46697. isValid
  46698. ) {
  46699. if (
  46700. instances[key] &&
  46701. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  46702. ) {
  46703. cb(instances[key]);
  46704. } else if (isValid()) {
  46705. setTimeout(function () {
  46706. poll(cb, instances, key, isValid);
  46707. }, 16);
  46708. }
  46709. }
  46710. /* */
  46711. var HTML5History = /*@__PURE__*/(function (History) {
  46712. function HTML5History (router, base) {
  46713. var this$1 = this;
  46714. History.call(this, router, base);
  46715. var expectScroll = router.options.scrollBehavior;
  46716. var supportsScroll = supportsPushState && expectScroll;
  46717. if (supportsScroll) {
  46718. setupScroll();
  46719. }
  46720. var initLocation = getLocation(this.base);
  46721. window.addEventListener('popstate', function (e) {
  46722. var current = this$1.current;
  46723. // Avoiding first `popstate` event dispatched in some browsers but first
  46724. // history route not updated since async guard at the same time.
  46725. var location = getLocation(this$1.base);
  46726. if (this$1.current === START && location === initLocation) {
  46727. return
  46728. }
  46729. this$1.transitionTo(location, function (route) {
  46730. if (supportsScroll) {
  46731. handleScroll(router, route, current, true);
  46732. }
  46733. });
  46734. });
  46735. }
  46736. if ( History ) HTML5History.__proto__ = History;
  46737. HTML5History.prototype = Object.create( History && History.prototype );
  46738. HTML5History.prototype.constructor = HTML5History;
  46739. HTML5History.prototype.go = function go (n) {
  46740. window.history.go(n);
  46741. };
  46742. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  46743. var this$1 = this;
  46744. var ref = this;
  46745. var fromRoute = ref.current;
  46746. this.transitionTo(location, function (route) {
  46747. pushState(cleanPath(this$1.base + route.fullPath));
  46748. handleScroll(this$1.router, route, fromRoute, false);
  46749. onComplete && onComplete(route);
  46750. }, onAbort);
  46751. };
  46752. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  46753. var this$1 = this;
  46754. var ref = this;
  46755. var fromRoute = ref.current;
  46756. this.transitionTo(location, function (route) {
  46757. replaceState(cleanPath(this$1.base + route.fullPath));
  46758. handleScroll(this$1.router, route, fromRoute, false);
  46759. onComplete && onComplete(route);
  46760. }, onAbort);
  46761. };
  46762. HTML5History.prototype.ensureURL = function ensureURL (push) {
  46763. if (getLocation(this.base) !== this.current.fullPath) {
  46764. var current = cleanPath(this.base + this.current.fullPath);
  46765. push ? pushState(current) : replaceState(current);
  46766. }
  46767. };
  46768. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  46769. return getLocation(this.base)
  46770. };
  46771. return HTML5History;
  46772. }(History));
  46773. function getLocation (base) {
  46774. var path = decodeURI(window.location.pathname);
  46775. if (base && path.indexOf(base) === 0) {
  46776. path = path.slice(base.length);
  46777. }
  46778. return (path || '/') + window.location.search + window.location.hash
  46779. }
  46780. /* */
  46781. var HashHistory = /*@__PURE__*/(function (History) {
  46782. function HashHistory (router, base, fallback) {
  46783. History.call(this, router, base);
  46784. // check history fallback deeplinking
  46785. if (fallback && checkFallback(this.base)) {
  46786. return
  46787. }
  46788. ensureSlash();
  46789. }
  46790. if ( History ) HashHistory.__proto__ = History;
  46791. HashHistory.prototype = Object.create( History && History.prototype );
  46792. HashHistory.prototype.constructor = HashHistory;
  46793. // this is delayed until the app mounts
  46794. // to avoid the hashchange listener being fired too early
  46795. HashHistory.prototype.setupListeners = function setupListeners () {
  46796. var this$1 = this;
  46797. var router = this.router;
  46798. var expectScroll = router.options.scrollBehavior;
  46799. var supportsScroll = supportsPushState && expectScroll;
  46800. if (supportsScroll) {
  46801. setupScroll();
  46802. }
  46803. window.addEventListener(
  46804. supportsPushState ? 'popstate' : 'hashchange',
  46805. function () {
  46806. var current = this$1.current;
  46807. if (!ensureSlash()) {
  46808. return
  46809. }
  46810. this$1.transitionTo(getHash(), function (route) {
  46811. if (supportsScroll) {
  46812. handleScroll(this$1.router, route, current, true);
  46813. }
  46814. if (!supportsPushState) {
  46815. replaceHash(route.fullPath);
  46816. }
  46817. });
  46818. }
  46819. );
  46820. };
  46821. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  46822. var this$1 = this;
  46823. var ref = this;
  46824. var fromRoute = ref.current;
  46825. this.transitionTo(
  46826. location,
  46827. function (route) {
  46828. pushHash(route.fullPath);
  46829. handleScroll(this$1.router, route, fromRoute, false);
  46830. onComplete && onComplete(route);
  46831. },
  46832. onAbort
  46833. );
  46834. };
  46835. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  46836. var this$1 = this;
  46837. var ref = this;
  46838. var fromRoute = ref.current;
  46839. this.transitionTo(
  46840. location,
  46841. function (route) {
  46842. replaceHash(route.fullPath);
  46843. handleScroll(this$1.router, route, fromRoute, false);
  46844. onComplete && onComplete(route);
  46845. },
  46846. onAbort
  46847. );
  46848. };
  46849. HashHistory.prototype.go = function go (n) {
  46850. window.history.go(n);
  46851. };
  46852. HashHistory.prototype.ensureURL = function ensureURL (push) {
  46853. var current = this.current.fullPath;
  46854. if (getHash() !== current) {
  46855. push ? pushHash(current) : replaceHash(current);
  46856. }
  46857. };
  46858. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  46859. return getHash()
  46860. };
  46861. return HashHistory;
  46862. }(History));
  46863. function checkFallback (base) {
  46864. var location = getLocation(base);
  46865. if (!/^\/#/.test(location)) {
  46866. window.location.replace(cleanPath(base + '/#' + location));
  46867. return true
  46868. }
  46869. }
  46870. function ensureSlash () {
  46871. var path = getHash();
  46872. if (path.charAt(0) === '/') {
  46873. return true
  46874. }
  46875. replaceHash('/' + path);
  46876. return false
  46877. }
  46878. function getHash () {
  46879. // We can't use window.location.hash here because it's not
  46880. // consistent across browsers - Firefox will pre-decode it!
  46881. var href = window.location.href;
  46882. var index = href.indexOf('#');
  46883. // empty path
  46884. if (index < 0) { return '' }
  46885. href = href.slice(index + 1);
  46886. // decode the hash but not the search or hash
  46887. // as search(query) is already decoded
  46888. // https://github.com/vuejs/vue-router/issues/2708
  46889. var searchIndex = href.indexOf('?');
  46890. if (searchIndex < 0) {
  46891. var hashIndex = href.indexOf('#');
  46892. if (hashIndex > -1) {
  46893. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  46894. } else { href = decodeURI(href); }
  46895. } else {
  46896. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  46897. }
  46898. return href
  46899. }
  46900. function getUrl (path) {
  46901. var href = window.location.href;
  46902. var i = href.indexOf('#');
  46903. var base = i >= 0 ? href.slice(0, i) : href;
  46904. return (base + "#" + path)
  46905. }
  46906. function pushHash (path) {
  46907. if (supportsPushState) {
  46908. pushState(getUrl(path));
  46909. } else {
  46910. window.location.hash = path;
  46911. }
  46912. }
  46913. function replaceHash (path) {
  46914. if (supportsPushState) {
  46915. replaceState(getUrl(path));
  46916. } else {
  46917. window.location.replace(getUrl(path));
  46918. }
  46919. }
  46920. /* */
  46921. var AbstractHistory = /*@__PURE__*/(function (History) {
  46922. function AbstractHistory (router, base) {
  46923. History.call(this, router, base);
  46924. this.stack = [];
  46925. this.index = -1;
  46926. }
  46927. if ( History ) AbstractHistory.__proto__ = History;
  46928. AbstractHistory.prototype = Object.create( History && History.prototype );
  46929. AbstractHistory.prototype.constructor = AbstractHistory;
  46930. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  46931. var this$1 = this;
  46932. this.transitionTo(
  46933. location,
  46934. function (route) {
  46935. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  46936. this$1.index++;
  46937. onComplete && onComplete(route);
  46938. },
  46939. onAbort
  46940. );
  46941. };
  46942. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  46943. var this$1 = this;
  46944. this.transitionTo(
  46945. location,
  46946. function (route) {
  46947. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  46948. onComplete && onComplete(route);
  46949. },
  46950. onAbort
  46951. );
  46952. };
  46953. AbstractHistory.prototype.go = function go (n) {
  46954. var this$1 = this;
  46955. var targetIndex = this.index + n;
  46956. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  46957. return
  46958. }
  46959. var route = this.stack[targetIndex];
  46960. this.confirmTransition(
  46961. route,
  46962. function () {
  46963. this$1.index = targetIndex;
  46964. this$1.updateRoute(route);
  46965. },
  46966. function (err) {
  46967. if (isExtendedError(NavigationDuplicated, err)) {
  46968. this$1.index = targetIndex;
  46969. }
  46970. }
  46971. );
  46972. };
  46973. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  46974. var current = this.stack[this.stack.length - 1];
  46975. return current ? current.fullPath : '/'
  46976. };
  46977. AbstractHistory.prototype.ensureURL = function ensureURL () {
  46978. // noop
  46979. };
  46980. return AbstractHistory;
  46981. }(History));
  46982. /* */
  46983. var VueRouter = function VueRouter (options) {
  46984. if ( options === void 0 ) options = {};
  46985. this.app = null;
  46986. this.apps = [];
  46987. this.options = options;
  46988. this.beforeHooks = [];
  46989. this.resolveHooks = [];
  46990. this.afterHooks = [];
  46991. this.matcher = createMatcher(options.routes || [], this);
  46992. var mode = options.mode || 'hash';
  46993. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  46994. if (this.fallback) {
  46995. mode = 'hash';
  46996. }
  46997. if (!inBrowser) {
  46998. mode = 'abstract';
  46999. }
  47000. this.mode = mode;
  47001. switch (mode) {
  47002. case 'history':
  47003. this.history = new HTML5History(this, options.base);
  47004. break
  47005. case 'hash':
  47006. this.history = new HashHistory(this, options.base, this.fallback);
  47007. break
  47008. case 'abstract':
  47009. this.history = new AbstractHistory(this, options.base);
  47010. break
  47011. default:
  47012. if (true) {
  47013. assert(false, ("invalid mode: " + mode));
  47014. }
  47015. }
  47016. };
  47017. var prototypeAccessors = { currentRoute: { configurable: true } };
  47018. VueRouter.prototype.match = function match (
  47019. raw,
  47020. current,
  47021. redirectedFrom
  47022. ) {
  47023. return this.matcher.match(raw, current, redirectedFrom)
  47024. };
  47025. prototypeAccessors.currentRoute.get = function () {
  47026. return this.history && this.history.current
  47027. };
  47028. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  47029. var this$1 = this;
  47030. true && assert(
  47031. install.installed,
  47032. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  47033. "before creating root instance."
  47034. );
  47035. this.apps.push(app);
  47036. // set up app destroyed handler
  47037. // https://github.com/vuejs/vue-router/issues/2639
  47038. app.$once('hook:destroyed', function () {
  47039. // clean out app from this.apps array once destroyed
  47040. var index = this$1.apps.indexOf(app);
  47041. if (index > -1) { this$1.apps.splice(index, 1); }
  47042. // ensure we still have a main app or null if no apps
  47043. // we do not release the router so it can be reused
  47044. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  47045. });
  47046. // main app previously initialized
  47047. // return as we don't need to set up new history listener
  47048. if (this.app) {
  47049. return
  47050. }
  47051. this.app = app;
  47052. var history = this.history;
  47053. if (history instanceof HTML5History) {
  47054. history.transitionTo(history.getCurrentLocation());
  47055. } else if (history instanceof HashHistory) {
  47056. var setupHashListener = function () {
  47057. history.setupListeners();
  47058. };
  47059. history.transitionTo(
  47060. history.getCurrentLocation(),
  47061. setupHashListener,
  47062. setupHashListener
  47063. );
  47064. }
  47065. history.listen(function (route) {
  47066. this$1.apps.forEach(function (app) {
  47067. app._route = route;
  47068. });
  47069. });
  47070. };
  47071. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  47072. return registerHook(this.beforeHooks, fn)
  47073. };
  47074. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  47075. return registerHook(this.resolveHooks, fn)
  47076. };
  47077. VueRouter.prototype.afterEach = function afterEach (fn) {
  47078. return registerHook(this.afterHooks, fn)
  47079. };
  47080. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  47081. this.history.onReady(cb, errorCb);
  47082. };
  47083. VueRouter.prototype.onError = function onError (errorCb) {
  47084. this.history.onError(errorCb);
  47085. };
  47086. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  47087. var this$1 = this;
  47088. // $flow-disable-line
  47089. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  47090. return new Promise(function (resolve, reject) {
  47091. this$1.history.push(location, resolve, reject);
  47092. })
  47093. } else {
  47094. this.history.push(location, onComplete, onAbort);
  47095. }
  47096. };
  47097. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  47098. var this$1 = this;
  47099. // $flow-disable-line
  47100. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  47101. return new Promise(function (resolve, reject) {
  47102. this$1.history.replace(location, resolve, reject);
  47103. })
  47104. } else {
  47105. this.history.replace(location, onComplete, onAbort);
  47106. }
  47107. };
  47108. VueRouter.prototype.go = function go (n) {
  47109. this.history.go(n);
  47110. };
  47111. VueRouter.prototype.back = function back () {
  47112. this.go(-1);
  47113. };
  47114. VueRouter.prototype.forward = function forward () {
  47115. this.go(1);
  47116. };
  47117. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  47118. var route = to
  47119. ? to.matched
  47120. ? to
  47121. : this.resolve(to).route
  47122. : this.currentRoute;
  47123. if (!route) {
  47124. return []
  47125. }
  47126. return [].concat.apply([], route.matched.map(function (m) {
  47127. return Object.keys(m.components).map(function (key) {
  47128. return m.components[key]
  47129. })
  47130. }))
  47131. };
  47132. VueRouter.prototype.resolve = function resolve (
  47133. to,
  47134. current,
  47135. append
  47136. ) {
  47137. current = current || this.history.current;
  47138. var location = normalizeLocation(
  47139. to,
  47140. current,
  47141. append,
  47142. this
  47143. );
  47144. var route = this.match(location, current);
  47145. var fullPath = route.redirectedFrom || route.fullPath;
  47146. var base = this.history.base;
  47147. var href = createHref(base, fullPath, this.mode);
  47148. return {
  47149. location: location,
  47150. route: route,
  47151. href: href,
  47152. // for backwards compat
  47153. normalizedTo: location,
  47154. resolved: route
  47155. }
  47156. };
  47157. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  47158. this.matcher.addRoutes(routes);
  47159. if (this.history.current !== START) {
  47160. this.history.transitionTo(this.history.getCurrentLocation());
  47161. }
  47162. };
  47163. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  47164. function registerHook (list, fn) {
  47165. list.push(fn);
  47166. return function () {
  47167. var i = list.indexOf(fn);
  47168. if (i > -1) { list.splice(i, 1); }
  47169. }
  47170. }
  47171. function createHref (base, fullPath, mode) {
  47172. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  47173. return base ? cleanPath(base + '/' + path) : path
  47174. }
  47175. VueRouter.install = install;
  47176. VueRouter.version = '3.1.6';
  47177. if (inBrowser && window.Vue) {
  47178. window.Vue.use(VueRouter);
  47179. }
  47180. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  47181. /***/ }),
  47182. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  47183. /*!*************************************************!*\
  47184. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  47185. \*************************************************/
  47186. /*! no static exports found */
  47187. /***/ (function(module, exports, __webpack_require__) {
  47188. "use strict";
  47189. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  47190. * Vue.js v2.6.11
  47191. * (c) 2014-2019 Evan You
  47192. * Released under the MIT License.
  47193. */
  47194. /* */
  47195. var emptyObject = Object.freeze({});
  47196. // These helpers produce better VM code in JS engines due to their
  47197. // explicitness and function inlining.
  47198. function isUndef (v) {
  47199. return v === undefined || v === null
  47200. }
  47201. function isDef (v) {
  47202. return v !== undefined && v !== null
  47203. }
  47204. function isTrue (v) {
  47205. return v === true
  47206. }
  47207. function isFalse (v) {
  47208. return v === false
  47209. }
  47210. /**
  47211. * Check if value is primitive.
  47212. */
  47213. function isPrimitive (value) {
  47214. return (
  47215. typeof value === 'string' ||
  47216. typeof value === 'number' ||
  47217. // $flow-disable-line
  47218. typeof value === 'symbol' ||
  47219. typeof value === 'boolean'
  47220. )
  47221. }
  47222. /**
  47223. * Quick object check - this is primarily used to tell
  47224. * Objects from primitive values when we know the value
  47225. * is a JSON-compliant type.
  47226. */
  47227. function isObject (obj) {
  47228. return obj !== null && typeof obj === 'object'
  47229. }
  47230. /**
  47231. * Get the raw type string of a value, e.g., [object Object].
  47232. */
  47233. var _toString = Object.prototype.toString;
  47234. function toRawType (value) {
  47235. return _toString.call(value).slice(8, -1)
  47236. }
  47237. /**
  47238. * Strict object type check. Only returns true
  47239. * for plain JavaScript objects.
  47240. */
  47241. function isPlainObject (obj) {
  47242. return _toString.call(obj) === '[object Object]'
  47243. }
  47244. function isRegExp (v) {
  47245. return _toString.call(v) === '[object RegExp]'
  47246. }
  47247. /**
  47248. * Check if val is a valid array index.
  47249. */
  47250. function isValidArrayIndex (val) {
  47251. var n = parseFloat(String(val));
  47252. return n >= 0 && Math.floor(n) === n && isFinite(val)
  47253. }
  47254. function isPromise (val) {
  47255. return (
  47256. isDef(val) &&
  47257. typeof val.then === 'function' &&
  47258. typeof val.catch === 'function'
  47259. )
  47260. }
  47261. /**
  47262. * Convert a value to a string that is actually rendered.
  47263. */
  47264. function toString (val) {
  47265. return val == null
  47266. ? ''
  47267. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  47268. ? JSON.stringify(val, null, 2)
  47269. : String(val)
  47270. }
  47271. /**
  47272. * Convert an input value to a number for persistence.
  47273. * If the conversion fails, return original string.
  47274. */
  47275. function toNumber (val) {
  47276. var n = parseFloat(val);
  47277. return isNaN(n) ? val : n
  47278. }
  47279. /**
  47280. * Make a map and return a function for checking if a key
  47281. * is in that map.
  47282. */
  47283. function makeMap (
  47284. str,
  47285. expectsLowerCase
  47286. ) {
  47287. var map = Object.create(null);
  47288. var list = str.split(',');
  47289. for (var i = 0; i < list.length; i++) {
  47290. map[list[i]] = true;
  47291. }
  47292. return expectsLowerCase
  47293. ? function (val) { return map[val.toLowerCase()]; }
  47294. : function (val) { return map[val]; }
  47295. }
  47296. /**
  47297. * Check if a tag is a built-in tag.
  47298. */
  47299. var isBuiltInTag = makeMap('slot,component', true);
  47300. /**
  47301. * Check if an attribute is a reserved attribute.
  47302. */
  47303. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  47304. /**
  47305. * Remove an item from an array.
  47306. */
  47307. function remove (arr, item) {
  47308. if (arr.length) {
  47309. var index = arr.indexOf(item);
  47310. if (index > -1) {
  47311. return arr.splice(index, 1)
  47312. }
  47313. }
  47314. }
  47315. /**
  47316. * Check whether an object has the property.
  47317. */
  47318. var hasOwnProperty = Object.prototype.hasOwnProperty;
  47319. function hasOwn (obj, key) {
  47320. return hasOwnProperty.call(obj, key)
  47321. }
  47322. /**
  47323. * Create a cached version of a pure function.
  47324. */
  47325. function cached (fn) {
  47326. var cache = Object.create(null);
  47327. return (function cachedFn (str) {
  47328. var hit = cache[str];
  47329. return hit || (cache[str] = fn(str))
  47330. })
  47331. }
  47332. /**
  47333. * Camelize a hyphen-delimited string.
  47334. */
  47335. var camelizeRE = /-(\w)/g;
  47336. var camelize = cached(function (str) {
  47337. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  47338. });
  47339. /**
  47340. * Capitalize a string.
  47341. */
  47342. var capitalize = cached(function (str) {
  47343. return str.charAt(0).toUpperCase() + str.slice(1)
  47344. });
  47345. /**
  47346. * Hyphenate a camelCase string.
  47347. */
  47348. var hyphenateRE = /\B([A-Z])/g;
  47349. var hyphenate = cached(function (str) {
  47350. return str.replace(hyphenateRE, '-$1').toLowerCase()
  47351. });
  47352. /**
  47353. * Simple bind polyfill for environments that do not support it,
  47354. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  47355. * since native bind is now performant enough in most browsers.
  47356. * But removing it would mean breaking code that was able to run in
  47357. * PhantomJS 1.x, so this must be kept for backward compatibility.
  47358. */
  47359. /* istanbul ignore next */
  47360. function polyfillBind (fn, ctx) {
  47361. function boundFn (a) {
  47362. var l = arguments.length;
  47363. return l
  47364. ? l > 1
  47365. ? fn.apply(ctx, arguments)
  47366. : fn.call(ctx, a)
  47367. : fn.call(ctx)
  47368. }
  47369. boundFn._length = fn.length;
  47370. return boundFn
  47371. }
  47372. function nativeBind (fn, ctx) {
  47373. return fn.bind(ctx)
  47374. }
  47375. var bind = Function.prototype.bind
  47376. ? nativeBind
  47377. : polyfillBind;
  47378. /**
  47379. * Convert an Array-like object to a real Array.
  47380. */
  47381. function toArray (list, start) {
  47382. start = start || 0;
  47383. var i = list.length - start;
  47384. var ret = new Array(i);
  47385. while (i--) {
  47386. ret[i] = list[i + start];
  47387. }
  47388. return ret
  47389. }
  47390. /**
  47391. * Mix properties into target object.
  47392. */
  47393. function extend (to, _from) {
  47394. for (var key in _from) {
  47395. to[key] = _from[key];
  47396. }
  47397. return to
  47398. }
  47399. /**
  47400. * Merge an Array of Objects into a single Object.
  47401. */
  47402. function toObject (arr) {
  47403. var res = {};
  47404. for (var i = 0; i < arr.length; i++) {
  47405. if (arr[i]) {
  47406. extend(res, arr[i]);
  47407. }
  47408. }
  47409. return res
  47410. }
  47411. /* eslint-disable no-unused-vars */
  47412. /**
  47413. * Perform no operation.
  47414. * Stubbing args to make Flow happy without leaving useless transpiled code
  47415. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  47416. */
  47417. function noop (a, b, c) {}
  47418. /**
  47419. * Always return false.
  47420. */
  47421. var no = function (a, b, c) { return false; };
  47422. /* eslint-enable no-unused-vars */
  47423. /**
  47424. * Return the same value.
  47425. */
  47426. var identity = function (_) { return _; };
  47427. /**
  47428. * Generate a string containing static keys from compiler modules.
  47429. */
  47430. function genStaticKeys (modules) {
  47431. return modules.reduce(function (keys, m) {
  47432. return keys.concat(m.staticKeys || [])
  47433. }, []).join(',')
  47434. }
  47435. /**
  47436. * Check if two values are loosely equal - that is,
  47437. * if they are plain objects, do they have the same shape?
  47438. */
  47439. function looseEqual (a, b) {
  47440. if (a === b) { return true }
  47441. var isObjectA = isObject(a);
  47442. var isObjectB = isObject(b);
  47443. if (isObjectA && isObjectB) {
  47444. try {
  47445. var isArrayA = Array.isArray(a);
  47446. var isArrayB = Array.isArray(b);
  47447. if (isArrayA && isArrayB) {
  47448. return a.length === b.length && a.every(function (e, i) {
  47449. return looseEqual(e, b[i])
  47450. })
  47451. } else if (a instanceof Date && b instanceof Date) {
  47452. return a.getTime() === b.getTime()
  47453. } else if (!isArrayA && !isArrayB) {
  47454. var keysA = Object.keys(a);
  47455. var keysB = Object.keys(b);
  47456. return keysA.length === keysB.length && keysA.every(function (key) {
  47457. return looseEqual(a[key], b[key])
  47458. })
  47459. } else {
  47460. /* istanbul ignore next */
  47461. return false
  47462. }
  47463. } catch (e) {
  47464. /* istanbul ignore next */
  47465. return false
  47466. }
  47467. } else if (!isObjectA && !isObjectB) {
  47468. return String(a) === String(b)
  47469. } else {
  47470. return false
  47471. }
  47472. }
  47473. /**
  47474. * Return the first index at which a loosely equal value can be
  47475. * found in the array (if value is a plain object, the array must
  47476. * contain an object of the same shape), or -1 if it is not present.
  47477. */
  47478. function looseIndexOf (arr, val) {
  47479. for (var i = 0; i < arr.length; i++) {
  47480. if (looseEqual(arr[i], val)) { return i }
  47481. }
  47482. return -1
  47483. }
  47484. /**
  47485. * Ensure a function is called only once.
  47486. */
  47487. function once (fn) {
  47488. var called = false;
  47489. return function () {
  47490. if (!called) {
  47491. called = true;
  47492. fn.apply(this, arguments);
  47493. }
  47494. }
  47495. }
  47496. var SSR_ATTR = 'data-server-rendered';
  47497. var ASSET_TYPES = [
  47498. 'component',
  47499. 'directive',
  47500. 'filter'
  47501. ];
  47502. var LIFECYCLE_HOOKS = [
  47503. 'beforeCreate',
  47504. 'created',
  47505. 'beforeMount',
  47506. 'mounted',
  47507. 'beforeUpdate',
  47508. 'updated',
  47509. 'beforeDestroy',
  47510. 'destroyed',
  47511. 'activated',
  47512. 'deactivated',
  47513. 'errorCaptured',
  47514. 'serverPrefetch'
  47515. ];
  47516. /* */
  47517. var config = ({
  47518. /**
  47519. * Option merge strategies (used in core/util/options)
  47520. */
  47521. // $flow-disable-line
  47522. optionMergeStrategies: Object.create(null),
  47523. /**
  47524. * Whether to suppress warnings.
  47525. */
  47526. silent: false,
  47527. /**
  47528. * Show production mode tip message on boot?
  47529. */
  47530. productionTip: "development" !== 'production',
  47531. /**
  47532. * Whether to enable devtools
  47533. */
  47534. devtools: "development" !== 'production',
  47535. /**
  47536. * Whether to record perf
  47537. */
  47538. performance: false,
  47539. /**
  47540. * Error handler for watcher errors
  47541. */
  47542. errorHandler: null,
  47543. /**
  47544. * Warn handler for watcher warns
  47545. */
  47546. warnHandler: null,
  47547. /**
  47548. * Ignore certain custom elements
  47549. */
  47550. ignoredElements: [],
  47551. /**
  47552. * Custom user key aliases for v-on
  47553. */
  47554. // $flow-disable-line
  47555. keyCodes: Object.create(null),
  47556. /**
  47557. * Check if a tag is reserved so that it cannot be registered as a
  47558. * component. This is platform-dependent and may be overwritten.
  47559. */
  47560. isReservedTag: no,
  47561. /**
  47562. * Check if an attribute is reserved so that it cannot be used as a component
  47563. * prop. This is platform-dependent and may be overwritten.
  47564. */
  47565. isReservedAttr: no,
  47566. /**
  47567. * Check if a tag is an unknown element.
  47568. * Platform-dependent.
  47569. */
  47570. isUnknownElement: no,
  47571. /**
  47572. * Get the namespace of an element
  47573. */
  47574. getTagNamespace: noop,
  47575. /**
  47576. * Parse the real tag name for the specific platform.
  47577. */
  47578. parsePlatformTagName: identity,
  47579. /**
  47580. * Check if an attribute must be bound using property, e.g. value
  47581. * Platform-dependent.
  47582. */
  47583. mustUseProp: no,
  47584. /**
  47585. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  47586. * This will significantly reduce performance if set to false.
  47587. */
  47588. async: true,
  47589. /**
  47590. * Exposed for legacy reasons
  47591. */
  47592. _lifecycleHooks: LIFECYCLE_HOOKS
  47593. });
  47594. /* */
  47595. /**
  47596. * unicode letters used for parsing html tags, component names and property paths.
  47597. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  47598. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  47599. */
  47600. 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/;
  47601. /**
  47602. * Check if a string starts with $ or _
  47603. */
  47604. function isReserved (str) {
  47605. var c = (str + '').charCodeAt(0);
  47606. return c === 0x24 || c === 0x5F
  47607. }
  47608. /**
  47609. * Define a property.
  47610. */
  47611. function def (obj, key, val, enumerable) {
  47612. Object.defineProperty(obj, key, {
  47613. value: val,
  47614. enumerable: !!enumerable,
  47615. writable: true,
  47616. configurable: true
  47617. });
  47618. }
  47619. /**
  47620. * Parse simple path.
  47621. */
  47622. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  47623. function parsePath (path) {
  47624. if (bailRE.test(path)) {
  47625. return
  47626. }
  47627. var segments = path.split('.');
  47628. return function (obj) {
  47629. for (var i = 0; i < segments.length; i++) {
  47630. if (!obj) { return }
  47631. obj = obj[segments[i]];
  47632. }
  47633. return obj
  47634. }
  47635. }
  47636. /* */
  47637. // can we use __proto__?
  47638. var hasProto = '__proto__' in {};
  47639. // Browser environment sniffing
  47640. var inBrowser = typeof window !== 'undefined';
  47641. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  47642. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  47643. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  47644. var isIE = UA && /msie|trident/.test(UA);
  47645. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  47646. var isEdge = UA && UA.indexOf('edge/') > 0;
  47647. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  47648. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  47649. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  47650. var isPhantomJS = UA && /phantomjs/.test(UA);
  47651. var isFF = UA && UA.match(/firefox\/(\d+)/);
  47652. // Firefox has a "watch" function on Object.prototype...
  47653. var nativeWatch = ({}).watch;
  47654. var supportsPassive = false;
  47655. if (inBrowser) {
  47656. try {
  47657. var opts = {};
  47658. Object.defineProperty(opts, 'passive', ({
  47659. get: function get () {
  47660. /* istanbul ignore next */
  47661. supportsPassive = true;
  47662. }
  47663. })); // https://github.com/facebook/flow/issues/285
  47664. window.addEventListener('test-passive', null, opts);
  47665. } catch (e) {}
  47666. }
  47667. // this needs to be lazy-evaled because vue may be required before
  47668. // vue-server-renderer can set VUE_ENV
  47669. var _isServer;
  47670. var isServerRendering = function () {
  47671. if (_isServer === undefined) {
  47672. /* istanbul ignore if */
  47673. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  47674. // detect presence of vue-server-renderer and avoid
  47675. // Webpack shimming the process
  47676. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  47677. } else {
  47678. _isServer = false;
  47679. }
  47680. }
  47681. return _isServer
  47682. };
  47683. // detect devtools
  47684. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  47685. /* istanbul ignore next */
  47686. function isNative (Ctor) {
  47687. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  47688. }
  47689. var hasSymbol =
  47690. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  47691. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  47692. var _Set;
  47693. /* istanbul ignore if */ // $flow-disable-line
  47694. if (typeof Set !== 'undefined' && isNative(Set)) {
  47695. // use native Set when available.
  47696. _Set = Set;
  47697. } else {
  47698. // a non-standard Set polyfill that only works with primitive keys.
  47699. _Set = /*@__PURE__*/(function () {
  47700. function Set () {
  47701. this.set = Object.create(null);
  47702. }
  47703. Set.prototype.has = function has (key) {
  47704. return this.set[key] === true
  47705. };
  47706. Set.prototype.add = function add (key) {
  47707. this.set[key] = true;
  47708. };
  47709. Set.prototype.clear = function clear () {
  47710. this.set = Object.create(null);
  47711. };
  47712. return Set;
  47713. }());
  47714. }
  47715. /* */
  47716. var warn = noop;
  47717. var tip = noop;
  47718. var generateComponentTrace = (noop); // work around flow check
  47719. var formatComponentName = (noop);
  47720. {
  47721. var hasConsole = typeof console !== 'undefined';
  47722. var classifyRE = /(?:^|[-_])(\w)/g;
  47723. var classify = function (str) { return str
  47724. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  47725. .replace(/[-_]/g, ''); };
  47726. warn = function (msg, vm) {
  47727. var trace = vm ? generateComponentTrace(vm) : '';
  47728. if (config.warnHandler) {
  47729. config.warnHandler.call(null, msg, vm, trace);
  47730. } else if (hasConsole && (!config.silent)) {
  47731. console.error(("[Vue warn]: " + msg + trace));
  47732. }
  47733. };
  47734. tip = function (msg, vm) {
  47735. if (hasConsole && (!config.silent)) {
  47736. console.warn("[Vue tip]: " + msg + (
  47737. vm ? generateComponentTrace(vm) : ''
  47738. ));
  47739. }
  47740. };
  47741. formatComponentName = function (vm, includeFile) {
  47742. if (vm.$root === vm) {
  47743. return '<Root>'
  47744. }
  47745. var options = typeof vm === 'function' && vm.cid != null
  47746. ? vm.options
  47747. : vm._isVue
  47748. ? vm.$options || vm.constructor.options
  47749. : vm;
  47750. var name = options.name || options._componentTag;
  47751. var file = options.__file;
  47752. if (!name && file) {
  47753. var match = file.match(/([^/\\]+)\.vue$/);
  47754. name = match && match[1];
  47755. }
  47756. return (
  47757. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  47758. (file && includeFile !== false ? (" at " + file) : '')
  47759. )
  47760. };
  47761. var repeat = function (str, n) {
  47762. var res = '';
  47763. while (n) {
  47764. if (n % 2 === 1) { res += str; }
  47765. if (n > 1) { str += str; }
  47766. n >>= 1;
  47767. }
  47768. return res
  47769. };
  47770. generateComponentTrace = function (vm) {
  47771. if (vm._isVue && vm.$parent) {
  47772. var tree = [];
  47773. var currentRecursiveSequence = 0;
  47774. while (vm) {
  47775. if (tree.length > 0) {
  47776. var last = tree[tree.length - 1];
  47777. if (last.constructor === vm.constructor) {
  47778. currentRecursiveSequence++;
  47779. vm = vm.$parent;
  47780. continue
  47781. } else if (currentRecursiveSequence > 0) {
  47782. tree[tree.length - 1] = [last, currentRecursiveSequence];
  47783. currentRecursiveSequence = 0;
  47784. }
  47785. }
  47786. tree.push(vm);
  47787. vm = vm.$parent;
  47788. }
  47789. return '\n\nfound in\n\n' + tree
  47790. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  47791. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  47792. : formatComponentName(vm))); })
  47793. .join('\n')
  47794. } else {
  47795. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  47796. }
  47797. };
  47798. }
  47799. /* */
  47800. var uid = 0;
  47801. /**
  47802. * A dep is an observable that can have multiple
  47803. * directives subscribing to it.
  47804. */
  47805. var Dep = function Dep () {
  47806. this.id = uid++;
  47807. this.subs = [];
  47808. };
  47809. Dep.prototype.addSub = function addSub (sub) {
  47810. this.subs.push(sub);
  47811. };
  47812. Dep.prototype.removeSub = function removeSub (sub) {
  47813. remove(this.subs, sub);
  47814. };
  47815. Dep.prototype.depend = function depend () {
  47816. if (Dep.target) {
  47817. Dep.target.addDep(this);
  47818. }
  47819. };
  47820. Dep.prototype.notify = function notify () {
  47821. // stabilize the subscriber list first
  47822. var subs = this.subs.slice();
  47823. if (!config.async) {
  47824. // subs aren't sorted in scheduler if not running async
  47825. // we need to sort them now to make sure they fire in correct
  47826. // order
  47827. subs.sort(function (a, b) { return a.id - b.id; });
  47828. }
  47829. for (var i = 0, l = subs.length; i < l; i++) {
  47830. subs[i].update();
  47831. }
  47832. };
  47833. // The current target watcher being evaluated.
  47834. // This is globally unique because only one watcher
  47835. // can be evaluated at a time.
  47836. Dep.target = null;
  47837. var targetStack = [];
  47838. function pushTarget (target) {
  47839. targetStack.push(target);
  47840. Dep.target = target;
  47841. }
  47842. function popTarget () {
  47843. targetStack.pop();
  47844. Dep.target = targetStack[targetStack.length - 1];
  47845. }
  47846. /* */
  47847. var VNode = function VNode (
  47848. tag,
  47849. data,
  47850. children,
  47851. text,
  47852. elm,
  47853. context,
  47854. componentOptions,
  47855. asyncFactory
  47856. ) {
  47857. this.tag = tag;
  47858. this.data = data;
  47859. this.children = children;
  47860. this.text = text;
  47861. this.elm = elm;
  47862. this.ns = undefined;
  47863. this.context = context;
  47864. this.fnContext = undefined;
  47865. this.fnOptions = undefined;
  47866. this.fnScopeId = undefined;
  47867. this.key = data && data.key;
  47868. this.componentOptions = componentOptions;
  47869. this.componentInstance = undefined;
  47870. this.parent = undefined;
  47871. this.raw = false;
  47872. this.isStatic = false;
  47873. this.isRootInsert = true;
  47874. this.isComment = false;
  47875. this.isCloned = false;
  47876. this.isOnce = false;
  47877. this.asyncFactory = asyncFactory;
  47878. this.asyncMeta = undefined;
  47879. this.isAsyncPlaceholder = false;
  47880. };
  47881. var prototypeAccessors = { child: { configurable: true } };
  47882. // DEPRECATED: alias for componentInstance for backwards compat.
  47883. /* istanbul ignore next */
  47884. prototypeAccessors.child.get = function () {
  47885. return this.componentInstance
  47886. };
  47887. Object.defineProperties( VNode.prototype, prototypeAccessors );
  47888. var createEmptyVNode = function (text) {
  47889. if ( text === void 0 ) text = '';
  47890. var node = new VNode();
  47891. node.text = text;
  47892. node.isComment = true;
  47893. return node
  47894. };
  47895. function createTextVNode (val) {
  47896. return new VNode(undefined, undefined, undefined, String(val))
  47897. }
  47898. // optimized shallow clone
  47899. // used for static nodes and slot nodes because they may be reused across
  47900. // multiple renders, cloning them avoids errors when DOM manipulations rely
  47901. // on their elm reference.
  47902. function cloneVNode (vnode) {
  47903. var cloned = new VNode(
  47904. vnode.tag,
  47905. vnode.data,
  47906. // #7975
  47907. // clone children array to avoid mutating original in case of cloning
  47908. // a child.
  47909. vnode.children && vnode.children.slice(),
  47910. vnode.text,
  47911. vnode.elm,
  47912. vnode.context,
  47913. vnode.componentOptions,
  47914. vnode.asyncFactory
  47915. );
  47916. cloned.ns = vnode.ns;
  47917. cloned.isStatic = vnode.isStatic;
  47918. cloned.key = vnode.key;
  47919. cloned.isComment = vnode.isComment;
  47920. cloned.fnContext = vnode.fnContext;
  47921. cloned.fnOptions = vnode.fnOptions;
  47922. cloned.fnScopeId = vnode.fnScopeId;
  47923. cloned.asyncMeta = vnode.asyncMeta;
  47924. cloned.isCloned = true;
  47925. return cloned
  47926. }
  47927. /*
  47928. * not type checking this file because flow doesn't play well with
  47929. * dynamically accessing methods on Array prototype
  47930. */
  47931. var arrayProto = Array.prototype;
  47932. var arrayMethods = Object.create(arrayProto);
  47933. var methodsToPatch = [
  47934. 'push',
  47935. 'pop',
  47936. 'shift',
  47937. 'unshift',
  47938. 'splice',
  47939. 'sort',
  47940. 'reverse'
  47941. ];
  47942. /**
  47943. * Intercept mutating methods and emit events
  47944. */
  47945. methodsToPatch.forEach(function (method) {
  47946. // cache original method
  47947. var original = arrayProto[method];
  47948. def(arrayMethods, method, function mutator () {
  47949. var args = [], len = arguments.length;
  47950. while ( len-- ) args[ len ] = arguments[ len ];
  47951. var result = original.apply(this, args);
  47952. var ob = this.__ob__;
  47953. var inserted;
  47954. switch (method) {
  47955. case 'push':
  47956. case 'unshift':
  47957. inserted = args;
  47958. break
  47959. case 'splice':
  47960. inserted = args.slice(2);
  47961. break
  47962. }
  47963. if (inserted) { ob.observeArray(inserted); }
  47964. // notify change
  47965. ob.dep.notify();
  47966. return result
  47967. });
  47968. });
  47969. /* */
  47970. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  47971. /**
  47972. * In some cases we may want to disable observation inside a component's
  47973. * update computation.
  47974. */
  47975. var shouldObserve = true;
  47976. function toggleObserving (value) {
  47977. shouldObserve = value;
  47978. }
  47979. /**
  47980. * Observer class that is attached to each observed
  47981. * object. Once attached, the observer converts the target
  47982. * object's property keys into getter/setters that
  47983. * collect dependencies and dispatch updates.
  47984. */
  47985. var Observer = function Observer (value) {
  47986. this.value = value;
  47987. this.dep = new Dep();
  47988. this.vmCount = 0;
  47989. def(value, '__ob__', this);
  47990. if (Array.isArray(value)) {
  47991. if (hasProto) {
  47992. protoAugment(value, arrayMethods);
  47993. } else {
  47994. copyAugment(value, arrayMethods, arrayKeys);
  47995. }
  47996. this.observeArray(value);
  47997. } else {
  47998. this.walk(value);
  47999. }
  48000. };
  48001. /**
  48002. * Walk through all properties and convert them into
  48003. * getter/setters. This method should only be called when
  48004. * value type is Object.
  48005. */
  48006. Observer.prototype.walk = function walk (obj) {
  48007. var keys = Object.keys(obj);
  48008. for (var i = 0; i < keys.length; i++) {
  48009. defineReactive$$1(obj, keys[i]);
  48010. }
  48011. };
  48012. /**
  48013. * Observe a list of Array items.
  48014. */
  48015. Observer.prototype.observeArray = function observeArray (items) {
  48016. for (var i = 0, l = items.length; i < l; i++) {
  48017. observe(items[i]);
  48018. }
  48019. };
  48020. // helpers
  48021. /**
  48022. * Augment a target Object or Array by intercepting
  48023. * the prototype chain using __proto__
  48024. */
  48025. function protoAugment (target, src) {
  48026. /* eslint-disable no-proto */
  48027. target.__proto__ = src;
  48028. /* eslint-enable no-proto */
  48029. }
  48030. /**
  48031. * Augment a target Object or Array by defining
  48032. * hidden properties.
  48033. */
  48034. /* istanbul ignore next */
  48035. function copyAugment (target, src, keys) {
  48036. for (var i = 0, l = keys.length; i < l; i++) {
  48037. var key = keys[i];
  48038. def(target, key, src[key]);
  48039. }
  48040. }
  48041. /**
  48042. * Attempt to create an observer instance for a value,
  48043. * returns the new observer if successfully observed,
  48044. * or the existing observer if the value already has one.
  48045. */
  48046. function observe (value, asRootData) {
  48047. if (!isObject(value) || value instanceof VNode) {
  48048. return
  48049. }
  48050. var ob;
  48051. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  48052. ob = value.__ob__;
  48053. } else if (
  48054. shouldObserve &&
  48055. !isServerRendering() &&
  48056. (Array.isArray(value) || isPlainObject(value)) &&
  48057. Object.isExtensible(value) &&
  48058. !value._isVue
  48059. ) {
  48060. ob = new Observer(value);
  48061. }
  48062. if (asRootData && ob) {
  48063. ob.vmCount++;
  48064. }
  48065. return ob
  48066. }
  48067. /**
  48068. * Define a reactive property on an Object.
  48069. */
  48070. function defineReactive$$1 (
  48071. obj,
  48072. key,
  48073. val,
  48074. customSetter,
  48075. shallow
  48076. ) {
  48077. var dep = new Dep();
  48078. var property = Object.getOwnPropertyDescriptor(obj, key);
  48079. if (property && property.configurable === false) {
  48080. return
  48081. }
  48082. // cater for pre-defined getter/setters
  48083. var getter = property && property.get;
  48084. var setter = property && property.set;
  48085. if ((!getter || setter) && arguments.length === 2) {
  48086. val = obj[key];
  48087. }
  48088. var childOb = !shallow && observe(val);
  48089. Object.defineProperty(obj, key, {
  48090. enumerable: true,
  48091. configurable: true,
  48092. get: function reactiveGetter () {
  48093. var value = getter ? getter.call(obj) : val;
  48094. if (Dep.target) {
  48095. dep.depend();
  48096. if (childOb) {
  48097. childOb.dep.depend();
  48098. if (Array.isArray(value)) {
  48099. dependArray(value);
  48100. }
  48101. }
  48102. }
  48103. return value
  48104. },
  48105. set: function reactiveSetter (newVal) {
  48106. var value = getter ? getter.call(obj) : val;
  48107. /* eslint-disable no-self-compare */
  48108. if (newVal === value || (newVal !== newVal && value !== value)) {
  48109. return
  48110. }
  48111. /* eslint-enable no-self-compare */
  48112. if (customSetter) {
  48113. customSetter();
  48114. }
  48115. // #7981: for accessor properties without setter
  48116. if (getter && !setter) { return }
  48117. if (setter) {
  48118. setter.call(obj, newVal);
  48119. } else {
  48120. val = newVal;
  48121. }
  48122. childOb = !shallow && observe(newVal);
  48123. dep.notify();
  48124. }
  48125. });
  48126. }
  48127. /**
  48128. * Set a property on an object. Adds the new property and
  48129. * triggers change notification if the property doesn't
  48130. * already exist.
  48131. */
  48132. function set (target, key, val) {
  48133. if (isUndef(target) || isPrimitive(target)
  48134. ) {
  48135. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  48136. }
  48137. if (Array.isArray(target) && isValidArrayIndex(key)) {
  48138. target.length = Math.max(target.length, key);
  48139. target.splice(key, 1, val);
  48140. return val
  48141. }
  48142. if (key in target && !(key in Object.prototype)) {
  48143. target[key] = val;
  48144. return val
  48145. }
  48146. var ob = (target).__ob__;
  48147. if (target._isVue || (ob && ob.vmCount)) {
  48148. warn(
  48149. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  48150. 'at runtime - declare it upfront in the data option.'
  48151. );
  48152. return val
  48153. }
  48154. if (!ob) {
  48155. target[key] = val;
  48156. return val
  48157. }
  48158. defineReactive$$1(ob.value, key, val);
  48159. ob.dep.notify();
  48160. return val
  48161. }
  48162. /**
  48163. * Delete a property and trigger change if necessary.
  48164. */
  48165. function del (target, key) {
  48166. if (isUndef(target) || isPrimitive(target)
  48167. ) {
  48168. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  48169. }
  48170. if (Array.isArray(target) && isValidArrayIndex(key)) {
  48171. target.splice(key, 1);
  48172. return
  48173. }
  48174. var ob = (target).__ob__;
  48175. if (target._isVue || (ob && ob.vmCount)) {
  48176. warn(
  48177. 'Avoid deleting properties on a Vue instance or its root $data ' +
  48178. '- just set it to null.'
  48179. );
  48180. return
  48181. }
  48182. if (!hasOwn(target, key)) {
  48183. return
  48184. }
  48185. delete target[key];
  48186. if (!ob) {
  48187. return
  48188. }
  48189. ob.dep.notify();
  48190. }
  48191. /**
  48192. * Collect dependencies on array elements when the array is touched, since
  48193. * we cannot intercept array element access like property getters.
  48194. */
  48195. function dependArray (value) {
  48196. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  48197. e = value[i];
  48198. e && e.__ob__ && e.__ob__.dep.depend();
  48199. if (Array.isArray(e)) {
  48200. dependArray(e);
  48201. }
  48202. }
  48203. }
  48204. /* */
  48205. /**
  48206. * Option overwriting strategies are functions that handle
  48207. * how to merge a parent option value and a child option
  48208. * value into the final value.
  48209. */
  48210. var strats = config.optionMergeStrategies;
  48211. /**
  48212. * Options with restrictions
  48213. */
  48214. {
  48215. strats.el = strats.propsData = function (parent, child, vm, key) {
  48216. if (!vm) {
  48217. warn(
  48218. "option \"" + key + "\" can only be used during instance " +
  48219. 'creation with the `new` keyword.'
  48220. );
  48221. }
  48222. return defaultStrat(parent, child)
  48223. };
  48224. }
  48225. /**
  48226. * Helper that recursively merges two data objects together.
  48227. */
  48228. function mergeData (to, from) {
  48229. if (!from) { return to }
  48230. var key, toVal, fromVal;
  48231. var keys = hasSymbol
  48232. ? Reflect.ownKeys(from)
  48233. : Object.keys(from);
  48234. for (var i = 0; i < keys.length; i++) {
  48235. key = keys[i];
  48236. // in case the object is already observed...
  48237. if (key === '__ob__') { continue }
  48238. toVal = to[key];
  48239. fromVal = from[key];
  48240. if (!hasOwn(to, key)) {
  48241. set(to, key, fromVal);
  48242. } else if (
  48243. toVal !== fromVal &&
  48244. isPlainObject(toVal) &&
  48245. isPlainObject(fromVal)
  48246. ) {
  48247. mergeData(toVal, fromVal);
  48248. }
  48249. }
  48250. return to
  48251. }
  48252. /**
  48253. * Data
  48254. */
  48255. function mergeDataOrFn (
  48256. parentVal,
  48257. childVal,
  48258. vm
  48259. ) {
  48260. if (!vm) {
  48261. // in a Vue.extend merge, both should be functions
  48262. if (!childVal) {
  48263. return parentVal
  48264. }
  48265. if (!parentVal) {
  48266. return childVal
  48267. }
  48268. // when parentVal & childVal are both present,
  48269. // we need to return a function that returns the
  48270. // merged result of both functions... no need to
  48271. // check if parentVal is a function here because
  48272. // it has to be a function to pass previous merges.
  48273. return function mergedDataFn () {
  48274. return mergeData(
  48275. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  48276. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  48277. )
  48278. }
  48279. } else {
  48280. return function mergedInstanceDataFn () {
  48281. // instance merge
  48282. var instanceData = typeof childVal === 'function'
  48283. ? childVal.call(vm, vm)
  48284. : childVal;
  48285. var defaultData = typeof parentVal === 'function'
  48286. ? parentVal.call(vm, vm)
  48287. : parentVal;
  48288. if (instanceData) {
  48289. return mergeData(instanceData, defaultData)
  48290. } else {
  48291. return defaultData
  48292. }
  48293. }
  48294. }
  48295. }
  48296. strats.data = function (
  48297. parentVal,
  48298. childVal,
  48299. vm
  48300. ) {
  48301. if (!vm) {
  48302. if (childVal && typeof childVal !== 'function') {
  48303. warn(
  48304. 'The "data" option should be a function ' +
  48305. 'that returns a per-instance value in component ' +
  48306. 'definitions.',
  48307. vm
  48308. );
  48309. return parentVal
  48310. }
  48311. return mergeDataOrFn(parentVal, childVal)
  48312. }
  48313. return mergeDataOrFn(parentVal, childVal, vm)
  48314. };
  48315. /**
  48316. * Hooks and props are merged as arrays.
  48317. */
  48318. function mergeHook (
  48319. parentVal,
  48320. childVal
  48321. ) {
  48322. var res = childVal
  48323. ? parentVal
  48324. ? parentVal.concat(childVal)
  48325. : Array.isArray(childVal)
  48326. ? childVal
  48327. : [childVal]
  48328. : parentVal;
  48329. return res
  48330. ? dedupeHooks(res)
  48331. : res
  48332. }
  48333. function dedupeHooks (hooks) {
  48334. var res = [];
  48335. for (var i = 0; i < hooks.length; i++) {
  48336. if (res.indexOf(hooks[i]) === -1) {
  48337. res.push(hooks[i]);
  48338. }
  48339. }
  48340. return res
  48341. }
  48342. LIFECYCLE_HOOKS.forEach(function (hook) {
  48343. strats[hook] = mergeHook;
  48344. });
  48345. /**
  48346. * Assets
  48347. *
  48348. * When a vm is present (instance creation), we need to do
  48349. * a three-way merge between constructor options, instance
  48350. * options and parent options.
  48351. */
  48352. function mergeAssets (
  48353. parentVal,
  48354. childVal,
  48355. vm,
  48356. key
  48357. ) {
  48358. var res = Object.create(parentVal || null);
  48359. if (childVal) {
  48360. assertObjectType(key, childVal, vm);
  48361. return extend(res, childVal)
  48362. } else {
  48363. return res
  48364. }
  48365. }
  48366. ASSET_TYPES.forEach(function (type) {
  48367. strats[type + 's'] = mergeAssets;
  48368. });
  48369. /**
  48370. * Watchers.
  48371. *
  48372. * Watchers hashes should not overwrite one
  48373. * another, so we merge them as arrays.
  48374. */
  48375. strats.watch = function (
  48376. parentVal,
  48377. childVal,
  48378. vm,
  48379. key
  48380. ) {
  48381. // work around Firefox's Object.prototype.watch...
  48382. if (parentVal === nativeWatch) { parentVal = undefined; }
  48383. if (childVal === nativeWatch) { childVal = undefined; }
  48384. /* istanbul ignore if */
  48385. if (!childVal) { return Object.create(parentVal || null) }
  48386. {
  48387. assertObjectType(key, childVal, vm);
  48388. }
  48389. if (!parentVal) { return childVal }
  48390. var ret = {};
  48391. extend(ret, parentVal);
  48392. for (var key$1 in childVal) {
  48393. var parent = ret[key$1];
  48394. var child = childVal[key$1];
  48395. if (parent && !Array.isArray(parent)) {
  48396. parent = [parent];
  48397. }
  48398. ret[key$1] = parent
  48399. ? parent.concat(child)
  48400. : Array.isArray(child) ? child : [child];
  48401. }
  48402. return ret
  48403. };
  48404. /**
  48405. * Other object hashes.
  48406. */
  48407. strats.props =
  48408. strats.methods =
  48409. strats.inject =
  48410. strats.computed = function (
  48411. parentVal,
  48412. childVal,
  48413. vm,
  48414. key
  48415. ) {
  48416. if (childVal && "development" !== 'production') {
  48417. assertObjectType(key, childVal, vm);
  48418. }
  48419. if (!parentVal) { return childVal }
  48420. var ret = Object.create(null);
  48421. extend(ret, parentVal);
  48422. if (childVal) { extend(ret, childVal); }
  48423. return ret
  48424. };
  48425. strats.provide = mergeDataOrFn;
  48426. /**
  48427. * Default strategy.
  48428. */
  48429. var defaultStrat = function (parentVal, childVal) {
  48430. return childVal === undefined
  48431. ? parentVal
  48432. : childVal
  48433. };
  48434. /**
  48435. * Validate component names
  48436. */
  48437. function checkComponents (options) {
  48438. for (var key in options.components) {
  48439. validateComponentName(key);
  48440. }
  48441. }
  48442. function validateComponentName (name) {
  48443. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  48444. warn(
  48445. 'Invalid component name: "' + name + '". Component names ' +
  48446. 'should conform to valid custom element name in html5 specification.'
  48447. );
  48448. }
  48449. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  48450. warn(
  48451. 'Do not use built-in or reserved HTML elements as component ' +
  48452. 'id: ' + name
  48453. );
  48454. }
  48455. }
  48456. /**
  48457. * Ensure all props option syntax are normalized into the
  48458. * Object-based format.
  48459. */
  48460. function normalizeProps (options, vm) {
  48461. var props = options.props;
  48462. if (!props) { return }
  48463. var res = {};
  48464. var i, val, name;
  48465. if (Array.isArray(props)) {
  48466. i = props.length;
  48467. while (i--) {
  48468. val = props[i];
  48469. if (typeof val === 'string') {
  48470. name = camelize(val);
  48471. res[name] = { type: null };
  48472. } else {
  48473. warn('props must be strings when using array syntax.');
  48474. }
  48475. }
  48476. } else if (isPlainObject(props)) {
  48477. for (var key in props) {
  48478. val = props[key];
  48479. name = camelize(key);
  48480. res[name] = isPlainObject(val)
  48481. ? val
  48482. : { type: val };
  48483. }
  48484. } else {
  48485. warn(
  48486. "Invalid value for option \"props\": expected an Array or an Object, " +
  48487. "but got " + (toRawType(props)) + ".",
  48488. vm
  48489. );
  48490. }
  48491. options.props = res;
  48492. }
  48493. /**
  48494. * Normalize all injections into Object-based format
  48495. */
  48496. function normalizeInject (options, vm) {
  48497. var inject = options.inject;
  48498. if (!inject) { return }
  48499. var normalized = options.inject = {};
  48500. if (Array.isArray(inject)) {
  48501. for (var i = 0; i < inject.length; i++) {
  48502. normalized[inject[i]] = { from: inject[i] };
  48503. }
  48504. } else if (isPlainObject(inject)) {
  48505. for (var key in inject) {
  48506. var val = inject[key];
  48507. normalized[key] = isPlainObject(val)
  48508. ? extend({ from: key }, val)
  48509. : { from: val };
  48510. }
  48511. } else {
  48512. warn(
  48513. "Invalid value for option \"inject\": expected an Array or an Object, " +
  48514. "but got " + (toRawType(inject)) + ".",
  48515. vm
  48516. );
  48517. }
  48518. }
  48519. /**
  48520. * Normalize raw function directives into object format.
  48521. */
  48522. function normalizeDirectives (options) {
  48523. var dirs = options.directives;
  48524. if (dirs) {
  48525. for (var key in dirs) {
  48526. var def$$1 = dirs[key];
  48527. if (typeof def$$1 === 'function') {
  48528. dirs[key] = { bind: def$$1, update: def$$1 };
  48529. }
  48530. }
  48531. }
  48532. }
  48533. function assertObjectType (name, value, vm) {
  48534. if (!isPlainObject(value)) {
  48535. warn(
  48536. "Invalid value for option \"" + name + "\": expected an Object, " +
  48537. "but got " + (toRawType(value)) + ".",
  48538. vm
  48539. );
  48540. }
  48541. }
  48542. /**
  48543. * Merge two option objects into a new one.
  48544. * Core utility used in both instantiation and inheritance.
  48545. */
  48546. function mergeOptions (
  48547. parent,
  48548. child,
  48549. vm
  48550. ) {
  48551. {
  48552. checkComponents(child);
  48553. }
  48554. if (typeof child === 'function') {
  48555. child = child.options;
  48556. }
  48557. normalizeProps(child, vm);
  48558. normalizeInject(child, vm);
  48559. normalizeDirectives(child);
  48560. // Apply extends and mixins on the child options,
  48561. // but only if it is a raw options object that isn't
  48562. // the result of another mergeOptions call.
  48563. // Only merged options has the _base property.
  48564. if (!child._base) {
  48565. if (child.extends) {
  48566. parent = mergeOptions(parent, child.extends, vm);
  48567. }
  48568. if (child.mixins) {
  48569. for (var i = 0, l = child.mixins.length; i < l; i++) {
  48570. parent = mergeOptions(parent, child.mixins[i], vm);
  48571. }
  48572. }
  48573. }
  48574. var options = {};
  48575. var key;
  48576. for (key in parent) {
  48577. mergeField(key);
  48578. }
  48579. for (key in child) {
  48580. if (!hasOwn(parent, key)) {
  48581. mergeField(key);
  48582. }
  48583. }
  48584. function mergeField (key) {
  48585. var strat = strats[key] || defaultStrat;
  48586. options[key] = strat(parent[key], child[key], vm, key);
  48587. }
  48588. return options
  48589. }
  48590. /**
  48591. * Resolve an asset.
  48592. * This function is used because child instances need access
  48593. * to assets defined in its ancestor chain.
  48594. */
  48595. function resolveAsset (
  48596. options,
  48597. type,
  48598. id,
  48599. warnMissing
  48600. ) {
  48601. /* istanbul ignore if */
  48602. if (typeof id !== 'string') {
  48603. return
  48604. }
  48605. var assets = options[type];
  48606. // check local registration variations first
  48607. if (hasOwn(assets, id)) { return assets[id] }
  48608. var camelizedId = camelize(id);
  48609. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  48610. var PascalCaseId = capitalize(camelizedId);
  48611. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  48612. // fallback to prototype chain
  48613. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  48614. if (warnMissing && !res) {
  48615. warn(
  48616. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  48617. options
  48618. );
  48619. }
  48620. return res
  48621. }
  48622. /* */
  48623. function validateProp (
  48624. key,
  48625. propOptions,
  48626. propsData,
  48627. vm
  48628. ) {
  48629. var prop = propOptions[key];
  48630. var absent = !hasOwn(propsData, key);
  48631. var value = propsData[key];
  48632. // boolean casting
  48633. var booleanIndex = getTypeIndex(Boolean, prop.type);
  48634. if (booleanIndex > -1) {
  48635. if (absent && !hasOwn(prop, 'default')) {
  48636. value = false;
  48637. } else if (value === '' || value === hyphenate(key)) {
  48638. // only cast empty string / same name to boolean if
  48639. // boolean has higher priority
  48640. var stringIndex = getTypeIndex(String, prop.type);
  48641. if (stringIndex < 0 || booleanIndex < stringIndex) {
  48642. value = true;
  48643. }
  48644. }
  48645. }
  48646. // check default value
  48647. if (value === undefined) {
  48648. value = getPropDefaultValue(vm, prop, key);
  48649. // since the default value is a fresh copy,
  48650. // make sure to observe it.
  48651. var prevShouldObserve = shouldObserve;
  48652. toggleObserving(true);
  48653. observe(value);
  48654. toggleObserving(prevShouldObserve);
  48655. }
  48656. {
  48657. assertProp(prop, key, value, vm, absent);
  48658. }
  48659. return value
  48660. }
  48661. /**
  48662. * Get the default value of a prop.
  48663. */
  48664. function getPropDefaultValue (vm, prop, key) {
  48665. // no default, return undefined
  48666. if (!hasOwn(prop, 'default')) {
  48667. return undefined
  48668. }
  48669. var def = prop.default;
  48670. // warn against non-factory defaults for Object & Array
  48671. if (isObject(def)) {
  48672. warn(
  48673. 'Invalid default value for prop "' + key + '": ' +
  48674. 'Props with type Object/Array must use a factory function ' +
  48675. 'to return the default value.',
  48676. vm
  48677. );
  48678. }
  48679. // the raw prop value was also undefined from previous render,
  48680. // return previous default value to avoid unnecessary watcher trigger
  48681. if (vm && vm.$options.propsData &&
  48682. vm.$options.propsData[key] === undefined &&
  48683. vm._props[key] !== undefined
  48684. ) {
  48685. return vm._props[key]
  48686. }
  48687. // call factory function for non-Function types
  48688. // a value is Function if its prototype is function even across different execution context
  48689. return typeof def === 'function' && getType(prop.type) !== 'Function'
  48690. ? def.call(vm)
  48691. : def
  48692. }
  48693. /**
  48694. * Assert whether a prop is valid.
  48695. */
  48696. function assertProp (
  48697. prop,
  48698. name,
  48699. value,
  48700. vm,
  48701. absent
  48702. ) {
  48703. if (prop.required && absent) {
  48704. warn(
  48705. 'Missing required prop: "' + name + '"',
  48706. vm
  48707. );
  48708. return
  48709. }
  48710. if (value == null && !prop.required) {
  48711. return
  48712. }
  48713. var type = prop.type;
  48714. var valid = !type || type === true;
  48715. var expectedTypes = [];
  48716. if (type) {
  48717. if (!Array.isArray(type)) {
  48718. type = [type];
  48719. }
  48720. for (var i = 0; i < type.length && !valid; i++) {
  48721. var assertedType = assertType(value, type[i]);
  48722. expectedTypes.push(assertedType.expectedType || '');
  48723. valid = assertedType.valid;
  48724. }
  48725. }
  48726. if (!valid) {
  48727. warn(
  48728. getInvalidTypeMessage(name, value, expectedTypes),
  48729. vm
  48730. );
  48731. return
  48732. }
  48733. var validator = prop.validator;
  48734. if (validator) {
  48735. if (!validator(value)) {
  48736. warn(
  48737. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  48738. vm
  48739. );
  48740. }
  48741. }
  48742. }
  48743. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  48744. function assertType (value, type) {
  48745. var valid;
  48746. var expectedType = getType(type);
  48747. if (simpleCheckRE.test(expectedType)) {
  48748. var t = typeof value;
  48749. valid = t === expectedType.toLowerCase();
  48750. // for primitive wrapper objects
  48751. if (!valid && t === 'object') {
  48752. valid = value instanceof type;
  48753. }
  48754. } else if (expectedType === 'Object') {
  48755. valid = isPlainObject(value);
  48756. } else if (expectedType === 'Array') {
  48757. valid = Array.isArray(value);
  48758. } else {
  48759. valid = value instanceof type;
  48760. }
  48761. return {
  48762. valid: valid,
  48763. expectedType: expectedType
  48764. }
  48765. }
  48766. /**
  48767. * Use function string name to check built-in types,
  48768. * because a simple equality check will fail when running
  48769. * across different vms / iframes.
  48770. */
  48771. function getType (fn) {
  48772. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  48773. return match ? match[1] : ''
  48774. }
  48775. function isSameType (a, b) {
  48776. return getType(a) === getType(b)
  48777. }
  48778. function getTypeIndex (type, expectedTypes) {
  48779. if (!Array.isArray(expectedTypes)) {
  48780. return isSameType(expectedTypes, type) ? 0 : -1
  48781. }
  48782. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  48783. if (isSameType(expectedTypes[i], type)) {
  48784. return i
  48785. }
  48786. }
  48787. return -1
  48788. }
  48789. function getInvalidTypeMessage (name, value, expectedTypes) {
  48790. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  48791. " Expected " + (expectedTypes.map(capitalize).join(', '));
  48792. var expectedType = expectedTypes[0];
  48793. var receivedType = toRawType(value);
  48794. var expectedValue = styleValue(value, expectedType);
  48795. var receivedValue = styleValue(value, receivedType);
  48796. // check if we need to specify expected value
  48797. if (expectedTypes.length === 1 &&
  48798. isExplicable(expectedType) &&
  48799. !isBoolean(expectedType, receivedType)) {
  48800. message += " with value " + expectedValue;
  48801. }
  48802. message += ", got " + receivedType + " ";
  48803. // check if we need to specify received value
  48804. if (isExplicable(receivedType)) {
  48805. message += "with value " + receivedValue + ".";
  48806. }
  48807. return message
  48808. }
  48809. function styleValue (value, type) {
  48810. if (type === 'String') {
  48811. return ("\"" + value + "\"")
  48812. } else if (type === 'Number') {
  48813. return ("" + (Number(value)))
  48814. } else {
  48815. return ("" + value)
  48816. }
  48817. }
  48818. function isExplicable (value) {
  48819. var explicitTypes = ['string', 'number', 'boolean'];
  48820. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  48821. }
  48822. function isBoolean () {
  48823. var args = [], len = arguments.length;
  48824. while ( len-- ) args[ len ] = arguments[ len ];
  48825. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  48826. }
  48827. /* */
  48828. function handleError (err, vm, info) {
  48829. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  48830. // See: https://github.com/vuejs/vuex/issues/1505
  48831. pushTarget();
  48832. try {
  48833. if (vm) {
  48834. var cur = vm;
  48835. while ((cur = cur.$parent)) {
  48836. var hooks = cur.$options.errorCaptured;
  48837. if (hooks) {
  48838. for (var i = 0; i < hooks.length; i++) {
  48839. try {
  48840. var capture = hooks[i].call(cur, err, vm, info) === false;
  48841. if (capture) { return }
  48842. } catch (e) {
  48843. globalHandleError(e, cur, 'errorCaptured hook');
  48844. }
  48845. }
  48846. }
  48847. }
  48848. }
  48849. globalHandleError(err, vm, info);
  48850. } finally {
  48851. popTarget();
  48852. }
  48853. }
  48854. function invokeWithErrorHandling (
  48855. handler,
  48856. context,
  48857. args,
  48858. vm,
  48859. info
  48860. ) {
  48861. var res;
  48862. try {
  48863. res = args ? handler.apply(context, args) : handler.call(context);
  48864. if (res && !res._isVue && isPromise(res) && !res._handled) {
  48865. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  48866. // issue #9511
  48867. // avoid catch triggering multiple times when nested calls
  48868. res._handled = true;
  48869. }
  48870. } catch (e) {
  48871. handleError(e, vm, info);
  48872. }
  48873. return res
  48874. }
  48875. function globalHandleError (err, vm, info) {
  48876. if (config.errorHandler) {
  48877. try {
  48878. return config.errorHandler.call(null, err, vm, info)
  48879. } catch (e) {
  48880. // if the user intentionally throws the original error in the handler,
  48881. // do not log it twice
  48882. if (e !== err) {
  48883. logError(e, null, 'config.errorHandler');
  48884. }
  48885. }
  48886. }
  48887. logError(err, vm, info);
  48888. }
  48889. function logError (err, vm, info) {
  48890. {
  48891. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  48892. }
  48893. /* istanbul ignore else */
  48894. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  48895. console.error(err);
  48896. } else {
  48897. throw err
  48898. }
  48899. }
  48900. /* */
  48901. var isUsingMicroTask = false;
  48902. var callbacks = [];
  48903. var pending = false;
  48904. function flushCallbacks () {
  48905. pending = false;
  48906. var copies = callbacks.slice(0);
  48907. callbacks.length = 0;
  48908. for (var i = 0; i < copies.length; i++) {
  48909. copies[i]();
  48910. }
  48911. }
  48912. // Here we have async deferring wrappers using microtasks.
  48913. // In 2.5 we used (macro) tasks (in combination with microtasks).
  48914. // However, it has subtle problems when state is changed right before repaint
  48915. // (e.g. #6813, out-in transitions).
  48916. // Also, using (macro) tasks in event handler would cause some weird behaviors
  48917. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  48918. // So we now use microtasks everywhere, again.
  48919. // A major drawback of this tradeoff is that there are some scenarios
  48920. // where microtasks have too high a priority and fire in between supposedly
  48921. // sequential events (e.g. #4521, #6690, which have workarounds)
  48922. // or even between bubbling of the same event (#6566).
  48923. var timerFunc;
  48924. // The nextTick behavior leverages the microtask queue, which can be accessed
  48925. // via either native Promise.then or MutationObserver.
  48926. // MutationObserver has wider support, however it is seriously bugged in
  48927. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  48928. // completely stops working after triggering a few times... so, if native
  48929. // Promise is available, we will use it:
  48930. /* istanbul ignore next, $flow-disable-line */
  48931. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  48932. var p = Promise.resolve();
  48933. timerFunc = function () {
  48934. p.then(flushCallbacks);
  48935. // In problematic UIWebViews, Promise.then doesn't completely break, but
  48936. // it can get stuck in a weird state where callbacks are pushed into the
  48937. // microtask queue but the queue isn't being flushed, until the browser
  48938. // needs to do some other work, e.g. handle a timer. Therefore we can
  48939. // "force" the microtask queue to be flushed by adding an empty timer.
  48940. if (isIOS) { setTimeout(noop); }
  48941. };
  48942. isUsingMicroTask = true;
  48943. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  48944. isNative(MutationObserver) ||
  48945. // PhantomJS and iOS 7.x
  48946. MutationObserver.toString() === '[object MutationObserverConstructor]'
  48947. )) {
  48948. // Use MutationObserver where native Promise is not available,
  48949. // e.g. PhantomJS, iOS7, Android 4.4
  48950. // (#6466 MutationObserver is unreliable in IE11)
  48951. var counter = 1;
  48952. var observer = new MutationObserver(flushCallbacks);
  48953. var textNode = document.createTextNode(String(counter));
  48954. observer.observe(textNode, {
  48955. characterData: true
  48956. });
  48957. timerFunc = function () {
  48958. counter = (counter + 1) % 2;
  48959. textNode.data = String(counter);
  48960. };
  48961. isUsingMicroTask = true;
  48962. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  48963. // Fallback to setImmediate.
  48964. // Technically it leverages the (macro) task queue,
  48965. // but it is still a better choice than setTimeout.
  48966. timerFunc = function () {
  48967. setImmediate(flushCallbacks);
  48968. };
  48969. } else {
  48970. // Fallback to setTimeout.
  48971. timerFunc = function () {
  48972. setTimeout(flushCallbacks, 0);
  48973. };
  48974. }
  48975. function nextTick (cb, ctx) {
  48976. var _resolve;
  48977. callbacks.push(function () {
  48978. if (cb) {
  48979. try {
  48980. cb.call(ctx);
  48981. } catch (e) {
  48982. handleError(e, ctx, 'nextTick');
  48983. }
  48984. } else if (_resolve) {
  48985. _resolve(ctx);
  48986. }
  48987. });
  48988. if (!pending) {
  48989. pending = true;
  48990. timerFunc();
  48991. }
  48992. // $flow-disable-line
  48993. if (!cb && typeof Promise !== 'undefined') {
  48994. return new Promise(function (resolve) {
  48995. _resolve = resolve;
  48996. })
  48997. }
  48998. }
  48999. /* */
  49000. var mark;
  49001. var measure;
  49002. {
  49003. var perf = inBrowser && window.performance;
  49004. /* istanbul ignore if */
  49005. if (
  49006. perf &&
  49007. perf.mark &&
  49008. perf.measure &&
  49009. perf.clearMarks &&
  49010. perf.clearMeasures
  49011. ) {
  49012. mark = function (tag) { return perf.mark(tag); };
  49013. measure = function (name, startTag, endTag) {
  49014. perf.measure(name, startTag, endTag);
  49015. perf.clearMarks(startTag);
  49016. perf.clearMarks(endTag);
  49017. // perf.clearMeasures(name)
  49018. };
  49019. }
  49020. }
  49021. /* not type checking this file because flow doesn't play well with Proxy */
  49022. var initProxy;
  49023. {
  49024. var allowedGlobals = makeMap(
  49025. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  49026. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  49027. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  49028. 'require' // for Webpack/Browserify
  49029. );
  49030. var warnNonPresent = function (target, key) {
  49031. warn(
  49032. "Property or method \"" + key + "\" is not defined on the instance but " +
  49033. 'referenced during render. Make sure that this property is reactive, ' +
  49034. 'either in the data option, or for class-based components, by ' +
  49035. 'initializing the property. ' +
  49036. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  49037. target
  49038. );
  49039. };
  49040. var warnReservedPrefix = function (target, key) {
  49041. warn(
  49042. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  49043. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  49044. 'prevent conflicts with Vue internals. ' +
  49045. 'See: https://vuejs.org/v2/api/#data',
  49046. target
  49047. );
  49048. };
  49049. var hasProxy =
  49050. typeof Proxy !== 'undefined' && isNative(Proxy);
  49051. if (hasProxy) {
  49052. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  49053. config.keyCodes = new Proxy(config.keyCodes, {
  49054. set: function set (target, key, value) {
  49055. if (isBuiltInModifier(key)) {
  49056. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  49057. return false
  49058. } else {
  49059. target[key] = value;
  49060. return true
  49061. }
  49062. }
  49063. });
  49064. }
  49065. var hasHandler = {
  49066. has: function has (target, key) {
  49067. var has = key in target;
  49068. var isAllowed = allowedGlobals(key) ||
  49069. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  49070. if (!has && !isAllowed) {
  49071. if (key in target.$data) { warnReservedPrefix(target, key); }
  49072. else { warnNonPresent(target, key); }
  49073. }
  49074. return has || !isAllowed
  49075. }
  49076. };
  49077. var getHandler = {
  49078. get: function get (target, key) {
  49079. if (typeof key === 'string' && !(key in target)) {
  49080. if (key in target.$data) { warnReservedPrefix(target, key); }
  49081. else { warnNonPresent(target, key); }
  49082. }
  49083. return target[key]
  49084. }
  49085. };
  49086. initProxy = function initProxy (vm) {
  49087. if (hasProxy) {
  49088. // determine which proxy handler to use
  49089. var options = vm.$options;
  49090. var handlers = options.render && options.render._withStripped
  49091. ? getHandler
  49092. : hasHandler;
  49093. vm._renderProxy = new Proxy(vm, handlers);
  49094. } else {
  49095. vm._renderProxy = vm;
  49096. }
  49097. };
  49098. }
  49099. /* */
  49100. var seenObjects = new _Set();
  49101. /**
  49102. * Recursively traverse an object to evoke all converted
  49103. * getters, so that every nested property inside the object
  49104. * is collected as a "deep" dependency.
  49105. */
  49106. function traverse (val) {
  49107. _traverse(val, seenObjects);
  49108. seenObjects.clear();
  49109. }
  49110. function _traverse (val, seen) {
  49111. var i, keys;
  49112. var isA = Array.isArray(val);
  49113. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  49114. return
  49115. }
  49116. if (val.__ob__) {
  49117. var depId = val.__ob__.dep.id;
  49118. if (seen.has(depId)) {
  49119. return
  49120. }
  49121. seen.add(depId);
  49122. }
  49123. if (isA) {
  49124. i = val.length;
  49125. while (i--) { _traverse(val[i], seen); }
  49126. } else {
  49127. keys = Object.keys(val);
  49128. i = keys.length;
  49129. while (i--) { _traverse(val[keys[i]], seen); }
  49130. }
  49131. }
  49132. /* */
  49133. var normalizeEvent = cached(function (name) {
  49134. var passive = name.charAt(0) === '&';
  49135. name = passive ? name.slice(1) : name;
  49136. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  49137. name = once$$1 ? name.slice(1) : name;
  49138. var capture = name.charAt(0) === '!';
  49139. name = capture ? name.slice(1) : name;
  49140. return {
  49141. name: name,
  49142. once: once$$1,
  49143. capture: capture,
  49144. passive: passive
  49145. }
  49146. });
  49147. function createFnInvoker (fns, vm) {
  49148. function invoker () {
  49149. var arguments$1 = arguments;
  49150. var fns = invoker.fns;
  49151. if (Array.isArray(fns)) {
  49152. var cloned = fns.slice();
  49153. for (var i = 0; i < cloned.length; i++) {
  49154. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  49155. }
  49156. } else {
  49157. // return handler return value for single handlers
  49158. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  49159. }
  49160. }
  49161. invoker.fns = fns;
  49162. return invoker
  49163. }
  49164. function updateListeners (
  49165. on,
  49166. oldOn,
  49167. add,
  49168. remove$$1,
  49169. createOnceHandler,
  49170. vm
  49171. ) {
  49172. var name, def$$1, cur, old, event;
  49173. for (name in on) {
  49174. def$$1 = cur = on[name];
  49175. old = oldOn[name];
  49176. event = normalizeEvent(name);
  49177. if (isUndef(cur)) {
  49178. warn(
  49179. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  49180. vm
  49181. );
  49182. } else if (isUndef(old)) {
  49183. if (isUndef(cur.fns)) {
  49184. cur = on[name] = createFnInvoker(cur, vm);
  49185. }
  49186. if (isTrue(event.once)) {
  49187. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  49188. }
  49189. add(event.name, cur, event.capture, event.passive, event.params);
  49190. } else if (cur !== old) {
  49191. old.fns = cur;
  49192. on[name] = old;
  49193. }
  49194. }
  49195. for (name in oldOn) {
  49196. if (isUndef(on[name])) {
  49197. event = normalizeEvent(name);
  49198. remove$$1(event.name, oldOn[name], event.capture);
  49199. }
  49200. }
  49201. }
  49202. /* */
  49203. function mergeVNodeHook (def, hookKey, hook) {
  49204. if (def instanceof VNode) {
  49205. def = def.data.hook || (def.data.hook = {});
  49206. }
  49207. var invoker;
  49208. var oldHook = def[hookKey];
  49209. function wrappedHook () {
  49210. hook.apply(this, arguments);
  49211. // important: remove merged hook to ensure it's called only once
  49212. // and prevent memory leak
  49213. remove(invoker.fns, wrappedHook);
  49214. }
  49215. if (isUndef(oldHook)) {
  49216. // no existing hook
  49217. invoker = createFnInvoker([wrappedHook]);
  49218. } else {
  49219. /* istanbul ignore if */
  49220. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  49221. // already a merged invoker
  49222. invoker = oldHook;
  49223. invoker.fns.push(wrappedHook);
  49224. } else {
  49225. // existing plain hook
  49226. invoker = createFnInvoker([oldHook, wrappedHook]);
  49227. }
  49228. }
  49229. invoker.merged = true;
  49230. def[hookKey] = invoker;
  49231. }
  49232. /* */
  49233. function extractPropsFromVNodeData (
  49234. data,
  49235. Ctor,
  49236. tag
  49237. ) {
  49238. // we are only extracting raw values here.
  49239. // validation and default values are handled in the child
  49240. // component itself.
  49241. var propOptions = Ctor.options.props;
  49242. if (isUndef(propOptions)) {
  49243. return
  49244. }
  49245. var res = {};
  49246. var attrs = data.attrs;
  49247. var props = data.props;
  49248. if (isDef(attrs) || isDef(props)) {
  49249. for (var key in propOptions) {
  49250. var altKey = hyphenate(key);
  49251. {
  49252. var keyInLowerCase = key.toLowerCase();
  49253. if (
  49254. key !== keyInLowerCase &&
  49255. attrs && hasOwn(attrs, keyInLowerCase)
  49256. ) {
  49257. tip(
  49258. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  49259. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  49260. " \"" + key + "\". " +
  49261. "Note that HTML attributes are case-insensitive and camelCased " +
  49262. "props need to use their kebab-case equivalents when using in-DOM " +
  49263. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  49264. );
  49265. }
  49266. }
  49267. checkProp(res, props, key, altKey, true) ||
  49268. checkProp(res, attrs, key, altKey, false);
  49269. }
  49270. }
  49271. return res
  49272. }
  49273. function checkProp (
  49274. res,
  49275. hash,
  49276. key,
  49277. altKey,
  49278. preserve
  49279. ) {
  49280. if (isDef(hash)) {
  49281. if (hasOwn(hash, key)) {
  49282. res[key] = hash[key];
  49283. if (!preserve) {
  49284. delete hash[key];
  49285. }
  49286. return true
  49287. } else if (hasOwn(hash, altKey)) {
  49288. res[key] = hash[altKey];
  49289. if (!preserve) {
  49290. delete hash[altKey];
  49291. }
  49292. return true
  49293. }
  49294. }
  49295. return false
  49296. }
  49297. /* */
  49298. // The template compiler attempts to minimize the need for normalization by
  49299. // statically analyzing the template at compile time.
  49300. //
  49301. // For plain HTML markup, normalization can be completely skipped because the
  49302. // generated render function is guaranteed to return Array<VNode>. There are
  49303. // two cases where extra normalization is needed:
  49304. // 1. When the children contains components - because a functional component
  49305. // may return an Array instead of a single root. In this case, just a simple
  49306. // normalization is needed - if any child is an Array, we flatten the whole
  49307. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  49308. // because functional components already normalize their own children.
  49309. function simpleNormalizeChildren (children) {
  49310. for (var i = 0; i < children.length; i++) {
  49311. if (Array.isArray(children[i])) {
  49312. return Array.prototype.concat.apply([], children)
  49313. }
  49314. }
  49315. return children
  49316. }
  49317. // 2. When the children contains constructs that always generated nested Arrays,
  49318. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  49319. // with hand-written render functions / JSX. In such cases a full normalization
  49320. // is needed to cater to all possible types of children values.
  49321. function normalizeChildren (children) {
  49322. return isPrimitive(children)
  49323. ? [createTextVNode(children)]
  49324. : Array.isArray(children)
  49325. ? normalizeArrayChildren(children)
  49326. : undefined
  49327. }
  49328. function isTextNode (node) {
  49329. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  49330. }
  49331. function normalizeArrayChildren (children, nestedIndex) {
  49332. var res = [];
  49333. var i, c, lastIndex, last;
  49334. for (i = 0; i < children.length; i++) {
  49335. c = children[i];
  49336. if (isUndef(c) || typeof c === 'boolean') { continue }
  49337. lastIndex = res.length - 1;
  49338. last = res[lastIndex];
  49339. // nested
  49340. if (Array.isArray(c)) {
  49341. if (c.length > 0) {
  49342. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  49343. // merge adjacent text nodes
  49344. if (isTextNode(c[0]) && isTextNode(last)) {
  49345. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  49346. c.shift();
  49347. }
  49348. res.push.apply(res, c);
  49349. }
  49350. } else if (isPrimitive(c)) {
  49351. if (isTextNode(last)) {
  49352. // merge adjacent text nodes
  49353. // this is necessary for SSR hydration because text nodes are
  49354. // essentially merged when rendered to HTML strings
  49355. res[lastIndex] = createTextVNode(last.text + c);
  49356. } else if (c !== '') {
  49357. // convert primitive to vnode
  49358. res.push(createTextVNode(c));
  49359. }
  49360. } else {
  49361. if (isTextNode(c) && isTextNode(last)) {
  49362. // merge adjacent text nodes
  49363. res[lastIndex] = createTextVNode(last.text + c.text);
  49364. } else {
  49365. // default key for nested array children (likely generated by v-for)
  49366. if (isTrue(children._isVList) &&
  49367. isDef(c.tag) &&
  49368. isUndef(c.key) &&
  49369. isDef(nestedIndex)) {
  49370. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  49371. }
  49372. res.push(c);
  49373. }
  49374. }
  49375. }
  49376. return res
  49377. }
  49378. /* */
  49379. function initProvide (vm) {
  49380. var provide = vm.$options.provide;
  49381. if (provide) {
  49382. vm._provided = typeof provide === 'function'
  49383. ? provide.call(vm)
  49384. : provide;
  49385. }
  49386. }
  49387. function initInjections (vm) {
  49388. var result = resolveInject(vm.$options.inject, vm);
  49389. if (result) {
  49390. toggleObserving(false);
  49391. Object.keys(result).forEach(function (key) {
  49392. /* istanbul ignore else */
  49393. {
  49394. defineReactive$$1(vm, key, result[key], function () {
  49395. warn(
  49396. "Avoid mutating an injected value directly since the changes will be " +
  49397. "overwritten whenever the provided component re-renders. " +
  49398. "injection being mutated: \"" + key + "\"",
  49399. vm
  49400. );
  49401. });
  49402. }
  49403. });
  49404. toggleObserving(true);
  49405. }
  49406. }
  49407. function resolveInject (inject, vm) {
  49408. if (inject) {
  49409. // inject is :any because flow is not smart enough to figure out cached
  49410. var result = Object.create(null);
  49411. var keys = hasSymbol
  49412. ? Reflect.ownKeys(inject)
  49413. : Object.keys(inject);
  49414. for (var i = 0; i < keys.length; i++) {
  49415. var key = keys[i];
  49416. // #6574 in case the inject object is observed...
  49417. if (key === '__ob__') { continue }
  49418. var provideKey = inject[key].from;
  49419. var source = vm;
  49420. while (source) {
  49421. if (source._provided && hasOwn(source._provided, provideKey)) {
  49422. result[key] = source._provided[provideKey];
  49423. break
  49424. }
  49425. source = source.$parent;
  49426. }
  49427. if (!source) {
  49428. if ('default' in inject[key]) {
  49429. var provideDefault = inject[key].default;
  49430. result[key] = typeof provideDefault === 'function'
  49431. ? provideDefault.call(vm)
  49432. : provideDefault;
  49433. } else {
  49434. warn(("Injection \"" + key + "\" not found"), vm);
  49435. }
  49436. }
  49437. }
  49438. return result
  49439. }
  49440. }
  49441. /* */
  49442. /**
  49443. * Runtime helper for resolving raw children VNodes into a slot object.
  49444. */
  49445. function resolveSlots (
  49446. children,
  49447. context
  49448. ) {
  49449. if (!children || !children.length) {
  49450. return {}
  49451. }
  49452. var slots = {};
  49453. for (var i = 0, l = children.length; i < l; i++) {
  49454. var child = children[i];
  49455. var data = child.data;
  49456. // remove slot attribute if the node is resolved as a Vue slot node
  49457. if (data && data.attrs && data.attrs.slot) {
  49458. delete data.attrs.slot;
  49459. }
  49460. // named slots should only be respected if the vnode was rendered in the
  49461. // same context.
  49462. if ((child.context === context || child.fnContext === context) &&
  49463. data && data.slot != null
  49464. ) {
  49465. var name = data.slot;
  49466. var slot = (slots[name] || (slots[name] = []));
  49467. if (child.tag === 'template') {
  49468. slot.push.apply(slot, child.children || []);
  49469. } else {
  49470. slot.push(child);
  49471. }
  49472. } else {
  49473. (slots.default || (slots.default = [])).push(child);
  49474. }
  49475. }
  49476. // ignore slots that contains only whitespace
  49477. for (var name$1 in slots) {
  49478. if (slots[name$1].every(isWhitespace)) {
  49479. delete slots[name$1];
  49480. }
  49481. }
  49482. return slots
  49483. }
  49484. function isWhitespace (node) {
  49485. return (node.isComment && !node.asyncFactory) || node.text === ' '
  49486. }
  49487. /* */
  49488. function normalizeScopedSlots (
  49489. slots,
  49490. normalSlots,
  49491. prevSlots
  49492. ) {
  49493. var res;
  49494. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  49495. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  49496. var key = slots && slots.$key;
  49497. if (!slots) {
  49498. res = {};
  49499. } else if (slots._normalized) {
  49500. // fast path 1: child component re-render only, parent did not change
  49501. return slots._normalized
  49502. } else if (
  49503. isStable &&
  49504. prevSlots &&
  49505. prevSlots !== emptyObject &&
  49506. key === prevSlots.$key &&
  49507. !hasNormalSlots &&
  49508. !prevSlots.$hasNormal
  49509. ) {
  49510. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  49511. // only need to normalize once
  49512. return prevSlots
  49513. } else {
  49514. res = {};
  49515. for (var key$1 in slots) {
  49516. if (slots[key$1] && key$1[0] !== '$') {
  49517. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  49518. }
  49519. }
  49520. }
  49521. // expose normal slots on scopedSlots
  49522. for (var key$2 in normalSlots) {
  49523. if (!(key$2 in res)) {
  49524. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  49525. }
  49526. }
  49527. // avoriaz seems to mock a non-extensible $scopedSlots object
  49528. // and when that is passed down this would cause an error
  49529. if (slots && Object.isExtensible(slots)) {
  49530. (slots)._normalized = res;
  49531. }
  49532. def(res, '$stable', isStable);
  49533. def(res, '$key', key);
  49534. def(res, '$hasNormal', hasNormalSlots);
  49535. return res
  49536. }
  49537. function normalizeScopedSlot(normalSlots, key, fn) {
  49538. var normalized = function () {
  49539. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  49540. res = res && typeof res === 'object' && !Array.isArray(res)
  49541. ? [res] // single vnode
  49542. : normalizeChildren(res);
  49543. return res && (
  49544. res.length === 0 ||
  49545. (res.length === 1 && res[0].isComment) // #9658
  49546. ) ? undefined
  49547. : res
  49548. };
  49549. // this is a slot using the new v-slot syntax without scope. although it is
  49550. // compiled as a scoped slot, render fn users would expect it to be present
  49551. // on this.$slots because the usage is semantically a normal slot.
  49552. if (fn.proxy) {
  49553. Object.defineProperty(normalSlots, key, {
  49554. get: normalized,
  49555. enumerable: true,
  49556. configurable: true
  49557. });
  49558. }
  49559. return normalized
  49560. }
  49561. function proxyNormalSlot(slots, key) {
  49562. return function () { return slots[key]; }
  49563. }
  49564. /* */
  49565. /**
  49566. * Runtime helper for rendering v-for lists.
  49567. */
  49568. function renderList (
  49569. val,
  49570. render
  49571. ) {
  49572. var ret, i, l, keys, key;
  49573. if (Array.isArray(val) || typeof val === 'string') {
  49574. ret = new Array(val.length);
  49575. for (i = 0, l = val.length; i < l; i++) {
  49576. ret[i] = render(val[i], i);
  49577. }
  49578. } else if (typeof val === 'number') {
  49579. ret = new Array(val);
  49580. for (i = 0; i < val; i++) {
  49581. ret[i] = render(i + 1, i);
  49582. }
  49583. } else if (isObject(val)) {
  49584. if (hasSymbol && val[Symbol.iterator]) {
  49585. ret = [];
  49586. var iterator = val[Symbol.iterator]();
  49587. var result = iterator.next();
  49588. while (!result.done) {
  49589. ret.push(render(result.value, ret.length));
  49590. result = iterator.next();
  49591. }
  49592. } else {
  49593. keys = Object.keys(val);
  49594. ret = new Array(keys.length);
  49595. for (i = 0, l = keys.length; i < l; i++) {
  49596. key = keys[i];
  49597. ret[i] = render(val[key], key, i);
  49598. }
  49599. }
  49600. }
  49601. if (!isDef(ret)) {
  49602. ret = [];
  49603. }
  49604. (ret)._isVList = true;
  49605. return ret
  49606. }
  49607. /* */
  49608. /**
  49609. * Runtime helper for rendering <slot>
  49610. */
  49611. function renderSlot (
  49612. name,
  49613. fallback,
  49614. props,
  49615. bindObject
  49616. ) {
  49617. var scopedSlotFn = this.$scopedSlots[name];
  49618. var nodes;
  49619. if (scopedSlotFn) { // scoped slot
  49620. props = props || {};
  49621. if (bindObject) {
  49622. if (!isObject(bindObject)) {
  49623. warn(
  49624. 'slot v-bind without argument expects an Object',
  49625. this
  49626. );
  49627. }
  49628. props = extend(extend({}, bindObject), props);
  49629. }
  49630. nodes = scopedSlotFn(props) || fallback;
  49631. } else {
  49632. nodes = this.$slots[name] || fallback;
  49633. }
  49634. var target = props && props.slot;
  49635. if (target) {
  49636. return this.$createElement('template', { slot: target }, nodes)
  49637. } else {
  49638. return nodes
  49639. }
  49640. }
  49641. /* */
  49642. /**
  49643. * Runtime helper for resolving filters
  49644. */
  49645. function resolveFilter (id) {
  49646. return resolveAsset(this.$options, 'filters', id, true) || identity
  49647. }
  49648. /* */
  49649. function isKeyNotMatch (expect, actual) {
  49650. if (Array.isArray(expect)) {
  49651. return expect.indexOf(actual) === -1
  49652. } else {
  49653. return expect !== actual
  49654. }
  49655. }
  49656. /**
  49657. * Runtime helper for checking keyCodes from config.
  49658. * exposed as Vue.prototype._k
  49659. * passing in eventKeyName as last argument separately for backwards compat
  49660. */
  49661. function checkKeyCodes (
  49662. eventKeyCode,
  49663. key,
  49664. builtInKeyCode,
  49665. eventKeyName,
  49666. builtInKeyName
  49667. ) {
  49668. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  49669. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  49670. return isKeyNotMatch(builtInKeyName, eventKeyName)
  49671. } else if (mappedKeyCode) {
  49672. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  49673. } else if (eventKeyName) {
  49674. return hyphenate(eventKeyName) !== key
  49675. }
  49676. }
  49677. /* */
  49678. /**
  49679. * Runtime helper for merging v-bind="object" into a VNode's data.
  49680. */
  49681. function bindObjectProps (
  49682. data,
  49683. tag,
  49684. value,
  49685. asProp,
  49686. isSync
  49687. ) {
  49688. if (value) {
  49689. if (!isObject(value)) {
  49690. warn(
  49691. 'v-bind without argument expects an Object or Array value',
  49692. this
  49693. );
  49694. } else {
  49695. if (Array.isArray(value)) {
  49696. value = toObject(value);
  49697. }
  49698. var hash;
  49699. var loop = function ( key ) {
  49700. if (
  49701. key === 'class' ||
  49702. key === 'style' ||
  49703. isReservedAttribute(key)
  49704. ) {
  49705. hash = data;
  49706. } else {
  49707. var type = data.attrs && data.attrs.type;
  49708. hash = asProp || config.mustUseProp(tag, type, key)
  49709. ? data.domProps || (data.domProps = {})
  49710. : data.attrs || (data.attrs = {});
  49711. }
  49712. var camelizedKey = camelize(key);
  49713. var hyphenatedKey = hyphenate(key);
  49714. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  49715. hash[key] = value[key];
  49716. if (isSync) {
  49717. var on = data.on || (data.on = {});
  49718. on[("update:" + key)] = function ($event) {
  49719. value[key] = $event;
  49720. };
  49721. }
  49722. }
  49723. };
  49724. for (var key in value) loop( key );
  49725. }
  49726. }
  49727. return data
  49728. }
  49729. /* */
  49730. /**
  49731. * Runtime helper for rendering static trees.
  49732. */
  49733. function renderStatic (
  49734. index,
  49735. isInFor
  49736. ) {
  49737. var cached = this._staticTrees || (this._staticTrees = []);
  49738. var tree = cached[index];
  49739. // if has already-rendered static tree and not inside v-for,
  49740. // we can reuse the same tree.
  49741. if (tree && !isInFor) {
  49742. return tree
  49743. }
  49744. // otherwise, render a fresh tree.
  49745. tree = cached[index] = this.$options.staticRenderFns[index].call(
  49746. this._renderProxy,
  49747. null,
  49748. this // for render fns generated for functional component templates
  49749. );
  49750. markStatic(tree, ("__static__" + index), false);
  49751. return tree
  49752. }
  49753. /**
  49754. * Runtime helper for v-once.
  49755. * Effectively it means marking the node as static with a unique key.
  49756. */
  49757. function markOnce (
  49758. tree,
  49759. index,
  49760. key
  49761. ) {
  49762. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  49763. return tree
  49764. }
  49765. function markStatic (
  49766. tree,
  49767. key,
  49768. isOnce
  49769. ) {
  49770. if (Array.isArray(tree)) {
  49771. for (var i = 0; i < tree.length; i++) {
  49772. if (tree[i] && typeof tree[i] !== 'string') {
  49773. markStaticNode(tree[i], (key + "_" + i), isOnce);
  49774. }
  49775. }
  49776. } else {
  49777. markStaticNode(tree, key, isOnce);
  49778. }
  49779. }
  49780. function markStaticNode (node, key, isOnce) {
  49781. node.isStatic = true;
  49782. node.key = key;
  49783. node.isOnce = isOnce;
  49784. }
  49785. /* */
  49786. function bindObjectListeners (data, value) {
  49787. if (value) {
  49788. if (!isPlainObject(value)) {
  49789. warn(
  49790. 'v-on without argument expects an Object value',
  49791. this
  49792. );
  49793. } else {
  49794. var on = data.on = data.on ? extend({}, data.on) : {};
  49795. for (var key in value) {
  49796. var existing = on[key];
  49797. var ours = value[key];
  49798. on[key] = existing ? [].concat(existing, ours) : ours;
  49799. }
  49800. }
  49801. }
  49802. return data
  49803. }
  49804. /* */
  49805. function resolveScopedSlots (
  49806. fns, // see flow/vnode
  49807. res,
  49808. // the following are added in 2.6
  49809. hasDynamicKeys,
  49810. contentHashKey
  49811. ) {
  49812. res = res || { $stable: !hasDynamicKeys };
  49813. for (var i = 0; i < fns.length; i++) {
  49814. var slot = fns[i];
  49815. if (Array.isArray(slot)) {
  49816. resolveScopedSlots(slot, res, hasDynamicKeys);
  49817. } else if (slot) {
  49818. // marker for reverse proxying v-slot without scope on this.$slots
  49819. if (slot.proxy) {
  49820. slot.fn.proxy = true;
  49821. }
  49822. res[slot.key] = slot.fn;
  49823. }
  49824. }
  49825. if (contentHashKey) {
  49826. (res).$key = contentHashKey;
  49827. }
  49828. return res
  49829. }
  49830. /* */
  49831. function bindDynamicKeys (baseObj, values) {
  49832. for (var i = 0; i < values.length; i += 2) {
  49833. var key = values[i];
  49834. if (typeof key === 'string' && key) {
  49835. baseObj[values[i]] = values[i + 1];
  49836. } else if (key !== '' && key !== null) {
  49837. // null is a special value for explicitly removing a binding
  49838. warn(
  49839. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  49840. this
  49841. );
  49842. }
  49843. }
  49844. return baseObj
  49845. }
  49846. // helper to dynamically append modifier runtime markers to event names.
  49847. // ensure only append when value is already string, otherwise it will be cast
  49848. // to string and cause the type check to miss.
  49849. function prependModifier (value, symbol) {
  49850. return typeof value === 'string' ? symbol + value : value
  49851. }
  49852. /* */
  49853. function installRenderHelpers (target) {
  49854. target._o = markOnce;
  49855. target._n = toNumber;
  49856. target._s = toString;
  49857. target._l = renderList;
  49858. target._t = renderSlot;
  49859. target._q = looseEqual;
  49860. target._i = looseIndexOf;
  49861. target._m = renderStatic;
  49862. target._f = resolveFilter;
  49863. target._k = checkKeyCodes;
  49864. target._b = bindObjectProps;
  49865. target._v = createTextVNode;
  49866. target._e = createEmptyVNode;
  49867. target._u = resolveScopedSlots;
  49868. target._g = bindObjectListeners;
  49869. target._d = bindDynamicKeys;
  49870. target._p = prependModifier;
  49871. }
  49872. /* */
  49873. function FunctionalRenderContext (
  49874. data,
  49875. props,
  49876. children,
  49877. parent,
  49878. Ctor
  49879. ) {
  49880. var this$1 = this;
  49881. var options = Ctor.options;
  49882. // ensure the createElement function in functional components
  49883. // gets a unique context - this is necessary for correct named slot check
  49884. var contextVm;
  49885. if (hasOwn(parent, '_uid')) {
  49886. contextVm = Object.create(parent);
  49887. // $flow-disable-line
  49888. contextVm._original = parent;
  49889. } else {
  49890. // the context vm passed in is a functional context as well.
  49891. // in this case we want to make sure we are able to get a hold to the
  49892. // real context instance.
  49893. contextVm = parent;
  49894. // $flow-disable-line
  49895. parent = parent._original;
  49896. }
  49897. var isCompiled = isTrue(options._compiled);
  49898. var needNormalization = !isCompiled;
  49899. this.data = data;
  49900. this.props = props;
  49901. this.children = children;
  49902. this.parent = parent;
  49903. this.listeners = data.on || emptyObject;
  49904. this.injections = resolveInject(options.inject, parent);
  49905. this.slots = function () {
  49906. if (!this$1.$slots) {
  49907. normalizeScopedSlots(
  49908. data.scopedSlots,
  49909. this$1.$slots = resolveSlots(children, parent)
  49910. );
  49911. }
  49912. return this$1.$slots
  49913. };
  49914. Object.defineProperty(this, 'scopedSlots', ({
  49915. enumerable: true,
  49916. get: function get () {
  49917. return normalizeScopedSlots(data.scopedSlots, this.slots())
  49918. }
  49919. }));
  49920. // support for compiled functional template
  49921. if (isCompiled) {
  49922. // exposing $options for renderStatic()
  49923. this.$options = options;
  49924. // pre-resolve slots for renderSlot()
  49925. this.$slots = this.slots();
  49926. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  49927. }
  49928. if (options._scopeId) {
  49929. this._c = function (a, b, c, d) {
  49930. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  49931. if (vnode && !Array.isArray(vnode)) {
  49932. vnode.fnScopeId = options._scopeId;
  49933. vnode.fnContext = parent;
  49934. }
  49935. return vnode
  49936. };
  49937. } else {
  49938. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  49939. }
  49940. }
  49941. installRenderHelpers(FunctionalRenderContext.prototype);
  49942. function createFunctionalComponent (
  49943. Ctor,
  49944. propsData,
  49945. data,
  49946. contextVm,
  49947. children
  49948. ) {
  49949. var options = Ctor.options;
  49950. var props = {};
  49951. var propOptions = options.props;
  49952. if (isDef(propOptions)) {
  49953. for (var key in propOptions) {
  49954. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  49955. }
  49956. } else {
  49957. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  49958. if (isDef(data.props)) { mergeProps(props, data.props); }
  49959. }
  49960. var renderContext = new FunctionalRenderContext(
  49961. data,
  49962. props,
  49963. children,
  49964. contextVm,
  49965. Ctor
  49966. );
  49967. var vnode = options.render.call(null, renderContext._c, renderContext);
  49968. if (vnode instanceof VNode) {
  49969. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  49970. } else if (Array.isArray(vnode)) {
  49971. var vnodes = normalizeChildren(vnode) || [];
  49972. var res = new Array(vnodes.length);
  49973. for (var i = 0; i < vnodes.length; i++) {
  49974. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  49975. }
  49976. return res
  49977. }
  49978. }
  49979. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  49980. // #7817 clone node before setting fnContext, otherwise if the node is reused
  49981. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  49982. // that should not be matched to match.
  49983. var clone = cloneVNode(vnode);
  49984. clone.fnContext = contextVm;
  49985. clone.fnOptions = options;
  49986. {
  49987. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  49988. }
  49989. if (data.slot) {
  49990. (clone.data || (clone.data = {})).slot = data.slot;
  49991. }
  49992. return clone
  49993. }
  49994. function mergeProps (to, from) {
  49995. for (var key in from) {
  49996. to[camelize(key)] = from[key];
  49997. }
  49998. }
  49999. /* */
  50000. /* */
  50001. /* */
  50002. /* */
  50003. // inline hooks to be invoked on component VNodes during patch
  50004. var componentVNodeHooks = {
  50005. init: function init (vnode, hydrating) {
  50006. if (
  50007. vnode.componentInstance &&
  50008. !vnode.componentInstance._isDestroyed &&
  50009. vnode.data.keepAlive
  50010. ) {
  50011. // kept-alive components, treat as a patch
  50012. var mountedNode = vnode; // work around flow
  50013. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  50014. } else {
  50015. var child = vnode.componentInstance = createComponentInstanceForVnode(
  50016. vnode,
  50017. activeInstance
  50018. );
  50019. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  50020. }
  50021. },
  50022. prepatch: function prepatch (oldVnode, vnode) {
  50023. var options = vnode.componentOptions;
  50024. var child = vnode.componentInstance = oldVnode.componentInstance;
  50025. updateChildComponent(
  50026. child,
  50027. options.propsData, // updated props
  50028. options.listeners, // updated listeners
  50029. vnode, // new parent vnode
  50030. options.children // new children
  50031. );
  50032. },
  50033. insert: function insert (vnode) {
  50034. var context = vnode.context;
  50035. var componentInstance = vnode.componentInstance;
  50036. if (!componentInstance._isMounted) {
  50037. componentInstance._isMounted = true;
  50038. callHook(componentInstance, 'mounted');
  50039. }
  50040. if (vnode.data.keepAlive) {
  50041. if (context._isMounted) {
  50042. // vue-router#1212
  50043. // During updates, a kept-alive component's child components may
  50044. // change, so directly walking the tree here may call activated hooks
  50045. // on incorrect children. Instead we push them into a queue which will
  50046. // be processed after the whole patch process ended.
  50047. queueActivatedComponent(componentInstance);
  50048. } else {
  50049. activateChildComponent(componentInstance, true /* direct */);
  50050. }
  50051. }
  50052. },
  50053. destroy: function destroy (vnode) {
  50054. var componentInstance = vnode.componentInstance;
  50055. if (!componentInstance._isDestroyed) {
  50056. if (!vnode.data.keepAlive) {
  50057. componentInstance.$destroy();
  50058. } else {
  50059. deactivateChildComponent(componentInstance, true /* direct */);
  50060. }
  50061. }
  50062. }
  50063. };
  50064. var hooksToMerge = Object.keys(componentVNodeHooks);
  50065. function createComponent (
  50066. Ctor,
  50067. data,
  50068. context,
  50069. children,
  50070. tag
  50071. ) {
  50072. if (isUndef(Ctor)) {
  50073. return
  50074. }
  50075. var baseCtor = context.$options._base;
  50076. // plain options object: turn it into a constructor
  50077. if (isObject(Ctor)) {
  50078. Ctor = baseCtor.extend(Ctor);
  50079. }
  50080. // if at this stage it's not a constructor or an async component factory,
  50081. // reject.
  50082. if (typeof Ctor !== 'function') {
  50083. {
  50084. warn(("Invalid Component definition: " + (String(Ctor))), context);
  50085. }
  50086. return
  50087. }
  50088. // async component
  50089. var asyncFactory;
  50090. if (isUndef(Ctor.cid)) {
  50091. asyncFactory = Ctor;
  50092. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  50093. if (Ctor === undefined) {
  50094. // return a placeholder node for async component, which is rendered
  50095. // as a comment node but preserves all the raw information for the node.
  50096. // the information will be used for async server-rendering and hydration.
  50097. return createAsyncPlaceholder(
  50098. asyncFactory,
  50099. data,
  50100. context,
  50101. children,
  50102. tag
  50103. )
  50104. }
  50105. }
  50106. data = data || {};
  50107. // resolve constructor options in case global mixins are applied after
  50108. // component constructor creation
  50109. resolveConstructorOptions(Ctor);
  50110. // transform component v-model data into props & events
  50111. if (isDef(data.model)) {
  50112. transformModel(Ctor.options, data);
  50113. }
  50114. // extract props
  50115. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  50116. // functional component
  50117. if (isTrue(Ctor.options.functional)) {
  50118. return createFunctionalComponent(Ctor, propsData, data, context, children)
  50119. }
  50120. // extract listeners, since these needs to be treated as
  50121. // child component listeners instead of DOM listeners
  50122. var listeners = data.on;
  50123. // replace with listeners with .native modifier
  50124. // so it gets processed during parent component patch.
  50125. data.on = data.nativeOn;
  50126. if (isTrue(Ctor.options.abstract)) {
  50127. // abstract components do not keep anything
  50128. // other than props & listeners & slot
  50129. // work around flow
  50130. var slot = data.slot;
  50131. data = {};
  50132. if (slot) {
  50133. data.slot = slot;
  50134. }
  50135. }
  50136. // install component management hooks onto the placeholder node
  50137. installComponentHooks(data);
  50138. // return a placeholder vnode
  50139. var name = Ctor.options.name || tag;
  50140. var vnode = new VNode(
  50141. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  50142. data, undefined, undefined, undefined, context,
  50143. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  50144. asyncFactory
  50145. );
  50146. return vnode
  50147. }
  50148. function createComponentInstanceForVnode (
  50149. vnode, // we know it's MountedComponentVNode but flow doesn't
  50150. parent // activeInstance in lifecycle state
  50151. ) {
  50152. var options = {
  50153. _isComponent: true,
  50154. _parentVnode: vnode,
  50155. parent: parent
  50156. };
  50157. // check inline-template render functions
  50158. var inlineTemplate = vnode.data.inlineTemplate;
  50159. if (isDef(inlineTemplate)) {
  50160. options.render = inlineTemplate.render;
  50161. options.staticRenderFns = inlineTemplate.staticRenderFns;
  50162. }
  50163. return new vnode.componentOptions.Ctor(options)
  50164. }
  50165. function installComponentHooks (data) {
  50166. var hooks = data.hook || (data.hook = {});
  50167. for (var i = 0; i < hooksToMerge.length; i++) {
  50168. var key = hooksToMerge[i];
  50169. var existing = hooks[key];
  50170. var toMerge = componentVNodeHooks[key];
  50171. if (existing !== toMerge && !(existing && existing._merged)) {
  50172. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  50173. }
  50174. }
  50175. }
  50176. function mergeHook$1 (f1, f2) {
  50177. var merged = function (a, b) {
  50178. // flow complains about extra args which is why we use any
  50179. f1(a, b);
  50180. f2(a, b);
  50181. };
  50182. merged._merged = true;
  50183. return merged
  50184. }
  50185. // transform component v-model info (value and callback) into
  50186. // prop and event handler respectively.
  50187. function transformModel (options, data) {
  50188. var prop = (options.model && options.model.prop) || 'value';
  50189. var event = (options.model && options.model.event) || 'input'
  50190. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  50191. var on = data.on || (data.on = {});
  50192. var existing = on[event];
  50193. var callback = data.model.callback;
  50194. if (isDef(existing)) {
  50195. if (
  50196. Array.isArray(existing)
  50197. ? existing.indexOf(callback) === -1
  50198. : existing !== callback
  50199. ) {
  50200. on[event] = [callback].concat(existing);
  50201. }
  50202. } else {
  50203. on[event] = callback;
  50204. }
  50205. }
  50206. /* */
  50207. var SIMPLE_NORMALIZE = 1;
  50208. var ALWAYS_NORMALIZE = 2;
  50209. // wrapper function for providing a more flexible interface
  50210. // without getting yelled at by flow
  50211. function createElement (
  50212. context,
  50213. tag,
  50214. data,
  50215. children,
  50216. normalizationType,
  50217. alwaysNormalize
  50218. ) {
  50219. if (Array.isArray(data) || isPrimitive(data)) {
  50220. normalizationType = children;
  50221. children = data;
  50222. data = undefined;
  50223. }
  50224. if (isTrue(alwaysNormalize)) {
  50225. normalizationType = ALWAYS_NORMALIZE;
  50226. }
  50227. return _createElement(context, tag, data, children, normalizationType)
  50228. }
  50229. function _createElement (
  50230. context,
  50231. tag,
  50232. data,
  50233. children,
  50234. normalizationType
  50235. ) {
  50236. if (isDef(data) && isDef((data).__ob__)) {
  50237. warn(
  50238. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  50239. 'Always create fresh vnode data objects in each render!',
  50240. context
  50241. );
  50242. return createEmptyVNode()
  50243. }
  50244. // object syntax in v-bind
  50245. if (isDef(data) && isDef(data.is)) {
  50246. tag = data.is;
  50247. }
  50248. if (!tag) {
  50249. // in case of component :is set to falsy value
  50250. return createEmptyVNode()
  50251. }
  50252. // warn against non-primitive key
  50253. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  50254. ) {
  50255. {
  50256. warn(
  50257. 'Avoid using non-primitive value as key, ' +
  50258. 'use string/number value instead.',
  50259. context
  50260. );
  50261. }
  50262. }
  50263. // support single function children as default scoped slot
  50264. if (Array.isArray(children) &&
  50265. typeof children[0] === 'function'
  50266. ) {
  50267. data = data || {};
  50268. data.scopedSlots = { default: children[0] };
  50269. children.length = 0;
  50270. }
  50271. if (normalizationType === ALWAYS_NORMALIZE) {
  50272. children = normalizeChildren(children);
  50273. } else if (normalizationType === SIMPLE_NORMALIZE) {
  50274. children = simpleNormalizeChildren(children);
  50275. }
  50276. var vnode, ns;
  50277. if (typeof tag === 'string') {
  50278. var Ctor;
  50279. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  50280. if (config.isReservedTag(tag)) {
  50281. // platform built-in elements
  50282. if (isDef(data) && isDef(data.nativeOn)) {
  50283. warn(
  50284. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  50285. context
  50286. );
  50287. }
  50288. vnode = new VNode(
  50289. config.parsePlatformTagName(tag), data, children,
  50290. undefined, undefined, context
  50291. );
  50292. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  50293. // component
  50294. vnode = createComponent(Ctor, data, context, children, tag);
  50295. } else {
  50296. // unknown or unlisted namespaced elements
  50297. // check at runtime because it may get assigned a namespace when its
  50298. // parent normalizes children
  50299. vnode = new VNode(
  50300. tag, data, children,
  50301. undefined, undefined, context
  50302. );
  50303. }
  50304. } else {
  50305. // direct component options / constructor
  50306. vnode = createComponent(tag, data, context, children);
  50307. }
  50308. if (Array.isArray(vnode)) {
  50309. return vnode
  50310. } else if (isDef(vnode)) {
  50311. if (isDef(ns)) { applyNS(vnode, ns); }
  50312. if (isDef(data)) { registerDeepBindings(data); }
  50313. return vnode
  50314. } else {
  50315. return createEmptyVNode()
  50316. }
  50317. }
  50318. function applyNS (vnode, ns, force) {
  50319. vnode.ns = ns;
  50320. if (vnode.tag === 'foreignObject') {
  50321. // use default namespace inside foreignObject
  50322. ns = undefined;
  50323. force = true;
  50324. }
  50325. if (isDef(vnode.children)) {
  50326. for (var i = 0, l = vnode.children.length; i < l; i++) {
  50327. var child = vnode.children[i];
  50328. if (isDef(child.tag) && (
  50329. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  50330. applyNS(child, ns, force);
  50331. }
  50332. }
  50333. }
  50334. }
  50335. // ref #5318
  50336. // necessary to ensure parent re-render when deep bindings like :style and
  50337. // :class are used on slot nodes
  50338. function registerDeepBindings (data) {
  50339. if (isObject(data.style)) {
  50340. traverse(data.style);
  50341. }
  50342. if (isObject(data.class)) {
  50343. traverse(data.class);
  50344. }
  50345. }
  50346. /* */
  50347. function initRender (vm) {
  50348. vm._vnode = null; // the root of the child tree
  50349. vm._staticTrees = null; // v-once cached trees
  50350. var options = vm.$options;
  50351. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  50352. var renderContext = parentVnode && parentVnode.context;
  50353. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  50354. vm.$scopedSlots = emptyObject;
  50355. // bind the createElement fn to this instance
  50356. // so that we get proper render context inside it.
  50357. // args order: tag, data, children, normalizationType, alwaysNormalize
  50358. // internal version is used by render functions compiled from templates
  50359. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  50360. // normalization is always applied for the public version, used in
  50361. // user-written render functions.
  50362. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  50363. // $attrs & $listeners are exposed for easier HOC creation.
  50364. // they need to be reactive so that HOCs using them are always updated
  50365. var parentData = parentVnode && parentVnode.data;
  50366. /* istanbul ignore else */
  50367. {
  50368. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  50369. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  50370. }, true);
  50371. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  50372. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  50373. }, true);
  50374. }
  50375. }
  50376. var currentRenderingInstance = null;
  50377. function renderMixin (Vue) {
  50378. // install runtime convenience helpers
  50379. installRenderHelpers(Vue.prototype);
  50380. Vue.prototype.$nextTick = function (fn) {
  50381. return nextTick(fn, this)
  50382. };
  50383. Vue.prototype._render = function () {
  50384. var vm = this;
  50385. var ref = vm.$options;
  50386. var render = ref.render;
  50387. var _parentVnode = ref._parentVnode;
  50388. if (_parentVnode) {
  50389. vm.$scopedSlots = normalizeScopedSlots(
  50390. _parentVnode.data.scopedSlots,
  50391. vm.$slots,
  50392. vm.$scopedSlots
  50393. );
  50394. }
  50395. // set parent vnode. this allows render functions to have access
  50396. // to the data on the placeholder node.
  50397. vm.$vnode = _parentVnode;
  50398. // render self
  50399. var vnode;
  50400. try {
  50401. // There's no need to maintain a stack because all render fns are called
  50402. // separately from one another. Nested component's render fns are called
  50403. // when parent component is patched.
  50404. currentRenderingInstance = vm;
  50405. vnode = render.call(vm._renderProxy, vm.$createElement);
  50406. } catch (e) {
  50407. handleError(e, vm, "render");
  50408. // return error render result,
  50409. // or previous vnode to prevent render error causing blank component
  50410. /* istanbul ignore else */
  50411. if (vm.$options.renderError) {
  50412. try {
  50413. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  50414. } catch (e) {
  50415. handleError(e, vm, "renderError");
  50416. vnode = vm._vnode;
  50417. }
  50418. } else {
  50419. vnode = vm._vnode;
  50420. }
  50421. } finally {
  50422. currentRenderingInstance = null;
  50423. }
  50424. // if the returned array contains only a single node, allow it
  50425. if (Array.isArray(vnode) && vnode.length === 1) {
  50426. vnode = vnode[0];
  50427. }
  50428. // return empty vnode in case the render function errored out
  50429. if (!(vnode instanceof VNode)) {
  50430. if (Array.isArray(vnode)) {
  50431. warn(
  50432. 'Multiple root nodes returned from render function. Render function ' +
  50433. 'should return a single root node.',
  50434. vm
  50435. );
  50436. }
  50437. vnode = createEmptyVNode();
  50438. }
  50439. // set parent
  50440. vnode.parent = _parentVnode;
  50441. return vnode
  50442. };
  50443. }
  50444. /* */
  50445. function ensureCtor (comp, base) {
  50446. if (
  50447. comp.__esModule ||
  50448. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  50449. ) {
  50450. comp = comp.default;
  50451. }
  50452. return isObject(comp)
  50453. ? base.extend(comp)
  50454. : comp
  50455. }
  50456. function createAsyncPlaceholder (
  50457. factory,
  50458. data,
  50459. context,
  50460. children,
  50461. tag
  50462. ) {
  50463. var node = createEmptyVNode();
  50464. node.asyncFactory = factory;
  50465. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  50466. return node
  50467. }
  50468. function resolveAsyncComponent (
  50469. factory,
  50470. baseCtor
  50471. ) {
  50472. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  50473. return factory.errorComp
  50474. }
  50475. if (isDef(factory.resolved)) {
  50476. return factory.resolved
  50477. }
  50478. var owner = currentRenderingInstance;
  50479. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  50480. // already pending
  50481. factory.owners.push(owner);
  50482. }
  50483. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  50484. return factory.loadingComp
  50485. }
  50486. if (owner && !isDef(factory.owners)) {
  50487. var owners = factory.owners = [owner];
  50488. var sync = true;
  50489. var timerLoading = null;
  50490. var timerTimeout = null
  50491. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  50492. var forceRender = function (renderCompleted) {
  50493. for (var i = 0, l = owners.length; i < l; i++) {
  50494. (owners[i]).$forceUpdate();
  50495. }
  50496. if (renderCompleted) {
  50497. owners.length = 0;
  50498. if (timerLoading !== null) {
  50499. clearTimeout(timerLoading);
  50500. timerLoading = null;
  50501. }
  50502. if (timerTimeout !== null) {
  50503. clearTimeout(timerTimeout);
  50504. timerTimeout = null;
  50505. }
  50506. }
  50507. };
  50508. var resolve = once(function (res) {
  50509. // cache resolved
  50510. factory.resolved = ensureCtor(res, baseCtor);
  50511. // invoke callbacks only if this is not a synchronous resolve
  50512. // (async resolves are shimmed as synchronous during SSR)
  50513. if (!sync) {
  50514. forceRender(true);
  50515. } else {
  50516. owners.length = 0;
  50517. }
  50518. });
  50519. var reject = once(function (reason) {
  50520. warn(
  50521. "Failed to resolve async component: " + (String(factory)) +
  50522. (reason ? ("\nReason: " + reason) : '')
  50523. );
  50524. if (isDef(factory.errorComp)) {
  50525. factory.error = true;
  50526. forceRender(true);
  50527. }
  50528. });
  50529. var res = factory(resolve, reject);
  50530. if (isObject(res)) {
  50531. if (isPromise(res)) {
  50532. // () => Promise
  50533. if (isUndef(factory.resolved)) {
  50534. res.then(resolve, reject);
  50535. }
  50536. } else if (isPromise(res.component)) {
  50537. res.component.then(resolve, reject);
  50538. if (isDef(res.error)) {
  50539. factory.errorComp = ensureCtor(res.error, baseCtor);
  50540. }
  50541. if (isDef(res.loading)) {
  50542. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  50543. if (res.delay === 0) {
  50544. factory.loading = true;
  50545. } else {
  50546. timerLoading = setTimeout(function () {
  50547. timerLoading = null;
  50548. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  50549. factory.loading = true;
  50550. forceRender(false);
  50551. }
  50552. }, res.delay || 200);
  50553. }
  50554. }
  50555. if (isDef(res.timeout)) {
  50556. timerTimeout = setTimeout(function () {
  50557. timerTimeout = null;
  50558. if (isUndef(factory.resolved)) {
  50559. reject(
  50560. "timeout (" + (res.timeout) + "ms)"
  50561. );
  50562. }
  50563. }, res.timeout);
  50564. }
  50565. }
  50566. }
  50567. sync = false;
  50568. // return in case resolved synchronously
  50569. return factory.loading
  50570. ? factory.loadingComp
  50571. : factory.resolved
  50572. }
  50573. }
  50574. /* */
  50575. function isAsyncPlaceholder (node) {
  50576. return node.isComment && node.asyncFactory
  50577. }
  50578. /* */
  50579. function getFirstComponentChild (children) {
  50580. if (Array.isArray(children)) {
  50581. for (var i = 0; i < children.length; i++) {
  50582. var c = children[i];
  50583. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  50584. return c
  50585. }
  50586. }
  50587. }
  50588. }
  50589. /* */
  50590. /* */
  50591. function initEvents (vm) {
  50592. vm._events = Object.create(null);
  50593. vm._hasHookEvent = false;
  50594. // init parent attached events
  50595. var listeners = vm.$options._parentListeners;
  50596. if (listeners) {
  50597. updateComponentListeners(vm, listeners);
  50598. }
  50599. }
  50600. var target;
  50601. function add (event, fn) {
  50602. target.$on(event, fn);
  50603. }
  50604. function remove$1 (event, fn) {
  50605. target.$off(event, fn);
  50606. }
  50607. function createOnceHandler (event, fn) {
  50608. var _target = target;
  50609. return function onceHandler () {
  50610. var res = fn.apply(null, arguments);
  50611. if (res !== null) {
  50612. _target.$off(event, onceHandler);
  50613. }
  50614. }
  50615. }
  50616. function updateComponentListeners (
  50617. vm,
  50618. listeners,
  50619. oldListeners
  50620. ) {
  50621. target = vm;
  50622. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  50623. target = undefined;
  50624. }
  50625. function eventsMixin (Vue) {
  50626. var hookRE = /^hook:/;
  50627. Vue.prototype.$on = function (event, fn) {
  50628. var vm = this;
  50629. if (Array.isArray(event)) {
  50630. for (var i = 0, l = event.length; i < l; i++) {
  50631. vm.$on(event[i], fn);
  50632. }
  50633. } else {
  50634. (vm._events[event] || (vm._events[event] = [])).push(fn);
  50635. // optimize hook:event cost by using a boolean flag marked at registration
  50636. // instead of a hash lookup
  50637. if (hookRE.test(event)) {
  50638. vm._hasHookEvent = true;
  50639. }
  50640. }
  50641. return vm
  50642. };
  50643. Vue.prototype.$once = function (event, fn) {
  50644. var vm = this;
  50645. function on () {
  50646. vm.$off(event, on);
  50647. fn.apply(vm, arguments);
  50648. }
  50649. on.fn = fn;
  50650. vm.$on(event, on);
  50651. return vm
  50652. };
  50653. Vue.prototype.$off = function (event, fn) {
  50654. var vm = this;
  50655. // all
  50656. if (!arguments.length) {
  50657. vm._events = Object.create(null);
  50658. return vm
  50659. }
  50660. // array of events
  50661. if (Array.isArray(event)) {
  50662. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  50663. vm.$off(event[i$1], fn);
  50664. }
  50665. return vm
  50666. }
  50667. // specific event
  50668. var cbs = vm._events[event];
  50669. if (!cbs) {
  50670. return vm
  50671. }
  50672. if (!fn) {
  50673. vm._events[event] = null;
  50674. return vm
  50675. }
  50676. // specific handler
  50677. var cb;
  50678. var i = cbs.length;
  50679. while (i--) {
  50680. cb = cbs[i];
  50681. if (cb === fn || cb.fn === fn) {
  50682. cbs.splice(i, 1);
  50683. break
  50684. }
  50685. }
  50686. return vm
  50687. };
  50688. Vue.prototype.$emit = function (event) {
  50689. var vm = this;
  50690. {
  50691. var lowerCaseEvent = event.toLowerCase();
  50692. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  50693. tip(
  50694. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  50695. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  50696. "Note that HTML attributes are case-insensitive and you cannot use " +
  50697. "v-on to listen to camelCase events when using in-DOM templates. " +
  50698. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  50699. );
  50700. }
  50701. }
  50702. var cbs = vm._events[event];
  50703. if (cbs) {
  50704. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  50705. var args = toArray(arguments, 1);
  50706. var info = "event handler for \"" + event + "\"";
  50707. for (var i = 0, l = cbs.length; i < l; i++) {
  50708. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  50709. }
  50710. }
  50711. return vm
  50712. };
  50713. }
  50714. /* */
  50715. var activeInstance = null;
  50716. var isUpdatingChildComponent = false;
  50717. function setActiveInstance(vm) {
  50718. var prevActiveInstance = activeInstance;
  50719. activeInstance = vm;
  50720. return function () {
  50721. activeInstance = prevActiveInstance;
  50722. }
  50723. }
  50724. function initLifecycle (vm) {
  50725. var options = vm.$options;
  50726. // locate first non-abstract parent
  50727. var parent = options.parent;
  50728. if (parent && !options.abstract) {
  50729. while (parent.$options.abstract && parent.$parent) {
  50730. parent = parent.$parent;
  50731. }
  50732. parent.$children.push(vm);
  50733. }
  50734. vm.$parent = parent;
  50735. vm.$root = parent ? parent.$root : vm;
  50736. vm.$children = [];
  50737. vm.$refs = {};
  50738. vm._watcher = null;
  50739. vm._inactive = null;
  50740. vm._directInactive = false;
  50741. vm._isMounted = false;
  50742. vm._isDestroyed = false;
  50743. vm._isBeingDestroyed = false;
  50744. }
  50745. function lifecycleMixin (Vue) {
  50746. Vue.prototype._update = function (vnode, hydrating) {
  50747. var vm = this;
  50748. var prevEl = vm.$el;
  50749. var prevVnode = vm._vnode;
  50750. var restoreActiveInstance = setActiveInstance(vm);
  50751. vm._vnode = vnode;
  50752. // Vue.prototype.__patch__ is injected in entry points
  50753. // based on the rendering backend used.
  50754. if (!prevVnode) {
  50755. // initial render
  50756. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  50757. } else {
  50758. // updates
  50759. vm.$el = vm.__patch__(prevVnode, vnode);
  50760. }
  50761. restoreActiveInstance();
  50762. // update __vue__ reference
  50763. if (prevEl) {
  50764. prevEl.__vue__ = null;
  50765. }
  50766. if (vm.$el) {
  50767. vm.$el.__vue__ = vm;
  50768. }
  50769. // if parent is an HOC, update its $el as well
  50770. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  50771. vm.$parent.$el = vm.$el;
  50772. }
  50773. // updated hook is called by the scheduler to ensure that children are
  50774. // updated in a parent's updated hook.
  50775. };
  50776. Vue.prototype.$forceUpdate = function () {
  50777. var vm = this;
  50778. if (vm._watcher) {
  50779. vm._watcher.update();
  50780. }
  50781. };
  50782. Vue.prototype.$destroy = function () {
  50783. var vm = this;
  50784. if (vm._isBeingDestroyed) {
  50785. return
  50786. }
  50787. callHook(vm, 'beforeDestroy');
  50788. vm._isBeingDestroyed = true;
  50789. // remove self from parent
  50790. var parent = vm.$parent;
  50791. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  50792. remove(parent.$children, vm);
  50793. }
  50794. // teardown watchers
  50795. if (vm._watcher) {
  50796. vm._watcher.teardown();
  50797. }
  50798. var i = vm._watchers.length;
  50799. while (i--) {
  50800. vm._watchers[i].teardown();
  50801. }
  50802. // remove reference from data ob
  50803. // frozen object may not have observer.
  50804. if (vm._data.__ob__) {
  50805. vm._data.__ob__.vmCount--;
  50806. }
  50807. // call the last hook...
  50808. vm._isDestroyed = true;
  50809. // invoke destroy hooks on current rendered tree
  50810. vm.__patch__(vm._vnode, null);
  50811. // fire destroyed hook
  50812. callHook(vm, 'destroyed');
  50813. // turn off all instance listeners.
  50814. vm.$off();
  50815. // remove __vue__ reference
  50816. if (vm.$el) {
  50817. vm.$el.__vue__ = null;
  50818. }
  50819. // release circular reference (#6759)
  50820. if (vm.$vnode) {
  50821. vm.$vnode.parent = null;
  50822. }
  50823. };
  50824. }
  50825. function mountComponent (
  50826. vm,
  50827. el,
  50828. hydrating
  50829. ) {
  50830. vm.$el = el;
  50831. if (!vm.$options.render) {
  50832. vm.$options.render = createEmptyVNode;
  50833. {
  50834. /* istanbul ignore if */
  50835. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  50836. vm.$options.el || el) {
  50837. warn(
  50838. 'You are using the runtime-only build of Vue where the template ' +
  50839. 'compiler is not available. Either pre-compile the templates into ' +
  50840. 'render functions, or use the compiler-included build.',
  50841. vm
  50842. );
  50843. } else {
  50844. warn(
  50845. 'Failed to mount component: template or render function not defined.',
  50846. vm
  50847. );
  50848. }
  50849. }
  50850. }
  50851. callHook(vm, 'beforeMount');
  50852. var updateComponent;
  50853. /* istanbul ignore if */
  50854. if (config.performance && mark) {
  50855. updateComponent = function () {
  50856. var name = vm._name;
  50857. var id = vm._uid;
  50858. var startTag = "vue-perf-start:" + id;
  50859. var endTag = "vue-perf-end:" + id;
  50860. mark(startTag);
  50861. var vnode = vm._render();
  50862. mark(endTag);
  50863. measure(("vue " + name + " render"), startTag, endTag);
  50864. mark(startTag);
  50865. vm._update(vnode, hydrating);
  50866. mark(endTag);
  50867. measure(("vue " + name + " patch"), startTag, endTag);
  50868. };
  50869. } else {
  50870. updateComponent = function () {
  50871. vm._update(vm._render(), hydrating);
  50872. };
  50873. }
  50874. // we set this to vm._watcher inside the watcher's constructor
  50875. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  50876. // component's mounted hook), which relies on vm._watcher being already defined
  50877. new Watcher(vm, updateComponent, noop, {
  50878. before: function before () {
  50879. if (vm._isMounted && !vm._isDestroyed) {
  50880. callHook(vm, 'beforeUpdate');
  50881. }
  50882. }
  50883. }, true /* isRenderWatcher */);
  50884. hydrating = false;
  50885. // manually mounted instance, call mounted on self
  50886. // mounted is called for render-created child components in its inserted hook
  50887. if (vm.$vnode == null) {
  50888. vm._isMounted = true;
  50889. callHook(vm, 'mounted');
  50890. }
  50891. return vm
  50892. }
  50893. function updateChildComponent (
  50894. vm,
  50895. propsData,
  50896. listeners,
  50897. parentVnode,
  50898. renderChildren
  50899. ) {
  50900. {
  50901. isUpdatingChildComponent = true;
  50902. }
  50903. // determine whether component has slot children
  50904. // we need to do this before overwriting $options._renderChildren.
  50905. // check if there are dynamic scopedSlots (hand-written or compiled but with
  50906. // dynamic slot names). Static scoped slots compiled from template has the
  50907. // "$stable" marker.
  50908. var newScopedSlots = parentVnode.data.scopedSlots;
  50909. var oldScopedSlots = vm.$scopedSlots;
  50910. var hasDynamicScopedSlot = !!(
  50911. (newScopedSlots && !newScopedSlots.$stable) ||
  50912. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  50913. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  50914. );
  50915. // Any static slot children from the parent may have changed during parent's
  50916. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  50917. // update is necessary to ensure correctness.
  50918. var needsForceUpdate = !!(
  50919. renderChildren || // has new static slots
  50920. vm.$options._renderChildren || // has old static slots
  50921. hasDynamicScopedSlot
  50922. );
  50923. vm.$options._parentVnode = parentVnode;
  50924. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  50925. if (vm._vnode) { // update child tree's parent
  50926. vm._vnode.parent = parentVnode;
  50927. }
  50928. vm.$options._renderChildren = renderChildren;
  50929. // update $attrs and $listeners hash
  50930. // these are also reactive so they may trigger child update if the child
  50931. // used them during render
  50932. vm.$attrs = parentVnode.data.attrs || emptyObject;
  50933. vm.$listeners = listeners || emptyObject;
  50934. // update props
  50935. if (propsData && vm.$options.props) {
  50936. toggleObserving(false);
  50937. var props = vm._props;
  50938. var propKeys = vm.$options._propKeys || [];
  50939. for (var i = 0; i < propKeys.length; i++) {
  50940. var key = propKeys[i];
  50941. var propOptions = vm.$options.props; // wtf flow?
  50942. props[key] = validateProp(key, propOptions, propsData, vm);
  50943. }
  50944. toggleObserving(true);
  50945. // keep a copy of raw propsData
  50946. vm.$options.propsData = propsData;
  50947. }
  50948. // update listeners
  50949. listeners = listeners || emptyObject;
  50950. var oldListeners = vm.$options._parentListeners;
  50951. vm.$options._parentListeners = listeners;
  50952. updateComponentListeners(vm, listeners, oldListeners);
  50953. // resolve slots + force update if has children
  50954. if (needsForceUpdate) {
  50955. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  50956. vm.$forceUpdate();
  50957. }
  50958. {
  50959. isUpdatingChildComponent = false;
  50960. }
  50961. }
  50962. function isInInactiveTree (vm) {
  50963. while (vm && (vm = vm.$parent)) {
  50964. if (vm._inactive) { return true }
  50965. }
  50966. return false
  50967. }
  50968. function activateChildComponent (vm, direct) {
  50969. if (direct) {
  50970. vm._directInactive = false;
  50971. if (isInInactiveTree(vm)) {
  50972. return
  50973. }
  50974. } else if (vm._directInactive) {
  50975. return
  50976. }
  50977. if (vm._inactive || vm._inactive === null) {
  50978. vm._inactive = false;
  50979. for (var i = 0; i < vm.$children.length; i++) {
  50980. activateChildComponent(vm.$children[i]);
  50981. }
  50982. callHook(vm, 'activated');
  50983. }
  50984. }
  50985. function deactivateChildComponent (vm, direct) {
  50986. if (direct) {
  50987. vm._directInactive = true;
  50988. if (isInInactiveTree(vm)) {
  50989. return
  50990. }
  50991. }
  50992. if (!vm._inactive) {
  50993. vm._inactive = true;
  50994. for (var i = 0; i < vm.$children.length; i++) {
  50995. deactivateChildComponent(vm.$children[i]);
  50996. }
  50997. callHook(vm, 'deactivated');
  50998. }
  50999. }
  51000. function callHook (vm, hook) {
  51001. // #7573 disable dep collection when invoking lifecycle hooks
  51002. pushTarget();
  51003. var handlers = vm.$options[hook];
  51004. var info = hook + " hook";
  51005. if (handlers) {
  51006. for (var i = 0, j = handlers.length; i < j; i++) {
  51007. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  51008. }
  51009. }
  51010. if (vm._hasHookEvent) {
  51011. vm.$emit('hook:' + hook);
  51012. }
  51013. popTarget();
  51014. }
  51015. /* */
  51016. var MAX_UPDATE_COUNT = 100;
  51017. var queue = [];
  51018. var activatedChildren = [];
  51019. var has = {};
  51020. var circular = {};
  51021. var waiting = false;
  51022. var flushing = false;
  51023. var index = 0;
  51024. /**
  51025. * Reset the scheduler's state.
  51026. */
  51027. function resetSchedulerState () {
  51028. index = queue.length = activatedChildren.length = 0;
  51029. has = {};
  51030. {
  51031. circular = {};
  51032. }
  51033. waiting = flushing = false;
  51034. }
  51035. // Async edge case #6566 requires saving the timestamp when event listeners are
  51036. // attached. However, calling performance.now() has a perf overhead especially
  51037. // if the page has thousands of event listeners. Instead, we take a timestamp
  51038. // every time the scheduler flushes and use that for all event listeners
  51039. // attached during that flush.
  51040. var currentFlushTimestamp = 0;
  51041. // Async edge case fix requires storing an event listener's attach timestamp.
  51042. var getNow = Date.now;
  51043. // Determine what event timestamp the browser is using. Annoyingly, the
  51044. // timestamp can either be hi-res (relative to page load) or low-res
  51045. // (relative to UNIX epoch), so in order to compare time we have to use the
  51046. // same timestamp type when saving the flush timestamp.
  51047. // All IE versions use low-res event timestamps, and have problematic clock
  51048. // implementations (#9632)
  51049. if (inBrowser && !isIE) {
  51050. var performance = window.performance;
  51051. if (
  51052. performance &&
  51053. typeof performance.now === 'function' &&
  51054. getNow() > document.createEvent('Event').timeStamp
  51055. ) {
  51056. // if the event timestamp, although evaluated AFTER the Date.now(), is
  51057. // smaller than it, it means the event is using a hi-res timestamp,
  51058. // and we need to use the hi-res version for event listener timestamps as
  51059. // well.
  51060. getNow = function () { return performance.now(); };
  51061. }
  51062. }
  51063. /**
  51064. * Flush both queues and run the watchers.
  51065. */
  51066. function flushSchedulerQueue () {
  51067. currentFlushTimestamp = getNow();
  51068. flushing = true;
  51069. var watcher, id;
  51070. // Sort queue before flush.
  51071. // This ensures that:
  51072. // 1. Components are updated from parent to child. (because parent is always
  51073. // created before the child)
  51074. // 2. A component's user watchers are run before its render watcher (because
  51075. // user watchers are created before the render watcher)
  51076. // 3. If a component is destroyed during a parent component's watcher run,
  51077. // its watchers can be skipped.
  51078. queue.sort(function (a, b) { return a.id - b.id; });
  51079. // do not cache length because more watchers might be pushed
  51080. // as we run existing watchers
  51081. for (index = 0; index < queue.length; index++) {
  51082. watcher = queue[index];
  51083. if (watcher.before) {
  51084. watcher.before();
  51085. }
  51086. id = watcher.id;
  51087. has[id] = null;
  51088. watcher.run();
  51089. // in dev build, check and stop circular updates.
  51090. if (has[id] != null) {
  51091. circular[id] = (circular[id] || 0) + 1;
  51092. if (circular[id] > MAX_UPDATE_COUNT) {
  51093. warn(
  51094. 'You may have an infinite update loop ' + (
  51095. watcher.user
  51096. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  51097. : "in a component render function."
  51098. ),
  51099. watcher.vm
  51100. );
  51101. break
  51102. }
  51103. }
  51104. }
  51105. // keep copies of post queues before resetting state
  51106. var activatedQueue = activatedChildren.slice();
  51107. var updatedQueue = queue.slice();
  51108. resetSchedulerState();
  51109. // call component updated and activated hooks
  51110. callActivatedHooks(activatedQueue);
  51111. callUpdatedHooks(updatedQueue);
  51112. // devtool hook
  51113. /* istanbul ignore if */
  51114. if (devtools && config.devtools) {
  51115. devtools.emit('flush');
  51116. }
  51117. }
  51118. function callUpdatedHooks (queue) {
  51119. var i = queue.length;
  51120. while (i--) {
  51121. var watcher = queue[i];
  51122. var vm = watcher.vm;
  51123. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  51124. callHook(vm, 'updated');
  51125. }
  51126. }
  51127. }
  51128. /**
  51129. * Queue a kept-alive component that was activated during patch.
  51130. * The queue will be processed after the entire tree has been patched.
  51131. */
  51132. function queueActivatedComponent (vm) {
  51133. // setting _inactive to false here so that a render function can
  51134. // rely on checking whether it's in an inactive tree (e.g. router-view)
  51135. vm._inactive = false;
  51136. activatedChildren.push(vm);
  51137. }
  51138. function callActivatedHooks (queue) {
  51139. for (var i = 0; i < queue.length; i++) {
  51140. queue[i]._inactive = true;
  51141. activateChildComponent(queue[i], true /* true */);
  51142. }
  51143. }
  51144. /**
  51145. * Push a watcher into the watcher queue.
  51146. * Jobs with duplicate IDs will be skipped unless it's
  51147. * pushed when the queue is being flushed.
  51148. */
  51149. function queueWatcher (watcher) {
  51150. var id = watcher.id;
  51151. if (has[id] == null) {
  51152. has[id] = true;
  51153. if (!flushing) {
  51154. queue.push(watcher);
  51155. } else {
  51156. // if already flushing, splice the watcher based on its id
  51157. // if already past its id, it will be run next immediately.
  51158. var i = queue.length - 1;
  51159. while (i > index && queue[i].id > watcher.id) {
  51160. i--;
  51161. }
  51162. queue.splice(i + 1, 0, watcher);
  51163. }
  51164. // queue the flush
  51165. if (!waiting) {
  51166. waiting = true;
  51167. if (!config.async) {
  51168. flushSchedulerQueue();
  51169. return
  51170. }
  51171. nextTick(flushSchedulerQueue);
  51172. }
  51173. }
  51174. }
  51175. /* */
  51176. var uid$2 = 0;
  51177. /**
  51178. * A watcher parses an expression, collects dependencies,
  51179. * and fires callback when the expression value changes.
  51180. * This is used for both the $watch() api and directives.
  51181. */
  51182. var Watcher = function Watcher (
  51183. vm,
  51184. expOrFn,
  51185. cb,
  51186. options,
  51187. isRenderWatcher
  51188. ) {
  51189. this.vm = vm;
  51190. if (isRenderWatcher) {
  51191. vm._watcher = this;
  51192. }
  51193. vm._watchers.push(this);
  51194. // options
  51195. if (options) {
  51196. this.deep = !!options.deep;
  51197. this.user = !!options.user;
  51198. this.lazy = !!options.lazy;
  51199. this.sync = !!options.sync;
  51200. this.before = options.before;
  51201. } else {
  51202. this.deep = this.user = this.lazy = this.sync = false;
  51203. }
  51204. this.cb = cb;
  51205. this.id = ++uid$2; // uid for batching
  51206. this.active = true;
  51207. this.dirty = this.lazy; // for lazy watchers
  51208. this.deps = [];
  51209. this.newDeps = [];
  51210. this.depIds = new _Set();
  51211. this.newDepIds = new _Set();
  51212. this.expression = expOrFn.toString();
  51213. // parse expression for getter
  51214. if (typeof expOrFn === 'function') {
  51215. this.getter = expOrFn;
  51216. } else {
  51217. this.getter = parsePath(expOrFn);
  51218. if (!this.getter) {
  51219. this.getter = noop;
  51220. warn(
  51221. "Failed watching path: \"" + expOrFn + "\" " +
  51222. 'Watcher only accepts simple dot-delimited paths. ' +
  51223. 'For full control, use a function instead.',
  51224. vm
  51225. );
  51226. }
  51227. }
  51228. this.value = this.lazy
  51229. ? undefined
  51230. : this.get();
  51231. };
  51232. /**
  51233. * Evaluate the getter, and re-collect dependencies.
  51234. */
  51235. Watcher.prototype.get = function get () {
  51236. pushTarget(this);
  51237. var value;
  51238. var vm = this.vm;
  51239. try {
  51240. value = this.getter.call(vm, vm);
  51241. } catch (e) {
  51242. if (this.user) {
  51243. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  51244. } else {
  51245. throw e
  51246. }
  51247. } finally {
  51248. // "touch" every property so they are all tracked as
  51249. // dependencies for deep watching
  51250. if (this.deep) {
  51251. traverse(value);
  51252. }
  51253. popTarget();
  51254. this.cleanupDeps();
  51255. }
  51256. return value
  51257. };
  51258. /**
  51259. * Add a dependency to this directive.
  51260. */
  51261. Watcher.prototype.addDep = function addDep (dep) {
  51262. var id = dep.id;
  51263. if (!this.newDepIds.has(id)) {
  51264. this.newDepIds.add(id);
  51265. this.newDeps.push(dep);
  51266. if (!this.depIds.has(id)) {
  51267. dep.addSub(this);
  51268. }
  51269. }
  51270. };
  51271. /**
  51272. * Clean up for dependency collection.
  51273. */
  51274. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  51275. var i = this.deps.length;
  51276. while (i--) {
  51277. var dep = this.deps[i];
  51278. if (!this.newDepIds.has(dep.id)) {
  51279. dep.removeSub(this);
  51280. }
  51281. }
  51282. var tmp = this.depIds;
  51283. this.depIds = this.newDepIds;
  51284. this.newDepIds = tmp;
  51285. this.newDepIds.clear();
  51286. tmp = this.deps;
  51287. this.deps = this.newDeps;
  51288. this.newDeps = tmp;
  51289. this.newDeps.length = 0;
  51290. };
  51291. /**
  51292. * Subscriber interface.
  51293. * Will be called when a dependency changes.
  51294. */
  51295. Watcher.prototype.update = function update () {
  51296. /* istanbul ignore else */
  51297. if (this.lazy) {
  51298. this.dirty = true;
  51299. } else if (this.sync) {
  51300. this.run();
  51301. } else {
  51302. queueWatcher(this);
  51303. }
  51304. };
  51305. /**
  51306. * Scheduler job interface.
  51307. * Will be called by the scheduler.
  51308. */
  51309. Watcher.prototype.run = function run () {
  51310. if (this.active) {
  51311. var value = this.get();
  51312. if (
  51313. value !== this.value ||
  51314. // Deep watchers and watchers on Object/Arrays should fire even
  51315. // when the value is the same, because the value may
  51316. // have mutated.
  51317. isObject(value) ||
  51318. this.deep
  51319. ) {
  51320. // set new value
  51321. var oldValue = this.value;
  51322. this.value = value;
  51323. if (this.user) {
  51324. try {
  51325. this.cb.call(this.vm, value, oldValue);
  51326. } catch (e) {
  51327. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  51328. }
  51329. } else {
  51330. this.cb.call(this.vm, value, oldValue);
  51331. }
  51332. }
  51333. }
  51334. };
  51335. /**
  51336. * Evaluate the value of the watcher.
  51337. * This only gets called for lazy watchers.
  51338. */
  51339. Watcher.prototype.evaluate = function evaluate () {
  51340. this.value = this.get();
  51341. this.dirty = false;
  51342. };
  51343. /**
  51344. * Depend on all deps collected by this watcher.
  51345. */
  51346. Watcher.prototype.depend = function depend () {
  51347. var i = this.deps.length;
  51348. while (i--) {
  51349. this.deps[i].depend();
  51350. }
  51351. };
  51352. /**
  51353. * Remove self from all dependencies' subscriber list.
  51354. */
  51355. Watcher.prototype.teardown = function teardown () {
  51356. if (this.active) {
  51357. // remove self from vm's watcher list
  51358. // this is a somewhat expensive operation so we skip it
  51359. // if the vm is being destroyed.
  51360. if (!this.vm._isBeingDestroyed) {
  51361. remove(this.vm._watchers, this);
  51362. }
  51363. var i = this.deps.length;
  51364. while (i--) {
  51365. this.deps[i].removeSub(this);
  51366. }
  51367. this.active = false;
  51368. }
  51369. };
  51370. /* */
  51371. var sharedPropertyDefinition = {
  51372. enumerable: true,
  51373. configurable: true,
  51374. get: noop,
  51375. set: noop
  51376. };
  51377. function proxy (target, sourceKey, key) {
  51378. sharedPropertyDefinition.get = function proxyGetter () {
  51379. return this[sourceKey][key]
  51380. };
  51381. sharedPropertyDefinition.set = function proxySetter (val) {
  51382. this[sourceKey][key] = val;
  51383. };
  51384. Object.defineProperty(target, key, sharedPropertyDefinition);
  51385. }
  51386. function initState (vm) {
  51387. vm._watchers = [];
  51388. var opts = vm.$options;
  51389. if (opts.props) { initProps(vm, opts.props); }
  51390. if (opts.methods) { initMethods(vm, opts.methods); }
  51391. if (opts.data) {
  51392. initData(vm);
  51393. } else {
  51394. observe(vm._data = {}, true /* asRootData */);
  51395. }
  51396. if (opts.computed) { initComputed(vm, opts.computed); }
  51397. if (opts.watch && opts.watch !== nativeWatch) {
  51398. initWatch(vm, opts.watch);
  51399. }
  51400. }
  51401. function initProps (vm, propsOptions) {
  51402. var propsData = vm.$options.propsData || {};
  51403. var props = vm._props = {};
  51404. // cache prop keys so that future props updates can iterate using Array
  51405. // instead of dynamic object key enumeration.
  51406. var keys = vm.$options._propKeys = [];
  51407. var isRoot = !vm.$parent;
  51408. // root instance props should be converted
  51409. if (!isRoot) {
  51410. toggleObserving(false);
  51411. }
  51412. var loop = function ( key ) {
  51413. keys.push(key);
  51414. var value = validateProp(key, propsOptions, propsData, vm);
  51415. /* istanbul ignore else */
  51416. {
  51417. var hyphenatedKey = hyphenate(key);
  51418. if (isReservedAttribute(hyphenatedKey) ||
  51419. config.isReservedAttr(hyphenatedKey)) {
  51420. warn(
  51421. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  51422. vm
  51423. );
  51424. }
  51425. defineReactive$$1(props, key, value, function () {
  51426. if (!isRoot && !isUpdatingChildComponent) {
  51427. warn(
  51428. "Avoid mutating a prop directly since the value will be " +
  51429. "overwritten whenever the parent component re-renders. " +
  51430. "Instead, use a data or computed property based on the prop's " +
  51431. "value. Prop being mutated: \"" + key + "\"",
  51432. vm
  51433. );
  51434. }
  51435. });
  51436. }
  51437. // static props are already proxied on the component's prototype
  51438. // during Vue.extend(). We only need to proxy props defined at
  51439. // instantiation here.
  51440. if (!(key in vm)) {
  51441. proxy(vm, "_props", key);
  51442. }
  51443. };
  51444. for (var key in propsOptions) loop( key );
  51445. toggleObserving(true);
  51446. }
  51447. function initData (vm) {
  51448. var data = vm.$options.data;
  51449. data = vm._data = typeof data === 'function'
  51450. ? getData(data, vm)
  51451. : data || {};
  51452. if (!isPlainObject(data)) {
  51453. data = {};
  51454. warn(
  51455. 'data functions should return an object:\n' +
  51456. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  51457. vm
  51458. );
  51459. }
  51460. // proxy data on instance
  51461. var keys = Object.keys(data);
  51462. var props = vm.$options.props;
  51463. var methods = vm.$options.methods;
  51464. var i = keys.length;
  51465. while (i--) {
  51466. var key = keys[i];
  51467. {
  51468. if (methods && hasOwn(methods, key)) {
  51469. warn(
  51470. ("Method \"" + key + "\" has already been defined as a data property."),
  51471. vm
  51472. );
  51473. }
  51474. }
  51475. if (props && hasOwn(props, key)) {
  51476. warn(
  51477. "The data property \"" + key + "\" is already declared as a prop. " +
  51478. "Use prop default value instead.",
  51479. vm
  51480. );
  51481. } else if (!isReserved(key)) {
  51482. proxy(vm, "_data", key);
  51483. }
  51484. }
  51485. // observe data
  51486. observe(data, true /* asRootData */);
  51487. }
  51488. function getData (data, vm) {
  51489. // #7573 disable dep collection when invoking data getters
  51490. pushTarget();
  51491. try {
  51492. return data.call(vm, vm)
  51493. } catch (e) {
  51494. handleError(e, vm, "data()");
  51495. return {}
  51496. } finally {
  51497. popTarget();
  51498. }
  51499. }
  51500. var computedWatcherOptions = { lazy: true };
  51501. function initComputed (vm, computed) {
  51502. // $flow-disable-line
  51503. var watchers = vm._computedWatchers = Object.create(null);
  51504. // computed properties are just getters during SSR
  51505. var isSSR = isServerRendering();
  51506. for (var key in computed) {
  51507. var userDef = computed[key];
  51508. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  51509. if (getter == null) {
  51510. warn(
  51511. ("Getter is missing for computed property \"" + key + "\"."),
  51512. vm
  51513. );
  51514. }
  51515. if (!isSSR) {
  51516. // create internal watcher for the computed property.
  51517. watchers[key] = new Watcher(
  51518. vm,
  51519. getter || noop,
  51520. noop,
  51521. computedWatcherOptions
  51522. );
  51523. }
  51524. // component-defined computed properties are already defined on the
  51525. // component prototype. We only need to define computed properties defined
  51526. // at instantiation here.
  51527. if (!(key in vm)) {
  51528. defineComputed(vm, key, userDef);
  51529. } else {
  51530. if (key in vm.$data) {
  51531. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  51532. } else if (vm.$options.props && key in vm.$options.props) {
  51533. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  51534. }
  51535. }
  51536. }
  51537. }
  51538. function defineComputed (
  51539. target,
  51540. key,
  51541. userDef
  51542. ) {
  51543. var shouldCache = !isServerRendering();
  51544. if (typeof userDef === 'function') {
  51545. sharedPropertyDefinition.get = shouldCache
  51546. ? createComputedGetter(key)
  51547. : createGetterInvoker(userDef);
  51548. sharedPropertyDefinition.set = noop;
  51549. } else {
  51550. sharedPropertyDefinition.get = userDef.get
  51551. ? shouldCache && userDef.cache !== false
  51552. ? createComputedGetter(key)
  51553. : createGetterInvoker(userDef.get)
  51554. : noop;
  51555. sharedPropertyDefinition.set = userDef.set || noop;
  51556. }
  51557. if (sharedPropertyDefinition.set === noop) {
  51558. sharedPropertyDefinition.set = function () {
  51559. warn(
  51560. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  51561. this
  51562. );
  51563. };
  51564. }
  51565. Object.defineProperty(target, key, sharedPropertyDefinition);
  51566. }
  51567. function createComputedGetter (key) {
  51568. return function computedGetter () {
  51569. var watcher = this._computedWatchers && this._computedWatchers[key];
  51570. if (watcher) {
  51571. if (watcher.dirty) {
  51572. watcher.evaluate();
  51573. }
  51574. if (Dep.target) {
  51575. watcher.depend();
  51576. }
  51577. return watcher.value
  51578. }
  51579. }
  51580. }
  51581. function createGetterInvoker(fn) {
  51582. return function computedGetter () {
  51583. return fn.call(this, this)
  51584. }
  51585. }
  51586. function initMethods (vm, methods) {
  51587. var props = vm.$options.props;
  51588. for (var key in methods) {
  51589. {
  51590. if (typeof methods[key] !== 'function') {
  51591. warn(
  51592. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  51593. "Did you reference the function correctly?",
  51594. vm
  51595. );
  51596. }
  51597. if (props && hasOwn(props, key)) {
  51598. warn(
  51599. ("Method \"" + key + "\" has already been defined as a prop."),
  51600. vm
  51601. );
  51602. }
  51603. if ((key in vm) && isReserved(key)) {
  51604. warn(
  51605. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  51606. "Avoid defining component methods that start with _ or $."
  51607. );
  51608. }
  51609. }
  51610. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  51611. }
  51612. }
  51613. function initWatch (vm, watch) {
  51614. for (var key in watch) {
  51615. var handler = watch[key];
  51616. if (Array.isArray(handler)) {
  51617. for (var i = 0; i < handler.length; i++) {
  51618. createWatcher(vm, key, handler[i]);
  51619. }
  51620. } else {
  51621. createWatcher(vm, key, handler);
  51622. }
  51623. }
  51624. }
  51625. function createWatcher (
  51626. vm,
  51627. expOrFn,
  51628. handler,
  51629. options
  51630. ) {
  51631. if (isPlainObject(handler)) {
  51632. options = handler;
  51633. handler = handler.handler;
  51634. }
  51635. if (typeof handler === 'string') {
  51636. handler = vm[handler];
  51637. }
  51638. return vm.$watch(expOrFn, handler, options)
  51639. }
  51640. function stateMixin (Vue) {
  51641. // flow somehow has problems with directly declared definition object
  51642. // when using Object.defineProperty, so we have to procedurally build up
  51643. // the object here.
  51644. var dataDef = {};
  51645. dataDef.get = function () { return this._data };
  51646. var propsDef = {};
  51647. propsDef.get = function () { return this._props };
  51648. {
  51649. dataDef.set = function () {
  51650. warn(
  51651. 'Avoid replacing instance root $data. ' +
  51652. 'Use nested data properties instead.',
  51653. this
  51654. );
  51655. };
  51656. propsDef.set = function () {
  51657. warn("$props is readonly.", this);
  51658. };
  51659. }
  51660. Object.defineProperty(Vue.prototype, '$data', dataDef);
  51661. Object.defineProperty(Vue.prototype, '$props', propsDef);
  51662. Vue.prototype.$set = set;
  51663. Vue.prototype.$delete = del;
  51664. Vue.prototype.$watch = function (
  51665. expOrFn,
  51666. cb,
  51667. options
  51668. ) {
  51669. var vm = this;
  51670. if (isPlainObject(cb)) {
  51671. return createWatcher(vm, expOrFn, cb, options)
  51672. }
  51673. options = options || {};
  51674. options.user = true;
  51675. var watcher = new Watcher(vm, expOrFn, cb, options);
  51676. if (options.immediate) {
  51677. try {
  51678. cb.call(vm, watcher.value);
  51679. } catch (error) {
  51680. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  51681. }
  51682. }
  51683. return function unwatchFn () {
  51684. watcher.teardown();
  51685. }
  51686. };
  51687. }
  51688. /* */
  51689. var uid$3 = 0;
  51690. function initMixin (Vue) {
  51691. Vue.prototype._init = function (options) {
  51692. var vm = this;
  51693. // a uid
  51694. vm._uid = uid$3++;
  51695. var startTag, endTag;
  51696. /* istanbul ignore if */
  51697. if (config.performance && mark) {
  51698. startTag = "vue-perf-start:" + (vm._uid);
  51699. endTag = "vue-perf-end:" + (vm._uid);
  51700. mark(startTag);
  51701. }
  51702. // a flag to avoid this being observed
  51703. vm._isVue = true;
  51704. // merge options
  51705. if (options && options._isComponent) {
  51706. // optimize internal component instantiation
  51707. // since dynamic options merging is pretty slow, and none of the
  51708. // internal component options needs special treatment.
  51709. initInternalComponent(vm, options);
  51710. } else {
  51711. vm.$options = mergeOptions(
  51712. resolveConstructorOptions(vm.constructor),
  51713. options || {},
  51714. vm
  51715. );
  51716. }
  51717. /* istanbul ignore else */
  51718. {
  51719. initProxy(vm);
  51720. }
  51721. // expose real self
  51722. vm._self = vm;
  51723. initLifecycle(vm);
  51724. initEvents(vm);
  51725. initRender(vm);
  51726. callHook(vm, 'beforeCreate');
  51727. initInjections(vm); // resolve injections before data/props
  51728. initState(vm);
  51729. initProvide(vm); // resolve provide after data/props
  51730. callHook(vm, 'created');
  51731. /* istanbul ignore if */
  51732. if (config.performance && mark) {
  51733. vm._name = formatComponentName(vm, false);
  51734. mark(endTag);
  51735. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  51736. }
  51737. if (vm.$options.el) {
  51738. vm.$mount(vm.$options.el);
  51739. }
  51740. };
  51741. }
  51742. function initInternalComponent (vm, options) {
  51743. var opts = vm.$options = Object.create(vm.constructor.options);
  51744. // doing this because it's faster than dynamic enumeration.
  51745. var parentVnode = options._parentVnode;
  51746. opts.parent = options.parent;
  51747. opts._parentVnode = parentVnode;
  51748. var vnodeComponentOptions = parentVnode.componentOptions;
  51749. opts.propsData = vnodeComponentOptions.propsData;
  51750. opts._parentListeners = vnodeComponentOptions.listeners;
  51751. opts._renderChildren = vnodeComponentOptions.children;
  51752. opts._componentTag = vnodeComponentOptions.tag;
  51753. if (options.render) {
  51754. opts.render = options.render;
  51755. opts.staticRenderFns = options.staticRenderFns;
  51756. }
  51757. }
  51758. function resolveConstructorOptions (Ctor) {
  51759. var options = Ctor.options;
  51760. if (Ctor.super) {
  51761. var superOptions = resolveConstructorOptions(Ctor.super);
  51762. var cachedSuperOptions = Ctor.superOptions;
  51763. if (superOptions !== cachedSuperOptions) {
  51764. // super option changed,
  51765. // need to resolve new options.
  51766. Ctor.superOptions = superOptions;
  51767. // check if there are any late-modified/attached options (#4976)
  51768. var modifiedOptions = resolveModifiedOptions(Ctor);
  51769. // update base extend options
  51770. if (modifiedOptions) {
  51771. extend(Ctor.extendOptions, modifiedOptions);
  51772. }
  51773. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  51774. if (options.name) {
  51775. options.components[options.name] = Ctor;
  51776. }
  51777. }
  51778. }
  51779. return options
  51780. }
  51781. function resolveModifiedOptions (Ctor) {
  51782. var modified;
  51783. var latest = Ctor.options;
  51784. var sealed = Ctor.sealedOptions;
  51785. for (var key in latest) {
  51786. if (latest[key] !== sealed[key]) {
  51787. if (!modified) { modified = {}; }
  51788. modified[key] = latest[key];
  51789. }
  51790. }
  51791. return modified
  51792. }
  51793. function Vue (options) {
  51794. if (!(this instanceof Vue)
  51795. ) {
  51796. warn('Vue is a constructor and should be called with the `new` keyword');
  51797. }
  51798. this._init(options);
  51799. }
  51800. initMixin(Vue);
  51801. stateMixin(Vue);
  51802. eventsMixin(Vue);
  51803. lifecycleMixin(Vue);
  51804. renderMixin(Vue);
  51805. /* */
  51806. function initUse (Vue) {
  51807. Vue.use = function (plugin) {
  51808. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  51809. if (installedPlugins.indexOf(plugin) > -1) {
  51810. return this
  51811. }
  51812. // additional parameters
  51813. var args = toArray(arguments, 1);
  51814. args.unshift(this);
  51815. if (typeof plugin.install === 'function') {
  51816. plugin.install.apply(plugin, args);
  51817. } else if (typeof plugin === 'function') {
  51818. plugin.apply(null, args);
  51819. }
  51820. installedPlugins.push(plugin);
  51821. return this
  51822. };
  51823. }
  51824. /* */
  51825. function initMixin$1 (Vue) {
  51826. Vue.mixin = function (mixin) {
  51827. this.options = mergeOptions(this.options, mixin);
  51828. return this
  51829. };
  51830. }
  51831. /* */
  51832. function initExtend (Vue) {
  51833. /**
  51834. * Each instance constructor, including Vue, has a unique
  51835. * cid. This enables us to create wrapped "child
  51836. * constructors" for prototypal inheritance and cache them.
  51837. */
  51838. Vue.cid = 0;
  51839. var cid = 1;
  51840. /**
  51841. * Class inheritance
  51842. */
  51843. Vue.extend = function (extendOptions) {
  51844. extendOptions = extendOptions || {};
  51845. var Super = this;
  51846. var SuperId = Super.cid;
  51847. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  51848. if (cachedCtors[SuperId]) {
  51849. return cachedCtors[SuperId]
  51850. }
  51851. var name = extendOptions.name || Super.options.name;
  51852. if (name) {
  51853. validateComponentName(name);
  51854. }
  51855. var Sub = function VueComponent (options) {
  51856. this._init(options);
  51857. };
  51858. Sub.prototype = Object.create(Super.prototype);
  51859. Sub.prototype.constructor = Sub;
  51860. Sub.cid = cid++;
  51861. Sub.options = mergeOptions(
  51862. Super.options,
  51863. extendOptions
  51864. );
  51865. Sub['super'] = Super;
  51866. // For props and computed properties, we define the proxy getters on
  51867. // the Vue instances at extension time, on the extended prototype. This
  51868. // avoids Object.defineProperty calls for each instance created.
  51869. if (Sub.options.props) {
  51870. initProps$1(Sub);
  51871. }
  51872. if (Sub.options.computed) {
  51873. initComputed$1(Sub);
  51874. }
  51875. // allow further extension/mixin/plugin usage
  51876. Sub.extend = Super.extend;
  51877. Sub.mixin = Super.mixin;
  51878. Sub.use = Super.use;
  51879. // create asset registers, so extended classes
  51880. // can have their private assets too.
  51881. ASSET_TYPES.forEach(function (type) {
  51882. Sub[type] = Super[type];
  51883. });
  51884. // enable recursive self-lookup
  51885. if (name) {
  51886. Sub.options.components[name] = Sub;
  51887. }
  51888. // keep a reference to the super options at extension time.
  51889. // later at instantiation we can check if Super's options have
  51890. // been updated.
  51891. Sub.superOptions = Super.options;
  51892. Sub.extendOptions = extendOptions;
  51893. Sub.sealedOptions = extend({}, Sub.options);
  51894. // cache constructor
  51895. cachedCtors[SuperId] = Sub;
  51896. return Sub
  51897. };
  51898. }
  51899. function initProps$1 (Comp) {
  51900. var props = Comp.options.props;
  51901. for (var key in props) {
  51902. proxy(Comp.prototype, "_props", key);
  51903. }
  51904. }
  51905. function initComputed$1 (Comp) {
  51906. var computed = Comp.options.computed;
  51907. for (var key in computed) {
  51908. defineComputed(Comp.prototype, key, computed[key]);
  51909. }
  51910. }
  51911. /* */
  51912. function initAssetRegisters (Vue) {
  51913. /**
  51914. * Create asset registration methods.
  51915. */
  51916. ASSET_TYPES.forEach(function (type) {
  51917. Vue[type] = function (
  51918. id,
  51919. definition
  51920. ) {
  51921. if (!definition) {
  51922. return this.options[type + 's'][id]
  51923. } else {
  51924. /* istanbul ignore if */
  51925. if (type === 'component') {
  51926. validateComponentName(id);
  51927. }
  51928. if (type === 'component' && isPlainObject(definition)) {
  51929. definition.name = definition.name || id;
  51930. definition = this.options._base.extend(definition);
  51931. }
  51932. if (type === 'directive' && typeof definition === 'function') {
  51933. definition = { bind: definition, update: definition };
  51934. }
  51935. this.options[type + 's'][id] = definition;
  51936. return definition
  51937. }
  51938. };
  51939. });
  51940. }
  51941. /* */
  51942. function getComponentName (opts) {
  51943. return opts && (opts.Ctor.options.name || opts.tag)
  51944. }
  51945. function matches (pattern, name) {
  51946. if (Array.isArray(pattern)) {
  51947. return pattern.indexOf(name) > -1
  51948. } else if (typeof pattern === 'string') {
  51949. return pattern.split(',').indexOf(name) > -1
  51950. } else if (isRegExp(pattern)) {
  51951. return pattern.test(name)
  51952. }
  51953. /* istanbul ignore next */
  51954. return false
  51955. }
  51956. function pruneCache (keepAliveInstance, filter) {
  51957. var cache = keepAliveInstance.cache;
  51958. var keys = keepAliveInstance.keys;
  51959. var _vnode = keepAliveInstance._vnode;
  51960. for (var key in cache) {
  51961. var cachedNode = cache[key];
  51962. if (cachedNode) {
  51963. var name = getComponentName(cachedNode.componentOptions);
  51964. if (name && !filter(name)) {
  51965. pruneCacheEntry(cache, key, keys, _vnode);
  51966. }
  51967. }
  51968. }
  51969. }
  51970. function pruneCacheEntry (
  51971. cache,
  51972. key,
  51973. keys,
  51974. current
  51975. ) {
  51976. var cached$$1 = cache[key];
  51977. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  51978. cached$$1.componentInstance.$destroy();
  51979. }
  51980. cache[key] = null;
  51981. remove(keys, key);
  51982. }
  51983. var patternTypes = [String, RegExp, Array];
  51984. var KeepAlive = {
  51985. name: 'keep-alive',
  51986. abstract: true,
  51987. props: {
  51988. include: patternTypes,
  51989. exclude: patternTypes,
  51990. max: [String, Number]
  51991. },
  51992. created: function created () {
  51993. this.cache = Object.create(null);
  51994. this.keys = [];
  51995. },
  51996. destroyed: function destroyed () {
  51997. for (var key in this.cache) {
  51998. pruneCacheEntry(this.cache, key, this.keys);
  51999. }
  52000. },
  52001. mounted: function mounted () {
  52002. var this$1 = this;
  52003. this.$watch('include', function (val) {
  52004. pruneCache(this$1, function (name) { return matches(val, name); });
  52005. });
  52006. this.$watch('exclude', function (val) {
  52007. pruneCache(this$1, function (name) { return !matches(val, name); });
  52008. });
  52009. },
  52010. render: function render () {
  52011. var slot = this.$slots.default;
  52012. var vnode = getFirstComponentChild(slot);
  52013. var componentOptions = vnode && vnode.componentOptions;
  52014. if (componentOptions) {
  52015. // check pattern
  52016. var name = getComponentName(componentOptions);
  52017. var ref = this;
  52018. var include = ref.include;
  52019. var exclude = ref.exclude;
  52020. if (
  52021. // not included
  52022. (include && (!name || !matches(include, name))) ||
  52023. // excluded
  52024. (exclude && name && matches(exclude, name))
  52025. ) {
  52026. return vnode
  52027. }
  52028. var ref$1 = this;
  52029. var cache = ref$1.cache;
  52030. var keys = ref$1.keys;
  52031. var key = vnode.key == null
  52032. // same constructor may get registered as different local components
  52033. // so cid alone is not enough (#3269)
  52034. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  52035. : vnode.key;
  52036. if (cache[key]) {
  52037. vnode.componentInstance = cache[key].componentInstance;
  52038. // make current key freshest
  52039. remove(keys, key);
  52040. keys.push(key);
  52041. } else {
  52042. cache[key] = vnode;
  52043. keys.push(key);
  52044. // prune oldest entry
  52045. if (this.max && keys.length > parseInt(this.max)) {
  52046. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  52047. }
  52048. }
  52049. vnode.data.keepAlive = true;
  52050. }
  52051. return vnode || (slot && slot[0])
  52052. }
  52053. };
  52054. var builtInComponents = {
  52055. KeepAlive: KeepAlive
  52056. };
  52057. /* */
  52058. function initGlobalAPI (Vue) {
  52059. // config
  52060. var configDef = {};
  52061. configDef.get = function () { return config; };
  52062. {
  52063. configDef.set = function () {
  52064. warn(
  52065. 'Do not replace the Vue.config object, set individual fields instead.'
  52066. );
  52067. };
  52068. }
  52069. Object.defineProperty(Vue, 'config', configDef);
  52070. // exposed util methods.
  52071. // NOTE: these are not considered part of the public API - avoid relying on
  52072. // them unless you are aware of the risk.
  52073. Vue.util = {
  52074. warn: warn,
  52075. extend: extend,
  52076. mergeOptions: mergeOptions,
  52077. defineReactive: defineReactive$$1
  52078. };
  52079. Vue.set = set;
  52080. Vue.delete = del;
  52081. Vue.nextTick = nextTick;
  52082. // 2.6 explicit observable API
  52083. Vue.observable = function (obj) {
  52084. observe(obj);
  52085. return obj
  52086. };
  52087. Vue.options = Object.create(null);
  52088. ASSET_TYPES.forEach(function (type) {
  52089. Vue.options[type + 's'] = Object.create(null);
  52090. });
  52091. // this is used to identify the "base" constructor to extend all plain-object
  52092. // components with in Weex's multi-instance scenarios.
  52093. Vue.options._base = Vue;
  52094. extend(Vue.options.components, builtInComponents);
  52095. initUse(Vue);
  52096. initMixin$1(Vue);
  52097. initExtend(Vue);
  52098. initAssetRegisters(Vue);
  52099. }
  52100. initGlobalAPI(Vue);
  52101. Object.defineProperty(Vue.prototype, '$isServer', {
  52102. get: isServerRendering
  52103. });
  52104. Object.defineProperty(Vue.prototype, '$ssrContext', {
  52105. get: function get () {
  52106. /* istanbul ignore next */
  52107. return this.$vnode && this.$vnode.ssrContext
  52108. }
  52109. });
  52110. // expose FunctionalRenderContext for ssr runtime helper installation
  52111. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  52112. value: FunctionalRenderContext
  52113. });
  52114. Vue.version = '2.6.11';
  52115. /* */
  52116. // these are reserved for web because they are directly compiled away
  52117. // during template compilation
  52118. var isReservedAttr = makeMap('style,class');
  52119. // attributes that should be using props for binding
  52120. var acceptValue = makeMap('input,textarea,option,select,progress');
  52121. var mustUseProp = function (tag, type, attr) {
  52122. return (
  52123. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  52124. (attr === 'selected' && tag === 'option') ||
  52125. (attr === 'checked' && tag === 'input') ||
  52126. (attr === 'muted' && tag === 'video')
  52127. )
  52128. };
  52129. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  52130. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  52131. var convertEnumeratedValue = function (key, value) {
  52132. return isFalsyAttrValue(value) || value === 'false'
  52133. ? 'false'
  52134. // allow arbitrary string value for contenteditable
  52135. : key === 'contenteditable' && isValidContentEditableValue(value)
  52136. ? value
  52137. : 'true'
  52138. };
  52139. var isBooleanAttr = makeMap(
  52140. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  52141. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  52142. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  52143. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  52144. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  52145. 'truespeed,typemustmatch,visible'
  52146. );
  52147. var xlinkNS = 'http://www.w3.org/1999/xlink';
  52148. var isXlink = function (name) {
  52149. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  52150. };
  52151. var getXlinkProp = function (name) {
  52152. return isXlink(name) ? name.slice(6, name.length) : ''
  52153. };
  52154. var isFalsyAttrValue = function (val) {
  52155. return val == null || val === false
  52156. };
  52157. /* */
  52158. function genClassForVnode (vnode) {
  52159. var data = vnode.data;
  52160. var parentNode = vnode;
  52161. var childNode = vnode;
  52162. while (isDef(childNode.componentInstance)) {
  52163. childNode = childNode.componentInstance._vnode;
  52164. if (childNode && childNode.data) {
  52165. data = mergeClassData(childNode.data, data);
  52166. }
  52167. }
  52168. while (isDef(parentNode = parentNode.parent)) {
  52169. if (parentNode && parentNode.data) {
  52170. data = mergeClassData(data, parentNode.data);
  52171. }
  52172. }
  52173. return renderClass(data.staticClass, data.class)
  52174. }
  52175. function mergeClassData (child, parent) {
  52176. return {
  52177. staticClass: concat(child.staticClass, parent.staticClass),
  52178. class: isDef(child.class)
  52179. ? [child.class, parent.class]
  52180. : parent.class
  52181. }
  52182. }
  52183. function renderClass (
  52184. staticClass,
  52185. dynamicClass
  52186. ) {
  52187. if (isDef(staticClass) || isDef(dynamicClass)) {
  52188. return concat(staticClass, stringifyClass(dynamicClass))
  52189. }
  52190. /* istanbul ignore next */
  52191. return ''
  52192. }
  52193. function concat (a, b) {
  52194. return a ? b ? (a + ' ' + b) : a : (b || '')
  52195. }
  52196. function stringifyClass (value) {
  52197. if (Array.isArray(value)) {
  52198. return stringifyArray(value)
  52199. }
  52200. if (isObject(value)) {
  52201. return stringifyObject(value)
  52202. }
  52203. if (typeof value === 'string') {
  52204. return value
  52205. }
  52206. /* istanbul ignore next */
  52207. return ''
  52208. }
  52209. function stringifyArray (value) {
  52210. var res = '';
  52211. var stringified;
  52212. for (var i = 0, l = value.length; i < l; i++) {
  52213. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  52214. if (res) { res += ' '; }
  52215. res += stringified;
  52216. }
  52217. }
  52218. return res
  52219. }
  52220. function stringifyObject (value) {
  52221. var res = '';
  52222. for (var key in value) {
  52223. if (value[key]) {
  52224. if (res) { res += ' '; }
  52225. res += key;
  52226. }
  52227. }
  52228. return res
  52229. }
  52230. /* */
  52231. var namespaceMap = {
  52232. svg: 'http://www.w3.org/2000/svg',
  52233. math: 'http://www.w3.org/1998/Math/MathML'
  52234. };
  52235. var isHTMLTag = makeMap(
  52236. 'html,body,base,head,link,meta,style,title,' +
  52237. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  52238. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  52239. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  52240. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  52241. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  52242. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  52243. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  52244. 'output,progress,select,textarea,' +
  52245. 'details,dialog,menu,menuitem,summary,' +
  52246. 'content,element,shadow,template,blockquote,iframe,tfoot'
  52247. );
  52248. // this map is intentionally selective, only covering SVG elements that may
  52249. // contain child elements.
  52250. var isSVG = makeMap(
  52251. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  52252. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  52253. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  52254. true
  52255. );
  52256. var isPreTag = function (tag) { return tag === 'pre'; };
  52257. var isReservedTag = function (tag) {
  52258. return isHTMLTag(tag) || isSVG(tag)
  52259. };
  52260. function getTagNamespace (tag) {
  52261. if (isSVG(tag)) {
  52262. return 'svg'
  52263. }
  52264. // basic support for MathML
  52265. // note it doesn't support other MathML elements being component roots
  52266. if (tag === 'math') {
  52267. return 'math'
  52268. }
  52269. }
  52270. var unknownElementCache = Object.create(null);
  52271. function isUnknownElement (tag) {
  52272. /* istanbul ignore if */
  52273. if (!inBrowser) {
  52274. return true
  52275. }
  52276. if (isReservedTag(tag)) {
  52277. return false
  52278. }
  52279. tag = tag.toLowerCase();
  52280. /* istanbul ignore if */
  52281. if (unknownElementCache[tag] != null) {
  52282. return unknownElementCache[tag]
  52283. }
  52284. var el = document.createElement(tag);
  52285. if (tag.indexOf('-') > -1) {
  52286. // http://stackoverflow.com/a/28210364/1070244
  52287. return (unknownElementCache[tag] = (
  52288. el.constructor === window.HTMLUnknownElement ||
  52289. el.constructor === window.HTMLElement
  52290. ))
  52291. } else {
  52292. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  52293. }
  52294. }
  52295. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  52296. /* */
  52297. /**
  52298. * Query an element selector if it's not an element already.
  52299. */
  52300. function query (el) {
  52301. if (typeof el === 'string') {
  52302. var selected = document.querySelector(el);
  52303. if (!selected) {
  52304. warn(
  52305. 'Cannot find element: ' + el
  52306. );
  52307. return document.createElement('div')
  52308. }
  52309. return selected
  52310. } else {
  52311. return el
  52312. }
  52313. }
  52314. /* */
  52315. function createElement$1 (tagName, vnode) {
  52316. var elm = document.createElement(tagName);
  52317. if (tagName !== 'select') {
  52318. return elm
  52319. }
  52320. // false or null will remove the attribute but undefined will not
  52321. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  52322. elm.setAttribute('multiple', 'multiple');
  52323. }
  52324. return elm
  52325. }
  52326. function createElementNS (namespace, tagName) {
  52327. return document.createElementNS(namespaceMap[namespace], tagName)
  52328. }
  52329. function createTextNode (text) {
  52330. return document.createTextNode(text)
  52331. }
  52332. function createComment (text) {
  52333. return document.createComment(text)
  52334. }
  52335. function insertBefore (parentNode, newNode, referenceNode) {
  52336. parentNode.insertBefore(newNode, referenceNode);
  52337. }
  52338. function removeChild (node, child) {
  52339. node.removeChild(child);
  52340. }
  52341. function appendChild (node, child) {
  52342. node.appendChild(child);
  52343. }
  52344. function parentNode (node) {
  52345. return node.parentNode
  52346. }
  52347. function nextSibling (node) {
  52348. return node.nextSibling
  52349. }
  52350. function tagName (node) {
  52351. return node.tagName
  52352. }
  52353. function setTextContent (node, text) {
  52354. node.textContent = text;
  52355. }
  52356. function setStyleScope (node, scopeId) {
  52357. node.setAttribute(scopeId, '');
  52358. }
  52359. var nodeOps = /*#__PURE__*/Object.freeze({
  52360. createElement: createElement$1,
  52361. createElementNS: createElementNS,
  52362. createTextNode: createTextNode,
  52363. createComment: createComment,
  52364. insertBefore: insertBefore,
  52365. removeChild: removeChild,
  52366. appendChild: appendChild,
  52367. parentNode: parentNode,
  52368. nextSibling: nextSibling,
  52369. tagName: tagName,
  52370. setTextContent: setTextContent,
  52371. setStyleScope: setStyleScope
  52372. });
  52373. /* */
  52374. var ref = {
  52375. create: function create (_, vnode) {
  52376. registerRef(vnode);
  52377. },
  52378. update: function update (oldVnode, vnode) {
  52379. if (oldVnode.data.ref !== vnode.data.ref) {
  52380. registerRef(oldVnode, true);
  52381. registerRef(vnode);
  52382. }
  52383. },
  52384. destroy: function destroy (vnode) {
  52385. registerRef(vnode, true);
  52386. }
  52387. };
  52388. function registerRef (vnode, isRemoval) {
  52389. var key = vnode.data.ref;
  52390. if (!isDef(key)) { return }
  52391. var vm = vnode.context;
  52392. var ref = vnode.componentInstance || vnode.elm;
  52393. var refs = vm.$refs;
  52394. if (isRemoval) {
  52395. if (Array.isArray(refs[key])) {
  52396. remove(refs[key], ref);
  52397. } else if (refs[key] === ref) {
  52398. refs[key] = undefined;
  52399. }
  52400. } else {
  52401. if (vnode.data.refInFor) {
  52402. if (!Array.isArray(refs[key])) {
  52403. refs[key] = [ref];
  52404. } else if (refs[key].indexOf(ref) < 0) {
  52405. // $flow-disable-line
  52406. refs[key].push(ref);
  52407. }
  52408. } else {
  52409. refs[key] = ref;
  52410. }
  52411. }
  52412. }
  52413. /**
  52414. * Virtual DOM patching algorithm based on Snabbdom by
  52415. * Simon Friis Vindum (@paldepind)
  52416. * Licensed under the MIT License
  52417. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  52418. *
  52419. * modified by Evan You (@yyx990803)
  52420. *
  52421. * Not type-checking this because this file is perf-critical and the cost
  52422. * of making flow understand it is not worth it.
  52423. */
  52424. var emptyNode = new VNode('', {}, []);
  52425. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  52426. function sameVnode (a, b) {
  52427. return (
  52428. a.key === b.key && (
  52429. (
  52430. a.tag === b.tag &&
  52431. a.isComment === b.isComment &&
  52432. isDef(a.data) === isDef(b.data) &&
  52433. sameInputType(a, b)
  52434. ) || (
  52435. isTrue(a.isAsyncPlaceholder) &&
  52436. a.asyncFactory === b.asyncFactory &&
  52437. isUndef(b.asyncFactory.error)
  52438. )
  52439. )
  52440. )
  52441. }
  52442. function sameInputType (a, b) {
  52443. if (a.tag !== 'input') { return true }
  52444. var i;
  52445. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  52446. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  52447. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  52448. }
  52449. function createKeyToOldIdx (children, beginIdx, endIdx) {
  52450. var i, key;
  52451. var map = {};
  52452. for (i = beginIdx; i <= endIdx; ++i) {
  52453. key = children[i].key;
  52454. if (isDef(key)) { map[key] = i; }
  52455. }
  52456. return map
  52457. }
  52458. function createPatchFunction (backend) {
  52459. var i, j;
  52460. var cbs = {};
  52461. var modules = backend.modules;
  52462. var nodeOps = backend.nodeOps;
  52463. for (i = 0; i < hooks.length; ++i) {
  52464. cbs[hooks[i]] = [];
  52465. for (j = 0; j < modules.length; ++j) {
  52466. if (isDef(modules[j][hooks[i]])) {
  52467. cbs[hooks[i]].push(modules[j][hooks[i]]);
  52468. }
  52469. }
  52470. }
  52471. function emptyNodeAt (elm) {
  52472. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  52473. }
  52474. function createRmCb (childElm, listeners) {
  52475. function remove$$1 () {
  52476. if (--remove$$1.listeners === 0) {
  52477. removeNode(childElm);
  52478. }
  52479. }
  52480. remove$$1.listeners = listeners;
  52481. return remove$$1
  52482. }
  52483. function removeNode (el) {
  52484. var parent = nodeOps.parentNode(el);
  52485. // element may have already been removed due to v-html / v-text
  52486. if (isDef(parent)) {
  52487. nodeOps.removeChild(parent, el);
  52488. }
  52489. }
  52490. function isUnknownElement$$1 (vnode, inVPre) {
  52491. return (
  52492. !inVPre &&
  52493. !vnode.ns &&
  52494. !(
  52495. config.ignoredElements.length &&
  52496. config.ignoredElements.some(function (ignore) {
  52497. return isRegExp(ignore)
  52498. ? ignore.test(vnode.tag)
  52499. : ignore === vnode.tag
  52500. })
  52501. ) &&
  52502. config.isUnknownElement(vnode.tag)
  52503. )
  52504. }
  52505. var creatingElmInVPre = 0;
  52506. function createElm (
  52507. vnode,
  52508. insertedVnodeQueue,
  52509. parentElm,
  52510. refElm,
  52511. nested,
  52512. ownerArray,
  52513. index
  52514. ) {
  52515. if (isDef(vnode.elm) && isDef(ownerArray)) {
  52516. // This vnode was used in a previous render!
  52517. // now it's used as a new node, overwriting its elm would cause
  52518. // potential patch errors down the road when it's used as an insertion
  52519. // reference node. Instead, we clone the node on-demand before creating
  52520. // associated DOM element for it.
  52521. vnode = ownerArray[index] = cloneVNode(vnode);
  52522. }
  52523. vnode.isRootInsert = !nested; // for transition enter check
  52524. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  52525. return
  52526. }
  52527. var data = vnode.data;
  52528. var children = vnode.children;
  52529. var tag = vnode.tag;
  52530. if (isDef(tag)) {
  52531. {
  52532. if (data && data.pre) {
  52533. creatingElmInVPre++;
  52534. }
  52535. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  52536. warn(
  52537. 'Unknown custom element: <' + tag + '> - did you ' +
  52538. 'register the component correctly? For recursive components, ' +
  52539. 'make sure to provide the "name" option.',
  52540. vnode.context
  52541. );
  52542. }
  52543. }
  52544. vnode.elm = vnode.ns
  52545. ? nodeOps.createElementNS(vnode.ns, tag)
  52546. : nodeOps.createElement(tag, vnode);
  52547. setScope(vnode);
  52548. /* istanbul ignore if */
  52549. {
  52550. createChildren(vnode, children, insertedVnodeQueue);
  52551. if (isDef(data)) {
  52552. invokeCreateHooks(vnode, insertedVnodeQueue);
  52553. }
  52554. insert(parentElm, vnode.elm, refElm);
  52555. }
  52556. if (data && data.pre) {
  52557. creatingElmInVPre--;
  52558. }
  52559. } else if (isTrue(vnode.isComment)) {
  52560. vnode.elm = nodeOps.createComment(vnode.text);
  52561. insert(parentElm, vnode.elm, refElm);
  52562. } else {
  52563. vnode.elm = nodeOps.createTextNode(vnode.text);
  52564. insert(parentElm, vnode.elm, refElm);
  52565. }
  52566. }
  52567. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  52568. var i = vnode.data;
  52569. if (isDef(i)) {
  52570. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  52571. if (isDef(i = i.hook) && isDef(i = i.init)) {
  52572. i(vnode, false /* hydrating */);
  52573. }
  52574. // after calling the init hook, if the vnode is a child component
  52575. // it should've created a child instance and mounted it. the child
  52576. // component also has set the placeholder vnode's elm.
  52577. // in that case we can just return the element and be done.
  52578. if (isDef(vnode.componentInstance)) {
  52579. initComponent(vnode, insertedVnodeQueue);
  52580. insert(parentElm, vnode.elm, refElm);
  52581. if (isTrue(isReactivated)) {
  52582. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  52583. }
  52584. return true
  52585. }
  52586. }
  52587. }
  52588. function initComponent (vnode, insertedVnodeQueue) {
  52589. if (isDef(vnode.data.pendingInsert)) {
  52590. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  52591. vnode.data.pendingInsert = null;
  52592. }
  52593. vnode.elm = vnode.componentInstance.$el;
  52594. if (isPatchable(vnode)) {
  52595. invokeCreateHooks(vnode, insertedVnodeQueue);
  52596. setScope(vnode);
  52597. } else {
  52598. // empty component root.
  52599. // skip all element-related modules except for ref (#3455)
  52600. registerRef(vnode);
  52601. // make sure to invoke the insert hook
  52602. insertedVnodeQueue.push(vnode);
  52603. }
  52604. }
  52605. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  52606. var i;
  52607. // hack for #4339: a reactivated component with inner transition
  52608. // does not trigger because the inner node's created hooks are not called
  52609. // again. It's not ideal to involve module-specific logic in here but
  52610. // there doesn't seem to be a better way to do it.
  52611. var innerNode = vnode;
  52612. while (innerNode.componentInstance) {
  52613. innerNode = innerNode.componentInstance._vnode;
  52614. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  52615. for (i = 0; i < cbs.activate.length; ++i) {
  52616. cbs.activate[i](emptyNode, innerNode);
  52617. }
  52618. insertedVnodeQueue.push(innerNode);
  52619. break
  52620. }
  52621. }
  52622. // unlike a newly created component,
  52623. // a reactivated keep-alive component doesn't insert itself
  52624. insert(parentElm, vnode.elm, refElm);
  52625. }
  52626. function insert (parent, elm, ref$$1) {
  52627. if (isDef(parent)) {
  52628. if (isDef(ref$$1)) {
  52629. if (nodeOps.parentNode(ref$$1) === parent) {
  52630. nodeOps.insertBefore(parent, elm, ref$$1);
  52631. }
  52632. } else {
  52633. nodeOps.appendChild(parent, elm);
  52634. }
  52635. }
  52636. }
  52637. function createChildren (vnode, children, insertedVnodeQueue) {
  52638. if (Array.isArray(children)) {
  52639. {
  52640. checkDuplicateKeys(children);
  52641. }
  52642. for (var i = 0; i < children.length; ++i) {
  52643. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  52644. }
  52645. } else if (isPrimitive(vnode.text)) {
  52646. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  52647. }
  52648. }
  52649. function isPatchable (vnode) {
  52650. while (vnode.componentInstance) {
  52651. vnode = vnode.componentInstance._vnode;
  52652. }
  52653. return isDef(vnode.tag)
  52654. }
  52655. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  52656. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  52657. cbs.create[i$1](emptyNode, vnode);
  52658. }
  52659. i = vnode.data.hook; // Reuse variable
  52660. if (isDef(i)) {
  52661. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  52662. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  52663. }
  52664. }
  52665. // set scope id attribute for scoped CSS.
  52666. // this is implemented as a special case to avoid the overhead
  52667. // of going through the normal attribute patching process.
  52668. function setScope (vnode) {
  52669. var i;
  52670. if (isDef(i = vnode.fnScopeId)) {
  52671. nodeOps.setStyleScope(vnode.elm, i);
  52672. } else {
  52673. var ancestor = vnode;
  52674. while (ancestor) {
  52675. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  52676. nodeOps.setStyleScope(vnode.elm, i);
  52677. }
  52678. ancestor = ancestor.parent;
  52679. }
  52680. }
  52681. // for slot content they should also get the scopeId from the host instance.
  52682. if (isDef(i = activeInstance) &&
  52683. i !== vnode.context &&
  52684. i !== vnode.fnContext &&
  52685. isDef(i = i.$options._scopeId)
  52686. ) {
  52687. nodeOps.setStyleScope(vnode.elm, i);
  52688. }
  52689. }
  52690. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  52691. for (; startIdx <= endIdx; ++startIdx) {
  52692. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  52693. }
  52694. }
  52695. function invokeDestroyHook (vnode) {
  52696. var i, j;
  52697. var data = vnode.data;
  52698. if (isDef(data)) {
  52699. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  52700. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  52701. }
  52702. if (isDef(i = vnode.children)) {
  52703. for (j = 0; j < vnode.children.length; ++j) {
  52704. invokeDestroyHook(vnode.children[j]);
  52705. }
  52706. }
  52707. }
  52708. function removeVnodes (vnodes, startIdx, endIdx) {
  52709. for (; startIdx <= endIdx; ++startIdx) {
  52710. var ch = vnodes[startIdx];
  52711. if (isDef(ch)) {
  52712. if (isDef(ch.tag)) {
  52713. removeAndInvokeRemoveHook(ch);
  52714. invokeDestroyHook(ch);
  52715. } else { // Text node
  52716. removeNode(ch.elm);
  52717. }
  52718. }
  52719. }
  52720. }
  52721. function removeAndInvokeRemoveHook (vnode, rm) {
  52722. if (isDef(rm) || isDef(vnode.data)) {
  52723. var i;
  52724. var listeners = cbs.remove.length + 1;
  52725. if (isDef(rm)) {
  52726. // we have a recursively passed down rm callback
  52727. // increase the listeners count
  52728. rm.listeners += listeners;
  52729. } else {
  52730. // directly removing
  52731. rm = createRmCb(vnode.elm, listeners);
  52732. }
  52733. // recursively invoke hooks on child component root node
  52734. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  52735. removeAndInvokeRemoveHook(i, rm);
  52736. }
  52737. for (i = 0; i < cbs.remove.length; ++i) {
  52738. cbs.remove[i](vnode, rm);
  52739. }
  52740. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  52741. i(vnode, rm);
  52742. } else {
  52743. rm();
  52744. }
  52745. } else {
  52746. removeNode(vnode.elm);
  52747. }
  52748. }
  52749. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  52750. var oldStartIdx = 0;
  52751. var newStartIdx = 0;
  52752. var oldEndIdx = oldCh.length - 1;
  52753. var oldStartVnode = oldCh[0];
  52754. var oldEndVnode = oldCh[oldEndIdx];
  52755. var newEndIdx = newCh.length - 1;
  52756. var newStartVnode = newCh[0];
  52757. var newEndVnode = newCh[newEndIdx];
  52758. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  52759. // removeOnly is a special flag used only by <transition-group>
  52760. // to ensure removed elements stay in correct relative positions
  52761. // during leaving transitions
  52762. var canMove = !removeOnly;
  52763. {
  52764. checkDuplicateKeys(newCh);
  52765. }
  52766. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  52767. if (isUndef(oldStartVnode)) {
  52768. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  52769. } else if (isUndef(oldEndVnode)) {
  52770. oldEndVnode = oldCh[--oldEndIdx];
  52771. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  52772. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  52773. oldStartVnode = oldCh[++oldStartIdx];
  52774. newStartVnode = newCh[++newStartIdx];
  52775. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  52776. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  52777. oldEndVnode = oldCh[--oldEndIdx];
  52778. newEndVnode = newCh[--newEndIdx];
  52779. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  52780. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  52781. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  52782. oldStartVnode = oldCh[++oldStartIdx];
  52783. newEndVnode = newCh[--newEndIdx];
  52784. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  52785. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  52786. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  52787. oldEndVnode = oldCh[--oldEndIdx];
  52788. newStartVnode = newCh[++newStartIdx];
  52789. } else {
  52790. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  52791. idxInOld = isDef(newStartVnode.key)
  52792. ? oldKeyToIdx[newStartVnode.key]
  52793. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  52794. if (isUndef(idxInOld)) { // New element
  52795. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  52796. } else {
  52797. vnodeToMove = oldCh[idxInOld];
  52798. if (sameVnode(vnodeToMove, newStartVnode)) {
  52799. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  52800. oldCh[idxInOld] = undefined;
  52801. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  52802. } else {
  52803. // same key but different element. treat as new element
  52804. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  52805. }
  52806. }
  52807. newStartVnode = newCh[++newStartIdx];
  52808. }
  52809. }
  52810. if (oldStartIdx > oldEndIdx) {
  52811. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  52812. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  52813. } else if (newStartIdx > newEndIdx) {
  52814. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  52815. }
  52816. }
  52817. function checkDuplicateKeys (children) {
  52818. var seenKeys = {};
  52819. for (var i = 0; i < children.length; i++) {
  52820. var vnode = children[i];
  52821. var key = vnode.key;
  52822. if (isDef(key)) {
  52823. if (seenKeys[key]) {
  52824. warn(
  52825. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  52826. vnode.context
  52827. );
  52828. } else {
  52829. seenKeys[key] = true;
  52830. }
  52831. }
  52832. }
  52833. }
  52834. function findIdxInOld (node, oldCh, start, end) {
  52835. for (var i = start; i < end; i++) {
  52836. var c = oldCh[i];
  52837. if (isDef(c) && sameVnode(node, c)) { return i }
  52838. }
  52839. }
  52840. function patchVnode (
  52841. oldVnode,
  52842. vnode,
  52843. insertedVnodeQueue,
  52844. ownerArray,
  52845. index,
  52846. removeOnly
  52847. ) {
  52848. if (oldVnode === vnode) {
  52849. return
  52850. }
  52851. if (isDef(vnode.elm) && isDef(ownerArray)) {
  52852. // clone reused vnode
  52853. vnode = ownerArray[index] = cloneVNode(vnode);
  52854. }
  52855. var elm = vnode.elm = oldVnode.elm;
  52856. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  52857. if (isDef(vnode.asyncFactory.resolved)) {
  52858. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  52859. } else {
  52860. vnode.isAsyncPlaceholder = true;
  52861. }
  52862. return
  52863. }
  52864. // reuse element for static trees.
  52865. // note we only do this if the vnode is cloned -
  52866. // if the new node is not cloned it means the render functions have been
  52867. // reset by the hot-reload-api and we need to do a proper re-render.
  52868. if (isTrue(vnode.isStatic) &&
  52869. isTrue(oldVnode.isStatic) &&
  52870. vnode.key === oldVnode.key &&
  52871. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  52872. ) {
  52873. vnode.componentInstance = oldVnode.componentInstance;
  52874. return
  52875. }
  52876. var i;
  52877. var data = vnode.data;
  52878. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  52879. i(oldVnode, vnode);
  52880. }
  52881. var oldCh = oldVnode.children;
  52882. var ch = vnode.children;
  52883. if (isDef(data) && isPatchable(vnode)) {
  52884. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  52885. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  52886. }
  52887. if (isUndef(vnode.text)) {
  52888. if (isDef(oldCh) && isDef(ch)) {
  52889. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  52890. } else if (isDef(ch)) {
  52891. {
  52892. checkDuplicateKeys(ch);
  52893. }
  52894. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  52895. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  52896. } else if (isDef(oldCh)) {
  52897. removeVnodes(oldCh, 0, oldCh.length - 1);
  52898. } else if (isDef(oldVnode.text)) {
  52899. nodeOps.setTextContent(elm, '');
  52900. }
  52901. } else if (oldVnode.text !== vnode.text) {
  52902. nodeOps.setTextContent(elm, vnode.text);
  52903. }
  52904. if (isDef(data)) {
  52905. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  52906. }
  52907. }
  52908. function invokeInsertHook (vnode, queue, initial) {
  52909. // delay insert hooks for component root nodes, invoke them after the
  52910. // element is really inserted
  52911. if (isTrue(initial) && isDef(vnode.parent)) {
  52912. vnode.parent.data.pendingInsert = queue;
  52913. } else {
  52914. for (var i = 0; i < queue.length; ++i) {
  52915. queue[i].data.hook.insert(queue[i]);
  52916. }
  52917. }
  52918. }
  52919. var hydrationBailed = false;
  52920. // list of modules that can skip create hook during hydration because they
  52921. // are already rendered on the client or has no need for initialization
  52922. // Note: style is excluded because it relies on initial clone for future
  52923. // deep updates (#7063).
  52924. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  52925. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  52926. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  52927. var i;
  52928. var tag = vnode.tag;
  52929. var data = vnode.data;
  52930. var children = vnode.children;
  52931. inVPre = inVPre || (data && data.pre);
  52932. vnode.elm = elm;
  52933. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  52934. vnode.isAsyncPlaceholder = true;
  52935. return true
  52936. }
  52937. // assert node match
  52938. {
  52939. if (!assertNodeMatch(elm, vnode, inVPre)) {
  52940. return false
  52941. }
  52942. }
  52943. if (isDef(data)) {
  52944. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  52945. if (isDef(i = vnode.componentInstance)) {
  52946. // child component. it should have hydrated its own tree.
  52947. initComponent(vnode, insertedVnodeQueue);
  52948. return true
  52949. }
  52950. }
  52951. if (isDef(tag)) {
  52952. if (isDef(children)) {
  52953. // empty element, allow client to pick up and populate children
  52954. if (!elm.hasChildNodes()) {
  52955. createChildren(vnode, children, insertedVnodeQueue);
  52956. } else {
  52957. // v-html and domProps: innerHTML
  52958. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  52959. if (i !== elm.innerHTML) {
  52960. /* istanbul ignore if */
  52961. if (typeof console !== 'undefined' &&
  52962. !hydrationBailed
  52963. ) {
  52964. hydrationBailed = true;
  52965. console.warn('Parent: ', elm);
  52966. console.warn('server innerHTML: ', i);
  52967. console.warn('client innerHTML: ', elm.innerHTML);
  52968. }
  52969. return false
  52970. }
  52971. } else {
  52972. // iterate and compare children lists
  52973. var childrenMatch = true;
  52974. var childNode = elm.firstChild;
  52975. for (var i$1 = 0; i$1 < children.length; i$1++) {
  52976. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  52977. childrenMatch = false;
  52978. break
  52979. }
  52980. childNode = childNode.nextSibling;
  52981. }
  52982. // if childNode is not null, it means the actual childNodes list is
  52983. // longer than the virtual children list.
  52984. if (!childrenMatch || childNode) {
  52985. /* istanbul ignore if */
  52986. if (typeof console !== 'undefined' &&
  52987. !hydrationBailed
  52988. ) {
  52989. hydrationBailed = true;
  52990. console.warn('Parent: ', elm);
  52991. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  52992. }
  52993. return false
  52994. }
  52995. }
  52996. }
  52997. }
  52998. if (isDef(data)) {
  52999. var fullInvoke = false;
  53000. for (var key in data) {
  53001. if (!isRenderedModule(key)) {
  53002. fullInvoke = true;
  53003. invokeCreateHooks(vnode, insertedVnodeQueue);
  53004. break
  53005. }
  53006. }
  53007. if (!fullInvoke && data['class']) {
  53008. // ensure collecting deps for deep class bindings for future updates
  53009. traverse(data['class']);
  53010. }
  53011. }
  53012. } else if (elm.data !== vnode.text) {
  53013. elm.data = vnode.text;
  53014. }
  53015. return true
  53016. }
  53017. function assertNodeMatch (node, vnode, inVPre) {
  53018. if (isDef(vnode.tag)) {
  53019. return vnode.tag.indexOf('vue-component') === 0 || (
  53020. !isUnknownElement$$1(vnode, inVPre) &&
  53021. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  53022. )
  53023. } else {
  53024. return node.nodeType === (vnode.isComment ? 8 : 3)
  53025. }
  53026. }
  53027. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  53028. if (isUndef(vnode)) {
  53029. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  53030. return
  53031. }
  53032. var isInitialPatch = false;
  53033. var insertedVnodeQueue = [];
  53034. if (isUndef(oldVnode)) {
  53035. // empty mount (likely as component), create new root element
  53036. isInitialPatch = true;
  53037. createElm(vnode, insertedVnodeQueue);
  53038. } else {
  53039. var isRealElement = isDef(oldVnode.nodeType);
  53040. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  53041. // patch existing root node
  53042. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  53043. } else {
  53044. if (isRealElement) {
  53045. // mounting to a real element
  53046. // check if this is server-rendered content and if we can perform
  53047. // a successful hydration.
  53048. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  53049. oldVnode.removeAttribute(SSR_ATTR);
  53050. hydrating = true;
  53051. }
  53052. if (isTrue(hydrating)) {
  53053. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  53054. invokeInsertHook(vnode, insertedVnodeQueue, true);
  53055. return oldVnode
  53056. } else {
  53057. warn(
  53058. 'The client-side rendered virtual DOM tree is not matching ' +
  53059. 'server-rendered content. This is likely caused by incorrect ' +
  53060. 'HTML markup, for example nesting block-level elements inside ' +
  53061. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  53062. 'full client-side render.'
  53063. );
  53064. }
  53065. }
  53066. // either not server-rendered, or hydration failed.
  53067. // create an empty node and replace it
  53068. oldVnode = emptyNodeAt(oldVnode);
  53069. }
  53070. // replacing existing element
  53071. var oldElm = oldVnode.elm;
  53072. var parentElm = nodeOps.parentNode(oldElm);
  53073. // create new node
  53074. createElm(
  53075. vnode,
  53076. insertedVnodeQueue,
  53077. // extremely rare edge case: do not insert if old element is in a
  53078. // leaving transition. Only happens when combining transition +
  53079. // keep-alive + HOCs. (#4590)
  53080. oldElm._leaveCb ? null : parentElm,
  53081. nodeOps.nextSibling(oldElm)
  53082. );
  53083. // update parent placeholder node element, recursively
  53084. if (isDef(vnode.parent)) {
  53085. var ancestor = vnode.parent;
  53086. var patchable = isPatchable(vnode);
  53087. while (ancestor) {
  53088. for (var i = 0; i < cbs.destroy.length; ++i) {
  53089. cbs.destroy[i](ancestor);
  53090. }
  53091. ancestor.elm = vnode.elm;
  53092. if (patchable) {
  53093. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  53094. cbs.create[i$1](emptyNode, ancestor);
  53095. }
  53096. // #6513
  53097. // invoke insert hooks that may have been merged by create hooks.
  53098. // e.g. for directives that uses the "inserted" hook.
  53099. var insert = ancestor.data.hook.insert;
  53100. if (insert.merged) {
  53101. // start at index 1 to avoid re-invoking component mounted hook
  53102. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  53103. insert.fns[i$2]();
  53104. }
  53105. }
  53106. } else {
  53107. registerRef(ancestor);
  53108. }
  53109. ancestor = ancestor.parent;
  53110. }
  53111. }
  53112. // destroy old node
  53113. if (isDef(parentElm)) {
  53114. removeVnodes([oldVnode], 0, 0);
  53115. } else if (isDef(oldVnode.tag)) {
  53116. invokeDestroyHook(oldVnode);
  53117. }
  53118. }
  53119. }
  53120. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  53121. return vnode.elm
  53122. }
  53123. }
  53124. /* */
  53125. var directives = {
  53126. create: updateDirectives,
  53127. update: updateDirectives,
  53128. destroy: function unbindDirectives (vnode) {
  53129. updateDirectives(vnode, emptyNode);
  53130. }
  53131. };
  53132. function updateDirectives (oldVnode, vnode) {
  53133. if (oldVnode.data.directives || vnode.data.directives) {
  53134. _update(oldVnode, vnode);
  53135. }
  53136. }
  53137. function _update (oldVnode, vnode) {
  53138. var isCreate = oldVnode === emptyNode;
  53139. var isDestroy = vnode === emptyNode;
  53140. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  53141. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  53142. var dirsWithInsert = [];
  53143. var dirsWithPostpatch = [];
  53144. var key, oldDir, dir;
  53145. for (key in newDirs) {
  53146. oldDir = oldDirs[key];
  53147. dir = newDirs[key];
  53148. if (!oldDir) {
  53149. // new directive, bind
  53150. callHook$1(dir, 'bind', vnode, oldVnode);
  53151. if (dir.def && dir.def.inserted) {
  53152. dirsWithInsert.push(dir);
  53153. }
  53154. } else {
  53155. // existing directive, update
  53156. dir.oldValue = oldDir.value;
  53157. dir.oldArg = oldDir.arg;
  53158. callHook$1(dir, 'update', vnode, oldVnode);
  53159. if (dir.def && dir.def.componentUpdated) {
  53160. dirsWithPostpatch.push(dir);
  53161. }
  53162. }
  53163. }
  53164. if (dirsWithInsert.length) {
  53165. var callInsert = function () {
  53166. for (var i = 0; i < dirsWithInsert.length; i++) {
  53167. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  53168. }
  53169. };
  53170. if (isCreate) {
  53171. mergeVNodeHook(vnode, 'insert', callInsert);
  53172. } else {
  53173. callInsert();
  53174. }
  53175. }
  53176. if (dirsWithPostpatch.length) {
  53177. mergeVNodeHook(vnode, 'postpatch', function () {
  53178. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  53179. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  53180. }
  53181. });
  53182. }
  53183. if (!isCreate) {
  53184. for (key in oldDirs) {
  53185. if (!newDirs[key]) {
  53186. // no longer present, unbind
  53187. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  53188. }
  53189. }
  53190. }
  53191. }
  53192. var emptyModifiers = Object.create(null);
  53193. function normalizeDirectives$1 (
  53194. dirs,
  53195. vm
  53196. ) {
  53197. var res = Object.create(null);
  53198. if (!dirs) {
  53199. // $flow-disable-line
  53200. return res
  53201. }
  53202. var i, dir;
  53203. for (i = 0; i < dirs.length; i++) {
  53204. dir = dirs[i];
  53205. if (!dir.modifiers) {
  53206. // $flow-disable-line
  53207. dir.modifiers = emptyModifiers;
  53208. }
  53209. res[getRawDirName(dir)] = dir;
  53210. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  53211. }
  53212. // $flow-disable-line
  53213. return res
  53214. }
  53215. function getRawDirName (dir) {
  53216. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  53217. }
  53218. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  53219. var fn = dir.def && dir.def[hook];
  53220. if (fn) {
  53221. try {
  53222. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  53223. } catch (e) {
  53224. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  53225. }
  53226. }
  53227. }
  53228. var baseModules = [
  53229. ref,
  53230. directives
  53231. ];
  53232. /* */
  53233. function updateAttrs (oldVnode, vnode) {
  53234. var opts = vnode.componentOptions;
  53235. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  53236. return
  53237. }
  53238. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  53239. return
  53240. }
  53241. var key, cur, old;
  53242. var elm = vnode.elm;
  53243. var oldAttrs = oldVnode.data.attrs || {};
  53244. var attrs = vnode.data.attrs || {};
  53245. // clone observed objects, as the user probably wants to mutate it
  53246. if (isDef(attrs.__ob__)) {
  53247. attrs = vnode.data.attrs = extend({}, attrs);
  53248. }
  53249. for (key in attrs) {
  53250. cur = attrs[key];
  53251. old = oldAttrs[key];
  53252. if (old !== cur) {
  53253. setAttr(elm, key, cur);
  53254. }
  53255. }
  53256. // #4391: in IE9, setting type can reset value for input[type=radio]
  53257. // #6666: IE/Edge forces progress value down to 1 before setting a max
  53258. /* istanbul ignore if */
  53259. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  53260. setAttr(elm, 'value', attrs.value);
  53261. }
  53262. for (key in oldAttrs) {
  53263. if (isUndef(attrs[key])) {
  53264. if (isXlink(key)) {
  53265. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  53266. } else if (!isEnumeratedAttr(key)) {
  53267. elm.removeAttribute(key);
  53268. }
  53269. }
  53270. }
  53271. }
  53272. function setAttr (el, key, value) {
  53273. if (el.tagName.indexOf('-') > -1) {
  53274. baseSetAttr(el, key, value);
  53275. } else if (isBooleanAttr(key)) {
  53276. // set attribute for blank value
  53277. // e.g. <option disabled>Select one</option>
  53278. if (isFalsyAttrValue(value)) {
  53279. el.removeAttribute(key);
  53280. } else {
  53281. // technically allowfullscreen is a boolean attribute for <iframe>,
  53282. // but Flash expects a value of "true" when used on <embed> tag
  53283. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  53284. ? 'true'
  53285. : key;
  53286. el.setAttribute(key, value);
  53287. }
  53288. } else if (isEnumeratedAttr(key)) {
  53289. el.setAttribute(key, convertEnumeratedValue(key, value));
  53290. } else if (isXlink(key)) {
  53291. if (isFalsyAttrValue(value)) {
  53292. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  53293. } else {
  53294. el.setAttributeNS(xlinkNS, key, value);
  53295. }
  53296. } else {
  53297. baseSetAttr(el, key, value);
  53298. }
  53299. }
  53300. function baseSetAttr (el, key, value) {
  53301. if (isFalsyAttrValue(value)) {
  53302. el.removeAttribute(key);
  53303. } else {
  53304. // #7138: IE10 & 11 fires input event when setting placeholder on
  53305. // <textarea>... block the first input event and remove the blocker
  53306. // immediately.
  53307. /* istanbul ignore if */
  53308. if (
  53309. isIE && !isIE9 &&
  53310. el.tagName === 'TEXTAREA' &&
  53311. key === 'placeholder' && value !== '' && !el.__ieph
  53312. ) {
  53313. var blocker = function (e) {
  53314. e.stopImmediatePropagation();
  53315. el.removeEventListener('input', blocker);
  53316. };
  53317. el.addEventListener('input', blocker);
  53318. // $flow-disable-line
  53319. el.__ieph = true; /* IE placeholder patched */
  53320. }
  53321. el.setAttribute(key, value);
  53322. }
  53323. }
  53324. var attrs = {
  53325. create: updateAttrs,
  53326. update: updateAttrs
  53327. };
  53328. /* */
  53329. function updateClass (oldVnode, vnode) {
  53330. var el = vnode.elm;
  53331. var data = vnode.data;
  53332. var oldData = oldVnode.data;
  53333. if (
  53334. isUndef(data.staticClass) &&
  53335. isUndef(data.class) && (
  53336. isUndef(oldData) || (
  53337. isUndef(oldData.staticClass) &&
  53338. isUndef(oldData.class)
  53339. )
  53340. )
  53341. ) {
  53342. return
  53343. }
  53344. var cls = genClassForVnode(vnode);
  53345. // handle transition classes
  53346. var transitionClass = el._transitionClasses;
  53347. if (isDef(transitionClass)) {
  53348. cls = concat(cls, stringifyClass(transitionClass));
  53349. }
  53350. // set the class
  53351. if (cls !== el._prevClass) {
  53352. el.setAttribute('class', cls);
  53353. el._prevClass = cls;
  53354. }
  53355. }
  53356. var klass = {
  53357. create: updateClass,
  53358. update: updateClass
  53359. };
  53360. /* */
  53361. var validDivisionCharRE = /[\w).+\-_$\]]/;
  53362. function parseFilters (exp) {
  53363. var inSingle = false;
  53364. var inDouble = false;
  53365. var inTemplateString = false;
  53366. var inRegex = false;
  53367. var curly = 0;
  53368. var square = 0;
  53369. var paren = 0;
  53370. var lastFilterIndex = 0;
  53371. var c, prev, i, expression, filters;
  53372. for (i = 0; i < exp.length; i++) {
  53373. prev = c;
  53374. c = exp.charCodeAt(i);
  53375. if (inSingle) {
  53376. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  53377. } else if (inDouble) {
  53378. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  53379. } else if (inTemplateString) {
  53380. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  53381. } else if (inRegex) {
  53382. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  53383. } else if (
  53384. c === 0x7C && // pipe
  53385. exp.charCodeAt(i + 1) !== 0x7C &&
  53386. exp.charCodeAt(i - 1) !== 0x7C &&
  53387. !curly && !square && !paren
  53388. ) {
  53389. if (expression === undefined) {
  53390. // first filter, end of expression
  53391. lastFilterIndex = i + 1;
  53392. expression = exp.slice(0, i).trim();
  53393. } else {
  53394. pushFilter();
  53395. }
  53396. } else {
  53397. switch (c) {
  53398. case 0x22: inDouble = true; break // "
  53399. case 0x27: inSingle = true; break // '
  53400. case 0x60: inTemplateString = true; break // `
  53401. case 0x28: paren++; break // (
  53402. case 0x29: paren--; break // )
  53403. case 0x5B: square++; break // [
  53404. case 0x5D: square--; break // ]
  53405. case 0x7B: curly++; break // {
  53406. case 0x7D: curly--; break // }
  53407. }
  53408. if (c === 0x2f) { // /
  53409. var j = i - 1;
  53410. var p = (void 0);
  53411. // find first non-whitespace prev char
  53412. for (; j >= 0; j--) {
  53413. p = exp.charAt(j);
  53414. if (p !== ' ') { break }
  53415. }
  53416. if (!p || !validDivisionCharRE.test(p)) {
  53417. inRegex = true;
  53418. }
  53419. }
  53420. }
  53421. }
  53422. if (expression === undefined) {
  53423. expression = exp.slice(0, i).trim();
  53424. } else if (lastFilterIndex !== 0) {
  53425. pushFilter();
  53426. }
  53427. function pushFilter () {
  53428. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  53429. lastFilterIndex = i + 1;
  53430. }
  53431. if (filters) {
  53432. for (i = 0; i < filters.length; i++) {
  53433. expression = wrapFilter(expression, filters[i]);
  53434. }
  53435. }
  53436. return expression
  53437. }
  53438. function wrapFilter (exp, filter) {
  53439. var i = filter.indexOf('(');
  53440. if (i < 0) {
  53441. // _f: resolveFilter
  53442. return ("_f(\"" + filter + "\")(" + exp + ")")
  53443. } else {
  53444. var name = filter.slice(0, i);
  53445. var args = filter.slice(i + 1);
  53446. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  53447. }
  53448. }
  53449. /* */
  53450. /* eslint-disable no-unused-vars */
  53451. function baseWarn (msg, range) {
  53452. console.error(("[Vue compiler]: " + msg));
  53453. }
  53454. /* eslint-enable no-unused-vars */
  53455. function pluckModuleFunction (
  53456. modules,
  53457. key
  53458. ) {
  53459. return modules
  53460. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  53461. : []
  53462. }
  53463. function addProp (el, name, value, range, dynamic) {
  53464. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  53465. el.plain = false;
  53466. }
  53467. function addAttr (el, name, value, range, dynamic) {
  53468. var attrs = dynamic
  53469. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  53470. : (el.attrs || (el.attrs = []));
  53471. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  53472. el.plain = false;
  53473. }
  53474. // add a raw attr (use this in preTransforms)
  53475. function addRawAttr (el, name, value, range) {
  53476. el.attrsMap[name] = value;
  53477. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  53478. }
  53479. function addDirective (
  53480. el,
  53481. name,
  53482. rawName,
  53483. value,
  53484. arg,
  53485. isDynamicArg,
  53486. modifiers,
  53487. range
  53488. ) {
  53489. (el.directives || (el.directives = [])).push(rangeSetItem({
  53490. name: name,
  53491. rawName: rawName,
  53492. value: value,
  53493. arg: arg,
  53494. isDynamicArg: isDynamicArg,
  53495. modifiers: modifiers
  53496. }, range));
  53497. el.plain = false;
  53498. }
  53499. function prependModifierMarker (symbol, name, dynamic) {
  53500. return dynamic
  53501. ? ("_p(" + name + ",\"" + symbol + "\")")
  53502. : symbol + name // mark the event as captured
  53503. }
  53504. function addHandler (
  53505. el,
  53506. name,
  53507. value,
  53508. modifiers,
  53509. important,
  53510. warn,
  53511. range,
  53512. dynamic
  53513. ) {
  53514. modifiers = modifiers || emptyObject;
  53515. // warn prevent and passive modifier
  53516. /* istanbul ignore if */
  53517. if (
  53518. warn &&
  53519. modifiers.prevent && modifiers.passive
  53520. ) {
  53521. warn(
  53522. 'passive and prevent can\'t be used together. ' +
  53523. 'Passive handler can\'t prevent default event.',
  53524. range
  53525. );
  53526. }
  53527. // normalize click.right and click.middle since they don't actually fire
  53528. // this is technically browser-specific, but at least for now browsers are
  53529. // the only target envs that have right/middle clicks.
  53530. if (modifiers.right) {
  53531. if (dynamic) {
  53532. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  53533. } else if (name === 'click') {
  53534. name = 'contextmenu';
  53535. delete modifiers.right;
  53536. }
  53537. } else if (modifiers.middle) {
  53538. if (dynamic) {
  53539. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  53540. } else if (name === 'click') {
  53541. name = 'mouseup';
  53542. }
  53543. }
  53544. // check capture modifier
  53545. if (modifiers.capture) {
  53546. delete modifiers.capture;
  53547. name = prependModifierMarker('!', name, dynamic);
  53548. }
  53549. if (modifiers.once) {
  53550. delete modifiers.once;
  53551. name = prependModifierMarker('~', name, dynamic);
  53552. }
  53553. /* istanbul ignore if */
  53554. if (modifiers.passive) {
  53555. delete modifiers.passive;
  53556. name = prependModifierMarker('&', name, dynamic);
  53557. }
  53558. var events;
  53559. if (modifiers.native) {
  53560. delete modifiers.native;
  53561. events = el.nativeEvents || (el.nativeEvents = {});
  53562. } else {
  53563. events = el.events || (el.events = {});
  53564. }
  53565. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  53566. if (modifiers !== emptyObject) {
  53567. newHandler.modifiers = modifiers;
  53568. }
  53569. var handlers = events[name];
  53570. /* istanbul ignore if */
  53571. if (Array.isArray(handlers)) {
  53572. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  53573. } else if (handlers) {
  53574. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  53575. } else {
  53576. events[name] = newHandler;
  53577. }
  53578. el.plain = false;
  53579. }
  53580. function getRawBindingAttr (
  53581. el,
  53582. name
  53583. ) {
  53584. return el.rawAttrsMap[':' + name] ||
  53585. el.rawAttrsMap['v-bind:' + name] ||
  53586. el.rawAttrsMap[name]
  53587. }
  53588. function getBindingAttr (
  53589. el,
  53590. name,
  53591. getStatic
  53592. ) {
  53593. var dynamicValue =
  53594. getAndRemoveAttr(el, ':' + name) ||
  53595. getAndRemoveAttr(el, 'v-bind:' + name);
  53596. if (dynamicValue != null) {
  53597. return parseFilters(dynamicValue)
  53598. } else if (getStatic !== false) {
  53599. var staticValue = getAndRemoveAttr(el, name);
  53600. if (staticValue != null) {
  53601. return JSON.stringify(staticValue)
  53602. }
  53603. }
  53604. }
  53605. // note: this only removes the attr from the Array (attrsList) so that it
  53606. // doesn't get processed by processAttrs.
  53607. // By default it does NOT remove it from the map (attrsMap) because the map is
  53608. // needed during codegen.
  53609. function getAndRemoveAttr (
  53610. el,
  53611. name,
  53612. removeFromMap
  53613. ) {
  53614. var val;
  53615. if ((val = el.attrsMap[name]) != null) {
  53616. var list = el.attrsList;
  53617. for (var i = 0, l = list.length; i < l; i++) {
  53618. if (list[i].name === name) {
  53619. list.splice(i, 1);
  53620. break
  53621. }
  53622. }
  53623. }
  53624. if (removeFromMap) {
  53625. delete el.attrsMap[name];
  53626. }
  53627. return val
  53628. }
  53629. function getAndRemoveAttrByRegex (
  53630. el,
  53631. name
  53632. ) {
  53633. var list = el.attrsList;
  53634. for (var i = 0, l = list.length; i < l; i++) {
  53635. var attr = list[i];
  53636. if (name.test(attr.name)) {
  53637. list.splice(i, 1);
  53638. return attr
  53639. }
  53640. }
  53641. }
  53642. function rangeSetItem (
  53643. item,
  53644. range
  53645. ) {
  53646. if (range) {
  53647. if (range.start != null) {
  53648. item.start = range.start;
  53649. }
  53650. if (range.end != null) {
  53651. item.end = range.end;
  53652. }
  53653. }
  53654. return item
  53655. }
  53656. /* */
  53657. /**
  53658. * Cross-platform code generation for component v-model
  53659. */
  53660. function genComponentModel (
  53661. el,
  53662. value,
  53663. modifiers
  53664. ) {
  53665. var ref = modifiers || {};
  53666. var number = ref.number;
  53667. var trim = ref.trim;
  53668. var baseValueExpression = '$$v';
  53669. var valueExpression = baseValueExpression;
  53670. if (trim) {
  53671. valueExpression =
  53672. "(typeof " + baseValueExpression + " === 'string'" +
  53673. "? " + baseValueExpression + ".trim()" +
  53674. ": " + baseValueExpression + ")";
  53675. }
  53676. if (number) {
  53677. valueExpression = "_n(" + valueExpression + ")";
  53678. }
  53679. var assignment = genAssignmentCode(value, valueExpression);
  53680. el.model = {
  53681. value: ("(" + value + ")"),
  53682. expression: JSON.stringify(value),
  53683. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  53684. };
  53685. }
  53686. /**
  53687. * Cross-platform codegen helper for generating v-model value assignment code.
  53688. */
  53689. function genAssignmentCode (
  53690. value,
  53691. assignment
  53692. ) {
  53693. var res = parseModel(value);
  53694. if (res.key === null) {
  53695. return (value + "=" + assignment)
  53696. } else {
  53697. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  53698. }
  53699. }
  53700. /**
  53701. * Parse a v-model expression into a base path and a final key segment.
  53702. * Handles both dot-path and possible square brackets.
  53703. *
  53704. * Possible cases:
  53705. *
  53706. * - test
  53707. * - test[key]
  53708. * - test[test1[key]]
  53709. * - test["a"][key]
  53710. * - xxx.test[a[a].test1[key]]
  53711. * - test.xxx.a["asa"][test1[key]]
  53712. *
  53713. */
  53714. var len, str, chr, index$1, expressionPos, expressionEndPos;
  53715. function parseModel (val) {
  53716. // Fix https://github.com/vuejs/vue/pull/7730
  53717. // allow v-model="obj.val " (trailing whitespace)
  53718. val = val.trim();
  53719. len = val.length;
  53720. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  53721. index$1 = val.lastIndexOf('.');
  53722. if (index$1 > -1) {
  53723. return {
  53724. exp: val.slice(0, index$1),
  53725. key: '"' + val.slice(index$1 + 1) + '"'
  53726. }
  53727. } else {
  53728. return {
  53729. exp: val,
  53730. key: null
  53731. }
  53732. }
  53733. }
  53734. str = val;
  53735. index$1 = expressionPos = expressionEndPos = 0;
  53736. while (!eof()) {
  53737. chr = next();
  53738. /* istanbul ignore if */
  53739. if (isStringStart(chr)) {
  53740. parseString(chr);
  53741. } else if (chr === 0x5B) {
  53742. parseBracket(chr);
  53743. }
  53744. }
  53745. return {
  53746. exp: val.slice(0, expressionPos),
  53747. key: val.slice(expressionPos + 1, expressionEndPos)
  53748. }
  53749. }
  53750. function next () {
  53751. return str.charCodeAt(++index$1)
  53752. }
  53753. function eof () {
  53754. return index$1 >= len
  53755. }
  53756. function isStringStart (chr) {
  53757. return chr === 0x22 || chr === 0x27
  53758. }
  53759. function parseBracket (chr) {
  53760. var inBracket = 1;
  53761. expressionPos = index$1;
  53762. while (!eof()) {
  53763. chr = next();
  53764. if (isStringStart(chr)) {
  53765. parseString(chr);
  53766. continue
  53767. }
  53768. if (chr === 0x5B) { inBracket++; }
  53769. if (chr === 0x5D) { inBracket--; }
  53770. if (inBracket === 0) {
  53771. expressionEndPos = index$1;
  53772. break
  53773. }
  53774. }
  53775. }
  53776. function parseString (chr) {
  53777. var stringQuote = chr;
  53778. while (!eof()) {
  53779. chr = next();
  53780. if (chr === stringQuote) {
  53781. break
  53782. }
  53783. }
  53784. }
  53785. /* */
  53786. var warn$1;
  53787. // in some cases, the event used has to be determined at runtime
  53788. // so we used some reserved tokens during compile.
  53789. var RANGE_TOKEN = '__r';
  53790. var CHECKBOX_RADIO_TOKEN = '__c';
  53791. function model (
  53792. el,
  53793. dir,
  53794. _warn
  53795. ) {
  53796. warn$1 = _warn;
  53797. var value = dir.value;
  53798. var modifiers = dir.modifiers;
  53799. var tag = el.tag;
  53800. var type = el.attrsMap.type;
  53801. {
  53802. // inputs with type="file" are read only and setting the input's
  53803. // value will throw an error.
  53804. if (tag === 'input' && type === 'file') {
  53805. warn$1(
  53806. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  53807. "File inputs are read only. Use a v-on:change listener instead.",
  53808. el.rawAttrsMap['v-model']
  53809. );
  53810. }
  53811. }
  53812. if (el.component) {
  53813. genComponentModel(el, value, modifiers);
  53814. // component v-model doesn't need extra runtime
  53815. return false
  53816. } else if (tag === 'select') {
  53817. genSelect(el, value, modifiers);
  53818. } else if (tag === 'input' && type === 'checkbox') {
  53819. genCheckboxModel(el, value, modifiers);
  53820. } else if (tag === 'input' && type === 'radio') {
  53821. genRadioModel(el, value, modifiers);
  53822. } else if (tag === 'input' || tag === 'textarea') {
  53823. genDefaultModel(el, value, modifiers);
  53824. } else if (!config.isReservedTag(tag)) {
  53825. genComponentModel(el, value, modifiers);
  53826. // component v-model doesn't need extra runtime
  53827. return false
  53828. } else {
  53829. warn$1(
  53830. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53831. "v-model is not supported on this element type. " +
  53832. 'If you are working with contenteditable, it\'s recommended to ' +
  53833. 'wrap a library dedicated for that purpose inside a custom component.',
  53834. el.rawAttrsMap['v-model']
  53835. );
  53836. }
  53837. // ensure runtime directive metadata
  53838. return true
  53839. }
  53840. function genCheckboxModel (
  53841. el,
  53842. value,
  53843. modifiers
  53844. ) {
  53845. var number = modifiers && modifiers.number;
  53846. var valueBinding = getBindingAttr(el, 'value') || 'null';
  53847. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  53848. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  53849. addProp(el, 'checked',
  53850. "Array.isArray(" + value + ")" +
  53851. "?_i(" + value + "," + valueBinding + ")>-1" + (
  53852. trueValueBinding === 'true'
  53853. ? (":(" + value + ")")
  53854. : (":_q(" + value + "," + trueValueBinding + ")")
  53855. )
  53856. );
  53857. addHandler(el, 'change',
  53858. "var $$a=" + value + "," +
  53859. '$$el=$event.target,' +
  53860. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  53861. 'if(Array.isArray($$a)){' +
  53862. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  53863. '$$i=_i($$a,$$v);' +
  53864. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  53865. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  53866. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  53867. null, true
  53868. );
  53869. }
  53870. function genRadioModel (
  53871. el,
  53872. value,
  53873. modifiers
  53874. ) {
  53875. var number = modifiers && modifiers.number;
  53876. var valueBinding = getBindingAttr(el, 'value') || 'null';
  53877. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  53878. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  53879. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  53880. }
  53881. function genSelect (
  53882. el,
  53883. value,
  53884. modifiers
  53885. ) {
  53886. var number = modifiers && modifiers.number;
  53887. var selectedVal = "Array.prototype.filter" +
  53888. ".call($event.target.options,function(o){return o.selected})" +
  53889. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  53890. "return " + (number ? '_n(val)' : 'val') + "})";
  53891. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  53892. var code = "var $$selectedVal = " + selectedVal + ";";
  53893. code = code + " " + (genAssignmentCode(value, assignment));
  53894. addHandler(el, 'change', code, null, true);
  53895. }
  53896. function genDefaultModel (
  53897. el,
  53898. value,
  53899. modifiers
  53900. ) {
  53901. var type = el.attrsMap.type;
  53902. // warn if v-bind:value conflicts with v-model
  53903. // except for inputs with v-bind:type
  53904. {
  53905. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  53906. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  53907. if (value$1 && !typeBinding) {
  53908. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  53909. warn$1(
  53910. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  53911. 'because the latter already expands to a value binding internally',
  53912. el.rawAttrsMap[binding]
  53913. );
  53914. }
  53915. }
  53916. var ref = modifiers || {};
  53917. var lazy = ref.lazy;
  53918. var number = ref.number;
  53919. var trim = ref.trim;
  53920. var needCompositionGuard = !lazy && type !== 'range';
  53921. var event = lazy
  53922. ? 'change'
  53923. : type === 'range'
  53924. ? RANGE_TOKEN
  53925. : 'input';
  53926. var valueExpression = '$event.target.value';
  53927. if (trim) {
  53928. valueExpression = "$event.target.value.trim()";
  53929. }
  53930. if (number) {
  53931. valueExpression = "_n(" + valueExpression + ")";
  53932. }
  53933. var code = genAssignmentCode(value, valueExpression);
  53934. if (needCompositionGuard) {
  53935. code = "if($event.target.composing)return;" + code;
  53936. }
  53937. addProp(el, 'value', ("(" + value + ")"));
  53938. addHandler(el, event, code, null, true);
  53939. if (trim || number) {
  53940. addHandler(el, 'blur', '$forceUpdate()');
  53941. }
  53942. }
  53943. /* */
  53944. // normalize v-model event tokens that can only be determined at runtime.
  53945. // it's important to place the event as the first in the array because
  53946. // the whole point is ensuring the v-model callback gets called before
  53947. // user-attached handlers.
  53948. function normalizeEvents (on) {
  53949. /* istanbul ignore if */
  53950. if (isDef(on[RANGE_TOKEN])) {
  53951. // IE input[type=range] only supports `change` event
  53952. var event = isIE ? 'change' : 'input';
  53953. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  53954. delete on[RANGE_TOKEN];
  53955. }
  53956. // This was originally intended to fix #4521 but no longer necessary
  53957. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  53958. /* istanbul ignore if */
  53959. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  53960. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  53961. delete on[CHECKBOX_RADIO_TOKEN];
  53962. }
  53963. }
  53964. var target$1;
  53965. function createOnceHandler$1 (event, handler, capture) {
  53966. var _target = target$1; // save current target element in closure
  53967. return function onceHandler () {
  53968. var res = handler.apply(null, arguments);
  53969. if (res !== null) {
  53970. remove$2(event, onceHandler, capture, _target);
  53971. }
  53972. }
  53973. }
  53974. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  53975. // implementation and does not fire microtasks in between event propagation, so
  53976. // safe to exclude.
  53977. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  53978. function add$1 (
  53979. name,
  53980. handler,
  53981. capture,
  53982. passive
  53983. ) {
  53984. // async edge case #6566: inner click event triggers patch, event handler
  53985. // attached to outer element during patch, and triggered again. This
  53986. // happens because browsers fire microtask ticks between event propagation.
  53987. // the solution is simple: we save the timestamp when a handler is attached,
  53988. // and the handler would only fire if the event passed to it was fired
  53989. // AFTER it was attached.
  53990. if (useMicrotaskFix) {
  53991. var attachedTimestamp = currentFlushTimestamp;
  53992. var original = handler;
  53993. handler = original._wrapper = function (e) {
  53994. if (
  53995. // no bubbling, should always fire.
  53996. // this is just a safety net in case event.timeStamp is unreliable in
  53997. // certain weird environments...
  53998. e.target === e.currentTarget ||
  53999. // event is fired after handler attachment
  54000. e.timeStamp >= attachedTimestamp ||
  54001. // bail for environments that have buggy event.timeStamp implementations
  54002. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  54003. // #9681 QtWebEngine event.timeStamp is negative value
  54004. e.timeStamp <= 0 ||
  54005. // #9448 bail if event is fired in another document in a multi-page
  54006. // electron/nw.js app, since event.timeStamp will be using a different
  54007. // starting reference
  54008. e.target.ownerDocument !== document
  54009. ) {
  54010. return original.apply(this, arguments)
  54011. }
  54012. };
  54013. }
  54014. target$1.addEventListener(
  54015. name,
  54016. handler,
  54017. supportsPassive
  54018. ? { capture: capture, passive: passive }
  54019. : capture
  54020. );
  54021. }
  54022. function remove$2 (
  54023. name,
  54024. handler,
  54025. capture,
  54026. _target
  54027. ) {
  54028. (_target || target$1).removeEventListener(
  54029. name,
  54030. handler._wrapper || handler,
  54031. capture
  54032. );
  54033. }
  54034. function updateDOMListeners (oldVnode, vnode) {
  54035. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  54036. return
  54037. }
  54038. var on = vnode.data.on || {};
  54039. var oldOn = oldVnode.data.on || {};
  54040. target$1 = vnode.elm;
  54041. normalizeEvents(on);
  54042. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  54043. target$1 = undefined;
  54044. }
  54045. var events = {
  54046. create: updateDOMListeners,
  54047. update: updateDOMListeners
  54048. };
  54049. /* */
  54050. var svgContainer;
  54051. function updateDOMProps (oldVnode, vnode) {
  54052. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  54053. return
  54054. }
  54055. var key, cur;
  54056. var elm = vnode.elm;
  54057. var oldProps = oldVnode.data.domProps || {};
  54058. var props = vnode.data.domProps || {};
  54059. // clone observed objects, as the user probably wants to mutate it
  54060. if (isDef(props.__ob__)) {
  54061. props = vnode.data.domProps = extend({}, props);
  54062. }
  54063. for (key in oldProps) {
  54064. if (!(key in props)) {
  54065. elm[key] = '';
  54066. }
  54067. }
  54068. for (key in props) {
  54069. cur = props[key];
  54070. // ignore children if the node has textContent or innerHTML,
  54071. // as these will throw away existing DOM nodes and cause removal errors
  54072. // on subsequent patches (#3360)
  54073. if (key === 'textContent' || key === 'innerHTML') {
  54074. if (vnode.children) { vnode.children.length = 0; }
  54075. if (cur === oldProps[key]) { continue }
  54076. // #6601 work around Chrome version <= 55 bug where single textNode
  54077. // replaced by innerHTML/textContent retains its parentNode property
  54078. if (elm.childNodes.length === 1) {
  54079. elm.removeChild(elm.childNodes[0]);
  54080. }
  54081. }
  54082. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  54083. // store value as _value as well since
  54084. // non-string values will be stringified
  54085. elm._value = cur;
  54086. // avoid resetting cursor position when value is the same
  54087. var strCur = isUndef(cur) ? '' : String(cur);
  54088. if (shouldUpdateValue(elm, strCur)) {
  54089. elm.value = strCur;
  54090. }
  54091. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  54092. // IE doesn't support innerHTML for SVG elements
  54093. svgContainer = svgContainer || document.createElement('div');
  54094. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  54095. var svg = svgContainer.firstChild;
  54096. while (elm.firstChild) {
  54097. elm.removeChild(elm.firstChild);
  54098. }
  54099. while (svg.firstChild) {
  54100. elm.appendChild(svg.firstChild);
  54101. }
  54102. } else if (
  54103. // skip the update if old and new VDOM state is the same.
  54104. // `value` is handled separately because the DOM value may be temporarily
  54105. // out of sync with VDOM state due to focus, composition and modifiers.
  54106. // This #4521 by skipping the unnecesarry `checked` update.
  54107. cur !== oldProps[key]
  54108. ) {
  54109. // some property updates can throw
  54110. // e.g. `value` on <progress> w/ non-finite value
  54111. try {
  54112. elm[key] = cur;
  54113. } catch (e) {}
  54114. }
  54115. }
  54116. }
  54117. // check platforms/web/util/attrs.js acceptValue
  54118. function shouldUpdateValue (elm, checkVal) {
  54119. return (!elm.composing && (
  54120. elm.tagName === 'OPTION' ||
  54121. isNotInFocusAndDirty(elm, checkVal) ||
  54122. isDirtyWithModifiers(elm, checkVal)
  54123. ))
  54124. }
  54125. function isNotInFocusAndDirty (elm, checkVal) {
  54126. // return true when textbox (.number and .trim) loses focus and its value is
  54127. // not equal to the updated value
  54128. var notInFocus = true;
  54129. // #6157
  54130. // work around IE bug when accessing document.activeElement in an iframe
  54131. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  54132. return notInFocus && elm.value !== checkVal
  54133. }
  54134. function isDirtyWithModifiers (elm, newVal) {
  54135. var value = elm.value;
  54136. var modifiers = elm._vModifiers; // injected by v-model runtime
  54137. if (isDef(modifiers)) {
  54138. if (modifiers.number) {
  54139. return toNumber(value) !== toNumber(newVal)
  54140. }
  54141. if (modifiers.trim) {
  54142. return value.trim() !== newVal.trim()
  54143. }
  54144. }
  54145. return value !== newVal
  54146. }
  54147. var domProps = {
  54148. create: updateDOMProps,
  54149. update: updateDOMProps
  54150. };
  54151. /* */
  54152. var parseStyleText = cached(function (cssText) {
  54153. var res = {};
  54154. var listDelimiter = /;(?![^(]*\))/g;
  54155. var propertyDelimiter = /:(.+)/;
  54156. cssText.split(listDelimiter).forEach(function (item) {
  54157. if (item) {
  54158. var tmp = item.split(propertyDelimiter);
  54159. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  54160. }
  54161. });
  54162. return res
  54163. });
  54164. // merge static and dynamic style data on the same vnode
  54165. function normalizeStyleData (data) {
  54166. var style = normalizeStyleBinding(data.style);
  54167. // static style is pre-processed into an object during compilation
  54168. // and is always a fresh object, so it's safe to merge into it
  54169. return data.staticStyle
  54170. ? extend(data.staticStyle, style)
  54171. : style
  54172. }
  54173. // normalize possible array / string values into Object
  54174. function normalizeStyleBinding (bindingStyle) {
  54175. if (Array.isArray(bindingStyle)) {
  54176. return toObject(bindingStyle)
  54177. }
  54178. if (typeof bindingStyle === 'string') {
  54179. return parseStyleText(bindingStyle)
  54180. }
  54181. return bindingStyle
  54182. }
  54183. /**
  54184. * parent component style should be after child's
  54185. * so that parent component's style could override it
  54186. */
  54187. function getStyle (vnode, checkChild) {
  54188. var res = {};
  54189. var styleData;
  54190. if (checkChild) {
  54191. var childNode = vnode;
  54192. while (childNode.componentInstance) {
  54193. childNode = childNode.componentInstance._vnode;
  54194. if (
  54195. childNode && childNode.data &&
  54196. (styleData = normalizeStyleData(childNode.data))
  54197. ) {
  54198. extend(res, styleData);
  54199. }
  54200. }
  54201. }
  54202. if ((styleData = normalizeStyleData(vnode.data))) {
  54203. extend(res, styleData);
  54204. }
  54205. var parentNode = vnode;
  54206. while ((parentNode = parentNode.parent)) {
  54207. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  54208. extend(res, styleData);
  54209. }
  54210. }
  54211. return res
  54212. }
  54213. /* */
  54214. var cssVarRE = /^--/;
  54215. var importantRE = /\s*!important$/;
  54216. var setProp = function (el, name, val) {
  54217. /* istanbul ignore if */
  54218. if (cssVarRE.test(name)) {
  54219. el.style.setProperty(name, val);
  54220. } else if (importantRE.test(val)) {
  54221. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  54222. } else {
  54223. var normalizedName = normalize(name);
  54224. if (Array.isArray(val)) {
  54225. // Support values array created by autoprefixer, e.g.
  54226. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  54227. // Set them one by one, and the browser will only set those it can recognize
  54228. for (var i = 0, len = val.length; i < len; i++) {
  54229. el.style[normalizedName] = val[i];
  54230. }
  54231. } else {
  54232. el.style[normalizedName] = val;
  54233. }
  54234. }
  54235. };
  54236. var vendorNames = ['Webkit', 'Moz', 'ms'];
  54237. var emptyStyle;
  54238. var normalize = cached(function (prop) {
  54239. emptyStyle = emptyStyle || document.createElement('div').style;
  54240. prop = camelize(prop);
  54241. if (prop !== 'filter' && (prop in emptyStyle)) {
  54242. return prop
  54243. }
  54244. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  54245. for (var i = 0; i < vendorNames.length; i++) {
  54246. var name = vendorNames[i] + capName;
  54247. if (name in emptyStyle) {
  54248. return name
  54249. }
  54250. }
  54251. });
  54252. function updateStyle (oldVnode, vnode) {
  54253. var data = vnode.data;
  54254. var oldData = oldVnode.data;
  54255. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  54256. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  54257. ) {
  54258. return
  54259. }
  54260. var cur, name;
  54261. var el = vnode.elm;
  54262. var oldStaticStyle = oldData.staticStyle;
  54263. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  54264. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  54265. var oldStyle = oldStaticStyle || oldStyleBinding;
  54266. var style = normalizeStyleBinding(vnode.data.style) || {};
  54267. // store normalized style under a different key for next diff
  54268. // make sure to clone it if it's reactive, since the user likely wants
  54269. // to mutate it.
  54270. vnode.data.normalizedStyle = isDef(style.__ob__)
  54271. ? extend({}, style)
  54272. : style;
  54273. var newStyle = getStyle(vnode, true);
  54274. for (name in oldStyle) {
  54275. if (isUndef(newStyle[name])) {
  54276. setProp(el, name, '');
  54277. }
  54278. }
  54279. for (name in newStyle) {
  54280. cur = newStyle[name];
  54281. if (cur !== oldStyle[name]) {
  54282. // ie9 setting to null has no effect, must use empty string
  54283. setProp(el, name, cur == null ? '' : cur);
  54284. }
  54285. }
  54286. }
  54287. var style = {
  54288. create: updateStyle,
  54289. update: updateStyle
  54290. };
  54291. /* */
  54292. var whitespaceRE = /\s+/;
  54293. /**
  54294. * Add class with compatibility for SVG since classList is not supported on
  54295. * SVG elements in IE
  54296. */
  54297. function addClass (el, cls) {
  54298. /* istanbul ignore if */
  54299. if (!cls || !(cls = cls.trim())) {
  54300. return
  54301. }
  54302. /* istanbul ignore else */
  54303. if (el.classList) {
  54304. if (cls.indexOf(' ') > -1) {
  54305. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  54306. } else {
  54307. el.classList.add(cls);
  54308. }
  54309. } else {
  54310. var cur = " " + (el.getAttribute('class') || '') + " ";
  54311. if (cur.indexOf(' ' + cls + ' ') < 0) {
  54312. el.setAttribute('class', (cur + cls).trim());
  54313. }
  54314. }
  54315. }
  54316. /**
  54317. * Remove class with compatibility for SVG since classList is not supported on
  54318. * SVG elements in IE
  54319. */
  54320. function removeClass (el, cls) {
  54321. /* istanbul ignore if */
  54322. if (!cls || !(cls = cls.trim())) {
  54323. return
  54324. }
  54325. /* istanbul ignore else */
  54326. if (el.classList) {
  54327. if (cls.indexOf(' ') > -1) {
  54328. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  54329. } else {
  54330. el.classList.remove(cls);
  54331. }
  54332. if (!el.classList.length) {
  54333. el.removeAttribute('class');
  54334. }
  54335. } else {
  54336. var cur = " " + (el.getAttribute('class') || '') + " ";
  54337. var tar = ' ' + cls + ' ';
  54338. while (cur.indexOf(tar) >= 0) {
  54339. cur = cur.replace(tar, ' ');
  54340. }
  54341. cur = cur.trim();
  54342. if (cur) {
  54343. el.setAttribute('class', cur);
  54344. } else {
  54345. el.removeAttribute('class');
  54346. }
  54347. }
  54348. }
  54349. /* */
  54350. function resolveTransition (def$$1) {
  54351. if (!def$$1) {
  54352. return
  54353. }
  54354. /* istanbul ignore else */
  54355. if (typeof def$$1 === 'object') {
  54356. var res = {};
  54357. if (def$$1.css !== false) {
  54358. extend(res, autoCssTransition(def$$1.name || 'v'));
  54359. }
  54360. extend(res, def$$1);
  54361. return res
  54362. } else if (typeof def$$1 === 'string') {
  54363. return autoCssTransition(def$$1)
  54364. }
  54365. }
  54366. var autoCssTransition = cached(function (name) {
  54367. return {
  54368. enterClass: (name + "-enter"),
  54369. enterToClass: (name + "-enter-to"),
  54370. enterActiveClass: (name + "-enter-active"),
  54371. leaveClass: (name + "-leave"),
  54372. leaveToClass: (name + "-leave-to"),
  54373. leaveActiveClass: (name + "-leave-active")
  54374. }
  54375. });
  54376. var hasTransition = inBrowser && !isIE9;
  54377. var TRANSITION = 'transition';
  54378. var ANIMATION = 'animation';
  54379. // Transition property/event sniffing
  54380. var transitionProp = 'transition';
  54381. var transitionEndEvent = 'transitionend';
  54382. var animationProp = 'animation';
  54383. var animationEndEvent = 'animationend';
  54384. if (hasTransition) {
  54385. /* istanbul ignore if */
  54386. if (window.ontransitionend === undefined &&
  54387. window.onwebkittransitionend !== undefined
  54388. ) {
  54389. transitionProp = 'WebkitTransition';
  54390. transitionEndEvent = 'webkitTransitionEnd';
  54391. }
  54392. if (window.onanimationend === undefined &&
  54393. window.onwebkitanimationend !== undefined
  54394. ) {
  54395. animationProp = 'WebkitAnimation';
  54396. animationEndEvent = 'webkitAnimationEnd';
  54397. }
  54398. }
  54399. // binding to window is necessary to make hot reload work in IE in strict mode
  54400. var raf = inBrowser
  54401. ? window.requestAnimationFrame
  54402. ? window.requestAnimationFrame.bind(window)
  54403. : setTimeout
  54404. : /* istanbul ignore next */ function (fn) { return fn(); };
  54405. function nextFrame (fn) {
  54406. raf(function () {
  54407. raf(fn);
  54408. });
  54409. }
  54410. function addTransitionClass (el, cls) {
  54411. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  54412. if (transitionClasses.indexOf(cls) < 0) {
  54413. transitionClasses.push(cls);
  54414. addClass(el, cls);
  54415. }
  54416. }
  54417. function removeTransitionClass (el, cls) {
  54418. if (el._transitionClasses) {
  54419. remove(el._transitionClasses, cls);
  54420. }
  54421. removeClass(el, cls);
  54422. }
  54423. function whenTransitionEnds (
  54424. el,
  54425. expectedType,
  54426. cb
  54427. ) {
  54428. var ref = getTransitionInfo(el, expectedType);
  54429. var type = ref.type;
  54430. var timeout = ref.timeout;
  54431. var propCount = ref.propCount;
  54432. if (!type) { return cb() }
  54433. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  54434. var ended = 0;
  54435. var end = function () {
  54436. el.removeEventListener(event, onEnd);
  54437. cb();
  54438. };
  54439. var onEnd = function (e) {
  54440. if (e.target === el) {
  54441. if (++ended >= propCount) {
  54442. end();
  54443. }
  54444. }
  54445. };
  54446. setTimeout(function () {
  54447. if (ended < propCount) {
  54448. end();
  54449. }
  54450. }, timeout + 1);
  54451. el.addEventListener(event, onEnd);
  54452. }
  54453. var transformRE = /\b(transform|all)(,|$)/;
  54454. function getTransitionInfo (el, expectedType) {
  54455. var styles = window.getComputedStyle(el);
  54456. // JSDOM may return undefined for transition properties
  54457. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  54458. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  54459. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  54460. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  54461. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  54462. var animationTimeout = getTimeout(animationDelays, animationDurations);
  54463. var type;
  54464. var timeout = 0;
  54465. var propCount = 0;
  54466. /* istanbul ignore if */
  54467. if (expectedType === TRANSITION) {
  54468. if (transitionTimeout > 0) {
  54469. type = TRANSITION;
  54470. timeout = transitionTimeout;
  54471. propCount = transitionDurations.length;
  54472. }
  54473. } else if (expectedType === ANIMATION) {
  54474. if (animationTimeout > 0) {
  54475. type = ANIMATION;
  54476. timeout = animationTimeout;
  54477. propCount = animationDurations.length;
  54478. }
  54479. } else {
  54480. timeout = Math.max(transitionTimeout, animationTimeout);
  54481. type = timeout > 0
  54482. ? transitionTimeout > animationTimeout
  54483. ? TRANSITION
  54484. : ANIMATION
  54485. : null;
  54486. propCount = type
  54487. ? type === TRANSITION
  54488. ? transitionDurations.length
  54489. : animationDurations.length
  54490. : 0;
  54491. }
  54492. var hasTransform =
  54493. type === TRANSITION &&
  54494. transformRE.test(styles[transitionProp + 'Property']);
  54495. return {
  54496. type: type,
  54497. timeout: timeout,
  54498. propCount: propCount,
  54499. hasTransform: hasTransform
  54500. }
  54501. }
  54502. function getTimeout (delays, durations) {
  54503. /* istanbul ignore next */
  54504. while (delays.length < durations.length) {
  54505. delays = delays.concat(delays);
  54506. }
  54507. return Math.max.apply(null, durations.map(function (d, i) {
  54508. return toMs(d) + toMs(delays[i])
  54509. }))
  54510. }
  54511. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  54512. // in a locale-dependent way, using a comma instead of a dot.
  54513. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  54514. // as a floor function) causing unexpected behaviors
  54515. function toMs (s) {
  54516. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  54517. }
  54518. /* */
  54519. function enter (vnode, toggleDisplay) {
  54520. var el = vnode.elm;
  54521. // call leave callback now
  54522. if (isDef(el._leaveCb)) {
  54523. el._leaveCb.cancelled = true;
  54524. el._leaveCb();
  54525. }
  54526. var data = resolveTransition(vnode.data.transition);
  54527. if (isUndef(data)) {
  54528. return
  54529. }
  54530. /* istanbul ignore if */
  54531. if (isDef(el._enterCb) || el.nodeType !== 1) {
  54532. return
  54533. }
  54534. var css = data.css;
  54535. var type = data.type;
  54536. var enterClass = data.enterClass;
  54537. var enterToClass = data.enterToClass;
  54538. var enterActiveClass = data.enterActiveClass;
  54539. var appearClass = data.appearClass;
  54540. var appearToClass = data.appearToClass;
  54541. var appearActiveClass = data.appearActiveClass;
  54542. var beforeEnter = data.beforeEnter;
  54543. var enter = data.enter;
  54544. var afterEnter = data.afterEnter;
  54545. var enterCancelled = data.enterCancelled;
  54546. var beforeAppear = data.beforeAppear;
  54547. var appear = data.appear;
  54548. var afterAppear = data.afterAppear;
  54549. var appearCancelled = data.appearCancelled;
  54550. var duration = data.duration;
  54551. // activeInstance will always be the <transition> component managing this
  54552. // transition. One edge case to check is when the <transition> is placed
  54553. // as the root node of a child component. In that case we need to check
  54554. // <transition>'s parent for appear check.
  54555. var context = activeInstance;
  54556. var transitionNode = activeInstance.$vnode;
  54557. while (transitionNode && transitionNode.parent) {
  54558. context = transitionNode.context;
  54559. transitionNode = transitionNode.parent;
  54560. }
  54561. var isAppear = !context._isMounted || !vnode.isRootInsert;
  54562. if (isAppear && !appear && appear !== '') {
  54563. return
  54564. }
  54565. var startClass = isAppear && appearClass
  54566. ? appearClass
  54567. : enterClass;
  54568. var activeClass = isAppear && appearActiveClass
  54569. ? appearActiveClass
  54570. : enterActiveClass;
  54571. var toClass = isAppear && appearToClass
  54572. ? appearToClass
  54573. : enterToClass;
  54574. var beforeEnterHook = isAppear
  54575. ? (beforeAppear || beforeEnter)
  54576. : beforeEnter;
  54577. var enterHook = isAppear
  54578. ? (typeof appear === 'function' ? appear : enter)
  54579. : enter;
  54580. var afterEnterHook = isAppear
  54581. ? (afterAppear || afterEnter)
  54582. : afterEnter;
  54583. var enterCancelledHook = isAppear
  54584. ? (appearCancelled || enterCancelled)
  54585. : enterCancelled;
  54586. var explicitEnterDuration = toNumber(
  54587. isObject(duration)
  54588. ? duration.enter
  54589. : duration
  54590. );
  54591. if (explicitEnterDuration != null) {
  54592. checkDuration(explicitEnterDuration, 'enter', vnode);
  54593. }
  54594. var expectsCSS = css !== false && !isIE9;
  54595. var userWantsControl = getHookArgumentsLength(enterHook);
  54596. var cb = el._enterCb = once(function () {
  54597. if (expectsCSS) {
  54598. removeTransitionClass(el, toClass);
  54599. removeTransitionClass(el, activeClass);
  54600. }
  54601. if (cb.cancelled) {
  54602. if (expectsCSS) {
  54603. removeTransitionClass(el, startClass);
  54604. }
  54605. enterCancelledHook && enterCancelledHook(el);
  54606. } else {
  54607. afterEnterHook && afterEnterHook(el);
  54608. }
  54609. el._enterCb = null;
  54610. });
  54611. if (!vnode.data.show) {
  54612. // remove pending leave element on enter by injecting an insert hook
  54613. mergeVNodeHook(vnode, 'insert', function () {
  54614. var parent = el.parentNode;
  54615. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  54616. if (pendingNode &&
  54617. pendingNode.tag === vnode.tag &&
  54618. pendingNode.elm._leaveCb
  54619. ) {
  54620. pendingNode.elm._leaveCb();
  54621. }
  54622. enterHook && enterHook(el, cb);
  54623. });
  54624. }
  54625. // start enter transition
  54626. beforeEnterHook && beforeEnterHook(el);
  54627. if (expectsCSS) {
  54628. addTransitionClass(el, startClass);
  54629. addTransitionClass(el, activeClass);
  54630. nextFrame(function () {
  54631. removeTransitionClass(el, startClass);
  54632. if (!cb.cancelled) {
  54633. addTransitionClass(el, toClass);
  54634. if (!userWantsControl) {
  54635. if (isValidDuration(explicitEnterDuration)) {
  54636. setTimeout(cb, explicitEnterDuration);
  54637. } else {
  54638. whenTransitionEnds(el, type, cb);
  54639. }
  54640. }
  54641. }
  54642. });
  54643. }
  54644. if (vnode.data.show) {
  54645. toggleDisplay && toggleDisplay();
  54646. enterHook && enterHook(el, cb);
  54647. }
  54648. if (!expectsCSS && !userWantsControl) {
  54649. cb();
  54650. }
  54651. }
  54652. function leave (vnode, rm) {
  54653. var el = vnode.elm;
  54654. // call enter callback now
  54655. if (isDef(el._enterCb)) {
  54656. el._enterCb.cancelled = true;
  54657. el._enterCb();
  54658. }
  54659. var data = resolveTransition(vnode.data.transition);
  54660. if (isUndef(data) || el.nodeType !== 1) {
  54661. return rm()
  54662. }
  54663. /* istanbul ignore if */
  54664. if (isDef(el._leaveCb)) {
  54665. return
  54666. }
  54667. var css = data.css;
  54668. var type = data.type;
  54669. var leaveClass = data.leaveClass;
  54670. var leaveToClass = data.leaveToClass;
  54671. var leaveActiveClass = data.leaveActiveClass;
  54672. var beforeLeave = data.beforeLeave;
  54673. var leave = data.leave;
  54674. var afterLeave = data.afterLeave;
  54675. var leaveCancelled = data.leaveCancelled;
  54676. var delayLeave = data.delayLeave;
  54677. var duration = data.duration;
  54678. var expectsCSS = css !== false && !isIE9;
  54679. var userWantsControl = getHookArgumentsLength(leave);
  54680. var explicitLeaveDuration = toNumber(
  54681. isObject(duration)
  54682. ? duration.leave
  54683. : duration
  54684. );
  54685. if (isDef(explicitLeaveDuration)) {
  54686. checkDuration(explicitLeaveDuration, 'leave', vnode);
  54687. }
  54688. var cb = el._leaveCb = once(function () {
  54689. if (el.parentNode && el.parentNode._pending) {
  54690. el.parentNode._pending[vnode.key] = null;
  54691. }
  54692. if (expectsCSS) {
  54693. removeTransitionClass(el, leaveToClass);
  54694. removeTransitionClass(el, leaveActiveClass);
  54695. }
  54696. if (cb.cancelled) {
  54697. if (expectsCSS) {
  54698. removeTransitionClass(el, leaveClass);
  54699. }
  54700. leaveCancelled && leaveCancelled(el);
  54701. } else {
  54702. rm();
  54703. afterLeave && afterLeave(el);
  54704. }
  54705. el._leaveCb = null;
  54706. });
  54707. if (delayLeave) {
  54708. delayLeave(performLeave);
  54709. } else {
  54710. performLeave();
  54711. }
  54712. function performLeave () {
  54713. // the delayed leave may have already been cancelled
  54714. if (cb.cancelled) {
  54715. return
  54716. }
  54717. // record leaving element
  54718. if (!vnode.data.show && el.parentNode) {
  54719. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  54720. }
  54721. beforeLeave && beforeLeave(el);
  54722. if (expectsCSS) {
  54723. addTransitionClass(el, leaveClass);
  54724. addTransitionClass(el, leaveActiveClass);
  54725. nextFrame(function () {
  54726. removeTransitionClass(el, leaveClass);
  54727. if (!cb.cancelled) {
  54728. addTransitionClass(el, leaveToClass);
  54729. if (!userWantsControl) {
  54730. if (isValidDuration(explicitLeaveDuration)) {
  54731. setTimeout(cb, explicitLeaveDuration);
  54732. } else {
  54733. whenTransitionEnds(el, type, cb);
  54734. }
  54735. }
  54736. }
  54737. });
  54738. }
  54739. leave && leave(el, cb);
  54740. if (!expectsCSS && !userWantsControl) {
  54741. cb();
  54742. }
  54743. }
  54744. }
  54745. // only used in dev mode
  54746. function checkDuration (val, name, vnode) {
  54747. if (typeof val !== 'number') {
  54748. warn(
  54749. "<transition> explicit " + name + " duration is not a valid number - " +
  54750. "got " + (JSON.stringify(val)) + ".",
  54751. vnode.context
  54752. );
  54753. } else if (isNaN(val)) {
  54754. warn(
  54755. "<transition> explicit " + name + " duration is NaN - " +
  54756. 'the duration expression might be incorrect.',
  54757. vnode.context
  54758. );
  54759. }
  54760. }
  54761. function isValidDuration (val) {
  54762. return typeof val === 'number' && !isNaN(val)
  54763. }
  54764. /**
  54765. * Normalize a transition hook's argument length. The hook may be:
  54766. * - a merged hook (invoker) with the original in .fns
  54767. * - a wrapped component method (check ._length)
  54768. * - a plain function (.length)
  54769. */
  54770. function getHookArgumentsLength (fn) {
  54771. if (isUndef(fn)) {
  54772. return false
  54773. }
  54774. var invokerFns = fn.fns;
  54775. if (isDef(invokerFns)) {
  54776. // invoker
  54777. return getHookArgumentsLength(
  54778. Array.isArray(invokerFns)
  54779. ? invokerFns[0]
  54780. : invokerFns
  54781. )
  54782. } else {
  54783. return (fn._length || fn.length) > 1
  54784. }
  54785. }
  54786. function _enter (_, vnode) {
  54787. if (vnode.data.show !== true) {
  54788. enter(vnode);
  54789. }
  54790. }
  54791. var transition = inBrowser ? {
  54792. create: _enter,
  54793. activate: _enter,
  54794. remove: function remove$$1 (vnode, rm) {
  54795. /* istanbul ignore else */
  54796. if (vnode.data.show !== true) {
  54797. leave(vnode, rm);
  54798. } else {
  54799. rm();
  54800. }
  54801. }
  54802. } : {};
  54803. var platformModules = [
  54804. attrs,
  54805. klass,
  54806. events,
  54807. domProps,
  54808. style,
  54809. transition
  54810. ];
  54811. /* */
  54812. // the directive module should be applied last, after all
  54813. // built-in modules have been applied.
  54814. var modules = platformModules.concat(baseModules);
  54815. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  54816. /**
  54817. * Not type checking this file because flow doesn't like attaching
  54818. * properties to Elements.
  54819. */
  54820. /* istanbul ignore if */
  54821. if (isIE9) {
  54822. // http://www.matts411.com/post/internet-explorer-9-oninput/
  54823. document.addEventListener('selectionchange', function () {
  54824. var el = document.activeElement;
  54825. if (el && el.vmodel) {
  54826. trigger(el, 'input');
  54827. }
  54828. });
  54829. }
  54830. var directive = {
  54831. inserted: function inserted (el, binding, vnode, oldVnode) {
  54832. if (vnode.tag === 'select') {
  54833. // #6903
  54834. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  54835. mergeVNodeHook(vnode, 'postpatch', function () {
  54836. directive.componentUpdated(el, binding, vnode);
  54837. });
  54838. } else {
  54839. setSelected(el, binding, vnode.context);
  54840. }
  54841. el._vOptions = [].map.call(el.options, getValue);
  54842. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  54843. el._vModifiers = binding.modifiers;
  54844. if (!binding.modifiers.lazy) {
  54845. el.addEventListener('compositionstart', onCompositionStart);
  54846. el.addEventListener('compositionend', onCompositionEnd);
  54847. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  54848. // switching focus before confirming composition choice
  54849. // this also fixes the issue where some browsers e.g. iOS Chrome
  54850. // fires "change" instead of "input" on autocomplete.
  54851. el.addEventListener('change', onCompositionEnd);
  54852. /* istanbul ignore if */
  54853. if (isIE9) {
  54854. el.vmodel = true;
  54855. }
  54856. }
  54857. }
  54858. },
  54859. componentUpdated: function componentUpdated (el, binding, vnode) {
  54860. if (vnode.tag === 'select') {
  54861. setSelected(el, binding, vnode.context);
  54862. // in case the options rendered by v-for have changed,
  54863. // it's possible that the value is out-of-sync with the rendered options.
  54864. // detect such cases and filter out values that no longer has a matching
  54865. // option in the DOM.
  54866. var prevOptions = el._vOptions;
  54867. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  54868. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  54869. // trigger change event if
  54870. // no matching option found for at least one value
  54871. var needReset = el.multiple
  54872. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  54873. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  54874. if (needReset) {
  54875. trigger(el, 'change');
  54876. }
  54877. }
  54878. }
  54879. }
  54880. };
  54881. function setSelected (el, binding, vm) {
  54882. actuallySetSelected(el, binding, vm);
  54883. /* istanbul ignore if */
  54884. if (isIE || isEdge) {
  54885. setTimeout(function () {
  54886. actuallySetSelected(el, binding, vm);
  54887. }, 0);
  54888. }
  54889. }
  54890. function actuallySetSelected (el, binding, vm) {
  54891. var value = binding.value;
  54892. var isMultiple = el.multiple;
  54893. if (isMultiple && !Array.isArray(value)) {
  54894. warn(
  54895. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  54896. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  54897. vm
  54898. );
  54899. return
  54900. }
  54901. var selected, option;
  54902. for (var i = 0, l = el.options.length; i < l; i++) {
  54903. option = el.options[i];
  54904. if (isMultiple) {
  54905. selected = looseIndexOf(value, getValue(option)) > -1;
  54906. if (option.selected !== selected) {
  54907. option.selected = selected;
  54908. }
  54909. } else {
  54910. if (looseEqual(getValue(option), value)) {
  54911. if (el.selectedIndex !== i) {
  54912. el.selectedIndex = i;
  54913. }
  54914. return
  54915. }
  54916. }
  54917. }
  54918. if (!isMultiple) {
  54919. el.selectedIndex = -1;
  54920. }
  54921. }
  54922. function hasNoMatchingOption (value, options) {
  54923. return options.every(function (o) { return !looseEqual(o, value); })
  54924. }
  54925. function getValue (option) {
  54926. return '_value' in option
  54927. ? option._value
  54928. : option.value
  54929. }
  54930. function onCompositionStart (e) {
  54931. e.target.composing = true;
  54932. }
  54933. function onCompositionEnd (e) {
  54934. // prevent triggering an input event for no reason
  54935. if (!e.target.composing) { return }
  54936. e.target.composing = false;
  54937. trigger(e.target, 'input');
  54938. }
  54939. function trigger (el, type) {
  54940. var e = document.createEvent('HTMLEvents');
  54941. e.initEvent(type, true, true);
  54942. el.dispatchEvent(e);
  54943. }
  54944. /* */
  54945. // recursively search for possible transition defined inside the component root
  54946. function locateNode (vnode) {
  54947. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  54948. ? locateNode(vnode.componentInstance._vnode)
  54949. : vnode
  54950. }
  54951. var show = {
  54952. bind: function bind (el, ref, vnode) {
  54953. var value = ref.value;
  54954. vnode = locateNode(vnode);
  54955. var transition$$1 = vnode.data && vnode.data.transition;
  54956. var originalDisplay = el.__vOriginalDisplay =
  54957. el.style.display === 'none' ? '' : el.style.display;
  54958. if (value && transition$$1) {
  54959. vnode.data.show = true;
  54960. enter(vnode, function () {
  54961. el.style.display = originalDisplay;
  54962. });
  54963. } else {
  54964. el.style.display = value ? originalDisplay : 'none';
  54965. }
  54966. },
  54967. update: function update (el, ref, vnode) {
  54968. var value = ref.value;
  54969. var oldValue = ref.oldValue;
  54970. /* istanbul ignore if */
  54971. if (!value === !oldValue) { return }
  54972. vnode = locateNode(vnode);
  54973. var transition$$1 = vnode.data && vnode.data.transition;
  54974. if (transition$$1) {
  54975. vnode.data.show = true;
  54976. if (value) {
  54977. enter(vnode, function () {
  54978. el.style.display = el.__vOriginalDisplay;
  54979. });
  54980. } else {
  54981. leave(vnode, function () {
  54982. el.style.display = 'none';
  54983. });
  54984. }
  54985. } else {
  54986. el.style.display = value ? el.__vOriginalDisplay : 'none';
  54987. }
  54988. },
  54989. unbind: function unbind (
  54990. el,
  54991. binding,
  54992. vnode,
  54993. oldVnode,
  54994. isDestroy
  54995. ) {
  54996. if (!isDestroy) {
  54997. el.style.display = el.__vOriginalDisplay;
  54998. }
  54999. }
  55000. };
  55001. var platformDirectives = {
  55002. model: directive,
  55003. show: show
  55004. };
  55005. /* */
  55006. var transitionProps = {
  55007. name: String,
  55008. appear: Boolean,
  55009. css: Boolean,
  55010. mode: String,
  55011. type: String,
  55012. enterClass: String,
  55013. leaveClass: String,
  55014. enterToClass: String,
  55015. leaveToClass: String,
  55016. enterActiveClass: String,
  55017. leaveActiveClass: String,
  55018. appearClass: String,
  55019. appearActiveClass: String,
  55020. appearToClass: String,
  55021. duration: [Number, String, Object]
  55022. };
  55023. // in case the child is also an abstract component, e.g. <keep-alive>
  55024. // we want to recursively retrieve the real component to be rendered
  55025. function getRealChild (vnode) {
  55026. var compOptions = vnode && vnode.componentOptions;
  55027. if (compOptions && compOptions.Ctor.options.abstract) {
  55028. return getRealChild(getFirstComponentChild(compOptions.children))
  55029. } else {
  55030. return vnode
  55031. }
  55032. }
  55033. function extractTransitionData (comp) {
  55034. var data = {};
  55035. var options = comp.$options;
  55036. // props
  55037. for (var key in options.propsData) {
  55038. data[key] = comp[key];
  55039. }
  55040. // events.
  55041. // extract listeners and pass them directly to the transition methods
  55042. var listeners = options._parentListeners;
  55043. for (var key$1 in listeners) {
  55044. data[camelize(key$1)] = listeners[key$1];
  55045. }
  55046. return data
  55047. }
  55048. function placeholder (h, rawChild) {
  55049. if (/\d-keep-alive$/.test(rawChild.tag)) {
  55050. return h('keep-alive', {
  55051. props: rawChild.componentOptions.propsData
  55052. })
  55053. }
  55054. }
  55055. function hasParentTransition (vnode) {
  55056. while ((vnode = vnode.parent)) {
  55057. if (vnode.data.transition) {
  55058. return true
  55059. }
  55060. }
  55061. }
  55062. function isSameChild (child, oldChild) {
  55063. return oldChild.key === child.key && oldChild.tag === child.tag
  55064. }
  55065. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  55066. var isVShowDirective = function (d) { return d.name === 'show'; };
  55067. var Transition = {
  55068. name: 'transition',
  55069. props: transitionProps,
  55070. abstract: true,
  55071. render: function render (h) {
  55072. var this$1 = this;
  55073. var children = this.$slots.default;
  55074. if (!children) {
  55075. return
  55076. }
  55077. // filter out text nodes (possible whitespaces)
  55078. children = children.filter(isNotTextNode);
  55079. /* istanbul ignore if */
  55080. if (!children.length) {
  55081. return
  55082. }
  55083. // warn multiple elements
  55084. if (children.length > 1) {
  55085. warn(
  55086. '<transition> can only be used on a single element. Use ' +
  55087. '<transition-group> for lists.',
  55088. this.$parent
  55089. );
  55090. }
  55091. var mode = this.mode;
  55092. // warn invalid mode
  55093. if (mode && mode !== 'in-out' && mode !== 'out-in'
  55094. ) {
  55095. warn(
  55096. 'invalid <transition> mode: ' + mode,
  55097. this.$parent
  55098. );
  55099. }
  55100. var rawChild = children[0];
  55101. // if this is a component root node and the component's
  55102. // parent container node also has transition, skip.
  55103. if (hasParentTransition(this.$vnode)) {
  55104. return rawChild
  55105. }
  55106. // apply transition data to child
  55107. // use getRealChild() to ignore abstract components e.g. keep-alive
  55108. var child = getRealChild(rawChild);
  55109. /* istanbul ignore if */
  55110. if (!child) {
  55111. return rawChild
  55112. }
  55113. if (this._leaving) {
  55114. return placeholder(h, rawChild)
  55115. }
  55116. // ensure a key that is unique to the vnode type and to this transition
  55117. // component instance. This key will be used to remove pending leaving nodes
  55118. // during entering.
  55119. var id = "__transition-" + (this._uid) + "-";
  55120. child.key = child.key == null
  55121. ? child.isComment
  55122. ? id + 'comment'
  55123. : id + child.tag
  55124. : isPrimitive(child.key)
  55125. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  55126. : child.key;
  55127. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  55128. var oldRawChild = this._vnode;
  55129. var oldChild = getRealChild(oldRawChild);
  55130. // mark v-show
  55131. // so that the transition module can hand over the control to the directive
  55132. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  55133. child.data.show = true;
  55134. }
  55135. if (
  55136. oldChild &&
  55137. oldChild.data &&
  55138. !isSameChild(child, oldChild) &&
  55139. !isAsyncPlaceholder(oldChild) &&
  55140. // #6687 component root is a comment node
  55141. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  55142. ) {
  55143. // replace old child transition data with fresh one
  55144. // important for dynamic transitions!
  55145. var oldData = oldChild.data.transition = extend({}, data);
  55146. // handle transition mode
  55147. if (mode === 'out-in') {
  55148. // return placeholder node and queue update when leave finishes
  55149. this._leaving = true;
  55150. mergeVNodeHook(oldData, 'afterLeave', function () {
  55151. this$1._leaving = false;
  55152. this$1.$forceUpdate();
  55153. });
  55154. return placeholder(h, rawChild)
  55155. } else if (mode === 'in-out') {
  55156. if (isAsyncPlaceholder(child)) {
  55157. return oldRawChild
  55158. }
  55159. var delayedLeave;
  55160. var performLeave = function () { delayedLeave(); };
  55161. mergeVNodeHook(data, 'afterEnter', performLeave);
  55162. mergeVNodeHook(data, 'enterCancelled', performLeave);
  55163. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  55164. }
  55165. }
  55166. return rawChild
  55167. }
  55168. };
  55169. /* */
  55170. var props = extend({
  55171. tag: String,
  55172. moveClass: String
  55173. }, transitionProps);
  55174. delete props.mode;
  55175. var TransitionGroup = {
  55176. props: props,
  55177. beforeMount: function beforeMount () {
  55178. var this$1 = this;
  55179. var update = this._update;
  55180. this._update = function (vnode, hydrating) {
  55181. var restoreActiveInstance = setActiveInstance(this$1);
  55182. // force removing pass
  55183. this$1.__patch__(
  55184. this$1._vnode,
  55185. this$1.kept,
  55186. false, // hydrating
  55187. true // removeOnly (!important, avoids unnecessary moves)
  55188. );
  55189. this$1._vnode = this$1.kept;
  55190. restoreActiveInstance();
  55191. update.call(this$1, vnode, hydrating);
  55192. };
  55193. },
  55194. render: function render (h) {
  55195. var tag = this.tag || this.$vnode.data.tag || 'span';
  55196. var map = Object.create(null);
  55197. var prevChildren = this.prevChildren = this.children;
  55198. var rawChildren = this.$slots.default || [];
  55199. var children = this.children = [];
  55200. var transitionData = extractTransitionData(this);
  55201. for (var i = 0; i < rawChildren.length; i++) {
  55202. var c = rawChildren[i];
  55203. if (c.tag) {
  55204. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  55205. children.push(c);
  55206. map[c.key] = c
  55207. ;(c.data || (c.data = {})).transition = transitionData;
  55208. } else {
  55209. var opts = c.componentOptions;
  55210. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  55211. warn(("<transition-group> children must be keyed: <" + name + ">"));
  55212. }
  55213. }
  55214. }
  55215. if (prevChildren) {
  55216. var kept = [];
  55217. var removed = [];
  55218. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  55219. var c$1 = prevChildren[i$1];
  55220. c$1.data.transition = transitionData;
  55221. c$1.data.pos = c$1.elm.getBoundingClientRect();
  55222. if (map[c$1.key]) {
  55223. kept.push(c$1);
  55224. } else {
  55225. removed.push(c$1);
  55226. }
  55227. }
  55228. this.kept = h(tag, null, kept);
  55229. this.removed = removed;
  55230. }
  55231. return h(tag, null, children)
  55232. },
  55233. updated: function updated () {
  55234. var children = this.prevChildren;
  55235. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  55236. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  55237. return
  55238. }
  55239. // we divide the work into three loops to avoid mixing DOM reads and writes
  55240. // in each iteration - which helps prevent layout thrashing.
  55241. children.forEach(callPendingCbs);
  55242. children.forEach(recordPosition);
  55243. children.forEach(applyTranslation);
  55244. // force reflow to put everything in position
  55245. // assign to this to avoid being removed in tree-shaking
  55246. // $flow-disable-line
  55247. this._reflow = document.body.offsetHeight;
  55248. children.forEach(function (c) {
  55249. if (c.data.moved) {
  55250. var el = c.elm;
  55251. var s = el.style;
  55252. addTransitionClass(el, moveClass);
  55253. s.transform = s.WebkitTransform = s.transitionDuration = '';
  55254. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  55255. if (e && e.target !== el) {
  55256. return
  55257. }
  55258. if (!e || /transform$/.test(e.propertyName)) {
  55259. el.removeEventListener(transitionEndEvent, cb);
  55260. el._moveCb = null;
  55261. removeTransitionClass(el, moveClass);
  55262. }
  55263. });
  55264. }
  55265. });
  55266. },
  55267. methods: {
  55268. hasMove: function hasMove (el, moveClass) {
  55269. /* istanbul ignore if */
  55270. if (!hasTransition) {
  55271. return false
  55272. }
  55273. /* istanbul ignore if */
  55274. if (this._hasMove) {
  55275. return this._hasMove
  55276. }
  55277. // Detect whether an element with the move class applied has
  55278. // CSS transitions. Since the element may be inside an entering
  55279. // transition at this very moment, we make a clone of it and remove
  55280. // all other transition classes applied to ensure only the move class
  55281. // is applied.
  55282. var clone = el.cloneNode();
  55283. if (el._transitionClasses) {
  55284. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  55285. }
  55286. addClass(clone, moveClass);
  55287. clone.style.display = 'none';
  55288. this.$el.appendChild(clone);
  55289. var info = getTransitionInfo(clone);
  55290. this.$el.removeChild(clone);
  55291. return (this._hasMove = info.hasTransform)
  55292. }
  55293. }
  55294. };
  55295. function callPendingCbs (c) {
  55296. /* istanbul ignore if */
  55297. if (c.elm._moveCb) {
  55298. c.elm._moveCb();
  55299. }
  55300. /* istanbul ignore if */
  55301. if (c.elm._enterCb) {
  55302. c.elm._enterCb();
  55303. }
  55304. }
  55305. function recordPosition (c) {
  55306. c.data.newPos = c.elm.getBoundingClientRect();
  55307. }
  55308. function applyTranslation (c) {
  55309. var oldPos = c.data.pos;
  55310. var newPos = c.data.newPos;
  55311. var dx = oldPos.left - newPos.left;
  55312. var dy = oldPos.top - newPos.top;
  55313. if (dx || dy) {
  55314. c.data.moved = true;
  55315. var s = c.elm.style;
  55316. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  55317. s.transitionDuration = '0s';
  55318. }
  55319. }
  55320. var platformComponents = {
  55321. Transition: Transition,
  55322. TransitionGroup: TransitionGroup
  55323. };
  55324. /* */
  55325. // install platform specific utils
  55326. Vue.config.mustUseProp = mustUseProp;
  55327. Vue.config.isReservedTag = isReservedTag;
  55328. Vue.config.isReservedAttr = isReservedAttr;
  55329. Vue.config.getTagNamespace = getTagNamespace;
  55330. Vue.config.isUnknownElement = isUnknownElement;
  55331. // install platform runtime directives & components
  55332. extend(Vue.options.directives, platformDirectives);
  55333. extend(Vue.options.components, platformComponents);
  55334. // install platform patch function
  55335. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  55336. // public mount method
  55337. Vue.prototype.$mount = function (
  55338. el,
  55339. hydrating
  55340. ) {
  55341. el = el && inBrowser ? query(el) : undefined;
  55342. return mountComponent(this, el, hydrating)
  55343. };
  55344. // devtools global hook
  55345. /* istanbul ignore next */
  55346. if (inBrowser) {
  55347. setTimeout(function () {
  55348. if (config.devtools) {
  55349. if (devtools) {
  55350. devtools.emit('init', Vue);
  55351. } else {
  55352. console[console.info ? 'info' : 'log'](
  55353. 'Download the Vue Devtools extension for a better development experience:\n' +
  55354. 'https://github.com/vuejs/vue-devtools'
  55355. );
  55356. }
  55357. }
  55358. if (config.productionTip !== false &&
  55359. typeof console !== 'undefined'
  55360. ) {
  55361. console[console.info ? 'info' : 'log'](
  55362. "You are running Vue in development mode.\n" +
  55363. "Make sure to turn on production mode when deploying for production.\n" +
  55364. "See more tips at https://vuejs.org/guide/deployment.html"
  55365. );
  55366. }
  55367. }, 0);
  55368. }
  55369. /* */
  55370. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  55371. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  55372. var buildRegex = cached(function (delimiters) {
  55373. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  55374. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  55375. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  55376. });
  55377. function parseText (
  55378. text,
  55379. delimiters
  55380. ) {
  55381. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  55382. if (!tagRE.test(text)) {
  55383. return
  55384. }
  55385. var tokens = [];
  55386. var rawTokens = [];
  55387. var lastIndex = tagRE.lastIndex = 0;
  55388. var match, index, tokenValue;
  55389. while ((match = tagRE.exec(text))) {
  55390. index = match.index;
  55391. // push text token
  55392. if (index > lastIndex) {
  55393. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  55394. tokens.push(JSON.stringify(tokenValue));
  55395. }
  55396. // tag token
  55397. var exp = parseFilters(match[1].trim());
  55398. tokens.push(("_s(" + exp + ")"));
  55399. rawTokens.push({ '@binding': exp });
  55400. lastIndex = index + match[0].length;
  55401. }
  55402. if (lastIndex < text.length) {
  55403. rawTokens.push(tokenValue = text.slice(lastIndex));
  55404. tokens.push(JSON.stringify(tokenValue));
  55405. }
  55406. return {
  55407. expression: tokens.join('+'),
  55408. tokens: rawTokens
  55409. }
  55410. }
  55411. /* */
  55412. function transformNode (el, options) {
  55413. var warn = options.warn || baseWarn;
  55414. var staticClass = getAndRemoveAttr(el, 'class');
  55415. if (staticClass) {
  55416. var res = parseText(staticClass, options.delimiters);
  55417. if (res) {
  55418. warn(
  55419. "class=\"" + staticClass + "\": " +
  55420. 'Interpolation inside attributes has been removed. ' +
  55421. 'Use v-bind or the colon shorthand instead. For example, ' +
  55422. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  55423. el.rawAttrsMap['class']
  55424. );
  55425. }
  55426. }
  55427. if (staticClass) {
  55428. el.staticClass = JSON.stringify(staticClass);
  55429. }
  55430. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  55431. if (classBinding) {
  55432. el.classBinding = classBinding;
  55433. }
  55434. }
  55435. function genData (el) {
  55436. var data = '';
  55437. if (el.staticClass) {
  55438. data += "staticClass:" + (el.staticClass) + ",";
  55439. }
  55440. if (el.classBinding) {
  55441. data += "class:" + (el.classBinding) + ",";
  55442. }
  55443. return data
  55444. }
  55445. var klass$1 = {
  55446. staticKeys: ['staticClass'],
  55447. transformNode: transformNode,
  55448. genData: genData
  55449. };
  55450. /* */
  55451. function transformNode$1 (el, options) {
  55452. var warn = options.warn || baseWarn;
  55453. var staticStyle = getAndRemoveAttr(el, 'style');
  55454. if (staticStyle) {
  55455. /* istanbul ignore if */
  55456. {
  55457. var res = parseText(staticStyle, options.delimiters);
  55458. if (res) {
  55459. warn(
  55460. "style=\"" + staticStyle + "\": " +
  55461. 'Interpolation inside attributes has been removed. ' +
  55462. 'Use v-bind or the colon shorthand instead. For example, ' +
  55463. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  55464. el.rawAttrsMap['style']
  55465. );
  55466. }
  55467. }
  55468. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  55469. }
  55470. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  55471. if (styleBinding) {
  55472. el.styleBinding = styleBinding;
  55473. }
  55474. }
  55475. function genData$1 (el) {
  55476. var data = '';
  55477. if (el.staticStyle) {
  55478. data += "staticStyle:" + (el.staticStyle) + ",";
  55479. }
  55480. if (el.styleBinding) {
  55481. data += "style:(" + (el.styleBinding) + "),";
  55482. }
  55483. return data
  55484. }
  55485. var style$1 = {
  55486. staticKeys: ['staticStyle'],
  55487. transformNode: transformNode$1,
  55488. genData: genData$1
  55489. };
  55490. /* */
  55491. var decoder;
  55492. var he = {
  55493. decode: function decode (html) {
  55494. decoder = decoder || document.createElement('div');
  55495. decoder.innerHTML = html;
  55496. return decoder.textContent
  55497. }
  55498. };
  55499. /* */
  55500. var isUnaryTag = makeMap(
  55501. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  55502. 'link,meta,param,source,track,wbr'
  55503. );
  55504. // Elements that you can, intentionally, leave open
  55505. // (and which close themselves)
  55506. var canBeLeftOpenTag = makeMap(
  55507. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  55508. );
  55509. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  55510. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  55511. var isNonPhrasingTag = makeMap(
  55512. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  55513. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  55514. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  55515. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  55516. 'title,tr,track'
  55517. );
  55518. /**
  55519. * Not type-checking this file because it's mostly vendor code.
  55520. */
  55521. // Regular Expressions for parsing tags and attributes
  55522. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  55523. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  55524. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  55525. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  55526. var startTagOpen = new RegExp(("^<" + qnameCapture));
  55527. var startTagClose = /^\s*(\/?)>/;
  55528. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  55529. var doctype = /^<!DOCTYPE [^>]+>/i;
  55530. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  55531. var comment = /^<!\--/;
  55532. var conditionalComment = /^<!\[/;
  55533. // Special Elements (can contain anything)
  55534. var isPlainTextElement = makeMap('script,style,textarea', true);
  55535. var reCache = {};
  55536. var decodingMap = {
  55537. '&lt;': '<',
  55538. '&gt;': '>',
  55539. '&quot;': '"',
  55540. '&amp;': '&',
  55541. '&#10;': '\n',
  55542. '&#9;': '\t',
  55543. '&#39;': "'"
  55544. };
  55545. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  55546. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  55547. // #5992
  55548. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  55549. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  55550. function decodeAttr (value, shouldDecodeNewlines) {
  55551. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  55552. return value.replace(re, function (match) { return decodingMap[match]; })
  55553. }
  55554. function parseHTML (html, options) {
  55555. var stack = [];
  55556. var expectHTML = options.expectHTML;
  55557. var isUnaryTag$$1 = options.isUnaryTag || no;
  55558. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  55559. var index = 0;
  55560. var last, lastTag;
  55561. while (html) {
  55562. last = html;
  55563. // Make sure we're not in a plaintext content element like script/style
  55564. if (!lastTag || !isPlainTextElement(lastTag)) {
  55565. var textEnd = html.indexOf('<');
  55566. if (textEnd === 0) {
  55567. // Comment:
  55568. if (comment.test(html)) {
  55569. var commentEnd = html.indexOf('-->');
  55570. if (commentEnd >= 0) {
  55571. if (options.shouldKeepComment) {
  55572. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  55573. }
  55574. advance(commentEnd + 3);
  55575. continue
  55576. }
  55577. }
  55578. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  55579. if (conditionalComment.test(html)) {
  55580. var conditionalEnd = html.indexOf(']>');
  55581. if (conditionalEnd >= 0) {
  55582. advance(conditionalEnd + 2);
  55583. continue
  55584. }
  55585. }
  55586. // Doctype:
  55587. var doctypeMatch = html.match(doctype);
  55588. if (doctypeMatch) {
  55589. advance(doctypeMatch[0].length);
  55590. continue
  55591. }
  55592. // End tag:
  55593. var endTagMatch = html.match(endTag);
  55594. if (endTagMatch) {
  55595. var curIndex = index;
  55596. advance(endTagMatch[0].length);
  55597. parseEndTag(endTagMatch[1], curIndex, index);
  55598. continue
  55599. }
  55600. // Start tag:
  55601. var startTagMatch = parseStartTag();
  55602. if (startTagMatch) {
  55603. handleStartTag(startTagMatch);
  55604. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  55605. advance(1);
  55606. }
  55607. continue
  55608. }
  55609. }
  55610. var text = (void 0), rest = (void 0), next = (void 0);
  55611. if (textEnd >= 0) {
  55612. rest = html.slice(textEnd);
  55613. while (
  55614. !endTag.test(rest) &&
  55615. !startTagOpen.test(rest) &&
  55616. !comment.test(rest) &&
  55617. !conditionalComment.test(rest)
  55618. ) {
  55619. // < in plain text, be forgiving and treat it as text
  55620. next = rest.indexOf('<', 1);
  55621. if (next < 0) { break }
  55622. textEnd += next;
  55623. rest = html.slice(textEnd);
  55624. }
  55625. text = html.substring(0, textEnd);
  55626. }
  55627. if (textEnd < 0) {
  55628. text = html;
  55629. }
  55630. if (text) {
  55631. advance(text.length);
  55632. }
  55633. if (options.chars && text) {
  55634. options.chars(text, index - text.length, index);
  55635. }
  55636. } else {
  55637. var endTagLength = 0;
  55638. var stackedTag = lastTag.toLowerCase();
  55639. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  55640. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  55641. endTagLength = endTag.length;
  55642. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  55643. text = text
  55644. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  55645. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  55646. }
  55647. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  55648. text = text.slice(1);
  55649. }
  55650. if (options.chars) {
  55651. options.chars(text);
  55652. }
  55653. return ''
  55654. });
  55655. index += html.length - rest$1.length;
  55656. html = rest$1;
  55657. parseEndTag(stackedTag, index - endTagLength, index);
  55658. }
  55659. if (html === last) {
  55660. options.chars && options.chars(html);
  55661. if (!stack.length && options.warn) {
  55662. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  55663. }
  55664. break
  55665. }
  55666. }
  55667. // Clean up any remaining tags
  55668. parseEndTag();
  55669. function advance (n) {
  55670. index += n;
  55671. html = html.substring(n);
  55672. }
  55673. function parseStartTag () {
  55674. var start = html.match(startTagOpen);
  55675. if (start) {
  55676. var match = {
  55677. tagName: start[1],
  55678. attrs: [],
  55679. start: index
  55680. };
  55681. advance(start[0].length);
  55682. var end, attr;
  55683. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  55684. attr.start = index;
  55685. advance(attr[0].length);
  55686. attr.end = index;
  55687. match.attrs.push(attr);
  55688. }
  55689. if (end) {
  55690. match.unarySlash = end[1];
  55691. advance(end[0].length);
  55692. match.end = index;
  55693. return match
  55694. }
  55695. }
  55696. }
  55697. function handleStartTag (match) {
  55698. var tagName = match.tagName;
  55699. var unarySlash = match.unarySlash;
  55700. if (expectHTML) {
  55701. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  55702. parseEndTag(lastTag);
  55703. }
  55704. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  55705. parseEndTag(tagName);
  55706. }
  55707. }
  55708. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  55709. var l = match.attrs.length;
  55710. var attrs = new Array(l);
  55711. for (var i = 0; i < l; i++) {
  55712. var args = match.attrs[i];
  55713. var value = args[3] || args[4] || args[5] || '';
  55714. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  55715. ? options.shouldDecodeNewlinesForHref
  55716. : options.shouldDecodeNewlines;
  55717. attrs[i] = {
  55718. name: args[1],
  55719. value: decodeAttr(value, shouldDecodeNewlines)
  55720. };
  55721. if (options.outputSourceRange) {
  55722. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  55723. attrs[i].end = args.end;
  55724. }
  55725. }
  55726. if (!unary) {
  55727. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  55728. lastTag = tagName;
  55729. }
  55730. if (options.start) {
  55731. options.start(tagName, attrs, unary, match.start, match.end);
  55732. }
  55733. }
  55734. function parseEndTag (tagName, start, end) {
  55735. var pos, lowerCasedTagName;
  55736. if (start == null) { start = index; }
  55737. if (end == null) { end = index; }
  55738. // Find the closest opened tag of the same type
  55739. if (tagName) {
  55740. lowerCasedTagName = tagName.toLowerCase();
  55741. for (pos = stack.length - 1; pos >= 0; pos--) {
  55742. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  55743. break
  55744. }
  55745. }
  55746. } else {
  55747. // If no tag name is provided, clean shop
  55748. pos = 0;
  55749. }
  55750. if (pos >= 0) {
  55751. // Close all the open elements, up the stack
  55752. for (var i = stack.length - 1; i >= pos; i--) {
  55753. if (i > pos || !tagName &&
  55754. options.warn
  55755. ) {
  55756. options.warn(
  55757. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  55758. { start: stack[i].start, end: stack[i].end }
  55759. );
  55760. }
  55761. if (options.end) {
  55762. options.end(stack[i].tag, start, end);
  55763. }
  55764. }
  55765. // Remove the open elements from the stack
  55766. stack.length = pos;
  55767. lastTag = pos && stack[pos - 1].tag;
  55768. } else if (lowerCasedTagName === 'br') {
  55769. if (options.start) {
  55770. options.start(tagName, [], true, start, end);
  55771. }
  55772. } else if (lowerCasedTagName === 'p') {
  55773. if (options.start) {
  55774. options.start(tagName, [], false, start, end);
  55775. }
  55776. if (options.end) {
  55777. options.end(tagName, start, end);
  55778. }
  55779. }
  55780. }
  55781. }
  55782. /* */
  55783. var onRE = /^@|^v-on:/;
  55784. var dirRE = /^v-|^@|^:|^#/;
  55785. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  55786. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  55787. var stripParensRE = /^\(|\)$/g;
  55788. var dynamicArgRE = /^\[.*\]$/;
  55789. var argRE = /:(.*)$/;
  55790. var bindRE = /^:|^\.|^v-bind:/;
  55791. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  55792. var slotRE = /^v-slot(:|$)|^#/;
  55793. var lineBreakRE = /[\r\n]/;
  55794. var whitespaceRE$1 = /\s+/g;
  55795. var invalidAttributeRE = /[\s"'<>\/=]/;
  55796. var decodeHTMLCached = cached(he.decode);
  55797. var emptySlotScopeToken = "_empty_";
  55798. // configurable state
  55799. var warn$2;
  55800. var delimiters;
  55801. var transforms;
  55802. var preTransforms;
  55803. var postTransforms;
  55804. var platformIsPreTag;
  55805. var platformMustUseProp;
  55806. var platformGetTagNamespace;
  55807. var maybeComponent;
  55808. function createASTElement (
  55809. tag,
  55810. attrs,
  55811. parent
  55812. ) {
  55813. return {
  55814. type: 1,
  55815. tag: tag,
  55816. attrsList: attrs,
  55817. attrsMap: makeAttrsMap(attrs),
  55818. rawAttrsMap: {},
  55819. parent: parent,
  55820. children: []
  55821. }
  55822. }
  55823. /**
  55824. * Convert HTML string to AST.
  55825. */
  55826. function parse (
  55827. template,
  55828. options
  55829. ) {
  55830. warn$2 = options.warn || baseWarn;
  55831. platformIsPreTag = options.isPreTag || no;
  55832. platformMustUseProp = options.mustUseProp || no;
  55833. platformGetTagNamespace = options.getTagNamespace || no;
  55834. var isReservedTag = options.isReservedTag || no;
  55835. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  55836. transforms = pluckModuleFunction(options.modules, 'transformNode');
  55837. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  55838. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  55839. delimiters = options.delimiters;
  55840. var stack = [];
  55841. var preserveWhitespace = options.preserveWhitespace !== false;
  55842. var whitespaceOption = options.whitespace;
  55843. var root;
  55844. var currentParent;
  55845. var inVPre = false;
  55846. var inPre = false;
  55847. var warned = false;
  55848. function warnOnce (msg, range) {
  55849. if (!warned) {
  55850. warned = true;
  55851. warn$2(msg, range);
  55852. }
  55853. }
  55854. function closeElement (element) {
  55855. trimEndingWhitespace(element);
  55856. if (!inVPre && !element.processed) {
  55857. element = processElement(element, options);
  55858. }
  55859. // tree management
  55860. if (!stack.length && element !== root) {
  55861. // allow root elements with v-if, v-else-if and v-else
  55862. if (root.if && (element.elseif || element.else)) {
  55863. {
  55864. checkRootConstraints(element);
  55865. }
  55866. addIfCondition(root, {
  55867. exp: element.elseif,
  55868. block: element
  55869. });
  55870. } else {
  55871. warnOnce(
  55872. "Component template should contain exactly one root element. " +
  55873. "If you are using v-if on multiple elements, " +
  55874. "use v-else-if to chain them instead.",
  55875. { start: element.start }
  55876. );
  55877. }
  55878. }
  55879. if (currentParent && !element.forbidden) {
  55880. if (element.elseif || element.else) {
  55881. processIfConditions(element, currentParent);
  55882. } else {
  55883. if (element.slotScope) {
  55884. // scoped slot
  55885. // keep it in the children list so that v-else(-if) conditions can
  55886. // find it as the prev node.
  55887. var name = element.slotTarget || '"default"'
  55888. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  55889. }
  55890. currentParent.children.push(element);
  55891. element.parent = currentParent;
  55892. }
  55893. }
  55894. // final children cleanup
  55895. // filter out scoped slots
  55896. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  55897. // remove trailing whitespace node again
  55898. trimEndingWhitespace(element);
  55899. // check pre state
  55900. if (element.pre) {
  55901. inVPre = false;
  55902. }
  55903. if (platformIsPreTag(element.tag)) {
  55904. inPre = false;
  55905. }
  55906. // apply post-transforms
  55907. for (var i = 0; i < postTransforms.length; i++) {
  55908. postTransforms[i](element, options);
  55909. }
  55910. }
  55911. function trimEndingWhitespace (el) {
  55912. // remove trailing whitespace node
  55913. if (!inPre) {
  55914. var lastNode;
  55915. while (
  55916. (lastNode = el.children[el.children.length - 1]) &&
  55917. lastNode.type === 3 &&
  55918. lastNode.text === ' '
  55919. ) {
  55920. el.children.pop();
  55921. }
  55922. }
  55923. }
  55924. function checkRootConstraints (el) {
  55925. if (el.tag === 'slot' || el.tag === 'template') {
  55926. warnOnce(
  55927. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  55928. 'contain multiple nodes.',
  55929. { start: el.start }
  55930. );
  55931. }
  55932. if (el.attrsMap.hasOwnProperty('v-for')) {
  55933. warnOnce(
  55934. 'Cannot use v-for on stateful component root element because ' +
  55935. 'it renders multiple elements.',
  55936. el.rawAttrsMap['v-for']
  55937. );
  55938. }
  55939. }
  55940. parseHTML(template, {
  55941. warn: warn$2,
  55942. expectHTML: options.expectHTML,
  55943. isUnaryTag: options.isUnaryTag,
  55944. canBeLeftOpenTag: options.canBeLeftOpenTag,
  55945. shouldDecodeNewlines: options.shouldDecodeNewlines,
  55946. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  55947. shouldKeepComment: options.comments,
  55948. outputSourceRange: options.outputSourceRange,
  55949. start: function start (tag, attrs, unary, start$1, end) {
  55950. // check namespace.
  55951. // inherit parent ns if there is one
  55952. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  55953. // handle IE svg bug
  55954. /* istanbul ignore if */
  55955. if (isIE && ns === 'svg') {
  55956. attrs = guardIESVGBug(attrs);
  55957. }
  55958. var element = createASTElement(tag, attrs, currentParent);
  55959. if (ns) {
  55960. element.ns = ns;
  55961. }
  55962. {
  55963. if (options.outputSourceRange) {
  55964. element.start = start$1;
  55965. element.end = end;
  55966. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  55967. cumulated[attr.name] = attr;
  55968. return cumulated
  55969. }, {});
  55970. }
  55971. attrs.forEach(function (attr) {
  55972. if (invalidAttributeRE.test(attr.name)) {
  55973. warn$2(
  55974. "Invalid dynamic argument expression: attribute names cannot contain " +
  55975. "spaces, quotes, <, >, / or =.",
  55976. {
  55977. start: attr.start + attr.name.indexOf("["),
  55978. end: attr.start + attr.name.length
  55979. }
  55980. );
  55981. }
  55982. });
  55983. }
  55984. if (isForbiddenTag(element) && !isServerRendering()) {
  55985. element.forbidden = true;
  55986. warn$2(
  55987. 'Templates should only be responsible for mapping the state to the ' +
  55988. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  55989. "<" + tag + ">" + ', as they will not be parsed.',
  55990. { start: element.start }
  55991. );
  55992. }
  55993. // apply pre-transforms
  55994. for (var i = 0; i < preTransforms.length; i++) {
  55995. element = preTransforms[i](element, options) || element;
  55996. }
  55997. if (!inVPre) {
  55998. processPre(element);
  55999. if (element.pre) {
  56000. inVPre = true;
  56001. }
  56002. }
  56003. if (platformIsPreTag(element.tag)) {
  56004. inPre = true;
  56005. }
  56006. if (inVPre) {
  56007. processRawAttrs(element);
  56008. } else if (!element.processed) {
  56009. // structural directives
  56010. processFor(element);
  56011. processIf(element);
  56012. processOnce(element);
  56013. }
  56014. if (!root) {
  56015. root = element;
  56016. {
  56017. checkRootConstraints(root);
  56018. }
  56019. }
  56020. if (!unary) {
  56021. currentParent = element;
  56022. stack.push(element);
  56023. } else {
  56024. closeElement(element);
  56025. }
  56026. },
  56027. end: function end (tag, start, end$1) {
  56028. var element = stack[stack.length - 1];
  56029. // pop stack
  56030. stack.length -= 1;
  56031. currentParent = stack[stack.length - 1];
  56032. if (options.outputSourceRange) {
  56033. element.end = end$1;
  56034. }
  56035. closeElement(element);
  56036. },
  56037. chars: function chars (text, start, end) {
  56038. if (!currentParent) {
  56039. {
  56040. if (text === template) {
  56041. warnOnce(
  56042. 'Component template requires a root element, rather than just text.',
  56043. { start: start }
  56044. );
  56045. } else if ((text = text.trim())) {
  56046. warnOnce(
  56047. ("text \"" + text + "\" outside root element will be ignored."),
  56048. { start: start }
  56049. );
  56050. }
  56051. }
  56052. return
  56053. }
  56054. // IE textarea placeholder bug
  56055. /* istanbul ignore if */
  56056. if (isIE &&
  56057. currentParent.tag === 'textarea' &&
  56058. currentParent.attrsMap.placeholder === text
  56059. ) {
  56060. return
  56061. }
  56062. var children = currentParent.children;
  56063. if (inPre || text.trim()) {
  56064. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  56065. } else if (!children.length) {
  56066. // remove the whitespace-only node right after an opening tag
  56067. text = '';
  56068. } else if (whitespaceOption) {
  56069. if (whitespaceOption === 'condense') {
  56070. // in condense mode, remove the whitespace node if it contains
  56071. // line break, otherwise condense to a single space
  56072. text = lineBreakRE.test(text) ? '' : ' ';
  56073. } else {
  56074. text = ' ';
  56075. }
  56076. } else {
  56077. text = preserveWhitespace ? ' ' : '';
  56078. }
  56079. if (text) {
  56080. if (!inPre && whitespaceOption === 'condense') {
  56081. // condense consecutive whitespaces into single space
  56082. text = text.replace(whitespaceRE$1, ' ');
  56083. }
  56084. var res;
  56085. var child;
  56086. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  56087. child = {
  56088. type: 2,
  56089. expression: res.expression,
  56090. tokens: res.tokens,
  56091. text: text
  56092. };
  56093. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  56094. child = {
  56095. type: 3,
  56096. text: text
  56097. };
  56098. }
  56099. if (child) {
  56100. if (options.outputSourceRange) {
  56101. child.start = start;
  56102. child.end = end;
  56103. }
  56104. children.push(child);
  56105. }
  56106. }
  56107. },
  56108. comment: function comment (text, start, end) {
  56109. // adding anyting as a sibling to the root node is forbidden
  56110. // comments should still be allowed, but ignored
  56111. if (currentParent) {
  56112. var child = {
  56113. type: 3,
  56114. text: text,
  56115. isComment: true
  56116. };
  56117. if (options.outputSourceRange) {
  56118. child.start = start;
  56119. child.end = end;
  56120. }
  56121. currentParent.children.push(child);
  56122. }
  56123. }
  56124. });
  56125. return root
  56126. }
  56127. function processPre (el) {
  56128. if (getAndRemoveAttr(el, 'v-pre') != null) {
  56129. el.pre = true;
  56130. }
  56131. }
  56132. function processRawAttrs (el) {
  56133. var list = el.attrsList;
  56134. var len = list.length;
  56135. if (len) {
  56136. var attrs = el.attrs = new Array(len);
  56137. for (var i = 0; i < len; i++) {
  56138. attrs[i] = {
  56139. name: list[i].name,
  56140. value: JSON.stringify(list[i].value)
  56141. };
  56142. if (list[i].start != null) {
  56143. attrs[i].start = list[i].start;
  56144. attrs[i].end = list[i].end;
  56145. }
  56146. }
  56147. } else if (!el.pre) {
  56148. // non root node in pre blocks with no attributes
  56149. el.plain = true;
  56150. }
  56151. }
  56152. function processElement (
  56153. element,
  56154. options
  56155. ) {
  56156. processKey(element);
  56157. // determine whether this is a plain element after
  56158. // removing structural attributes
  56159. element.plain = (
  56160. !element.key &&
  56161. !element.scopedSlots &&
  56162. !element.attrsList.length
  56163. );
  56164. processRef(element);
  56165. processSlotContent(element);
  56166. processSlotOutlet(element);
  56167. processComponent(element);
  56168. for (var i = 0; i < transforms.length; i++) {
  56169. element = transforms[i](element, options) || element;
  56170. }
  56171. processAttrs(element);
  56172. return element
  56173. }
  56174. function processKey (el) {
  56175. var exp = getBindingAttr(el, 'key');
  56176. if (exp) {
  56177. {
  56178. if (el.tag === 'template') {
  56179. warn$2(
  56180. "<template> cannot be keyed. Place the key on real elements instead.",
  56181. getRawBindingAttr(el, 'key')
  56182. );
  56183. }
  56184. if (el.for) {
  56185. var iterator = el.iterator2 || el.iterator1;
  56186. var parent = el.parent;
  56187. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  56188. warn$2(
  56189. "Do not use v-for index as key on <transition-group> children, " +
  56190. "this is the same as not using keys.",
  56191. getRawBindingAttr(el, 'key'),
  56192. true /* tip */
  56193. );
  56194. }
  56195. }
  56196. }
  56197. el.key = exp;
  56198. }
  56199. }
  56200. function processRef (el) {
  56201. var ref = getBindingAttr(el, 'ref');
  56202. if (ref) {
  56203. el.ref = ref;
  56204. el.refInFor = checkInFor(el);
  56205. }
  56206. }
  56207. function processFor (el) {
  56208. var exp;
  56209. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  56210. var res = parseFor(exp);
  56211. if (res) {
  56212. extend(el, res);
  56213. } else {
  56214. warn$2(
  56215. ("Invalid v-for expression: " + exp),
  56216. el.rawAttrsMap['v-for']
  56217. );
  56218. }
  56219. }
  56220. }
  56221. function parseFor (exp) {
  56222. var inMatch = exp.match(forAliasRE);
  56223. if (!inMatch) { return }
  56224. var res = {};
  56225. res.for = inMatch[2].trim();
  56226. var alias = inMatch[1].trim().replace(stripParensRE, '');
  56227. var iteratorMatch = alias.match(forIteratorRE);
  56228. if (iteratorMatch) {
  56229. res.alias = alias.replace(forIteratorRE, '').trim();
  56230. res.iterator1 = iteratorMatch[1].trim();
  56231. if (iteratorMatch[2]) {
  56232. res.iterator2 = iteratorMatch[2].trim();
  56233. }
  56234. } else {
  56235. res.alias = alias;
  56236. }
  56237. return res
  56238. }
  56239. function processIf (el) {
  56240. var exp = getAndRemoveAttr(el, 'v-if');
  56241. if (exp) {
  56242. el.if = exp;
  56243. addIfCondition(el, {
  56244. exp: exp,
  56245. block: el
  56246. });
  56247. } else {
  56248. if (getAndRemoveAttr(el, 'v-else') != null) {
  56249. el.else = true;
  56250. }
  56251. var elseif = getAndRemoveAttr(el, 'v-else-if');
  56252. if (elseif) {
  56253. el.elseif = elseif;
  56254. }
  56255. }
  56256. }
  56257. function processIfConditions (el, parent) {
  56258. var prev = findPrevElement(parent.children);
  56259. if (prev && prev.if) {
  56260. addIfCondition(prev, {
  56261. exp: el.elseif,
  56262. block: el
  56263. });
  56264. } else {
  56265. warn$2(
  56266. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  56267. "used on element <" + (el.tag) + "> without corresponding v-if.",
  56268. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  56269. );
  56270. }
  56271. }
  56272. function findPrevElement (children) {
  56273. var i = children.length;
  56274. while (i--) {
  56275. if (children[i].type === 1) {
  56276. return children[i]
  56277. } else {
  56278. if (children[i].text !== ' ') {
  56279. warn$2(
  56280. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  56281. "will be ignored.",
  56282. children[i]
  56283. );
  56284. }
  56285. children.pop();
  56286. }
  56287. }
  56288. }
  56289. function addIfCondition (el, condition) {
  56290. if (!el.ifConditions) {
  56291. el.ifConditions = [];
  56292. }
  56293. el.ifConditions.push(condition);
  56294. }
  56295. function processOnce (el) {
  56296. var once$$1 = getAndRemoveAttr(el, 'v-once');
  56297. if (once$$1 != null) {
  56298. el.once = true;
  56299. }
  56300. }
  56301. // handle content being passed to a component as slot,
  56302. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  56303. function processSlotContent (el) {
  56304. var slotScope;
  56305. if (el.tag === 'template') {
  56306. slotScope = getAndRemoveAttr(el, 'scope');
  56307. /* istanbul ignore if */
  56308. if (slotScope) {
  56309. warn$2(
  56310. "the \"scope\" attribute for scoped slots have been deprecated and " +
  56311. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  56312. "can also be used on plain elements in addition to <template> to " +
  56313. "denote scoped slots.",
  56314. el.rawAttrsMap['scope'],
  56315. true
  56316. );
  56317. }
  56318. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  56319. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  56320. /* istanbul ignore if */
  56321. if (el.attrsMap['v-for']) {
  56322. warn$2(
  56323. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  56324. "(v-for takes higher priority). Use a wrapper <template> for the " +
  56325. "scoped slot to make it clearer.",
  56326. el.rawAttrsMap['slot-scope'],
  56327. true
  56328. );
  56329. }
  56330. el.slotScope = slotScope;
  56331. }
  56332. // slot="xxx"
  56333. var slotTarget = getBindingAttr(el, 'slot');
  56334. if (slotTarget) {
  56335. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  56336. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  56337. // preserve slot as an attribute for native shadow DOM compat
  56338. // only for non-scoped slots.
  56339. if (el.tag !== 'template' && !el.slotScope) {
  56340. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  56341. }
  56342. }
  56343. // 2.6 v-slot syntax
  56344. {
  56345. if (el.tag === 'template') {
  56346. // v-slot on <template>
  56347. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  56348. if (slotBinding) {
  56349. {
  56350. if (el.slotTarget || el.slotScope) {
  56351. warn$2(
  56352. "Unexpected mixed usage of different slot syntaxes.",
  56353. el
  56354. );
  56355. }
  56356. if (el.parent && !maybeComponent(el.parent)) {
  56357. warn$2(
  56358. "<template v-slot> can only appear at the root level inside " +
  56359. "the receiving component",
  56360. el
  56361. );
  56362. }
  56363. }
  56364. var ref = getSlotName(slotBinding);
  56365. var name = ref.name;
  56366. var dynamic = ref.dynamic;
  56367. el.slotTarget = name;
  56368. el.slotTargetDynamic = dynamic;
  56369. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  56370. }
  56371. } else {
  56372. // v-slot on component, denotes default slot
  56373. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  56374. if (slotBinding$1) {
  56375. {
  56376. if (!maybeComponent(el)) {
  56377. warn$2(
  56378. "v-slot can only be used on components or <template>.",
  56379. slotBinding$1
  56380. );
  56381. }
  56382. if (el.slotScope || el.slotTarget) {
  56383. warn$2(
  56384. "Unexpected mixed usage of different slot syntaxes.",
  56385. el
  56386. );
  56387. }
  56388. if (el.scopedSlots) {
  56389. warn$2(
  56390. "To avoid scope ambiguity, the default slot should also use " +
  56391. "<template> syntax when there are other named slots.",
  56392. slotBinding$1
  56393. );
  56394. }
  56395. }
  56396. // add the component's children to its default slot
  56397. var slots = el.scopedSlots || (el.scopedSlots = {});
  56398. var ref$1 = getSlotName(slotBinding$1);
  56399. var name$1 = ref$1.name;
  56400. var dynamic$1 = ref$1.dynamic;
  56401. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  56402. slotContainer.slotTarget = name$1;
  56403. slotContainer.slotTargetDynamic = dynamic$1;
  56404. slotContainer.children = el.children.filter(function (c) {
  56405. if (!c.slotScope) {
  56406. c.parent = slotContainer;
  56407. return true
  56408. }
  56409. });
  56410. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  56411. // remove children as they are returned from scopedSlots now
  56412. el.children = [];
  56413. // mark el non-plain so data gets generated
  56414. el.plain = false;
  56415. }
  56416. }
  56417. }
  56418. }
  56419. function getSlotName (binding) {
  56420. var name = binding.name.replace(slotRE, '');
  56421. if (!name) {
  56422. if (binding.name[0] !== '#') {
  56423. name = 'default';
  56424. } else {
  56425. warn$2(
  56426. "v-slot shorthand syntax requires a slot name.",
  56427. binding
  56428. );
  56429. }
  56430. }
  56431. return dynamicArgRE.test(name)
  56432. // dynamic [name]
  56433. ? { name: name.slice(1, -1), dynamic: true }
  56434. // static name
  56435. : { name: ("\"" + name + "\""), dynamic: false }
  56436. }
  56437. // handle <slot/> outlets
  56438. function processSlotOutlet (el) {
  56439. if (el.tag === 'slot') {
  56440. el.slotName = getBindingAttr(el, 'name');
  56441. if (el.key) {
  56442. warn$2(
  56443. "`key` does not work on <slot> because slots are abstract outlets " +
  56444. "and can possibly expand into multiple elements. " +
  56445. "Use the key on a wrapping element instead.",
  56446. getRawBindingAttr(el, 'key')
  56447. );
  56448. }
  56449. }
  56450. }
  56451. function processComponent (el) {
  56452. var binding;
  56453. if ((binding = getBindingAttr(el, 'is'))) {
  56454. el.component = binding;
  56455. }
  56456. if (getAndRemoveAttr(el, 'inline-template') != null) {
  56457. el.inlineTemplate = true;
  56458. }
  56459. }
  56460. function processAttrs (el) {
  56461. var list = el.attrsList;
  56462. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  56463. for (i = 0, l = list.length; i < l; i++) {
  56464. name = rawName = list[i].name;
  56465. value = list[i].value;
  56466. if (dirRE.test(name)) {
  56467. // mark element as dynamic
  56468. el.hasBindings = true;
  56469. // modifiers
  56470. modifiers = parseModifiers(name.replace(dirRE, ''));
  56471. // support .foo shorthand syntax for the .prop modifier
  56472. if (modifiers) {
  56473. name = name.replace(modifierRE, '');
  56474. }
  56475. if (bindRE.test(name)) { // v-bind
  56476. name = name.replace(bindRE, '');
  56477. value = parseFilters(value);
  56478. isDynamic = dynamicArgRE.test(name);
  56479. if (isDynamic) {
  56480. name = name.slice(1, -1);
  56481. }
  56482. if (
  56483. value.trim().length === 0
  56484. ) {
  56485. warn$2(
  56486. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  56487. );
  56488. }
  56489. if (modifiers) {
  56490. if (modifiers.prop && !isDynamic) {
  56491. name = camelize(name);
  56492. if (name === 'innerHtml') { name = 'innerHTML'; }
  56493. }
  56494. if (modifiers.camel && !isDynamic) {
  56495. name = camelize(name);
  56496. }
  56497. if (modifiers.sync) {
  56498. syncGen = genAssignmentCode(value, "$event");
  56499. if (!isDynamic) {
  56500. addHandler(
  56501. el,
  56502. ("update:" + (camelize(name))),
  56503. syncGen,
  56504. null,
  56505. false,
  56506. warn$2,
  56507. list[i]
  56508. );
  56509. if (hyphenate(name) !== camelize(name)) {
  56510. addHandler(
  56511. el,
  56512. ("update:" + (hyphenate(name))),
  56513. syncGen,
  56514. null,
  56515. false,
  56516. warn$2,
  56517. list[i]
  56518. );
  56519. }
  56520. } else {
  56521. // handler w/ dynamic event name
  56522. addHandler(
  56523. el,
  56524. ("\"update:\"+(" + name + ")"),
  56525. syncGen,
  56526. null,
  56527. false,
  56528. warn$2,
  56529. list[i],
  56530. true // dynamic
  56531. );
  56532. }
  56533. }
  56534. }
  56535. if ((modifiers && modifiers.prop) || (
  56536. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  56537. )) {
  56538. addProp(el, name, value, list[i], isDynamic);
  56539. } else {
  56540. addAttr(el, name, value, list[i], isDynamic);
  56541. }
  56542. } else if (onRE.test(name)) { // v-on
  56543. name = name.replace(onRE, '');
  56544. isDynamic = dynamicArgRE.test(name);
  56545. if (isDynamic) {
  56546. name = name.slice(1, -1);
  56547. }
  56548. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  56549. } else { // normal directives
  56550. name = name.replace(dirRE, '');
  56551. // parse arg
  56552. var argMatch = name.match(argRE);
  56553. var arg = argMatch && argMatch[1];
  56554. isDynamic = false;
  56555. if (arg) {
  56556. name = name.slice(0, -(arg.length + 1));
  56557. if (dynamicArgRE.test(arg)) {
  56558. arg = arg.slice(1, -1);
  56559. isDynamic = true;
  56560. }
  56561. }
  56562. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  56563. if (name === 'model') {
  56564. checkForAliasModel(el, value);
  56565. }
  56566. }
  56567. } else {
  56568. // literal attribute
  56569. {
  56570. var res = parseText(value, delimiters);
  56571. if (res) {
  56572. warn$2(
  56573. name + "=\"" + value + "\": " +
  56574. 'Interpolation inside attributes has been removed. ' +
  56575. 'Use v-bind or the colon shorthand instead. For example, ' +
  56576. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  56577. list[i]
  56578. );
  56579. }
  56580. }
  56581. addAttr(el, name, JSON.stringify(value), list[i]);
  56582. // #6887 firefox doesn't update muted state if set via attribute
  56583. // even immediately after element creation
  56584. if (!el.component &&
  56585. name === 'muted' &&
  56586. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  56587. addProp(el, name, 'true', list[i]);
  56588. }
  56589. }
  56590. }
  56591. }
  56592. function checkInFor (el) {
  56593. var parent = el;
  56594. while (parent) {
  56595. if (parent.for !== undefined) {
  56596. return true
  56597. }
  56598. parent = parent.parent;
  56599. }
  56600. return false
  56601. }
  56602. function parseModifiers (name) {
  56603. var match = name.match(modifierRE);
  56604. if (match) {
  56605. var ret = {};
  56606. match.forEach(function (m) { ret[m.slice(1)] = true; });
  56607. return ret
  56608. }
  56609. }
  56610. function makeAttrsMap (attrs) {
  56611. var map = {};
  56612. for (var i = 0, l = attrs.length; i < l; i++) {
  56613. if (
  56614. map[attrs[i].name] && !isIE && !isEdge
  56615. ) {
  56616. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  56617. }
  56618. map[attrs[i].name] = attrs[i].value;
  56619. }
  56620. return map
  56621. }
  56622. // for script (e.g. type="x/template") or style, do not decode content
  56623. function isTextTag (el) {
  56624. return el.tag === 'script' || el.tag === 'style'
  56625. }
  56626. function isForbiddenTag (el) {
  56627. return (
  56628. el.tag === 'style' ||
  56629. (el.tag === 'script' && (
  56630. !el.attrsMap.type ||
  56631. el.attrsMap.type === 'text/javascript'
  56632. ))
  56633. )
  56634. }
  56635. var ieNSBug = /^xmlns:NS\d+/;
  56636. var ieNSPrefix = /^NS\d+:/;
  56637. /* istanbul ignore next */
  56638. function guardIESVGBug (attrs) {
  56639. var res = [];
  56640. for (var i = 0; i < attrs.length; i++) {
  56641. var attr = attrs[i];
  56642. if (!ieNSBug.test(attr.name)) {
  56643. attr.name = attr.name.replace(ieNSPrefix, '');
  56644. res.push(attr);
  56645. }
  56646. }
  56647. return res
  56648. }
  56649. function checkForAliasModel (el, value) {
  56650. var _el = el;
  56651. while (_el) {
  56652. if (_el.for && _el.alias === value) {
  56653. warn$2(
  56654. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  56655. "You are binding v-model directly to a v-for iteration alias. " +
  56656. "This will not be able to modify the v-for source array because " +
  56657. "writing to the alias is like modifying a function local variable. " +
  56658. "Consider using an array of objects and use v-model on an object property instead.",
  56659. el.rawAttrsMap['v-model']
  56660. );
  56661. }
  56662. _el = _el.parent;
  56663. }
  56664. }
  56665. /* */
  56666. function preTransformNode (el, options) {
  56667. if (el.tag === 'input') {
  56668. var map = el.attrsMap;
  56669. if (!map['v-model']) {
  56670. return
  56671. }
  56672. var typeBinding;
  56673. if (map[':type'] || map['v-bind:type']) {
  56674. typeBinding = getBindingAttr(el, 'type');
  56675. }
  56676. if (!map.type && !typeBinding && map['v-bind']) {
  56677. typeBinding = "(" + (map['v-bind']) + ").type";
  56678. }
  56679. if (typeBinding) {
  56680. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  56681. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  56682. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  56683. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  56684. // 1. checkbox
  56685. var branch0 = cloneASTElement(el);
  56686. // process for on the main node
  56687. processFor(branch0);
  56688. addRawAttr(branch0, 'type', 'checkbox');
  56689. processElement(branch0, options);
  56690. branch0.processed = true; // prevent it from double-processed
  56691. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  56692. addIfCondition(branch0, {
  56693. exp: branch0.if,
  56694. block: branch0
  56695. });
  56696. // 2. add radio else-if condition
  56697. var branch1 = cloneASTElement(el);
  56698. getAndRemoveAttr(branch1, 'v-for', true);
  56699. addRawAttr(branch1, 'type', 'radio');
  56700. processElement(branch1, options);
  56701. addIfCondition(branch0, {
  56702. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  56703. block: branch1
  56704. });
  56705. // 3. other
  56706. var branch2 = cloneASTElement(el);
  56707. getAndRemoveAttr(branch2, 'v-for', true);
  56708. addRawAttr(branch2, ':type', typeBinding);
  56709. processElement(branch2, options);
  56710. addIfCondition(branch0, {
  56711. exp: ifCondition,
  56712. block: branch2
  56713. });
  56714. if (hasElse) {
  56715. branch0.else = true;
  56716. } else if (elseIfCondition) {
  56717. branch0.elseif = elseIfCondition;
  56718. }
  56719. return branch0
  56720. }
  56721. }
  56722. }
  56723. function cloneASTElement (el) {
  56724. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  56725. }
  56726. var model$1 = {
  56727. preTransformNode: preTransformNode
  56728. };
  56729. var modules$1 = [
  56730. klass$1,
  56731. style$1,
  56732. model$1
  56733. ];
  56734. /* */
  56735. function text (el, dir) {
  56736. if (dir.value) {
  56737. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  56738. }
  56739. }
  56740. /* */
  56741. function html (el, dir) {
  56742. if (dir.value) {
  56743. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  56744. }
  56745. }
  56746. var directives$1 = {
  56747. model: model,
  56748. text: text,
  56749. html: html
  56750. };
  56751. /* */
  56752. var baseOptions = {
  56753. expectHTML: true,
  56754. modules: modules$1,
  56755. directives: directives$1,
  56756. isPreTag: isPreTag,
  56757. isUnaryTag: isUnaryTag,
  56758. mustUseProp: mustUseProp,
  56759. canBeLeftOpenTag: canBeLeftOpenTag,
  56760. isReservedTag: isReservedTag,
  56761. getTagNamespace: getTagNamespace,
  56762. staticKeys: genStaticKeys(modules$1)
  56763. };
  56764. /* */
  56765. var isStaticKey;
  56766. var isPlatformReservedTag;
  56767. var genStaticKeysCached = cached(genStaticKeys$1);
  56768. /**
  56769. * Goal of the optimizer: walk the generated template AST tree
  56770. * and detect sub-trees that are purely static, i.e. parts of
  56771. * the DOM that never needs to change.
  56772. *
  56773. * Once we detect these sub-trees, we can:
  56774. *
  56775. * 1. Hoist them into constants, so that we no longer need to
  56776. * create fresh nodes for them on each re-render;
  56777. * 2. Completely skip them in the patching process.
  56778. */
  56779. function optimize (root, options) {
  56780. if (!root) { return }
  56781. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  56782. isPlatformReservedTag = options.isReservedTag || no;
  56783. // first pass: mark all non-static nodes.
  56784. markStatic$1(root);
  56785. // second pass: mark static roots.
  56786. markStaticRoots(root, false);
  56787. }
  56788. function genStaticKeys$1 (keys) {
  56789. return makeMap(
  56790. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  56791. (keys ? ',' + keys : '')
  56792. )
  56793. }
  56794. function markStatic$1 (node) {
  56795. node.static = isStatic(node);
  56796. if (node.type === 1) {
  56797. // do not make component slot content static. this avoids
  56798. // 1. components not able to mutate slot nodes
  56799. // 2. static slot content fails for hot-reloading
  56800. if (
  56801. !isPlatformReservedTag(node.tag) &&
  56802. node.tag !== 'slot' &&
  56803. node.attrsMap['inline-template'] == null
  56804. ) {
  56805. return
  56806. }
  56807. for (var i = 0, l = node.children.length; i < l; i++) {
  56808. var child = node.children[i];
  56809. markStatic$1(child);
  56810. if (!child.static) {
  56811. node.static = false;
  56812. }
  56813. }
  56814. if (node.ifConditions) {
  56815. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  56816. var block = node.ifConditions[i$1].block;
  56817. markStatic$1(block);
  56818. if (!block.static) {
  56819. node.static = false;
  56820. }
  56821. }
  56822. }
  56823. }
  56824. }
  56825. function markStaticRoots (node, isInFor) {
  56826. if (node.type === 1) {
  56827. if (node.static || node.once) {
  56828. node.staticInFor = isInFor;
  56829. }
  56830. // For a node to qualify as a static root, it should have children that
  56831. // are not just static text. Otherwise the cost of hoisting out will
  56832. // outweigh the benefits and it's better off to just always render it fresh.
  56833. if (node.static && node.children.length && !(
  56834. node.children.length === 1 &&
  56835. node.children[0].type === 3
  56836. )) {
  56837. node.staticRoot = true;
  56838. return
  56839. } else {
  56840. node.staticRoot = false;
  56841. }
  56842. if (node.children) {
  56843. for (var i = 0, l = node.children.length; i < l; i++) {
  56844. markStaticRoots(node.children[i], isInFor || !!node.for);
  56845. }
  56846. }
  56847. if (node.ifConditions) {
  56848. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  56849. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  56850. }
  56851. }
  56852. }
  56853. }
  56854. function isStatic (node) {
  56855. if (node.type === 2) { // expression
  56856. return false
  56857. }
  56858. if (node.type === 3) { // text
  56859. return true
  56860. }
  56861. return !!(node.pre || (
  56862. !node.hasBindings && // no dynamic bindings
  56863. !node.if && !node.for && // not v-if or v-for or v-else
  56864. !isBuiltInTag(node.tag) && // not a built-in
  56865. isPlatformReservedTag(node.tag) && // not a component
  56866. !isDirectChildOfTemplateFor(node) &&
  56867. Object.keys(node).every(isStaticKey)
  56868. ))
  56869. }
  56870. function isDirectChildOfTemplateFor (node) {
  56871. while (node.parent) {
  56872. node = node.parent;
  56873. if (node.tag !== 'template') {
  56874. return false
  56875. }
  56876. if (node.for) {
  56877. return true
  56878. }
  56879. }
  56880. return false
  56881. }
  56882. /* */
  56883. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  56884. var fnInvokeRE = /\([^)]*?\);*$/;
  56885. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  56886. // KeyboardEvent.keyCode aliases
  56887. var keyCodes = {
  56888. esc: 27,
  56889. tab: 9,
  56890. enter: 13,
  56891. space: 32,
  56892. up: 38,
  56893. left: 37,
  56894. right: 39,
  56895. down: 40,
  56896. 'delete': [8, 46]
  56897. };
  56898. // KeyboardEvent.key aliases
  56899. var keyNames = {
  56900. // #7880: IE11 and Edge use `Esc` for Escape key name.
  56901. esc: ['Esc', 'Escape'],
  56902. tab: 'Tab',
  56903. enter: 'Enter',
  56904. // #9112: IE11 uses `Spacebar` for Space key name.
  56905. space: [' ', 'Spacebar'],
  56906. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  56907. up: ['Up', 'ArrowUp'],
  56908. left: ['Left', 'ArrowLeft'],
  56909. right: ['Right', 'ArrowRight'],
  56910. down: ['Down', 'ArrowDown'],
  56911. // #9112: IE11 uses `Del` for Delete key name.
  56912. 'delete': ['Backspace', 'Delete', 'Del']
  56913. };
  56914. // #4868: modifiers that prevent the execution of the listener
  56915. // need to explicitly return null so that we can determine whether to remove
  56916. // the listener for .once
  56917. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  56918. var modifierCode = {
  56919. stop: '$event.stopPropagation();',
  56920. prevent: '$event.preventDefault();',
  56921. self: genGuard("$event.target !== $event.currentTarget"),
  56922. ctrl: genGuard("!$event.ctrlKey"),
  56923. shift: genGuard("!$event.shiftKey"),
  56924. alt: genGuard("!$event.altKey"),
  56925. meta: genGuard("!$event.metaKey"),
  56926. left: genGuard("'button' in $event && $event.button !== 0"),
  56927. middle: genGuard("'button' in $event && $event.button !== 1"),
  56928. right: genGuard("'button' in $event && $event.button !== 2")
  56929. };
  56930. function genHandlers (
  56931. events,
  56932. isNative
  56933. ) {
  56934. var prefix = isNative ? 'nativeOn:' : 'on:';
  56935. var staticHandlers = "";
  56936. var dynamicHandlers = "";
  56937. for (var name in events) {
  56938. var handlerCode = genHandler(events[name]);
  56939. if (events[name] && events[name].dynamic) {
  56940. dynamicHandlers += name + "," + handlerCode + ",";
  56941. } else {
  56942. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  56943. }
  56944. }
  56945. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  56946. if (dynamicHandlers) {
  56947. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  56948. } else {
  56949. return prefix + staticHandlers
  56950. }
  56951. }
  56952. function genHandler (handler) {
  56953. if (!handler) {
  56954. return 'function(){}'
  56955. }
  56956. if (Array.isArray(handler)) {
  56957. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  56958. }
  56959. var isMethodPath = simplePathRE.test(handler.value);
  56960. var isFunctionExpression = fnExpRE.test(handler.value);
  56961. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  56962. if (!handler.modifiers) {
  56963. if (isMethodPath || isFunctionExpression) {
  56964. return handler.value
  56965. }
  56966. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  56967. } else {
  56968. var code = '';
  56969. var genModifierCode = '';
  56970. var keys = [];
  56971. for (var key in handler.modifiers) {
  56972. if (modifierCode[key]) {
  56973. genModifierCode += modifierCode[key];
  56974. // left/right
  56975. if (keyCodes[key]) {
  56976. keys.push(key);
  56977. }
  56978. } else if (key === 'exact') {
  56979. var modifiers = (handler.modifiers);
  56980. genModifierCode += genGuard(
  56981. ['ctrl', 'shift', 'alt', 'meta']
  56982. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  56983. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  56984. .join('||')
  56985. );
  56986. } else {
  56987. keys.push(key);
  56988. }
  56989. }
  56990. if (keys.length) {
  56991. code += genKeyFilter(keys);
  56992. }
  56993. // Make sure modifiers like prevent and stop get executed after key filtering
  56994. if (genModifierCode) {
  56995. code += genModifierCode;
  56996. }
  56997. var handlerCode = isMethodPath
  56998. ? ("return " + (handler.value) + "($event)")
  56999. : isFunctionExpression
  57000. ? ("return (" + (handler.value) + ")($event)")
  57001. : isFunctionInvocation
  57002. ? ("return " + (handler.value))
  57003. : handler.value;
  57004. return ("function($event){" + code + handlerCode + "}")
  57005. }
  57006. }
  57007. function genKeyFilter (keys) {
  57008. return (
  57009. // make sure the key filters only apply to KeyboardEvents
  57010. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  57011. // key events that do not have keyCode property...
  57012. "if(!$event.type.indexOf('key')&&" +
  57013. (keys.map(genFilterCode).join('&&')) + ")return null;"
  57014. )
  57015. }
  57016. function genFilterCode (key) {
  57017. var keyVal = parseInt(key, 10);
  57018. if (keyVal) {
  57019. return ("$event.keyCode!==" + keyVal)
  57020. }
  57021. var keyCode = keyCodes[key];
  57022. var keyName = keyNames[key];
  57023. return (
  57024. "_k($event.keyCode," +
  57025. (JSON.stringify(key)) + "," +
  57026. (JSON.stringify(keyCode)) + "," +
  57027. "$event.key," +
  57028. "" + (JSON.stringify(keyName)) +
  57029. ")"
  57030. )
  57031. }
  57032. /* */
  57033. function on (el, dir) {
  57034. if (dir.modifiers) {
  57035. warn("v-on without argument does not support modifiers.");
  57036. }
  57037. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  57038. }
  57039. /* */
  57040. function bind$1 (el, dir) {
  57041. el.wrapData = function (code) {
  57042. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  57043. };
  57044. }
  57045. /* */
  57046. var baseDirectives = {
  57047. on: on,
  57048. bind: bind$1,
  57049. cloak: noop
  57050. };
  57051. /* */
  57052. var CodegenState = function CodegenState (options) {
  57053. this.options = options;
  57054. this.warn = options.warn || baseWarn;
  57055. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  57056. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  57057. this.directives = extend(extend({}, baseDirectives), options.directives);
  57058. var isReservedTag = options.isReservedTag || no;
  57059. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57060. this.onceId = 0;
  57061. this.staticRenderFns = [];
  57062. this.pre = false;
  57063. };
  57064. function generate (
  57065. ast,
  57066. options
  57067. ) {
  57068. var state = new CodegenState(options);
  57069. var code = ast ? genElement(ast, state) : '_c("div")';
  57070. return {
  57071. render: ("with(this){return " + code + "}"),
  57072. staticRenderFns: state.staticRenderFns
  57073. }
  57074. }
  57075. function genElement (el, state) {
  57076. if (el.parent) {
  57077. el.pre = el.pre || el.parent.pre;
  57078. }
  57079. if (el.staticRoot && !el.staticProcessed) {
  57080. return genStatic(el, state)
  57081. } else if (el.once && !el.onceProcessed) {
  57082. return genOnce(el, state)
  57083. } else if (el.for && !el.forProcessed) {
  57084. return genFor(el, state)
  57085. } else if (el.if && !el.ifProcessed) {
  57086. return genIf(el, state)
  57087. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  57088. return genChildren(el, state) || 'void 0'
  57089. } else if (el.tag === 'slot') {
  57090. return genSlot(el, state)
  57091. } else {
  57092. // component or element
  57093. var code;
  57094. if (el.component) {
  57095. code = genComponent(el.component, el, state);
  57096. } else {
  57097. var data;
  57098. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  57099. data = genData$2(el, state);
  57100. }
  57101. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  57102. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  57103. }
  57104. // module transforms
  57105. for (var i = 0; i < state.transforms.length; i++) {
  57106. code = state.transforms[i](el, code);
  57107. }
  57108. return code
  57109. }
  57110. }
  57111. // hoist static sub-trees out
  57112. function genStatic (el, state) {
  57113. el.staticProcessed = true;
  57114. // Some elements (templates) need to behave differently inside of a v-pre
  57115. // node. All pre nodes are static roots, so we can use this as a location to
  57116. // wrap a state change and reset it upon exiting the pre node.
  57117. var originalPreState = state.pre;
  57118. if (el.pre) {
  57119. state.pre = el.pre;
  57120. }
  57121. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  57122. state.pre = originalPreState;
  57123. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  57124. }
  57125. // v-once
  57126. function genOnce (el, state) {
  57127. el.onceProcessed = true;
  57128. if (el.if && !el.ifProcessed) {
  57129. return genIf(el, state)
  57130. } else if (el.staticInFor) {
  57131. var key = '';
  57132. var parent = el.parent;
  57133. while (parent) {
  57134. if (parent.for) {
  57135. key = parent.key;
  57136. break
  57137. }
  57138. parent = parent.parent;
  57139. }
  57140. if (!key) {
  57141. state.warn(
  57142. "v-once can only be used inside v-for that is keyed. ",
  57143. el.rawAttrsMap['v-once']
  57144. );
  57145. return genElement(el, state)
  57146. }
  57147. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  57148. } else {
  57149. return genStatic(el, state)
  57150. }
  57151. }
  57152. function genIf (
  57153. el,
  57154. state,
  57155. altGen,
  57156. altEmpty
  57157. ) {
  57158. el.ifProcessed = true; // avoid recursion
  57159. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  57160. }
  57161. function genIfConditions (
  57162. conditions,
  57163. state,
  57164. altGen,
  57165. altEmpty
  57166. ) {
  57167. if (!conditions.length) {
  57168. return altEmpty || '_e()'
  57169. }
  57170. var condition = conditions.shift();
  57171. if (condition.exp) {
  57172. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  57173. } else {
  57174. return ("" + (genTernaryExp(condition.block)))
  57175. }
  57176. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  57177. function genTernaryExp (el) {
  57178. return altGen
  57179. ? altGen(el, state)
  57180. : el.once
  57181. ? genOnce(el, state)
  57182. : genElement(el, state)
  57183. }
  57184. }
  57185. function genFor (
  57186. el,
  57187. state,
  57188. altGen,
  57189. altHelper
  57190. ) {
  57191. var exp = el.for;
  57192. var alias = el.alias;
  57193. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  57194. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  57195. if (state.maybeComponent(el) &&
  57196. el.tag !== 'slot' &&
  57197. el.tag !== 'template' &&
  57198. !el.key
  57199. ) {
  57200. state.warn(
  57201. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  57202. "v-for should have explicit keys. " +
  57203. "See https://vuejs.org/guide/list.html#key for more info.",
  57204. el.rawAttrsMap['v-for'],
  57205. true /* tip */
  57206. );
  57207. }
  57208. el.forProcessed = true; // avoid recursion
  57209. return (altHelper || '_l') + "((" + exp + ")," +
  57210. "function(" + alias + iterator1 + iterator2 + "){" +
  57211. "return " + ((altGen || genElement)(el, state)) +
  57212. '})'
  57213. }
  57214. function genData$2 (el, state) {
  57215. var data = '{';
  57216. // directives first.
  57217. // directives may mutate the el's other properties before they are generated.
  57218. var dirs = genDirectives(el, state);
  57219. if (dirs) { data += dirs + ','; }
  57220. // key
  57221. if (el.key) {
  57222. data += "key:" + (el.key) + ",";
  57223. }
  57224. // ref
  57225. if (el.ref) {
  57226. data += "ref:" + (el.ref) + ",";
  57227. }
  57228. if (el.refInFor) {
  57229. data += "refInFor:true,";
  57230. }
  57231. // pre
  57232. if (el.pre) {
  57233. data += "pre:true,";
  57234. }
  57235. // record original tag name for components using "is" attribute
  57236. if (el.component) {
  57237. data += "tag:\"" + (el.tag) + "\",";
  57238. }
  57239. // module data generation functions
  57240. for (var i = 0; i < state.dataGenFns.length; i++) {
  57241. data += state.dataGenFns[i](el);
  57242. }
  57243. // attributes
  57244. if (el.attrs) {
  57245. data += "attrs:" + (genProps(el.attrs)) + ",";
  57246. }
  57247. // DOM props
  57248. if (el.props) {
  57249. data += "domProps:" + (genProps(el.props)) + ",";
  57250. }
  57251. // event handlers
  57252. if (el.events) {
  57253. data += (genHandlers(el.events, false)) + ",";
  57254. }
  57255. if (el.nativeEvents) {
  57256. data += (genHandlers(el.nativeEvents, true)) + ",";
  57257. }
  57258. // slot target
  57259. // only for non-scoped slots
  57260. if (el.slotTarget && !el.slotScope) {
  57261. data += "slot:" + (el.slotTarget) + ",";
  57262. }
  57263. // scoped slots
  57264. if (el.scopedSlots) {
  57265. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  57266. }
  57267. // component v-model
  57268. if (el.model) {
  57269. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  57270. }
  57271. // inline-template
  57272. if (el.inlineTemplate) {
  57273. var inlineTemplate = genInlineTemplate(el, state);
  57274. if (inlineTemplate) {
  57275. data += inlineTemplate + ",";
  57276. }
  57277. }
  57278. data = data.replace(/,$/, '') + '}';
  57279. // v-bind dynamic argument wrap
  57280. // v-bind with dynamic arguments must be applied using the same v-bind object
  57281. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  57282. if (el.dynamicAttrs) {
  57283. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  57284. }
  57285. // v-bind data wrap
  57286. if (el.wrapData) {
  57287. data = el.wrapData(data);
  57288. }
  57289. // v-on data wrap
  57290. if (el.wrapListeners) {
  57291. data = el.wrapListeners(data);
  57292. }
  57293. return data
  57294. }
  57295. function genDirectives (el, state) {
  57296. var dirs = el.directives;
  57297. if (!dirs) { return }
  57298. var res = 'directives:[';
  57299. var hasRuntime = false;
  57300. var i, l, dir, needRuntime;
  57301. for (i = 0, l = dirs.length; i < l; i++) {
  57302. dir = dirs[i];
  57303. needRuntime = true;
  57304. var gen = state.directives[dir.name];
  57305. if (gen) {
  57306. // compile-time directive that manipulates AST.
  57307. // returns true if it also needs a runtime counterpart.
  57308. needRuntime = !!gen(el, dir, state.warn);
  57309. }
  57310. if (needRuntime) {
  57311. hasRuntime = true;
  57312. 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))) : '') + "},";
  57313. }
  57314. }
  57315. if (hasRuntime) {
  57316. return res.slice(0, -1) + ']'
  57317. }
  57318. }
  57319. function genInlineTemplate (el, state) {
  57320. var ast = el.children[0];
  57321. if (el.children.length !== 1 || ast.type !== 1) {
  57322. state.warn(
  57323. 'Inline-template components must have exactly one child element.',
  57324. { start: el.start }
  57325. );
  57326. }
  57327. if (ast && ast.type === 1) {
  57328. var inlineRenderFns = generate(ast, state.options);
  57329. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  57330. }
  57331. }
  57332. function genScopedSlots (
  57333. el,
  57334. slots,
  57335. state
  57336. ) {
  57337. // by default scoped slots are considered "stable", this allows child
  57338. // components with only scoped slots to skip forced updates from parent.
  57339. // but in some cases we have to bail-out of this optimization
  57340. // for example if the slot contains dynamic names, has v-if or v-for on them...
  57341. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  57342. var slot = slots[key];
  57343. return (
  57344. slot.slotTargetDynamic ||
  57345. slot.if ||
  57346. slot.for ||
  57347. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  57348. )
  57349. });
  57350. // #9534: if a component with scoped slots is inside a conditional branch,
  57351. // it's possible for the same component to be reused but with different
  57352. // compiled slot content. To avoid that, we generate a unique key based on
  57353. // the generated code of all the slot contents.
  57354. var needsKey = !!el.if;
  57355. // OR when it is inside another scoped slot or v-for (the reactivity may be
  57356. // disconnected due to the intermediate scope variable)
  57357. // #9438, #9506
  57358. // TODO: this can be further optimized by properly analyzing in-scope bindings
  57359. // and skip force updating ones that do not actually use scope variables.
  57360. if (!needsForceUpdate) {
  57361. var parent = el.parent;
  57362. while (parent) {
  57363. if (
  57364. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  57365. parent.for
  57366. ) {
  57367. needsForceUpdate = true;
  57368. break
  57369. }
  57370. if (parent.if) {
  57371. needsKey = true;
  57372. }
  57373. parent = parent.parent;
  57374. }
  57375. }
  57376. var generatedSlots = Object.keys(slots)
  57377. .map(function (key) { return genScopedSlot(slots[key], state); })
  57378. .join(',');
  57379. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  57380. }
  57381. function hash(str) {
  57382. var hash = 5381;
  57383. var i = str.length;
  57384. while(i) {
  57385. hash = (hash * 33) ^ str.charCodeAt(--i);
  57386. }
  57387. return hash >>> 0
  57388. }
  57389. function containsSlotChild (el) {
  57390. if (el.type === 1) {
  57391. if (el.tag === 'slot') {
  57392. return true
  57393. }
  57394. return el.children.some(containsSlotChild)
  57395. }
  57396. return false
  57397. }
  57398. function genScopedSlot (
  57399. el,
  57400. state
  57401. ) {
  57402. var isLegacySyntax = el.attrsMap['slot-scope'];
  57403. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  57404. return genIf(el, state, genScopedSlot, "null")
  57405. }
  57406. if (el.for && !el.forProcessed) {
  57407. return genFor(el, state, genScopedSlot)
  57408. }
  57409. var slotScope = el.slotScope === emptySlotScopeToken
  57410. ? ""
  57411. : String(el.slotScope);
  57412. var fn = "function(" + slotScope + "){" +
  57413. "return " + (el.tag === 'template'
  57414. ? el.if && isLegacySyntax
  57415. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  57416. : genChildren(el, state) || 'undefined'
  57417. : genElement(el, state)) + "}";
  57418. // reverse proxy v-slot without scope on this.$slots
  57419. var reverseProxy = slotScope ? "" : ",proxy:true";
  57420. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  57421. }
  57422. function genChildren (
  57423. el,
  57424. state,
  57425. checkSkip,
  57426. altGenElement,
  57427. altGenNode
  57428. ) {
  57429. var children = el.children;
  57430. if (children.length) {
  57431. var el$1 = children[0];
  57432. // optimize single v-for
  57433. if (children.length === 1 &&
  57434. el$1.for &&
  57435. el$1.tag !== 'template' &&
  57436. el$1.tag !== 'slot'
  57437. ) {
  57438. var normalizationType = checkSkip
  57439. ? state.maybeComponent(el$1) ? ",1" : ",0"
  57440. : "";
  57441. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  57442. }
  57443. var normalizationType$1 = checkSkip
  57444. ? getNormalizationType(children, state.maybeComponent)
  57445. : 0;
  57446. var gen = altGenNode || genNode;
  57447. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  57448. }
  57449. }
  57450. // determine the normalization needed for the children array.
  57451. // 0: no normalization needed
  57452. // 1: simple normalization needed (possible 1-level deep nested array)
  57453. // 2: full normalization needed
  57454. function getNormalizationType (
  57455. children,
  57456. maybeComponent
  57457. ) {
  57458. var res = 0;
  57459. for (var i = 0; i < children.length; i++) {
  57460. var el = children[i];
  57461. if (el.type !== 1) {
  57462. continue
  57463. }
  57464. if (needsNormalization(el) ||
  57465. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  57466. res = 2;
  57467. break
  57468. }
  57469. if (maybeComponent(el) ||
  57470. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  57471. res = 1;
  57472. }
  57473. }
  57474. return res
  57475. }
  57476. function needsNormalization (el) {
  57477. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  57478. }
  57479. function genNode (node, state) {
  57480. if (node.type === 1) {
  57481. return genElement(node, state)
  57482. } else if (node.type === 3 && node.isComment) {
  57483. return genComment(node)
  57484. } else {
  57485. return genText(node)
  57486. }
  57487. }
  57488. function genText (text) {
  57489. return ("_v(" + (text.type === 2
  57490. ? text.expression // no need for () because already wrapped in _s()
  57491. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  57492. }
  57493. function genComment (comment) {
  57494. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  57495. }
  57496. function genSlot (el, state) {
  57497. var slotName = el.slotName || '"default"';
  57498. var children = genChildren(el, state);
  57499. var res = "_t(" + slotName + (children ? ("," + children) : '');
  57500. var attrs = el.attrs || el.dynamicAttrs
  57501. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  57502. // slot props are camelized
  57503. name: camelize(attr.name),
  57504. value: attr.value,
  57505. dynamic: attr.dynamic
  57506. }); }))
  57507. : null;
  57508. var bind$$1 = el.attrsMap['v-bind'];
  57509. if ((attrs || bind$$1) && !children) {
  57510. res += ",null";
  57511. }
  57512. if (attrs) {
  57513. res += "," + attrs;
  57514. }
  57515. if (bind$$1) {
  57516. res += (attrs ? '' : ',null') + "," + bind$$1;
  57517. }
  57518. return res + ')'
  57519. }
  57520. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  57521. function genComponent (
  57522. componentName,
  57523. el,
  57524. state
  57525. ) {
  57526. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  57527. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  57528. }
  57529. function genProps (props) {
  57530. var staticProps = "";
  57531. var dynamicProps = "";
  57532. for (var i = 0; i < props.length; i++) {
  57533. var prop = props[i];
  57534. var value = transformSpecialNewlines(prop.value);
  57535. if (prop.dynamic) {
  57536. dynamicProps += (prop.name) + "," + value + ",";
  57537. } else {
  57538. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  57539. }
  57540. }
  57541. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  57542. if (dynamicProps) {
  57543. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  57544. } else {
  57545. return staticProps
  57546. }
  57547. }
  57548. // #3895, #4268
  57549. function transformSpecialNewlines (text) {
  57550. return text
  57551. .replace(/\u2028/g, '\\u2028')
  57552. .replace(/\u2029/g, '\\u2029')
  57553. }
  57554. /* */
  57555. // these keywords should not appear inside expressions, but operators like
  57556. // typeof, instanceof and in are allowed
  57557. var prohibitedKeywordRE = new RegExp('\\b' + (
  57558. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  57559. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  57560. 'extends,finally,continue,debugger,function,arguments'
  57561. ).split(',').join('\\b|\\b') + '\\b');
  57562. // these unary operators should not be used as property/method names
  57563. var unaryOperatorsRE = new RegExp('\\b' + (
  57564. 'delete,typeof,void'
  57565. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  57566. // strip strings in expressions
  57567. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  57568. // detect problematic expressions in a template
  57569. function detectErrors (ast, warn) {
  57570. if (ast) {
  57571. checkNode(ast, warn);
  57572. }
  57573. }
  57574. function checkNode (node, warn) {
  57575. if (node.type === 1) {
  57576. for (var name in node.attrsMap) {
  57577. if (dirRE.test(name)) {
  57578. var value = node.attrsMap[name];
  57579. if (value) {
  57580. var range = node.rawAttrsMap[name];
  57581. if (name === 'v-for') {
  57582. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  57583. } else if (name === 'v-slot' || name[0] === '#') {
  57584. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  57585. } else if (onRE.test(name)) {
  57586. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  57587. } else {
  57588. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  57589. }
  57590. }
  57591. }
  57592. }
  57593. if (node.children) {
  57594. for (var i = 0; i < node.children.length; i++) {
  57595. checkNode(node.children[i], warn);
  57596. }
  57597. }
  57598. } else if (node.type === 2) {
  57599. checkExpression(node.expression, node.text, warn, node);
  57600. }
  57601. }
  57602. function checkEvent (exp, text, warn, range) {
  57603. var stripped = exp.replace(stripStringRE, '');
  57604. var keywordMatch = stripped.match(unaryOperatorsRE);
  57605. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  57606. warn(
  57607. "avoid using JavaScript unary operator as property name: " +
  57608. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  57609. range
  57610. );
  57611. }
  57612. checkExpression(exp, text, warn, range);
  57613. }
  57614. function checkFor (node, text, warn, range) {
  57615. checkExpression(node.for || '', text, warn, range);
  57616. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  57617. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  57618. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  57619. }
  57620. function checkIdentifier (
  57621. ident,
  57622. type,
  57623. text,
  57624. warn,
  57625. range
  57626. ) {
  57627. if (typeof ident === 'string') {
  57628. try {
  57629. new Function(("var " + ident + "=_"));
  57630. } catch (e) {
  57631. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  57632. }
  57633. }
  57634. }
  57635. function checkExpression (exp, text, warn, range) {
  57636. try {
  57637. new Function(("return " + exp));
  57638. } catch (e) {
  57639. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  57640. if (keywordMatch) {
  57641. warn(
  57642. "avoid using JavaScript keyword as property name: " +
  57643. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  57644. range
  57645. );
  57646. } else {
  57647. warn(
  57648. "invalid expression: " + (e.message) + " in\n\n" +
  57649. " " + exp + "\n\n" +
  57650. " Raw expression: " + (text.trim()) + "\n",
  57651. range
  57652. );
  57653. }
  57654. }
  57655. }
  57656. function checkFunctionParameterExpression (exp, text, warn, range) {
  57657. try {
  57658. new Function(exp, '');
  57659. } catch (e) {
  57660. warn(
  57661. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  57662. " " + exp + "\n\n" +
  57663. " Raw expression: " + (text.trim()) + "\n",
  57664. range
  57665. );
  57666. }
  57667. }
  57668. /* */
  57669. var range = 2;
  57670. function generateCodeFrame (
  57671. source,
  57672. start,
  57673. end
  57674. ) {
  57675. if ( start === void 0 ) start = 0;
  57676. if ( end === void 0 ) end = source.length;
  57677. var lines = source.split(/\r?\n/);
  57678. var count = 0;
  57679. var res = [];
  57680. for (var i = 0; i < lines.length; i++) {
  57681. count += lines[i].length + 1;
  57682. if (count >= start) {
  57683. for (var j = i - range; j <= i + range || end > count; j++) {
  57684. if (j < 0 || j >= lines.length) { continue }
  57685. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  57686. var lineLength = lines[j].length;
  57687. if (j === i) {
  57688. // push underline
  57689. var pad = start - (count - lineLength) + 1;
  57690. var length = end > count ? lineLength - pad : end - start;
  57691. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  57692. } else if (j > i) {
  57693. if (end > count) {
  57694. var length$1 = Math.min(end - count, lineLength);
  57695. res.push(" | " + repeat$1("^", length$1));
  57696. }
  57697. count += lineLength + 1;
  57698. }
  57699. }
  57700. break
  57701. }
  57702. }
  57703. return res.join('\n')
  57704. }
  57705. function repeat$1 (str, n) {
  57706. var result = '';
  57707. if (n > 0) {
  57708. while (true) { // eslint-disable-line
  57709. if (n & 1) { result += str; }
  57710. n >>>= 1;
  57711. if (n <= 0) { break }
  57712. str += str;
  57713. }
  57714. }
  57715. return result
  57716. }
  57717. /* */
  57718. function createFunction (code, errors) {
  57719. try {
  57720. return new Function(code)
  57721. } catch (err) {
  57722. errors.push({ err: err, code: code });
  57723. return noop
  57724. }
  57725. }
  57726. function createCompileToFunctionFn (compile) {
  57727. var cache = Object.create(null);
  57728. return function compileToFunctions (
  57729. template,
  57730. options,
  57731. vm
  57732. ) {
  57733. options = extend({}, options);
  57734. var warn$$1 = options.warn || warn;
  57735. delete options.warn;
  57736. /* istanbul ignore if */
  57737. {
  57738. // detect possible CSP restriction
  57739. try {
  57740. new Function('return 1');
  57741. } catch (e) {
  57742. if (e.toString().match(/unsafe-eval|CSP/)) {
  57743. warn$$1(
  57744. 'It seems you are using the standalone build of Vue.js in an ' +
  57745. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  57746. 'The template compiler cannot work in this environment. Consider ' +
  57747. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  57748. 'templates into render functions.'
  57749. );
  57750. }
  57751. }
  57752. }
  57753. // check cache
  57754. var key = options.delimiters
  57755. ? String(options.delimiters) + template
  57756. : template;
  57757. if (cache[key]) {
  57758. return cache[key]
  57759. }
  57760. // compile
  57761. var compiled = compile(template, options);
  57762. // check compilation errors/tips
  57763. {
  57764. if (compiled.errors && compiled.errors.length) {
  57765. if (options.outputSourceRange) {
  57766. compiled.errors.forEach(function (e) {
  57767. warn$$1(
  57768. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  57769. generateCodeFrame(template, e.start, e.end),
  57770. vm
  57771. );
  57772. });
  57773. } else {
  57774. warn$$1(
  57775. "Error compiling template:\n\n" + template + "\n\n" +
  57776. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  57777. vm
  57778. );
  57779. }
  57780. }
  57781. if (compiled.tips && compiled.tips.length) {
  57782. if (options.outputSourceRange) {
  57783. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  57784. } else {
  57785. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  57786. }
  57787. }
  57788. }
  57789. // turn code into functions
  57790. var res = {};
  57791. var fnGenErrors = [];
  57792. res.render = createFunction(compiled.render, fnGenErrors);
  57793. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  57794. return createFunction(code, fnGenErrors)
  57795. });
  57796. // check function generation errors.
  57797. // this should only happen if there is a bug in the compiler itself.
  57798. // mostly for codegen development use
  57799. /* istanbul ignore if */
  57800. {
  57801. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  57802. warn$$1(
  57803. "Failed to generate render function:\n\n" +
  57804. fnGenErrors.map(function (ref) {
  57805. var err = ref.err;
  57806. var code = ref.code;
  57807. return ((err.toString()) + " in\n\n" + code + "\n");
  57808. }).join('\n'),
  57809. vm
  57810. );
  57811. }
  57812. }
  57813. return (cache[key] = res)
  57814. }
  57815. }
  57816. /* */
  57817. function createCompilerCreator (baseCompile) {
  57818. return function createCompiler (baseOptions) {
  57819. function compile (
  57820. template,
  57821. options
  57822. ) {
  57823. var finalOptions = Object.create(baseOptions);
  57824. var errors = [];
  57825. var tips = [];
  57826. var warn = function (msg, range, tip) {
  57827. (tip ? tips : errors).push(msg);
  57828. };
  57829. if (options) {
  57830. if (options.outputSourceRange) {
  57831. // $flow-disable-line
  57832. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  57833. warn = function (msg, range, tip) {
  57834. var data = { msg: msg };
  57835. if (range) {
  57836. if (range.start != null) {
  57837. data.start = range.start + leadingSpaceLength;
  57838. }
  57839. if (range.end != null) {
  57840. data.end = range.end + leadingSpaceLength;
  57841. }
  57842. }
  57843. (tip ? tips : errors).push(data);
  57844. };
  57845. }
  57846. // merge custom modules
  57847. if (options.modules) {
  57848. finalOptions.modules =
  57849. (baseOptions.modules || []).concat(options.modules);
  57850. }
  57851. // merge custom directives
  57852. if (options.directives) {
  57853. finalOptions.directives = extend(
  57854. Object.create(baseOptions.directives || null),
  57855. options.directives
  57856. );
  57857. }
  57858. // copy other options
  57859. for (var key in options) {
  57860. if (key !== 'modules' && key !== 'directives') {
  57861. finalOptions[key] = options[key];
  57862. }
  57863. }
  57864. }
  57865. finalOptions.warn = warn;
  57866. var compiled = baseCompile(template.trim(), finalOptions);
  57867. {
  57868. detectErrors(compiled.ast, warn);
  57869. }
  57870. compiled.errors = errors;
  57871. compiled.tips = tips;
  57872. return compiled
  57873. }
  57874. return {
  57875. compile: compile,
  57876. compileToFunctions: createCompileToFunctionFn(compile)
  57877. }
  57878. }
  57879. }
  57880. /* */
  57881. // `createCompilerCreator` allows creating compilers that use alternative
  57882. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  57883. // Here we just export a default compiler using the default parts.
  57884. var createCompiler = createCompilerCreator(function baseCompile (
  57885. template,
  57886. options
  57887. ) {
  57888. var ast = parse(template.trim(), options);
  57889. if (options.optimize !== false) {
  57890. optimize(ast, options);
  57891. }
  57892. var code = generate(ast, options);
  57893. return {
  57894. ast: ast,
  57895. render: code.render,
  57896. staticRenderFns: code.staticRenderFns
  57897. }
  57898. });
  57899. /* */
  57900. var ref$1 = createCompiler(baseOptions);
  57901. var compile = ref$1.compile;
  57902. var compileToFunctions = ref$1.compileToFunctions;
  57903. /* */
  57904. // check whether current browser encodes a char inside attribute values
  57905. var div;
  57906. function getShouldDecode (href) {
  57907. div = div || document.createElement('div');
  57908. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  57909. return div.innerHTML.indexOf('&#10;') > 0
  57910. }
  57911. // #3663: IE encodes newlines inside attribute values while other browsers don't
  57912. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  57913. // #6828: chrome encodes content in a[href]
  57914. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  57915. /* */
  57916. var idToTemplate = cached(function (id) {
  57917. var el = query(id);
  57918. return el && el.innerHTML
  57919. });
  57920. var mount = Vue.prototype.$mount;
  57921. Vue.prototype.$mount = function (
  57922. el,
  57923. hydrating
  57924. ) {
  57925. el = el && query(el);
  57926. /* istanbul ignore if */
  57927. if (el === document.body || el === document.documentElement) {
  57928. warn(
  57929. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  57930. );
  57931. return this
  57932. }
  57933. var options = this.$options;
  57934. // resolve template/el and convert to render function
  57935. if (!options.render) {
  57936. var template = options.template;
  57937. if (template) {
  57938. if (typeof template === 'string') {
  57939. if (template.charAt(0) === '#') {
  57940. template = idToTemplate(template);
  57941. /* istanbul ignore if */
  57942. if (!template) {
  57943. warn(
  57944. ("Template element not found or is empty: " + (options.template)),
  57945. this
  57946. );
  57947. }
  57948. }
  57949. } else if (template.nodeType) {
  57950. template = template.innerHTML;
  57951. } else {
  57952. {
  57953. warn('invalid template option:' + template, this);
  57954. }
  57955. return this
  57956. }
  57957. } else if (el) {
  57958. template = getOuterHTML(el);
  57959. }
  57960. if (template) {
  57961. /* istanbul ignore if */
  57962. if (config.performance && mark) {
  57963. mark('compile');
  57964. }
  57965. var ref = compileToFunctions(template, {
  57966. outputSourceRange: "development" !== 'production',
  57967. shouldDecodeNewlines: shouldDecodeNewlines,
  57968. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  57969. delimiters: options.delimiters,
  57970. comments: options.comments
  57971. }, this);
  57972. var render = ref.render;
  57973. var staticRenderFns = ref.staticRenderFns;
  57974. options.render = render;
  57975. options.staticRenderFns = staticRenderFns;
  57976. /* istanbul ignore if */
  57977. if (config.performance && mark) {
  57978. mark('compile end');
  57979. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  57980. }
  57981. }
  57982. }
  57983. return mount.call(this, el, hydrating)
  57984. };
  57985. /**
  57986. * Get outerHTML of elements, taking care
  57987. * of SVG elements in IE as well.
  57988. */
  57989. function getOuterHTML (el) {
  57990. if (el.outerHTML) {
  57991. return el.outerHTML
  57992. } else {
  57993. var container = document.createElement('div');
  57994. container.appendChild(el.cloneNode(true));
  57995. return container.innerHTML
  57996. }
  57997. }
  57998. Vue.compile = compileToFunctions;
  57999. module.exports = Vue;
  58000. /* 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))
  58001. /***/ }),
  58002. /***/ "./node_modules/vue/dist/vue.common.js":
  58003. /*!*********************************************!*\
  58004. !*** ./node_modules/vue/dist/vue.common.js ***!
  58005. \*********************************************/
  58006. /*! no static exports found */
  58007. /***/ (function(module, exports, __webpack_require__) {
  58008. if (false) {} else {
  58009. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  58010. }
  58011. /***/ }),
  58012. /***/ "./node_modules/webpack/buildin/global.js":
  58013. /*!***********************************!*\
  58014. !*** (webpack)/buildin/global.js ***!
  58015. \***********************************/
  58016. /*! no static exports found */
  58017. /***/ (function(module, exports) {
  58018. var g;
  58019. // This works in non-strict mode
  58020. g = (function() {
  58021. return this;
  58022. })();
  58023. try {
  58024. // This works if eval is allowed (see CSP)
  58025. g = g || new Function("return this")();
  58026. } catch (e) {
  58027. // This works if the window reference is available
  58028. if (typeof window === "object") g = window;
  58029. }
  58030. // g can still be undefined, but nothing to do about it...
  58031. // We return undefined, instead of nothing here, so it's
  58032. // easier to handle this case. if(!global) { ...}
  58033. module.exports = g;
  58034. /***/ }),
  58035. /***/ "./node_modules/webpack/buildin/module.js":
  58036. /*!***********************************!*\
  58037. !*** (webpack)/buildin/module.js ***!
  58038. \***********************************/
  58039. /*! no static exports found */
  58040. /***/ (function(module, exports) {
  58041. module.exports = function(module) {
  58042. if (!module.webpackPolyfill) {
  58043. module.deprecate = function() {};
  58044. module.paths = [];
  58045. // module.parent = undefined by default
  58046. if (!module.children) module.children = [];
  58047. Object.defineProperty(module, "loaded", {
  58048. enumerable: true,
  58049. get: function() {
  58050. return module.l;
  58051. }
  58052. });
  58053. Object.defineProperty(module, "id", {
  58054. enumerable: true,
  58055. get: function() {
  58056. return module.i;
  58057. }
  58058. });
  58059. module.webpackPolyfill = 1;
  58060. }
  58061. return module;
  58062. };
  58063. /***/ }),
  58064. /***/ "./resources/js/app.js":
  58065. /*!*****************************!*\
  58066. !*** ./resources/js/app.js ***!
  58067. \*****************************/
  58068. /*! no exports provided */
  58069. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58070. "use strict";
  58071. __webpack_require__.r(__webpack_exports__);
  58072. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  58073. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  58074. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  58075. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  58076. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  58077. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  58078. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  58079. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  58080. /**
  58081. * First we will load all of this project's JavaScript dependencies which
  58082. * includes Vue and other libraries. It is a great starting point when
  58083. * building robust, powerful web applications using Vue and Laravel.
  58084. */
  58085. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  58086. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  58087. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  58088. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  58089. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  58090. mode: 'history',
  58091. routes: [{
  58092. path: '/',
  58093. name: 'home',
  58094. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  58095. }, {
  58096. path: '/login',
  58097. name: 'login',
  58098. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  58099. }, {
  58100. path: '/dashboard',
  58101. name: 'dashboard',
  58102. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  58103. }, {
  58104. path: '/workorders/:id',
  58105. name: 'workorders',
  58106. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  58107. props: true
  58108. }]
  58109. });
  58110. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  58111. el: '#app',
  58112. components: {
  58113. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  58114. },
  58115. router: router
  58116. });
  58117. $(function () {
  58118. $('[data-toggle="tooltip"]').tooltip();
  58119. });
  58120. var clipboard = new Clipboard('.btn-clip');
  58121. clipboard.on('success', function (e) {
  58122. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  58123. position: "right",
  58124. className: 'success'
  58125. });
  58126. e.clearSelection();
  58127. });
  58128. /***/ }),
  58129. /***/ "./resources/js/bootstrap.js":
  58130. /*!***********************************!*\
  58131. !*** ./resources/js/bootstrap.js ***!
  58132. \***********************************/
  58133. /*! no exports provided */
  58134. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58135. "use strict";
  58136. __webpack_require__.r(__webpack_exports__);
  58137. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  58138. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  58139. /**
  58140. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  58141. * for JavaScript based Bootstrap features such as modals and tabs. This
  58142. * code may be modified to fit the specific needs of your application.
  58143. */
  58144. try {
  58145. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  58146. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  58147. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  58148. } catch (e) {}
  58149. /**
  58150. * We'll load the axios HTTP library which allows us to easily issue requests
  58151. * to our Laravel back-end. This library automatically handles sending the
  58152. * CSRF token as a header based on the value of the "XSRF" token cookie.
  58153. */
  58154. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  58155. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  58156. /**
  58157. * Echo exposes an expressive API for subscribing to channels and listening
  58158. * for events that are broadcast by Laravel. Echo and event broadcasting
  58159. * allows your team to easily build robust real-time web applications.
  58160. */
  58161. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  58162. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  58163. broadcaster: 'pusher',
  58164. key: "upccrt",
  58165. authEndpoint: '/broadcasting/auth',
  58166. wsHost: window.location.hostname,
  58167. wsPort: 6001,
  58168. disableStats: true
  58169. });
  58170. /***/ }),
  58171. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  58172. /*!****************************************************************!*\
  58173. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  58174. \****************************************************************/
  58175. /*! exports provided: default */
  58176. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58177. "use strict";
  58178. __webpack_require__.r(__webpack_exports__);
  58179. /* harmony import */ var _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& */ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&");
  58180. /* harmony import */ var _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AutocompleteCustomDropdown.vue?vue&type=script&lang=js& */ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&");
  58181. /* 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");
  58182. /* normalize component */
  58183. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58184. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58185. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  58186. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58187. false,
  58188. null,
  58189. null,
  58190. null
  58191. )
  58192. /* hot reload */
  58193. if (false) { var api; }
  58194. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  58195. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58196. /***/ }),
  58197. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  58198. /*!*****************************************************************************************!*\
  58199. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  58200. \*****************************************************************************************/
  58201. /*! exports provided: default */
  58202. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58203. "use strict";
  58204. __webpack_require__.r(__webpack_exports__);
  58205. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AutocompleteCustomDropdown_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!./AutocompleteCustomDropdown.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&");
  58206. /* 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_AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58207. /***/ }),
  58208. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  58209. /*!***********************************************************************************************!*\
  58210. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  58211. \***********************************************************************************************/
  58212. /*! exports provided: render, staticRenderFns */
  58213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58214. "use strict";
  58215. __webpack_require__.r(__webpack_exports__);
  58216. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___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!./AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&");
  58217. /* 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_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58218. /* 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_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58219. /***/ }),
  58220. /***/ "./resources/js/components/Modal.vue":
  58221. /*!*******************************************!*\
  58222. !*** ./resources/js/components/Modal.vue ***!
  58223. \*******************************************/
  58224. /*! exports provided: default */
  58225. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58226. "use strict";
  58227. __webpack_require__.r(__webpack_exports__);
  58228. /* harmony import */ var _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Modal.vue?vue&type=template&id=53ab54d2& */ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&");
  58229. /* 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");
  58230. var script = {}
  58231. /* normalize component */
  58232. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  58233. script,
  58234. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  58235. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58236. false,
  58237. null,
  58238. null,
  58239. null
  58240. )
  58241. /* hot reload */
  58242. if (false) { var api; }
  58243. component.options.__file = "resources/js/components/Modal.vue"
  58244. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58245. /***/ }),
  58246. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  58247. /*!**************************************************************************!*\
  58248. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  58249. \**************************************************************************/
  58250. /*! exports provided: render, staticRenderFns */
  58251. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58252. "use strict";
  58253. __webpack_require__.r(__webpack_exports__);
  58254. /* 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_53ab54d2___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=53ab54d2& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&");
  58255. /* 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_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58256. /* 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_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58257. /***/ }),
  58258. /***/ "./resources/js/components/WoInfoEditModal.vue":
  58259. /*!*****************************************************!*\
  58260. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  58261. \*****************************************************/
  58262. /*! exports provided: default */
  58263. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58264. "use strict";
  58265. __webpack_require__.r(__webpack_exports__);
  58266. /* harmony import */ var _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WoInfoEditModal.vue?vue&type=template&id=352dd7a2& */ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&");
  58267. /* harmony import */ var _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WoInfoEditModal.vue?vue&type=script&lang=js& */ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&");
  58268. /* 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");
  58269. /* normalize component */
  58270. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58271. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58272. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  58273. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58274. false,
  58275. null,
  58276. null,
  58277. null
  58278. )
  58279. /* hot reload */
  58280. if (false) { var api; }
  58281. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  58282. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58283. /***/ }),
  58284. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  58285. /*!******************************************************************************!*\
  58286. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  58287. \******************************************************************************/
  58288. /*! exports provided: default */
  58289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58290. "use strict";
  58291. __webpack_require__.r(__webpack_exports__);
  58292. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WoInfoEditModal_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!./WoInfoEditModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&");
  58293. /* 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_WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58294. /***/ }),
  58295. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  58296. /*!************************************************************************************!*\
  58297. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  58298. \************************************************************************************/
  58299. /*! exports provided: render, staticRenderFns */
  58300. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58301. "use strict";
  58302. __webpack_require__.r(__webpack_exports__);
  58303. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___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!./WoInfoEditModal.vue?vue&type=template&id=352dd7a2& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&");
  58304. /* 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_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58305. /* 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_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58306. /***/ }),
  58307. /***/ "./resources/js/components/WorkOrderInfo.vue":
  58308. /*!***************************************************!*\
  58309. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  58310. \***************************************************/
  58311. /*! exports provided: default */
  58312. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58313. "use strict";
  58314. __webpack_require__.r(__webpack_exports__);
  58315. /* harmony import */ var _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WorkOrderInfo.vue?vue&type=template&id=50116330& */ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&");
  58316. /* harmony import */ var _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WorkOrderInfo.vue?vue&type=script&lang=js& */ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&");
  58317. /* 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");
  58318. /* normalize component */
  58319. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58320. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58321. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  58322. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58323. false,
  58324. null,
  58325. null,
  58326. null
  58327. )
  58328. /* hot reload */
  58329. if (false) { var api; }
  58330. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  58331. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58332. /***/ }),
  58333. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  58334. /*!****************************************************************************!*\
  58335. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  58336. \****************************************************************************/
  58337. /*! exports provided: default */
  58338. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58339. "use strict";
  58340. __webpack_require__.r(__webpack_exports__);
  58341. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrderInfo_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!./WorkOrderInfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&");
  58342. /* 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_WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58343. /***/ }),
  58344. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  58345. /*!**********************************************************************************!*\
  58346. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  58347. \**********************************************************************************/
  58348. /*! exports provided: render, staticRenderFns */
  58349. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58350. "use strict";
  58351. __webpack_require__.r(__webpack_exports__);
  58352. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrderInfo_vue_vue_type_template_id_50116330___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!./WorkOrderInfo.vue?vue&type=template&id=50116330& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&");
  58353. /* 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_WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58354. /* 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_WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58355. /***/ }),
  58356. /***/ "./resources/js/mixins/dateMixin.js":
  58357. /*!******************************************!*\
  58358. !*** ./resources/js/mixins/dateMixin.js ***!
  58359. \******************************************/
  58360. /*! exports provided: default */
  58361. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58362. "use strict";
  58363. __webpack_require__.r(__webpack_exports__);
  58364. /* harmony default export */ __webpack_exports__["default"] = ({
  58365. methods: {
  58366. treatAsUTC: function treatAsUTC(date) {
  58367. var result = new Date(date);
  58368. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  58369. return result;
  58370. },
  58371. daysSinceToday: function daysSinceToday(date) {
  58372. var currentDate = new Date();
  58373. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  58374. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  58375. },
  58376. getHRDate: function getHRDate(dateString) {
  58377. var date = new Date(dateString);
  58378. return date.toLocaleString('default', {
  58379. month: 'short',
  58380. day: 'numeric',
  58381. year: 'numeric',
  58382. hour: 'numeric',
  58383. minute: 'numeric'
  58384. });
  58385. },
  58386. isZero: function isZero(dateString) {
  58387. return dateString === '0000-00-00 00:00:00';
  58388. }
  58389. }
  58390. });
  58391. /***/ }),
  58392. /***/ "./resources/js/notify.min.js":
  58393. /*!************************************!*\
  58394. !*** ./resources/js/notify.min.js ***!
  58395. \************************************/
  58396. /*! no static exports found */
  58397. /***/ (function(module, exports, __webpack_require__) {
  58398. 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); }
  58399. (function (e) {
  58400. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  58401. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  58402. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  58403. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  58404. })(function (e) {
  58405. function A(t, n, i) {
  58406. typeof i == "string" && (i = {
  58407. className: i
  58408. }), 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);
  58409. }
  58410. var t = [].indexOf || function (e) {
  58411. for (var t = 0, n = this.length; t < n; t++) {
  58412. if (t in this && this[t] === e) return t;
  58413. }
  58414. return -1;
  58415. },
  58416. n = "notify",
  58417. r = n + "js",
  58418. i = n + "!blank",
  58419. s = {
  58420. t: "top",
  58421. m: "middle",
  58422. b: "bottom",
  58423. l: "left",
  58424. c: "center",
  58425. r: "right"
  58426. },
  58427. o = ["l", "c", "r"],
  58428. u = ["t", "m", "b"],
  58429. a = ["t", "b", "l", "r"],
  58430. f = {
  58431. t: "b",
  58432. m: null,
  58433. b: "t",
  58434. l: "r",
  58435. c: null,
  58436. r: "l"
  58437. },
  58438. l = function l(t) {
  58439. var n;
  58440. return n = [], e.each(t.split(/\W+/), function (e, t) {
  58441. var r;
  58442. r = t.toLowerCase().charAt(0);
  58443. if (s[r]) return n.push(r);
  58444. }), n;
  58445. },
  58446. c = {},
  58447. h = {
  58448. name: "core",
  58449. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  58450. 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}"
  58451. },
  58452. p = {
  58453. "border-radius": ["-webkit-", "-moz-"]
  58454. },
  58455. d = function d(e) {
  58456. return c[e];
  58457. },
  58458. v = function v(e) {
  58459. if (!e) throw "Missing Style name";
  58460. c[e] && delete c[e];
  58461. },
  58462. m = function m(t, i) {
  58463. if (!t) throw "Missing Style name";
  58464. if (!i) throw "Missing Style definition";
  58465. if (!i.html) throw "Missing Style HTML";
  58466. var s = c[t];
  58467. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  58468. var o = "";
  58469. i.classes && e.each(i.classes, function (t, n) {
  58470. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  58471. return p[t] && e.each(p[t], function (e, r) {
  58472. return o += " " + r + t + ": " + n + ";\n";
  58473. }), o += " " + t + ": " + n + ";\n";
  58474. }), o += "}\n";
  58475. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  58476. var u = {},
  58477. a = e(i.html);
  58478. y("html", a, u), y("text", a, u), i.fields = u;
  58479. },
  58480. g = function g(t) {
  58481. var n, r, i;
  58482. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  58483. try {
  58484. r.html(t);
  58485. } catch (s) {
  58486. r[0].styleSheet.cssText = t;
  58487. }
  58488. return r;
  58489. },
  58490. y = function y(t, n, r) {
  58491. var s;
  58492. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  58493. var n;
  58494. n = e(this).attr(s), n || (n = i), r[n] = t;
  58495. });
  58496. },
  58497. b = function b(e, t) {
  58498. return e.is(t) ? e : e.find(t);
  58499. },
  58500. w = {
  58501. clickToHide: !0,
  58502. autoHide: !0,
  58503. autoHideDelay: 5e3,
  58504. arrowShow: !0,
  58505. arrowSize: 5,
  58506. breakNewLines: !0,
  58507. elementPosition: "bottom",
  58508. globalPosition: "top right",
  58509. style: "bootstrap",
  58510. className: "error",
  58511. showAnimation: "slideDown",
  58512. showDuration: 400,
  58513. hideAnimation: "slideUp",
  58514. hideDuration: 200,
  58515. gap: 5
  58516. },
  58517. E = function E(t, n) {
  58518. var r;
  58519. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  58520. },
  58521. S = function S(t) {
  58522. return e.extend(w, t);
  58523. },
  58524. x = function x(t) {
  58525. return e("<" + t + "></" + t + ">");
  58526. },
  58527. T = {},
  58528. N = function N(t) {
  58529. var n;
  58530. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  58531. return e(r).attr("name") === t.attr("name");
  58532. }), t = n.first()), t;
  58533. },
  58534. C = function C(e, t, n) {
  58535. var r, i;
  58536. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  58537. if (isNaN(n)) return;
  58538. 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;
  58539. },
  58540. k = function k(e, t, n) {
  58541. if (e === "l" || e === "t") return 0;
  58542. if (e === "c" || e === "m") return n / 2 - t / 2;
  58543. if (e === "r" || e === "b") return n - t;
  58544. throw "Invalid alignment";
  58545. },
  58546. L = function L(e) {
  58547. return L.e = L.e || x("div"), L.e.text(e).html();
  58548. };
  58549. A.prototype.loadHTML = function () {
  58550. var t;
  58551. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  58552. }, A.prototype.show = function (e, t) {
  58553. var n, r, i, s, o;
  58554. r = function (n) {
  58555. return function () {
  58556. !e && !n.elem && n.destroy();
  58557. if (t) return t();
  58558. };
  58559. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  58560. 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 {
  58561. if (!!o || !!e) return r();
  58562. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  58563. }
  58564. return n.push(r), i[s].apply(i, n);
  58565. }, A.prototype.setGlobalPosition = function () {
  58566. var t = this.getPosition(),
  58567. n = t[0],
  58568. i = t[1],
  58569. o = s[n],
  58570. u = s[i],
  58571. a = n + "|" + i,
  58572. f = T[a];
  58573. if (!f || !document.body.contains(f[0])) {
  58574. f = T[a] = x("div");
  58575. var l = {};
  58576. 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);
  58577. }
  58578. return f.prepend(this.wrapper);
  58579. }, A.prototype.setElementPosition = function () {
  58580. 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;
  58581. 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"];
  58582. for (w = 0, S = B.length; w < S; w++) {
  58583. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  58584. }
  58585. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  58586. if (!this.options.arrowShow) this.arrow.hide();else {
  58587. 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";
  58588. for (E = 0, x = a.length; E < x; E++) {
  58589. D = a[E], P = s[D];
  58590. if (D === L) continue;
  58591. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  58592. }
  58593. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  58594. }
  58595. 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);
  58596. if (r) return this.arrow.removeAttr("style").css(r);
  58597. }, A.prototype.getPosition = function () {
  58598. var e, n, r, i, s, f, c, h;
  58599. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  58600. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  58601. 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";
  58602. return e.length === 2 && (e[2] = e[1]), e;
  58603. }, A.prototype.getStyle = function (e) {
  58604. var t;
  58605. e || (e = this.options.style), e || (e = "default"), t = c[e];
  58606. if (!t) throw "Missing style: " + e;
  58607. return t;
  58608. }, A.prototype.updateClasses = function () {
  58609. var t, n;
  58610. 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) {
  58611. return r + "-" + n.name + "-" + e;
  58612. }).join(" "), this.userContainer.attr("class", t);
  58613. }, A.prototype.run = function (t, n) {
  58614. var r, s, o, u, a;
  58615. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  58616. if (this.container && !t) {
  58617. this.show(!1);
  58618. return;
  58619. }
  58620. if (!this.container && !t) return;
  58621. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  58622. for (o in s) {
  58623. r = s[o], u = this.userFields[o];
  58624. if (!u) continue;
  58625. 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);
  58626. }
  58627. 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));
  58628. }, A.prototype.destroy = function () {
  58629. this.wrapper.data(r, null), this.wrapper.remove();
  58630. }, e[n] = function (t, r, i) {
  58631. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  58632. }, e.fn[n] = function (t, n) {
  58633. return e(this).each(function () {
  58634. var i = N(e(this)).data(r);
  58635. i && i.destroy();
  58636. var s = new A(e(this), t, n);
  58637. }), this;
  58638. }, e.extend(e[n], {
  58639. defaults: S,
  58640. addStyle: m,
  58641. removeStyle: v,
  58642. pluginOptions: w,
  58643. getStyle: d,
  58644. insertCSS: g
  58645. }), m("bootstrap", {
  58646. html: "<div>\n<span data-notify-text></span>\n</div>",
  58647. classes: {
  58648. base: {
  58649. "font-weight": "bold",
  58650. padding: "8px 15px 8px 14px",
  58651. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  58652. "background-color": "#fcf8e3",
  58653. border: "1px solid #fbeed5",
  58654. "border-radius": "4px",
  58655. "white-space": "nowrap",
  58656. "padding-left": "25px",
  58657. "background-repeat": "no-repeat",
  58658. "background-position": "3px 7px"
  58659. },
  58660. error: {
  58661. color: "#B94A48",
  58662. "background-color": "#F2DEDE",
  58663. "border-color": "#EED3D7",
  58664. "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=)"
  58665. },
  58666. success: {
  58667. color: "#468847",
  58668. "background-color": "#DFF0D8",
  58669. "border-color": "#D6E9C6",
  58670. "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==)"
  58671. },
  58672. info: {
  58673. color: "#3A87AD",
  58674. "background-color": "#D9EDF7",
  58675. "border-color": "#BCE8F1",
  58676. "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=)"
  58677. },
  58678. warn: {
  58679. color: "#C09853",
  58680. "background-color": "#FCF8E3",
  58681. "border-color": "#FBEED5",
  58682. "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)"
  58683. }
  58684. }
  58685. }), e(function () {
  58686. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  58687. e(this).trigger("notify-hide");
  58688. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  58689. var n = e(this).data(r);
  58690. n && n.show(!1);
  58691. });
  58692. });
  58693. });
  58694. /***/ }),
  58695. /***/ "./resources/js/views/App.vue":
  58696. /*!************************************!*\
  58697. !*** ./resources/js/views/App.vue ***!
  58698. \************************************/
  58699. /*! exports provided: default */
  58700. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58701. "use strict";
  58702. __webpack_require__.r(__webpack_exports__);
  58703. /* harmony import */ var _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./App.vue?vue&type=template&id=91ac6b5c& */ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&");
  58704. /* harmony import */ var _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./App.vue?vue&type=script&lang=js& */ "./resources/js/views/App.vue?vue&type=script&lang=js&");
  58705. /* 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");
  58706. /* normalize component */
  58707. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58708. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58709. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  58710. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58711. false,
  58712. null,
  58713. null,
  58714. null
  58715. )
  58716. /* hot reload */
  58717. if (false) { var api; }
  58718. component.options.__file = "resources/js/views/App.vue"
  58719. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58720. /***/ }),
  58721. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  58722. /*!*************************************************************!*\
  58723. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  58724. \*************************************************************/
  58725. /*! exports provided: default */
  58726. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58727. "use strict";
  58728. __webpack_require__.r(__webpack_exports__);
  58729. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_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!./App.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&");
  58730. /* 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_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58731. /***/ }),
  58732. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  58733. /*!*******************************************************************!*\
  58734. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  58735. \*******************************************************************/
  58736. /*! exports provided: render, staticRenderFns */
  58737. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58738. "use strict";
  58739. __webpack_require__.r(__webpack_exports__);
  58740. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_template_id_91ac6b5c___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!./App.vue?vue&type=template&id=91ac6b5c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&");
  58741. /* 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_App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58742. /* 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_App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58743. /***/ }),
  58744. /***/ "./resources/js/views/Dashboard.vue":
  58745. /*!******************************************!*\
  58746. !*** ./resources/js/views/Dashboard.vue ***!
  58747. \******************************************/
  58748. /*! exports provided: default */
  58749. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58750. "use strict";
  58751. __webpack_require__.r(__webpack_exports__);
  58752. /* harmony import */ var _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Dashboard.vue?vue&type=template&id=1f79daf6& */ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&");
  58753. /* harmony import */ var _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Dashboard.vue?vue&type=script&lang=js& */ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&");
  58754. /* 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");
  58755. /* normalize component */
  58756. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58757. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58758. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  58759. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58760. false,
  58761. null,
  58762. null,
  58763. null
  58764. )
  58765. /* hot reload */
  58766. if (false) { var api; }
  58767. component.options.__file = "resources/js/views/Dashboard.vue"
  58768. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58769. /***/ }),
  58770. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  58771. /*!*******************************************************************!*\
  58772. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  58773. \*******************************************************************/
  58774. /*! exports provided: default */
  58775. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58776. "use strict";
  58777. __webpack_require__.r(__webpack_exports__);
  58778. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Dashboard_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!./Dashboard.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&");
  58779. /* 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_Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58780. /***/ }),
  58781. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  58782. /*!*************************************************************************!*\
  58783. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  58784. \*************************************************************************/
  58785. /*! exports provided: render, staticRenderFns */
  58786. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58787. "use strict";
  58788. __webpack_require__.r(__webpack_exports__);
  58789. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Dashboard_vue_vue_type_template_id_1f79daf6___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!./Dashboard.vue?vue&type=template&id=1f79daf6& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&");
  58790. /* 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_Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58791. /* 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_Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58792. /***/ }),
  58793. /***/ "./resources/js/views/Login.vue":
  58794. /*!**************************************!*\
  58795. !*** ./resources/js/views/Login.vue ***!
  58796. \**************************************/
  58797. /*! exports provided: default */
  58798. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58799. "use strict";
  58800. __webpack_require__.r(__webpack_exports__);
  58801. /* harmony import */ var _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Login.vue?vue&type=template&id=12f5395a& */ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&");
  58802. /* harmony import */ var _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Login.vue?vue&type=script&lang=js& */ "./resources/js/views/Login.vue?vue&type=script&lang=js&");
  58803. /* 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");
  58804. /* normalize component */
  58805. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58806. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58807. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  58808. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58809. false,
  58810. null,
  58811. null,
  58812. null
  58813. )
  58814. /* hot reload */
  58815. if (false) { var api; }
  58816. component.options.__file = "resources/js/views/Login.vue"
  58817. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58818. /***/ }),
  58819. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  58820. /*!***************************************************************!*\
  58821. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  58822. \***************************************************************/
  58823. /*! exports provided: default */
  58824. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58825. "use strict";
  58826. __webpack_require__.r(__webpack_exports__);
  58827. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_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!./Login.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&");
  58828. /* 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_Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58829. /***/ }),
  58830. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  58831. /*!*********************************************************************!*\
  58832. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  58833. \*********************************************************************/
  58834. /*! exports provided: render, staticRenderFns */
  58835. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58836. "use strict";
  58837. __webpack_require__.r(__webpack_exports__);
  58838. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_template_id_12f5395a___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!./Login.vue?vue&type=template&id=12f5395a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=template&id=12f5395a&");
  58839. /* 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_Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58840. /* 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_Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58841. /***/ }),
  58842. /***/ "./resources/js/views/Welcome.vue":
  58843. /*!****************************************!*\
  58844. !*** ./resources/js/views/Welcome.vue ***!
  58845. \****************************************/
  58846. /*! exports provided: default */
  58847. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58848. "use strict";
  58849. __webpack_require__.r(__webpack_exports__);
  58850. /* harmony import */ var _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& */ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&");
  58851. /* harmony import */ var _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Welcome.vue?vue&type=script&lang=js& */ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&");
  58852. /* empty/unused harmony star reexport *//* harmony import */ var _Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  58853. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  58854. /* normalize component */
  58855. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  58856. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58857. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  58858. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58859. false,
  58860. null,
  58861. "1ae8ae93",
  58862. null
  58863. )
  58864. /* hot reload */
  58865. if (false) { var api; }
  58866. component.options.__file = "resources/js/views/Welcome.vue"
  58867. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58868. /***/ }),
  58869. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  58870. /*!*****************************************************************!*\
  58871. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  58872. \*****************************************************************/
  58873. /*! exports provided: default */
  58874. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58875. "use strict";
  58876. __webpack_require__.r(__webpack_exports__);
  58877. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_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!./Welcome.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&");
  58878. /* 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_Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58879. /***/ }),
  58880. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  58881. /*!*************************************************************************************************!*\
  58882. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  58883. \*************************************************************************************************/
  58884. /*! no static exports found */
  58885. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58886. "use strict";
  58887. __webpack_require__.r(__webpack_exports__);
  58888. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/style-loader!../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  58889. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
  58890. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  58891. /* harmony default export */ __webpack_exports__["default"] = (_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
  58892. /***/ }),
  58893. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  58894. /*!***********************************************************************************!*\
  58895. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  58896. \***********************************************************************************/
  58897. /*! exports provided: render, staticRenderFns */
  58898. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58899. "use strict";
  58900. __webpack_require__.r(__webpack_exports__);
  58901. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___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!./Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&");
  58902. /* 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_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58903. /* 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_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58904. /***/ }),
  58905. /***/ "./resources/js/views/WorkOrder.vue":
  58906. /*!******************************************!*\
  58907. !*** ./resources/js/views/WorkOrder.vue ***!
  58908. \******************************************/
  58909. /*! exports provided: default */
  58910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58911. "use strict";
  58912. __webpack_require__.r(__webpack_exports__);
  58913. /* harmony import */ var _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WorkOrder.vue?vue&type=template&id=17837e2e& */ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&");
  58914. /* harmony import */ var _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WorkOrder.vue?vue&type=script&lang=js& */ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&");
  58915. /* 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");
  58916. /* normalize component */
  58917. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58918. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58919. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  58920. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58921. false,
  58922. null,
  58923. null,
  58924. null
  58925. )
  58926. /* hot reload */
  58927. if (false) { var api; }
  58928. component.options.__file = "resources/js/views/WorkOrder.vue"
  58929. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58930. /***/ }),
  58931. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  58932. /*!*******************************************************************!*\
  58933. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  58934. \*******************************************************************/
  58935. /*! exports provided: default */
  58936. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58937. "use strict";
  58938. __webpack_require__.r(__webpack_exports__);
  58939. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrder_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!./WorkOrder.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&");
  58940. /* 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_WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58941. /***/ }),
  58942. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  58943. /*!*************************************************************************!*\
  58944. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  58945. \*************************************************************************/
  58946. /*! exports provided: render, staticRenderFns */
  58947. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58948. "use strict";
  58949. __webpack_require__.r(__webpack_exports__);
  58950. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrder_vue_vue_type_template_id_17837e2e___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!./WorkOrder.vue?vue&type=template&id=17837e2e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&");
  58951. /* 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_WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58952. /* 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_WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58953. /***/ }),
  58954. /***/ "./resources/sass/app.scss":
  58955. /*!*********************************!*\
  58956. !*** ./resources/sass/app.scss ***!
  58957. \*********************************/
  58958. /*! no static exports found */
  58959. /***/ (function(module, exports) {
  58960. // removed by extract-text-webpack-plugin
  58961. /***/ }),
  58962. /***/ 0:
  58963. /*!*************************************************************!*\
  58964. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  58965. \*************************************************************/
  58966. /*! no static exports found */
  58967. /***/ (function(module, exports, __webpack_require__) {
  58968. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  58969. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  58970. /***/ })
  58971. /******/ });